After having
Analysed my Raspberry Pi I2C sensor data with the HANA Cloud Platform, predictive services and inspired by
rajaprasad.gupta‘s excellent blog series
SAP Smart Business Service – Create Analytic Content in HCP without Coding and especially this hands-on blog
Create Your First Smart Business KPI and Tiles in 10 Minutes and his more recent blog
Connect On-Premise HANA to Smart Business Service – An End-to-End Example I want to measure my Raspberry Pi sensor data with the Smart Business Service.
For this, I create a new package in the HANA Multitenant Database Container that I had created for the predictive and IoT services and within it an Empty application (with XSAccess and XSApp):
Within this package I create a New Calculation View:
Based on my IoT table with dimension Timestamp based on G_CREATED and measure Temperature based on C_TEMPERATURE:
And expose it as a XSODATA service with file c4pa.xsodata:
service {
"blog::c4pa" as "c4pa" keys generate local "ID" aggregates always;
}
annotations {
enable OData4SAP;
}
To make access easier, I enable anonymous access to the XSODATA service in line with this excellent discussion
SAP Hana Anonymous User? And HTTP POST method? by adopting the .xsaccess file:
{
"exposed": true,
"authentication": null,
"anonymous_connection": "blog::anonymous"
}
Creating a role that has only SELECT access to my VIEW in addition to the general catalogue analytic privilege _SYS_BI_CP_ALL:
role blog::anonymous
{
catalog sql object "_SYS_BIC"."blog/c4pa": //Objecttype: VIEW
SELECT;
catalog analytic privilege : "_SYS_BI_CP_ALL";
}
Also adding files anonymous.xssqlcc with my newly created role:
{
"description" : "anonymous",
"role_for_auto_user" : "blog::anonymous"
}
And .xsjs:
var conn = $.db.getConnection("blog::anonymous");
Activating these, results in an entry in table _SYS_XS.SQL_CONNECTIONS:
Leveraging an automatically created XSSQLCC_AUTO_USER with the correct authorizations:
To activate this with the XS Admin Tool, I need Role sap.hana.xs.admin.roles::SQLCCAdministrator:
With this I can call the XS Admin Tool:
https://c4pa.hanatrial.ondemand.com/sap/hana/xs/admin/
I choose the SQL Connection Configurations in my package, which warns me that This SQLCC Artifact is invalid for runtime application usage because it is in inactive mode. Therefore, I Activate it:
As a test, I call my service and receive the expected annotated result:
https://c4pa.hanatrial.ondemand.com/blog/c4pa.xsodata/$metadata
With this I create a Destination to my service in HCP. The naming convention is BusinessSystemXX where XX can range from 00 (reserved) to 10:
And a Business System based on it leveraging OData Service Discovery:
Based on this Business System I discover my available OData Service, Entity Set and available Value Measures via drop down selections:
Next I Activate and Add Evaluation with Fixed Value targets and thresholds:
Then I Activate and Configure Tile:
Finally, I Save and Configure Drill-Down to define my Dimension and View Title:
With Saving my Configuration I am done and see the tile in my Fiori Launchpad on my phone:
And can drill down into Temperature by Day:
Of course, this is quite a simple example, but I hope it shows you how to leverage the Smart Business Service on your IoT data.