Skip to Content

In this blog we will learn how to create a MDC instance on HCP trial account . We will also create schema,tables and update data and then expose the data using the XSOData. Finally we will create a HCP mobile application which will consume the exposed data.

Create a hcp trial account by logging into hanatrial.ondemend.com.

https://account.hanatrial.ondemand.com/

Goto Databases & Schema -> HANA MDC (Trial).

After few minutes, the MDC DB will be created.

Now you can create some data in the HANA MDC trial instance using either WebIDE or Eclipse.

For Eclipse, you need to update all the SAP HANA addons/plugins first.

https://tools.hana.ondemand.com/#cloud

Open Eclipse in SAP HANA development perspective.

Enter the HCP account name. Say P123455trial

Enter the username : P12345 and the corresponding HCP password as shown below.

Now enter the Database name that you created while creating the MDC DB instance earlier and the USER as SYSTEM. Also provide the password given earlier while creating the MDC DB.

Now create a testmdc schema . (create schema “testmdc” )

Now rightclick on the the testmdc schema and create a new table.

Create an EMPLOYEE table with some fields and atleast one key field.

Load Sample data. ( You can also load sample data from excel or flat file)

insert into “testmdc”.”EMPLOYEE” values(‘0000000001′,’Andy’,’Newyork’,’4117890000′);

insert into “testmdc”.”EMPLOYEE” values(‘0000000002′,’Becky’,’Dallas’,’3879827890′);

insert into “testmdc”.”EMPLOYEE” values(‘0000000003′,’Carlos’,’Chicago’,’782628299′);

insert into “testmdc”.”EMPLOYEE” values(‘0000000004′,’Dave’,’Los Angles’,’97352820′);

Now, switch from SAP HANA to Java perspective in eclipse.

Create a new XS project.

Once the XS project is created, create a new XS odata file.(say empdata.xsodata)

service { “testmdc”.”EMPLOYEE” as “empdata”; }

Now Right click on the empdata.xsodata file and click on Team -> activate

 

Now rightclick on the same file and run as XS service.

A new url opens in browser. Login with user SYSTEM and corresponding MDC password.

In the above image you can see that you are able to access the different records of the employee table based on the odata query standard.

You can also create attr views/analytic/calc views and expose using xsodata.

Consuming the SAP HANA MDC data in a HCP Mobile application.

Goto Services in HCP. Select Mobile services.

Enable if it is not enabled already.


Add a new application.  Make Security Configuration as Basic.
Set SSO configuration as “No Authentication”

In the backend URL put the XSOdata exposed URL and save the configuration.

Now Click on Ping to see if you are able to connect from the HCP mobile app to the HANA MDC data exposed using XSOdata.

Now goto Application overview.

We will have 3 URLs here namely primary backend URL, server url and mobile app url.
These will be used for registration of the users,mobile app(ios/android) , accessing the data etc.
If you wish to write back to the DB then the CSRF (Cross-Site Request Forgery)  protection needs to be enabled. These URLs are sufficient to develop and run any mobile applications.

 

To report this post you need to login first.

Be the first to leave a comment

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

Leave a Reply