Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
qmacro
Developer Advocate
Developer Advocate
This is a searchable description of the content of a live stream recording, specifically “Ep.40 – Catchup from SAP TechEd" in the “Hands-on SAP dev with qmacro” series. There are links directly to specific highlights in the video recording. For links to annotations of other episodes, please see the “Catch the replays” section of the series blog post.

This episode, titled “Catchup from SAP TechEd”, was streamed live on Wed 05 Jun 2019 and is approximately one hour in length. The stream recording is available on YouTube.



Brief synopsis: We’re in the midst of the SAP TechEd season – in this episode we catch up with what’s been going on and dig into whatever takes our fancy.

02:10 Talking about the sort of direction I want to take the episodes in, building on what we learned from SAP TechEd recently.

03:10 A reminder of the badges and stickers I have to give away, thanks again to rsletta for the awesome #HandsOnSAPDev laptop stickers, they rock!

08:50 Looking at the new repo on GitHub that gregorw created to coordinate and provide a read/write platform for technical activities and sharing around all things related to the SAP Cloud Application Programming Model. It’s in the https://github.com/sapmentors organisation and can be found here: → https://github.com/sapmentors/cap-community. Get to it with this canonical short URL <bit.ly/cap-com>.

10:40 Talking about our coffee chats with daniel.hutzel at SAP TechEd 2019 in Barcelona; turns out he’s on Twitter as aragonX. These chats are the birthplace of this <bit.ly/cap-com> repo.

12:50 Within the repo right now there are a couple of subdirectories. The first (created initially by vobu) is called issues/ where code can be shared that reproduces an issue that you’re asking about. (First rule of asking a technical question: make sure you ask it precisely and accurately. Second rule of asking a technical question: make it as easy as possible for those trying to help you reproduce the issue so they can understand and diagnose). Volker does this very well in the first instance of an issue in the structured-types/ directory. The second is examples/ where we can share simple, running examples of concepts; the first item in here is deep-insert/ which shows a running, simple example of how to perform a deep insert (of parent and child entities in a single operation).

16:20 Describing briefly how to easily contribute to the CAP Community repo by forking it, making changes in your fork, and then sending a pull request with those changes.

19:25 Examining the deep-insert/ example contents, starting with the README, and then the simple parent-child relationship expressed between two basic entities in the db/schema.cds file, and finally the simple exposure of both those entities in the srv/main.cds service file.

22:10 A first look at Composition, and how it relates to (and differs from) Association in CDS. Basically, a composition represents a contained-in relationship, as described in CAP’s CDL documentation. This also includes a quick discussion on whether a navigation property should be capitalised or not. Basically the consensus is that such properties should be in lowercase (here items), but the target entity itself should be in uppercase (here: Items😞
namespace demo;
using { cuid, managed } from '@sap/cds/common';

entity Headers : cuid, managed {
identifier : String;
items : Composition of many Items on items.parent = $self;
}

entity Items : cuid {
parent : Association to Headers;
data : String;
}

26:20 Starting the service up and checking that there are no existing headers or items.

27:10 Performing our first deep insert, causing a header entity to be created, and two related child item entities, as follows (in a single request!):
curl http://localhost:4004/main/Headers \
-H "Content-Type: application/json" \
-d '{ "identifier": "Header 1", "items": [ { "data": "A" }, { "data": "B" } ] }'

31:10 Performing a second deep insert, this time using jq to format the JSON output nicely, and also looking at the HTTP request and response headers (with curl’s -v verbose option), where we note the proper HTTP 201 response with a “Location” header.

33:20 Looking at the results of the deep inserts with the OData $expand system query option: http://localhost:4004/main/Headers?$expand=items.

34:10 Now we can see the effect of the use of “Composition” by performing an OData DELETE operation on a header entity and we see in the browser that the items that are “contained-in” that header are also deleted. Lovely!

37:20 David Kunz reminds us that we can use DEBUG=true to see what’s going on behind the scenes - use this as follows:
DEBUG=true cds run --in-memory

39:30 I completely fail to parse gregorw’s statement (in the chat) “@qmacro does @francis3745”. Doh! “does [work for SAP]”, of course!

40:30 Thinking about what I want to be talking about in the upcoming episodes, in particular Business Services on the SAP Cloud Platform, which we can now also refer to as SAP’s Business Technology Platfom (BTP) - this was a big part of juergen.mueller’s keynote at SAP TechEd 2019 in Barcelona (you can watch the replay here: The Technical Foundation of the Intelligent Enterprise. My journey is likely to be starting from a similar place to yours, i.e. in the Neo environment, where I’ve already established services using Workflow, Business Rules, Portal and other subscriptions … but where I want to get to of course is those equivalent business services in the Cloud Foundry environment. I thought it would be good to make that journey openly and share my learning as I go.

42:40 Mentioning my talk at UI5con 2018 "Diving into the sap.rules.ui library" (YouTube link), which I recommend you watch, at least in 1.5X, to see the API calls and structure that I make use of when building, deploying and executing business rules.

43:00 Looking at the SAP API Business Hub to start to understand what the business services are about, “from underneath”, picking specifically the Business Rules API package here: https://api.sap.com/package/SAPCPBusinessRulesAPIs?section=Artifacts.

45:00 Noting that the APIs are split multiple ways: there are APIs for Neo and Cloud Foundry, those APIs are either for Authoring or Execution, and the APIs are versioned (the Rule Execution API v1 is already deprecated in favour of v2, as we see here).

49:00 There’s some great information out there on orchestration services (such as Workflow and Business Rules) on the SAP Cloud Platform - look out for content from christian.loos, archana.shukla and stephan.schluchter.

51:40 Looking at setting up an environment within which to explore and try out the APIs within the SAP API Hub; rather than use the sandbox environment (which is not always available anyway) you can use your own trial account on the SAP Cloud Platform.

54:25 Trying out the API (specifically a GET on the /v2/workingeset-rule-definitions) within the SAP API Hub and we can see some results.

56:00 Now trying to make the same API call from the command line (with curl), and talking about the different components that make up an entire business rules service, starting with ‘working set’. We remind ourselves also about the .netrc file and facilities that it offers, especially in conjunction with curl.