SAP HANA Local Native Development

Aus MattWiki

This article describes how to develop HANA native applications locally without Web IDE and even without XSA server.

hana-cli is a tool from SAP development which contains some scripts which reproduce the behavior of the Web IDE when building and deploying apps. Without the Web IDE one could use CF / XS to create the appropriate services, which are built tand deployed by the Web IDE. But if one wants to work even without CF / XSA server all of the tasks need to be done with the appropriate NPM tools. In order to make this easier hana-cli comes into play.

Source: ABAP Freak Show Ep. 6 - HANA; Local Development, VCAP_SERVICES, and HDI Deployer Tips and Tricks -> https://www.youtube.com/watch?v=JLfv04rlmfI

Installation of Tools

Relevant Tools from SAP

npm i -g @sap/cds
npm i -g @sap/cds-dk

Additional 3rd Party Tools

npm i -g hana-cli

Setup Project

Create a new folder for the project.

Create a DB module inside the project:

hana-cli createModule

Connect to HANA DB - if asked for user don't forget to enter a HANA user, not a XSA user:

hana-cli connect

Get different infos of connected server:

hana-cli systemInfo -a
hana-cli status -a
hana-cli schemas -a

Create HDI container:

hana-cli createContainer

This actually uses SQL statements to create the HDI container to execute the same processes as the build function in the Web IDE would do. This statement needs to be issued from the db folder of the project. Also a default-env-admin.json file is needed in the db folder as well. This creates a default-env.json file which contains the connection details. Now the following statement without the -a is available (which stands for admin):

hana-cli status

This shows the current user, which should be the runtime user and also its roles in the HANA db.