Skip to Content

SAP Cloud Platform predictive services, Expose your predictive demo dataset as an OData service

Previous

SAP Cloud Platform predictive services, Expose your predictive demo dataset as an OData service

By Abdel Dadouche

Expose the demo data to be used with the SAP Cloud Platform predictive services as an OData services

You will learn

  • How to create an OData service to expose a table stored in the HANA SAP Cloud Platform instance

Details

Note:
- The OData service will be used in a SAPUI5 application to render the data in a graph or a table, and is not used by the predictive services.
- The predictive services only consumes data stored inside of your HANA instance.**

Step 1: Open the Content Editor

Open the SAP HANA Web-based Development Workbench on your trial HANA instance connected HANA User Account, click on Editor.

SAP HANA Web-based Development Workbench
Please log in to access this content.
Step 2: Create an application

Right click on Content, then click on Create Application.

SAP HANA Web-based Development Workbench

Complete the form following properties:

  • Package: public.predictive.odata

Click on Create

New Application
Please log in to access this content.
Step 3: Create the XS OData service

Expand the tree structure and reach the public.predictive.odata package.

Right click on odata, then navigate the menu New > File.

SAP HANA Web-based Development Workbench

Complete the form following properties:

  • File Name: predictive.xsodata

Click on Create

New Package

Enter the following code in the file:

service {
  "DEMO"."CashFlow"     as "CashFlowData";
  "DEMO"."Census"       as "CensusData";
  "DEMO"."Transactions" as "TransactionsData";
}
settings {
  support null;
}

Note: if you didn’t import all the datasets provided in the previous step, then file will not get activated, and the console will show you an error message.

This is the OData Service declaration for the datasets located in the DEMO schema.
[DONE]

Step 4: Test the XS OData service

Click on the save button in the top menu bar

XS OData

You can now test your service by clicking on the run button in the top menu bar.

This will list all the services defined in your xsodata file.

<service xmlns:atom="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns="http://www.w3.org/2007/app" xml:base="https://mdcxxxxxxxxxtrial.hanatrial.ondemand.com:443/public/predictive/odata/predictive.xsodata/">
  <workspace>
    <atom:title>Default</atom:title>
    <collection href="CashFlowData">
      <atom:title>CashFlowData</atom:title>
    </collection>
    <collection href="CensusData">
      <atom:title>CensusData</atom:title>
    </collection>
    <collection href="TransactionsData">
      <atom:title>TransactionsData</atom:title>
    </collection>
  </workspace>
</service>
OData Service List

Later, you will be using this OData service, so you should save the highlighted URL in a notepad as your OData Service URL.

Please log in to access this content.

Next Steps

Next
Back to top