After having Analysed my Raspberry Pi I2C sensor data with the HANA Cloud Platform, predictive services and inspired by Raja Prasad 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"
}

And adding files anonymous.xssqlcc:

{
    "description" : "anonymous"
}

And .xsjs:

var conn = $.db.getConnection("blog::anonymous");

Activating these, results in a default entry in table _SYS_XS.SQL_CONNECTIONS:

To augment and 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 there is no database user configured:

So I put in my Username and Password:

To be rewarded with an enabled SQLCC Artifact for runtime application usage:

 

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.

To report this post you need to login first.

7 Comments

You must be Logged on to comment or reply to a post.

  1. Gregor Wolf

    Hi Frank,

    I would suggest that you follow Thomas Jung’s advice and do not directly update  SQL_CONNECTIONS.

    Best regards

    Gregor

    (0) 
    1. Frank Schuler Post author

      Thank you Gregor,

      Perhaps you can help me with this.

      I would have preferred to use the SQLCC app, but when trying to call http://host:port/sap/hana/xs/sqlcc, I get a 404 – Not found error, despite my user having authorization sap.hana.xs.admin.roles::SQLCCAdministrator.

      Is there a perhaps package or configuration missing in the out of the box HCP HANA MDC, that I have to add or did I just get the URL wrong? I could unfortunately not find much information on the topic.

      Very best regards and many thanks for any further help in advance

      Frank

       

      (0) 
      1. Gregor Wolf

        Hi Frank,

        it seems the URL is wrong for current releases. In my 1.12 and 2.0 Systems it is /sap/hana/xs/admin/ and then you have to open the package where you want to allow anonymous access open the .xssqlcc file, switch to edit mode and tick the activate checkbox.

        Best regards
        Gregor

        (0) 
        1. Frank Schuler Post author

          Thank you very much Gregor!

          The correct URL made all the difference 😉 and I improved my blog using the XS Admin Tool accordingly.

          Very best regards

          Frank

           

          (1) 
            1. Frank Schuler Post author

              Hello Gregor,

              Thank you for your question. I had not been aware of the generated XSSQLCC_AUTO_USERs. I got 3 of those in my system with a different Role each:

              1. sap.hana.xs.selfService.user.roles::USSExecutor
              2. sap.hana.xs.admin.roles::JobAdministrator
              3. sap.hana.xs.admin.roles::WebDispatcherHTTPTracingAdministrator

              Is it correct that I should use the first one for the anonymous access rather than the SYSTEM user?

              Very best regards and many thanks for your further help in advance

              Frank

              (0) 

Leave a Reply