Exposing HANA Calc Views via OData to Fiori Tiles
source link: https://blogs.sap.com/2015/07/29/exposing-a-hana-calc-view-via-odata-to-a-fiori-tiles/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Exposing HANA Calc Views via OData to Fiori Tiles
In this blogpost I have captured how to expose HANA Calculation Views as OData Service for a Fiori tile to consume. There are many examples that show some of pieces of this process but I haven’t seen this documented anywhere fully, so I have captured it below.
1. Create a Calc View to return a single row as is required by the Fiori tiles.
2. Add additional parameters supported by the Fiori Dynamic Tiles
3. Surface Calc View as an OData service
4. Create Fiori Catalogue for the Fiori dynamic tile to reside within
5. Add dynamic tile to Fiori Launchpad
1. Calculation View
The Calc View needs to return a single row to the Fiori tile so you may need to perform some aggregation and/or filtering to return the required information.
In this example the Calc View also contains the other Fiori Dynamic Tile Parameters although only the “number” output is mandatory, all others are optional.
2. Fiori Dynamic Parameters
The required OData structure and parameters are well documented in this HCP link. SAP HANA Cloud Portal Documentation. That link appears to be broken now, see the Portal Service documentation for the latest updates to this stucture, OData Structure for Dynamic App Launchers
3. OData Services
3.1 HANA XS Project
The OData service resides within a XS Project, so you should create that first ensuring the you have the .xsapp and .xsaccess files, with later revisions of HANA this should be created automatically when you create the XS Project.
Follow the step by step instructions here for creating XS Apps, described in the HANA Quick Start Guide.
3.2 HANA OData Service
The OData service is very simple in this example, Werner wrote a great Blog on building HANA OData services
REST your Models on SAP HANA XS
The OData service below access the FIORI_LATEST_VALUE CalculationView and exposes this as LatestValue
service {
"TimeSeries::FIORI_LATEST_VALUE" as "LatestValue"
keys generate local "ID"
aggregates always;
}
You can check the OData service easily by launching this from HANA Studio, with the Run As, XS Service
This will launch the XML definition of the OData (xsodata) service that has been created
To check the metadata within the OData Service look at the URL in this format
http://ukhana.mo.sap.corp:8001/Ian-Fiori/LatestValue2.xsodata/$metadata
Once the service is created the import thing is that it needs to return data is JSON format as this is what Fiori expects, the $format=json parameter does this nicely, as below. Also using a chrome extension to format the JSON response.
http://ukhana.mo.sap.corp:8001/Ian-Fiori/LatestValue.xsodata/LatestValue/?$select=subtitle,number&$format=json
Creating a new Fiori Catalogue in HANA Studio for your custom tiles to reside within
Using the tile templates makes it easy to create the dynamic tiles
Paste in the OData URL from above into the Service URL field, ensure to have the $select=number&$format=json
The dynamic tile can then be added to the appropriate Fiori Launch Pad through the standard Fiori interface.
There seems to be an issue with “Error Failure – Unable to load groups” with HANA Revision 101 and accessing some Fiori Launchpad links.
This link errors for me
http://ukhana.mo.sap.corp:8001/sap/hana/uis/clients/ushell-app/shells/fiori/FioriLaunchpad.html
Where as this link works fine
I hope this helps you if you are creating similar Fiori tiles.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK