E2E Tutorial: create annotation-based Fiori application on top of HCP OData provisioning – Part 3
Part 3 : Explore the Annotation Model
— — No ABAP development skills required — —
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 (this blog)
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: Trouble-Tips
This is the third part of our tutorial. After having created the annotation model, we’ll be now going a little bit deeper in this blog.
To see the mystic ABAP, expand the node “Runtime Artifacts” in your project, open the context menu on the <xxx>APC entry and … no, no, don’t choose “Display” (this switches the project to read-only mode). The correct entry is
“Go to ABAP Workbench”
The form-based view on the ABAP class is displayed.
Do a double-click on the method “DEFINE_VOCAB_ANNOTATIONS” to finally see the code:
In the screenshot above, I’ve pointed out some interesting parts to remember.
Now it is up to you: in future, you candecide to define your annotation models completely via code instead of clicking in Service Builder…
To leave the good old ABAP Workbench (really old, but good), click the “Back” button on the very top most toolbar.
Two clicks and you’re back in Service Builder.
From the main menu, choose System -> Create Session to open a new window.
In the transaction field, type /n/IWBEP/REG_VOCAN and press “Enter”
This opens the “Maintain Annotation Models” tool.
Now you have to find your annotation model. For this you need the “Technical name” … remember, you’ve seen it above, after pressing the “Generate”-ball …ehm… sorry, I mean the “Generate”-button.
After you’ve found it, you might think you have to select the entire row… but no, no, this time you have to click on the Technical model name.
(Our adventure continues…)
Only then, the section underneath will display the services that are assigned to our annotation model.
No surprise here: it is the GWSAMPLE_BASIC service:
That’s all. Just view the assignment and close the window via x or via main menu: System -> End Session.
In the next (last) step, we’ll briefly use the Service Builder one last time.
After all that work, we want to get a result: the XML document representing the annotation model
So, what we’re going to do in this step is to view the annotations in their xml-dress.
Our annotation model is not a service, so we cannot invoke it. But there’s the CATALOGSERVICE, which is offered in the SAP Gateway (hub), and it contains a collection of annotation models, as the service document shows:
So let’s verify.
Go to the SAP Gateway Client (the window should still be open, otherwise open it with transaction /n/IWFND/GW_CLIENT) and open the following URL
We most probably don’t find our own annotation model in the list of all existing annotation models.
Reason is that it is not yet fully loaded.
In order to force a reload, there are a couple of possibilities, see below.
One way to achieve a reload: just invoke the Gateway service to which our annotation model is attached: the GWSAMPLE_BASIC
In the SAP Gateway Client, open the following URI
Don’t expect to see our annotations there.
Since we’re working with the so-called standalone annotations, the OData service itself does not know that it is annotated, so there’s no annotation section in the metadata.
(Only if the Gateway service itself defines annotations (i.e. not standalone), only then the annotation section is shown in the metadata document of the service.)
Then try again, open the Annotations collection of the CATALOGSERVICE:
If it still doesn’t help, try cleaning the metadata cache, to force the system to reload the metadata.
The SAP Gateway Client tool offers a main menu entry for that:
Metadata -> Cleanup Cache -> On both Systems
Another alternative (for the adventurous reader):
In the SAP Gateway Client, you can click on the button “Service Administration” which opens the “Activate and Maintain Services” tool in a new window, with the GWSAMPLE_BASIC entry pre-selected.
There you can press the “Load Metadata” button.
The “Activate and Maintain Services” tool can also be reached via transaction /IWFND/MAINT_SERVICE
And it can also be reached from Service Builder: double-click “Service Maintenance” node in the tree, then there’s the “Maintain” button on the right side.
Now open the Annotations collection again. Our new annotation model should now be listed.
Now that our annotation model can be accessed via the CATALOGSERVICE, we can explore the information that we get there.
Perform a READ of the entry:
Follow the /Services link, it should display the GWSAMPLE_BASIC service, to which our annotation model is attached.
Now we can follow the /$value link.
It displays the actual, the real raw value of the annotation model, presented in xml format:
This is what we wanted to achieve.
Finally, we’re done with the annotation part of our tutorial.
With the help of Service Builder, we’ve created an annotation model that declares how the referenced OData service is to be displayed in an application.
All this work was not just for fun: in the last step of this E2E tutorial, this xml will serve as descriptor for a UI5 application.
The good thing: that application is fully generated out of this xml, nothing else needs to be done
… that’s no fantasy… you’ll see!
The promised browser-based application will run in the cloud and we’ll use a browser-based IDE that runs in the cloud to create it.
So the next step we have to do is to make our annotation model available in the cloud.
But first we have to connect the cloud to the backend onPremise system.
Be sure not to miss it!
The fun part will then be in the last part.
— — Stay tuned and you’ll connect the cloud — —