SAP HANA Local Native Development: Unterschied zwischen den Versionen

Aus MattWiki
K (Matt verschob die Seite SAP HANA Local Native and CPM Development nach SAP HANA Local Native Development, ohne dabei eine Weiterleitung anzulegen)
Keine Bearbeitungszusammenfassung
Zeile 1: Zeile 1:
This article describes how to develop HANA native database modules locally without Web IDE and even without XSA server.
This article describes how to develop HANA native database modules locally without Web IDE and even without XSA server.
For CAP development with CLI see [[SAP HANA CAP Development with CLI]]


The approach described below deploys the data to a local SAP HANA Express but it could be deployed to Cloud Foundry as well.
The approach described below deploys the data to a local SAP HANA Express but it could be deployed to Cloud Foundry as well.
Zeile 7: Zeile 9:
Source: ABAP Freak Show Ep. 6 - HANA; Local Development, VCAP_SERVICES, and HDI Deployer Tips and Tricks -> https://www.youtube.com/watch?v=JLfv04rlmfI&list=PLoc6uc3ML1JR38-V46qhmGIKG07nXwO6X&index=67
Source: ABAP Freak Show Ep. 6 - HANA; Local Development, VCAP_SERVICES, and HDI Deployer Tips and Tricks -> https://www.youtube.com/watch?v=JLfv04rlmfI&list=PLoc6uc3ML1JR38-V46qhmGIKG07nXwO6X&index=67


Further down it will bescribed how to build CDS projects and according artefacts.
== Installation of Prerequisites ==
 
Source: ABAP Freak Show Ep. 1 - HANA Cloud and the Business Application Studio -> https://www.youtube.com/watch?v=a3WPQwmpbvI&list=PLoc6uc3ML1JR38-V46qhmGIKG07nXwO6X&index=71
 
== Installation of Requirements ==


'''Relevant Tools from SAP'''
'''Relevant Tools from SAP'''
Zeile 22: Zeile 20:
  npm i -g hana-cli
  npm i -g hana-cli


== Local Native Development ==
== Setup Project ==
 
=== Setup Project ===


Create a new folder for the project.
Create a new folder for the project.
Zeile 42: Zeile 38:
  hana-cli schemas -a
  hana-cli schemas -a


=== Create HDI Container ===
== Create HDI Container ==


  hana-cli createContainer
  hana-cli createContainer
Zeile 54: Zeile 50:
This shows the current user, which should be the runtime user and also its roles in the HANA db.
This shows the current user, which should be the runtime user and also its roles in the HANA db.


=== Build and Deploy Project ===
== Build and Deploy Project ==


First let NPM download the necessary libraries that the project depends on. i.e. ''@sap/hdi-deploy'', which are defined in ''package.json''
First let NPM download the necessary libraries that the project depends on. i.e. ''@sap/hdi-deploy'', which are defined in ''package.json''
Zeile 67: Zeile 63:


  hana-cli tables
  hana-cli tables
== CPM Development ==
=== Create CDS Project ===
cds init MyCDSProject --add hana, mta


[[Category:SAP]]
[[Category:SAP]]
[[Category:HANA]]
[[Category:HANA]]

Version vom 5. März 2021, 18:43 Uhr

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

For CAP development with CLI see SAP HANA CAP Development with CLI

The approach described below deploys the data to a local SAP HANA Express but it could be deployed to Cloud Foundry as well.

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&list=PLoc6uc3ML1JR38-V46qhmGIKG07nXwO6X&index=67

Installation of Prerequisites

Relevant Tools from SAP

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

Additional 3rd Party Tools1

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. When asked for a container name remember to use a unique name. The Web IDE by default adds a _1 at the end of the name of the HDB module.

The createContainer 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.

Build and Deploy Project

First let NPM download the necessary libraries that the project depends on. i.e. @sap/hdi-deploy, which are defined in package.json

npm install -global

Now start the deploy process defined in the package.json by issuing:

npm start

Check crated tables:

hana-cli tables