E2E Tutorial: create annotation-based Fiori application on top of HCP OData provisioning – Part 7
Part 7: Useless stuff & Trouble-Tips
— — Read this blog and get trouble-tips for free — —
Part 1: Preparation
* Quick-View on Prerequisites
* Service-Oriented View
Part 2: Create the Annotation Model
* Create Project
* Reference the Gateway Service
* Reference the vocabulary
* Create the Annotation Model
* Runtime Artifacts
Part 3: Explore the Annotation Model
Part 4: Connect the Cloud
* SAP HANA Cloud Connector
** Configure 1
** Configure 2
** Access HCP trial
** Tip: Avoid SSO
Part 5: OData provisioning
* Find it
* Configure it
** Assign Roles
** Create Destination
* Register Service
Part 6: The Fiori Application
* Create destination pointing to OData provisioning in HCP
* Generate application
* Run the application
Part 7: No title (this blog)
Optional: Under the hood
Let’s do one more thing: let’s check how the Gateway service is used under the hood.
Relaunch your generated app
Open the “Developer Tools”. In Chrome, Firefox and IE, this is done with F12, otherwise use the Browser’s menu to open.
Note: I’m using Chrome for the following screenshots and description.
Usually, the “Developer Tools” open in the bottom of the browser. I recommend to “undock” it to a separate window, to have more space.
Click on the menu-button of the Developer Tools, then click the icon for “undock”
In the Developer Tools, you can clear the data and change to the “Network” tab, in order to see the HTTP calls.
Now go ahead and in the application, press the “Go” button.
This triggers the HTTP call to the backend
In the Developer Tools, you can see that actually 2 calls have been executed:
The first call is a HEAD request to the URL of the service document.
The second call is the $batch request
Click on the first entry (HEAD) to see the details.
The HEAD request to the service document. It is fast (in our example: 32 ms) and used to fetch the x-csrf-token: you can see the corresponding request header and response header
The x-csrf-token is necessary, because the GET request for fetching the sales orders is wrapped in a $batch, and $batch is sent with POST, which requires the x-csrf-token
Now select the second entry, the $batch (POST) request
You can see the Request URL of the $batch request and you can see the actual GET request inside the request payload.
The interesting thing about the GET request is that a $select query option is added, such that only the 2 properties are included in the response (which improves the performance). The 2 specified properties are those which we had mentioned in our annotation model.
Configuring the destination for Web IDE to use OData provisioning: in our tutorial we’ve chosen a simple authentication type: we’ve entered a hard-coded user and password.
However, in productive scenarios, the user of the Fiori application doesn’t want to use foreign user credentials and he also doesn’t want to be frequently asked to enter his user/pw
Therefore, it would be more appropriate to use the authentication type AppToAppSSO
You can do so, even for our tutorial.
In that case, you will get a credentials popup when choosing the destination in the wizard. There you have to enter your HCP user and HCP password, because the wizard connects to ODP and needs to pass credentials.
This can be avoided by configuring principal propagation for your account.
Check the docu here and here for more info.
The additional property WebIDEUsage
I promised to spend some words on the property value odata_gen
It indicates that the destination which is flagged with this property (WebIDEUsage = odata_gen) can be used for generic purpose, related to odata services
Such a destination usually points to a host that contains odata services, such that a relative path can be concatenated to this destination.
We can create a destination (on account level) for the URL https://services.odata.org/ which contains the reference services for odata
Possible service calls are for example the following:
In the Web IDE we can generate a SAP Fiori Master-Detail Application based on this destination.
The only difference is that the host doesn’t offer a service catalog, such that we cannot browse and choose a service.
We have to use the “Service URL” option on the left pane, then enter the relative URL, then press the “Test” button:
Then we can proceed as usual.
Trouble-Tips in case of trouble with annotations
Trouble-Tips: annotation model not shown
You’re stepping through the project creation wizard and when reaching the wizard page “Annotation Selection”, the box is empty, although you know that there’s an annotation model available for the selected service (GWSAMPLE_BASIC)
The wizard invokes the CATALOGSERVICE URL and checks if there are annotations for the selected service, but for unknown reason it doesn’t find them
Standalone annotations are exposed in HCP via OData provisioning and we have opened them via URL in the browser (see part 2)
We know the URL of our annotation model, so can specify it in this wizard page.
So if the annotation model is not listed in the box, click the little arrow next to “Add Annotation Files” in order to open the dropdown menu.
Select “Annotation URL”
In the “Add From URL” dialog, select the same destination like before and enter the relative path, starting with slash, to the annotation model:
If you don’t see your destination in the drop down list, then the reason is that you didn’t specify the “odata_gen” as value of the additional Property.
This popup can only work with destinations which have the “Additional Property” with name “WebIDEUsage” and value “odata_gen”
If you don’t remember the URL, proceed as follows:
Go to OData provisioning Admin screen and click the “Open Service Document” hyperlink
The service is opened in a new browser tab.
Replace the service-path segment with CATALOGSERVICE;v=2/Annotations
Search your annotation model and open the READ URL of the single entry, then use the /$value link.
Finally, cut off the relative URI (including the leading slash)
This is the URI required to be used in the “Add from URL” dialog
After confirming the dialog, the “Technical Name” of the annotation model is entered in the box
Trouble-Tips: columns not shown
You’ve generated the application as described above, but after startup, the application doesn’t display the 2 columns for Sales Order ID and Note
The project wizard hasn’t been able to properly parse the annotation file via the given URL
Download the annotation to local file and provide this file in the wizard (like the steps described in the previous troubleshooting section, but instead of specifying a URL, the local file is uploaded)
In order to download the annotation, open the annotation model via the URL that was mentioned in this tutorial.
It can be the backend URL or the HCP URL, whatever you prefer.
After download from this location, check if the file has a file extension .xml – otherwise rename the file for example to
If you like, you can open the xml file with a suitable editor (can be Eclipse, or Web IDE) and pretty-print it, such that you can check the xml content.
Then start the project wizard again and in the “Annotation Selection” wizard page, choose
Add Annotation File -> File System
then specify your local file.
Note: I’ve attached an annotations file to the present blog, it can be used in the project wizard
I have to disappoint you ;-(
Connection probs are difficult to solve from within an Appendix section.
But…by the way… here is one tip:
Always check your Cloud Connector at https://localhost:8443/
Is it up and running?
And everything properly configured?
Check the exposed “Virtual Host”, does it exactly match the URL in your HCP destination?
Check the resources configured: is the node /sap/iwbep exposed? Or is everything exposed with a / ?
Check the backend, maybe your user is locked there due to too many invalid attempts?
You have changed your annotation model in the backend but don’t see the changes in the OData provisioning.
Solution: refresh the metadata of the service which is referenced by the annotation model.
Afterwards, invoke the annotation model again.
Note that it might be required to clear the cache of the referenced service and to restart the browser to get everything refreshed.
Who doubts that having probs is (unfortunately) rather expected in the daily life within IT…
In such case, we always prefer to have a look into the logfile.
I recommend to check this blog which introduces the Troubleshooting capability of OData provisioning
SAP Gateway documentation can be found as follows:
[https://help.sap.com | https://help.sap.com/] -> Technology Platform -> SAP NetWeaver -> -> Function-Oriented View -> English -> SAP Gateway Foundation
-> Developer Guide -> Service Builder -> Data Modeling Basics -> Working with Annotations
SCN: Service Builder: https://scn.sap.com/community/gateway/blog/2014/01/21/vocabulary-based-annotation-support-in-service-builder
Maintain Annotation Models
-> Developer Guide -> OData Channel -> Basic Features -> Service Life-Cycle -> Maintain Annotation Models
SAP Annotations for OData Version 2.0 https://scn.sap.com/docs/DOC-44986
Documentation for service GWSAMPLE_BASIC:
-> Developer Guide -> Service Builder -> Sample Service Basic
Official SAP HANA Cloud documentation: https://help.hana.ondemand.com
HCP ODP Intro
HCP ODP Official documentation: https://help.hana.ondemand.com/hci_odata_provisioning/frameset.htm
HCP ODP Troubleshooting
Documentation for Smart Templates: SAPUI5 SDK – Demo Kit
— — Search the SCN for Carlos Roggan blogs … and you’ll learn much more — —
— — Read 10 blogs and you’ll get 10 more for free — —
Would you like to access Full Article?
If you are already a member in this website, Please Click here to loginIf you are not yet a member, Please Click here to Sign up
New NetWeaver Information at SAP.com