Skip to content

sap hana guide

Sarmokadam edited this page Sep 9, 2020 · 9 revisions

SAP HAHA

User can configure SAP HANA use case on local by creating VM on local machine and setting up SAP HANA database on it. In case, user do not have sufficient memory on local, user can setup VM remotely and configure SAP HANA database on it. Detailed requirement and procedure for setting up remote VM is provided at https://developers.sap.com/group.hxe-install-binary.html . In case, user choose to create VM remotely you can skop next 2 steps and start with Setting up Database for MTSJ .

Download/Install Vmware/SAP hana

Run SAP Hana Database Server

  • Once the .ova file has been opened inside VMware workstation. Click on the image and go to Edit Virtual Machine Settings. Set the memory allocation to 5GB. And Network Connection to NAT . NAT shows the IP for the virtual machine which will be used to establish JDBC connection

  • Click Play Virtual Machine. When first time the virtual machine runs it display following. Copy the IP address which will be used for JDBC connection

  • Type hxeadm, which is the username and hit Enter. Next it will ask for password which is HXEHana1. Once successfully logged in it will ask to set a new password. Choose a new password and remember.

  • You need to set Master password for SAP Hana database. Set it as you like and remember.

  • For “proceed with configuration” type y and hit Enter. Hana database has started in the background.

  • Try connecting with following command, replace the password with the master password

hxehost:hxeadm>hdbsql
   \c -d SYSTEMDB -n localhost:39013 -u SYSTEM -p <>

Setting up Database for MTSJ

Once you have install SAP hana with VMware , you need to setup the DB.

Connect to DB

  • After you start Vmware, login with hxeadm as login and the password. At the prompt - hxehost:hxeadm>hdbsql Please note the IP address, that need to be put in mtsj java backend

  • On prompt hdbsql> type below to connect to the DB

\c -d SYSTEMDB -n localhost:39013 -u SYSTEM -p <password>
  • Type below query to see, if you have access to tenant database i.e. HXE

SELECT DATABASE_NAME,  ACTIVE_STATUS FROM SYS.M_DATABASES ORDER BY 1;

Enabling the script server

Run the below for enabling the script server

ALTER DATABASE HXE ADD 'scriptserver'

To check if the script server is enable, execute below statement

SELECT SERVICE_NAME, PORT, ACTIVE_STATUS FROM SYS.M_SERVICES ORDER BY 1;

It should see the scriptserver in it.

Creating a User on HXE

  • Connect using the below

\c -d hxe -n localhost:39013 -u system -p <password>
  • To create a user

Create user hanauser1 password <password> no force_first_password_change
  • Grant below permission to the user

GRANT AFLPM_CREATOR_ERASER_EXECUTE TO hanauser1
GRANT AFL__SYS_AFL_AFLPAL_EXECUTE TO hanauser1 – here we have 2 underscore
grant AFL__SYS_AFL_AFLPAL_EXECUTE_WITH_GRANT_OPTION to hanauser1
grant AFLPM_CREATOR_ERASER_EXECUTE to hanauser
GRANT DATA ADMIN TO hanauser1
GRANT IMPORT TO hanauser1

GRANT EXECUTE on _SYS_REPO.GRANT_ACTIVATED_ROLE TO hanauser1
GRANT EXECUTE ON system.afl_wrapper_generator to hanauser1

GRANT EXECUTE ON system.afl_wrapper_eraser to hanauser1
GRANT MODELING TO hanauser1
  • Now connect to HXE tenant using below

\c -d hxe -n localhost:39013 -u hanauser1 -p <password>

Setting up MTSJ Java backend

  • Update application.properties file

# update the below
spring.flyway.locations=classpath:db/migration,classpath:db/specific/hana
# Add the below
spring.jpa.database=default
spring.jpa.database-platform=org.hibernate.dialect.HANAColumnStoreDialect
spring.datasource.driver-class-name=com.sap.db.jdbc.Driver
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true

#Comment the below
#spring.profiles.active=h2mem

spring.profiles.active=hana
  • Update config/application.properties file

# update the below
spring.flyway.locations=classpath:db/migration,classpath:db/specific/hana
spring.datasource.url=jdbc:sap://ip:port/?databaseName=hxe
spring.datasource.username=username
spring.datasource.password=password

Enabling prediction usecase in MTSJ

Setting up MTSJ angular

  1. Update the following property in config file in my-thai-star\angular\src\app\core\config

enablePrediction: true,
  1. Open console.bat

  2. Go to folder > sappoc\my-thai-star\angular and type the below commands in following order

npm uninstall -g angular-cli @angular/cli
npm install -g @angular/cli
npm install
npm audit fix
npm run start

Setting up data for Predictive use case

  1. Update the config.ini with the corresponding details:

➢ Use the below query to find the SQL port of the indexserver:

	SELECT SERVICE_NAME, PORT, SQL_PORT FROM SYS.M_SERVICES
db screenshot 1

➢ Update now the config.ini:

	host = 192.168.188.128 (update this with your IP as done above)
	port = 39015 – check this port it might be different
	user = hanauser1
	password = <password>
  1. Next, open eclipse and run the SpringBootApp.java as Java Application.

  2. We will use hana-my-thai-star-data-generator at https://github.com/SAP/hana-my-thai-star-data-generator .

  3. Open the console.bat.

  4. Go to the folder \hana-my-thai-star-data-generator and type the following command:

pip install -r requirements.txt

If pip is not part of your path run:

${devonfw-distribution}\software\python3\scripts\pip install -r requirements.txt

  1. Last but not least, you need to run the following commands in the correct order:

➢ Go to dir \sappoc\hana-my-thai-star-data-generator\src ➢ Python address_generator.py ➢ Python main.py

After a while you will get the screen below.

sap hana data generator output

Testing

Login to the mythaistar GUI using:

Username: manager Password: manager

mts login

You will get the following output:

Prediction usecase