Wednesday, 14 June 2017

SAP HANA EXPRESS XSA Application Part 2

In this part, we will continue developing our XSA application with Node.js module for business logic.

HANA XSA MTA project and HDI Module

1. Right click on the MTA project name and create Node.js module New->Node.js Module. Complete the steps in the wizard.


SAP HANA EXPRESS and XSA

The wizard even provides an option of XSJS support. Kindly check the same as we are going to use xsodata services.

SAP HANA EXPRESS and XSA

2. Once the above steps is completed, we can see the Node.js module in our project workspace with all the source files such as server.js to bootstrap xsjs, package.json  created.  

SAP HANA EXPRESS and XSA

3. As shown below , we have both HDI module(CMData) and Node.js module(MSBusinessLogic). This both module needs to interact with each other. To achieve this, we to maintain required entries in mta.yaml file. In mta.yml file, we need to mention Node.js module requires HDI module and Node.js module provide service to be used by any other module.   

SAP HANA EXPRESS and XSA

4. Next we willl create xsodata service for the two entities created in CMData HDI module. Right click on MSBusinessLogic module and create an new file as service.xsodata under the lib folder.

SAP HANA EXPRESS and XSA

In the xsodata, we have defined the service to expose the entities as well as the association from Customer to Orders.

SAP HANA EXPRESS and XSA

Save, Build and Run the application.

SAP HANA EXPRESS and XSA

SAP HANA EXPRESS and XSA

5. Once the application is running, we can test the xsodata service from the application URL. Metadata of service.xsodata is displayed.

SAP HANA EXPRESS and XSA

6. We will also create XSJS to interact with the HDI module.

SAP HANA EXPRESS and XSA

Thus till now we have created MTA poject, HDI module and Node.js module. Also we have seen how the Node.js module consumes the HDI module artifacts.