Skip to Content

Binding to and developing on SAP HANA XSC (IoT for Neo)

0 %
Binding to and developing on SAP HANA XSC (IoT for Neo)
// Explore More Tutorials

Binding to and developing on SAP HANA XSC (IoT for Neo)


Now connect your IoT Services to an SAP HANA MDC instance and show the data using SAP HANA XS Classic

You will learn

Now that your IoT Services are collecting data and you were able to view it your deployed Java application, now how about redirecting the data to a shared SAP HANA MDC instance and developing a small SAP HANA XS Classic application to show the data.

Step 1: Stop the running app

To be on the safe side go ahead and stop your iotmms Java application.

Step 2: Create a new SAP HANA MDC instance

From within the cockpit now choose Databases & Schemas.

HANA instances

Create a new SAP HANA MDC instance. MDC stands for Multi-database Container. Your MDC instance is your own within a shared SAP HANA system.

HANA instances
Step 3: select the SAP HANA Cockpit link

Once the instance has fully created you will need to follow a couple of steps to allocate your user the proper authorizations.

Creating instance

Now select the “SAP HANA Cockpit” link where you will receive two messages indicating a missing authorization followed by authorizations being granted.

Step 4: Apply authorizations to users

Now select the “Manage Users and Roles” where you will apply additional authorizations to your user or to a new user.

Step 5: Grant special access

Once you here you will select the “SYSTEM” user or right click on the “SYSTEM” user and choose copy user first. Then under the first tab “Granted Roles” you will select the “+” symbol and search for “developer” then select each role listed and mark “OK” then again search for “admin” and do the same. Basically this gives your user “super user” access to the database. As you are currently the only one with access use it wisely.

Step 6: Create new binding

Now return to your Java applications within the SAP Cloud Platform and choose the iotmms application and then the data bindings option. Delete the existing binding to XXXXXXtrial.iotmms.web database. Then create a new binding to your new HANA MDC instance.

Step 7: Start the application

Now start (or restart) the iotmms Java application.

Step 8: View your tables

With previous step finished you should be able to go back to your MDC instance and select the “Catalog” under the menu options along the top of the page and see your tables now listed under “SYSTEM” schema - if not return to the IoT Services and send another test message. (see tutorial). So provided you received the “200” status in your messages then you should now have data in your tables and can begin working on your XS application.


Your table T_IOT_XXXXXXXXXXXXX will be the other item you need to make note of for use in a moment.

Step 9: Create empty application

Choose the “SAP HANA Web-based Development Workbench,” now right click on the top level, Content, and choose Create Application“. Choose the Empty Application” option and the “sub package” - codejam.iotmmsxs

new application
Step 10: Modify the access file

Now modify the .xsaccess file, line 13 you need to change the “true” to “false”.

Step 11: Add a new sub package

Select your sub package iotmmsxs and then add a new sub package called services. There you will add a new file called iotservice.xsodata.

service {
"SYSTEM"."T_IOT_<table_postfix>" key generate local "GEN_ID";

So this file you can open in your web browser right now and have full access to all of the built in OData functionality.

Step 12: Edit the index HTML file

Now you will use the created service in the index.html file.

default page

You will replace the existing code with the following, which is quite a bit but should be easily readable and understandable as we are adding a table to a page.

Make sure you replace <MESSAGE_ID> below with the name of your table with corresponding message type table, like T_IOT_15B1E994B520C8D65A42

 <meta http-equiv="X-UA-Compatible" content="IE=edge" />
 <meta charset="UTF-8"/>
 <title>My Sensor Data</title>
 <script id='sap-ui-bootstrap'
 <script language="JavaScript">
   var oModel = new sap.ui.model.odata.ODataModel("/codejam/iotmmsxs/services/iotservice.xsodata/", false);
   var arrayHeaders = new Array();
   oTable = new sap.ui.table.Table("test",{tableId: "tableID", visibleRowCount: 10});
   //Bring the table onto the UI
   //Table Column Definitions
   var oMeta = oModel.getServiceMetadata();
   var oControl;
   for ( var i = 0; i < oMeta.dataServices.schema[0].entityType[0].property.length; i++) {
      var property = oMeta.dataServices.schema[0].entityType[0].property[i];
      oControl = new sap.ui.commons.TextField().bindProperty("value",;
      oTable.addColumn(new sap.ui.table.Column({label:new sap.ui.commons.Label({text:}), template: oControl, sortProperty:, filterProperty:, filterOperator: sap.ui.model.FilterOperator.EQ, flexible: true, width: "125px" }));
   var sort1 = new sap.ui.model.Sorter("C_TIMESTAMP");
   //Replace <MESSAGE_ID> below with the name of your table with corresponding message type table, like T_IOT_15B1E994B520C8D65A42
    <div id="sensor_table"/>
Step 13: View the results

Example results are below.

new page

This is not the only way to do, but that is a matter for you to explore and discover!

Next Steps

Next Steps

Back to top