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: 
CarlosRoggan
Product and Topic Expert
Product and Topic Expert


Part 7: Useless stuff & Trouble-Tips


--
Advertisement
-- -- Read this blog and get trouble-tips for free -- --
--
 



Over-View


Part 1: Preparation
     * 360°-View
     * Pre-View
     * Quick-View on Prerequisites
     * Service-Oriented View
Part 2: Create the Annotation Model
     * Background
     * Create Project
     * Reference the Gateway Service
     * Reference the vocabulary
     * Create the Annotation Model
     * Runtime Artifacts
Part 3: Explore the Annotation Model
     * ABAP-View
     * Model-View
     * XML-View
     * Post-View
Part 4: Connect the Cloud
     * Intro
     * Prerequisites
     * SAP HANA Cloud Connector
          ** Download
          ** Install
          ** Start
          ** Configure 1
          ** Configure 2
          ** Verify
     * Appendix
          ** Access HCP trial
          ** Tip: Avoid SSO
Part 5: OData provisioning
     * Find it
     * Configure it
          ** Assign Roles
          ** Create Destination
     * Register Service
     * Summary
Part 6: The Fiori Application
     * Intro
     * Create destination pointing to OData provisioning in HCP
     * Generate application
     * Run the application
     * Summary

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.




Appendix



Destination configuration


Authentication type

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.

An example:

We can create a destination (on account level) for the URL http://services.odata.org/ which contains the reference services for odata



Possible service calls are for example the following:

http://services.odata.org/V2/OData/OData.svc/Products
http://services.odata.org/V2/Northwind/Northwind.svc/Customers

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

Problem:
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)

Reason:
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

Solution:
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:



Note:
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"

Note:
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.
The URL:

https://gwaas-<yourUser>trial.hanatrial.ondemand.com/odata/IWBEP/GWSAMPLE_BASIC

Replace the service-path segment with CATALOGSERVICE;v=2/Annotations

https://gwaas-<yourUser>trial.hanatrial.ondemand.com/CATALOGSERVICE;v=2/Annotations

Search your annotation model and open the READ URL of the single entry, then use the /$value link.

For example:

https://gwaas-<yourUser>trial.hanatrial.ondemand.com/CATALOGSERVICE;v=2/Annotations(TechnicalName='ZGWSAMPLE_ANNOTATIONS_ANNO_MDL',Version='1')/$value

Finally, cut off the relative URI (including the leading slash)
/CATALOGSERVICE;v=2/Annotations(TechnicalName='ZGWSAMPLE_ANNOTATIONS_ANNO_MDL',Version='1')

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

Problem:

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

Reason:

The project wizard hasn’t been able to properly parse the annotation file via the given URL

Solution:

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.

https://<yourBackendHost>:<yourPort>/sap/opu/odata/IWFND/CATALOGSERVICE;v=2/Annotations(TechnicalName='ZGWSAMPLE_ANNOTATIONS_ANNO_MDL',Version='0001')/$value

or

https://gwaas-<yourUser>trial.hanatrial.ondemand.com/CATALOGSERVICE;v=2/Annotations(TechnicalName='ZGWSAMPLE_ANNOTATIONS_ANNO_MDL',Version='1')/$value

After download from this location, check if the file has a file extension .xml - otherwise rename the file for example to

Annotations_GWSAMPLE_SalesOrder.xml

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

Connection trouble


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?

Refactoring


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.

General Trouble-Tips


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


Links




Documentation

SAP Gateway documentation can be found as follows:
[http://help.sap.com | http://help.sap.com/] -> Technology Platform -> SAP NetWeaver -> <yourRelease> -> Function-Oriented View -> English -> SAP Gateway Foundation

Service Builder

docu
-> Developer Guide -> Service Builder -> Data Modeling Basics -> Working with Annotations
Direct link

SCN: Service Builder: http://scn.sap.com/community/gateway/blog/2014/01/21/vocabulary-based-annotation-support-in-service-...

Maintain Annotation Models
-> Developer Guide -> OData Channel -> Basic Features -> Service Life-Cycle -> Maintain Annotation Models
Direct link

SAP Annotations for OData Version 2.0 http://scn.sap.com/docs/DOC-44986

Documentation for service GWSAMPLE_BASIC:
-> Developer Guide -> Service Builder -> Sample Service Basic
Direct Link


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



--
Advertisement
-- -- Search the SCN for Carlos Roggan blogs ... and you'll learn much more -- --
-- -- Read 10 blogs and you'll get 10 more for free -- --
--



1 Comment