setting_up_SAP_HANA_to_MTS - marcelmohm/SAP-HANA-Usecase GitHub Wiki

Table of Contents

Setting up SAP HANA to MTSJ

System Requirements

Software Requirements

The Download Manager requires Java SE Runtime Environment 8 (JRE 8) or higher.

Hardware Requirements

RAM - 16 GB RAM minimum. 24 GB RAM recommended. (But: If you want to run the server only version, which is sufficient to pass this tutorial, you only need 8 GB RAM)

HDD 120 GB HDD recommended.

Cores - 2 cores (4 recommended). Hardware Virtualization - (Intel processors only) For Intel processors, virtualization is a BIOS setting known as either Intel Virtualization Technology or Intel VT.

Check on https://www.intel.com/content/www/us/en/support/articles/000005486/processors.html if your processor is capable of supporting virtualization.

The following hypervisors have been tested with SAP HANA 2.0, express edition:

VMware Workstation Player 12.x

VMware Workstation Player 7.x

VMware Workstation Pro 12.x

VMware Fusion or VMware Fusion Pro 8.x

Oracle VirtualBox

This tutorial is based on the VMware Workstation. Therefore, a guide to install this software is also included.

Getting started

Download/ Install VMware/ SAP HANA

  1. Download the VMware Workstation Player from the link below and install it on your device. https://www.vmware.com/in/products/workstation-player/workstation-player-evaluation.html

  2. Register for the free version and get the Download Manager for SAP HANA 2.0, express edition. https://www.sap.com/cmp/td/sap-hana-express-edition.html

  3. Run the Download Manager, let the defaults as shown in the image below and click download to get the OVA file for the server only database.

01

Modify your BIOS settings

To enable the virtual machine you probably need to change some BIOS or UEFI settings.

On a BIOS-based system, you’ll access BIOS settings by restarting your PC and pressing the appropriate key right when it first boots.

Whether your PC uses BIOS or UEFI, once you’re in the settings menu, you can begin looking around for an option labeled something like “Intel VT-x,” “Intel Virtualization Technology,” “Virtualization Extensions,” “Vanderpool,” or something similar.

Often, you’ll find the option under a “Processor” submenu. That submenu may be located somewhere under a “Chipset,” “Northbridge,” “Advanced Chipset Control,” or “Advanced CPU Configuration” menu.

Enable the option and then select “Save and Exit” or the equivalent feature to save your settings changes and reboot your PC.

Run SAP HANA Database Server

After finishing the “getting started” part, you can start the VMware Workstation Player and continue with the following steps.

  1. Import the downloaded OVA file into your hypervisor.

  2. Click on the image and go to Edit Virtual Machine Settings. Set the memory allocation to 8GB and Network Connection to NAT as shown below. NAT shows the IP for the virtual machine which will be used to establish JDBC connection.

(If you do not meet the needed requirements, visit https://developers.sap.com/topics/sap-hana.html#deployment to run SAP HANA, express edition in a cloud)

02
  1. Now you can hit the play button and set your preferred keyboard and time zone.

  2. By running the virtual machine for the first time it shows the following screen. Note the IP address, since we will need it later on for the JDBC connection.

03
  1. The hxehost login name is hxeadm by default and the password HXEHana1.

04
  1. After logging in you need to change the passwords for the login as well as the HANA database master password. The selected passwords can be the same but have to comply with these rules:

    • At least 8 characters

    • At least 1 uppercase letter

    • At least 1 lowercase letter

    • At least 1 number

    • Can contain special characters, but not backtick, $ (dollar sign), \ (backslash), ' (single quote), or " (double quotes)

    • Cannot contain simplistic or systematic values, like strings in ascending or descending numerical or alphabetical order

In this case you can choose for example 1anaHEXH as a strong password.

05
  1. When prompted to Proceed with configuration? enter Y. (If the following error is thrown, HANA database has already started in the background and you can continue)

06
  1. Now we want to connect with the systemdb by typing these two commands:

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

If successful, you should see the screen below:

07

Commands

Virtual Machine

  • To see IP address

sudo ifconfig

HDBSQL

  • To get System information you are connected to

\s
  • To exit hdbsql

exit or quit or \q
  • To start the server

./HDB start
  • To see the running process for a user

ps aux | grep hxeadm

where hxeadm is the username

  • To login into the database

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

Where SYSTEMDB is the name of the database,

localhost:39013 is the database URL,

SYSTEM is user and <password> is the password.

  • To create a new user

Create user <user_name> password <password> no force_first_password_change
  • Create schema

Create schema <schema_name>
  • To view tables

SELECT TABLE_NAME AS "Table" FROM M_CS_TABLES WHERE SCHEMA_NAME = 'your schema name';

Setting up the Database for MTSJ

Connect to DB

Login as you learned in the first section with the hxehost login “hxeadm” and your password if you are not already logged in. Now you can connect with the SYSTEMDB by typing these two commands:

hdbsql
\c -d SYSTEMDB -n localhost:39013 -u SYSTEM -p <password>
08

The query from below shows all the databases you have access to. HXE should be mentioned in that list.

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

You can exit this overview by hitting the q-button.

Enabling the script server

The script server is an auxiliary service that is required to execute Application Function Libraries (AFL). For example, this applies to the SAP HANA AFL component like the SAP HANA Predictive Analysis Library (PAL) and other similar libraries. By default, the Script Server is not activated on the HXE tenant. The following command enables the script server.

ALTER DATABASE HXE ADD 'scriptserver'

To check if the script server is enable you need to change to the HXE. To do so you should enter these statements:

\c -d HXE -n localhost:39013 -u SYSTEM -p <password>
SELECT SERVICE_NAME, PORT, ACTIVE_STATUS FROM SYS.M_SERVICES ORDER BY 1

Now you should see the script server in the HXE database like this:

10

Creating a user on HXE

In this part of this documentation we will create a user on the HXE and grant it several permissions. If you are not already connected you should use the following statement to do so:

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

To create a user and set a password in your personal HXE type:

Create user hanauser1 password <password> no force_first_password_change
11

Grant below permission to the user

GRANT AFLPM_CREATOR_ERASER_EXECUTE TO hanauser1
GRANT AFL__SYS_AFL_AFLPAL_EXECUTE TO hanauser1
GRANT AFL__SYS_AFL_AFLPAL_EXECUTE_WITH_GRANT_OPTION TO hanauser1
GRANT AFLPM_CREATOR_ERASER_EXECUTE TO hanauser1
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 the HXE tenant with the user we’ve just created.

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

Create schema

As the next step we need to create and set a schema with the following commands:

CREATE SCHEMA mythaistarhana
SET SCHEMA mythaistarhana

Setting up MTSJ backend

  1. Clone the poc https://github.com/vapadwal/sappoc

  2. Using the distribution, start the eclipse and import mythaistar backend – from sappoc\my-thai-star\java\mtsj (If you do not know how to import correctly the file, take a look at this link: https://github.com/devonfw/devonfw-tutorial-sources/wiki/build-devon4j-application#import-and-run-the-app)

  3. Update the config\application.properties

spring.datasource.url=jdbc:sap://192.168.188.128:39013/?databaseName=hxe
spring.datasource.username=hanauser1
spring.datasource.password=<password>
13

Setting up MTSJ angular

  1. Open the 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
14
  • 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 the poc https://github.com/vapadwal/sappoc hana-my-thai-star-data-generator, as it has all the required files, so there is no need to setup anything.

  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:

Devon-dist_3.1.0\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.

15

Testing

Login to the mythaistar GUI using: Username: manager Password: manager

16

You will get the following output:

17
⚠️ **GitHub.com Fallback** ⚠️