Skip to Content
Previous

Create a cloud-native application in SAP HANA

By Lucia Subatin

Combine SAP HANA and Fiori to create a cloud-native application using a micro-services approach.

Details

You will learn

You will learn how to create a cloud-native applications involving SAP HANA, Node.js and the Fiori master-detail template using SAP Web IDE.


Step 1: Connect to SAP Web IDE for SAP HANA

Have you just created your own Virtual Machine on Google Cloud Platform?

If yes, go to this URL https://hxehost:53075

If not, click on the SAP HANA button in the favorite bar in Google Chrome. Button

If a warning about the certificate appears, choose Advanced > Continue to hxehost to continue to the site.

Incognito Chrome

Log in with user XSA_DEV and HXEHana2

Incognito Chrome

You are now logged in to SAP Web IDE for SAP HANA, a tool to develop applications. You will be building a multi-target application. This is a collection of micro-services combined in the same development lifecycle to create a business application.

Step 2: Create a project

This is the SAP Web IDE for SAP HANA. It is the development tool for native SAP HANA development.
If you see any existing folders, use the right-click menu to delete them.

Delete any existing projects

Right-click on Workspace and choose New > Project from template.

Create a new project

Click Next.

Create a new project

Call your project APP and click Next.

Create a new project

Click Finish to create your project.

Create a new project
Step 3: Create a database module

Right-click APP and choose New > SAP HANA Database Module.

Create a new DB module

Call the module db and click Next.

Create a new DB module

Click the checkbox to Build module after creation

Create a new DB module

Right-click src and click Import > File or Project.

Import data

User browse to navigate to the folder Desktop/1- HANA Data Import and choose the file src (native).zip.

Import data

Delete the name of the file and click OK. When prompted, confirm the import.

Import data

Build the database module.

Import data

Congratulations! You have just created two tables and loaded data into them.

Step 4: Expose data for consumption

You will now create a Node.js module to expose the data in the tables using an OData service.
Right-click APP and select New > Node.js Module.

Create Node.js module

Call it js and click Next.

Create Node.js module

Tick the box next to Enable XSJS support, and click Finish

Create Node.js module

Expand the js folder and right-click the lib folder. Create a new file.

Create Node.js module

Call it service.xsodata

Create Node.js module

Paste the following contents into the file


service { "APP.db::SO.Header" as "Header" navigates ("Items" as "Item"); "APP.db::SO.Item" as "Item"; association "Items" principal "Header"("SALESORDERID") multiplicity "1" dependent "Item"("SALESORDERID") multiplicity "*"; }

Save the file.

Open the mta.yaml file, click on the js module and use the + sign to add the hdi_db and db dependencies under Requires.

Create Node.js module

Save the mta.yaml file.

Save and Run the js module.

Create Node.js module

This will build and redeploy the entire application because the mta.yaml file has been modified. This file describes the dependencies between the different modules (micro-services) and the order in which they are deployed.

Once the application is Running, you can proceed to the last step.

Create Node.js module
Step 5: Use the Fiori master-detail wizard to visualize your app

You will now create the web module using the SAP Fiori master-detail wizard.

Right-click APP and choose New > SAP Fiori Master-Detail Module.

Create UI5 module

Call it web, and click Next.

Create UI5 module

Choose the available service and click Next.

Create UI5 module

Map the fields for the header of the sales order in the wizard.

Create UI5 module

Scroll down to map the fields for the items in the sales orders.

Create UI5 module

Right-click on the web module, and select Run as > Web Application.

Create UI5 module

Scroll down to select the file index.html.

Create UI5 module

Congratulations!

You have created an instance of an SAP HANA service, a Node.js and a web micro-services and glued them together to produce a multi-target application. This can run both on premise or in the cloud.
 


Updated 06/06/2018

Time to Complete

20 Min

Beginner

Tags

Next
Back to top