Skip to Content

Measure your Raspberry Pi sensor data on the go with the Smart Business Service

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"

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

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:$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.

You must be Logged on to comment or reply to a post.
    • 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



      • 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

        • 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



          • 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


          • Hi Frank,

            in the SITreg app there is a package that should be accessible without authentication. For that I'm using ans XSSQLCC connection and in the XS configuration I'm using the generated user by choosing this setting:

            Hope that helps.

            Best regards

          • Thank you again Gregor,

            Especially also for the link to your SITreg app on GitHub.

            I created a role for my anonymous access and adjusted my anonymous.xssqlcc accordingly so that everything works like charm with the generated XSSQLCC_AUTO_USER now.

            Also, I reflected these changes in the blog.

            Very best regards


  • Thanks for sharing that. Actually I've been working on something similar to be added to our IoT tutorials:

    Should come this month 🙂

  • This is one of the best articles. I am working on the SAP UI5 application. We followed the same in development and working fine. The code is moved to TEST, xsjs services are working fine but getting  "Error [SQL-258] insufficient privilege." when accessing Odataservices.

    Please let me know your comments.