Set up SAP Business Application Studio and Python for SAP HANA developer challenge

Estimated read time 7 min read

1. Set up your SAP HANA database in SAP HANA Cloud trial

Please note that it is recommended to use a Trial of the SAP Business Technology Platform (aka SAP BTP), and not a Free Tier or your organization’s account, if you do not have it yet: https://developers.sap.com/group.hana-cloud-get-started-1-trial.html

Make sure that you know your database’s SQL endpoint and the DBAdmin’s password.

2. Open your SAP Business Application Studio

If you are using the SAP BTP free trial, then open the SAP Business Application Studio trial from the “Quick Tool Access” section.

Should you have issues opening SAP Business Application Studio (for example when you have had the account for a long time), then check the steps in this tutorial – Set Up SAP Business Application Studio for Development.

3. Create a new Dev Space for the developer challenge

Go to your instance of SAP Business Application Studio (further referred to as “BAS”).

For this exercise create a new Dev Space called DevChallengeHANA24 of a kind Basic in BAS:

Screen element Value

Dev Space nameDevChallengeHANA24KindBasic

Open the dev space once it is in the state “Running”.

Close the Get Started tab if it opens.

4. Import the profile with the required extensions

You want to customize extensions used in SAP BAS. By default it contains many extensions you will not need. At the same time, you need some extensions specific to working with Python and Jupyter notebooks.

Import the profile `HANAwPy` from the gist: https://gist.github.com/Sygyzmundovych/1938132cf5810680c25f675fe3810630

Create the profile only using Extensions and Code snippets…

… and switch to this new profile.

 

You should see fewer icons in the Activity Bar. When you click on the Extensions icon in the Activity Bar, you should see extensions like Jupyter and Python in the folder “DEV SPACE – INSTALLED.”

 

As well the icon of the profile should change to the icon with a snake.

 

5. Open the Terminal

Even though we’ll use Jupyter Notebooks in the exercises, for this setup exercise, we’ll stick solely to the terminal.

Open it from the hamburger menu:

Run a few commands in the terminal to explore the setup:

 

 

 

 

 

 

whoami
pwd
ls
hostname
echo ${WORKSPACE_ID}
clear

 

 

 

 

 

 

You can also maximize the terminal’s panel.

Check the available locale and set the missing values.

 

 

 

 

 

 

locale -a
export LC_ALL=C.utf8
locale

 

 

 

 

6. Install SAP HANA Client from the SAP Development Tools

SAP Development Tools https://tools.hana.ondemand.com/#hanatools gives you access to the SAP HANA Client, which developers can use to connect client applications to SAP HANA databases.

You need to agree to the SAP developer license https://tools.hana.ondemand.com/developer-license-3_2.txt to use these tools.

Download the SAP HANA Client installer to your BAS Dev Space using the following commands in the terminal.

 

 

 

 

 

 

 

 

 

 

 

wget –no-cookies –header “Cookie: eula_3_2_agreed=tools.hana.ondemand.com/developer-license-3_2.txt” “https://tools.hana.ondemand.com/additional/hanaclient-latest-linux-x64.tar.gz” -O /tmp/hanaclient-latest.tar.gz

tar -xvf /tmp/hanaclient-latest.tar.gz -C /tmp/

 

 

 

 

Check and install the drivers and tools.

 

 

 

 

/tmp/client/hdbinst -l

/tmp/client/hdbinst –batch –hostname=${WORKSPACE_ID}

 

 

 

 

Note that the client has been installed in `~/sap/hdbclient` by default.

 

7. Use the HANA Client user store to store DBAdmin credentials

Check the SQL endpoint of your SAP HANA database, e.g., in the example below, it is `81095c17-3e52-424f-8924-b5e09da9a80a.hana.trial-us10.hanacloud.ondemand.com:443`. Make sure to replace it with the value of the SQL endpoint of your own database when creating a key `myDBAdmin` to store the credentials of your database administrator user.

 

 

 

 

 

 

 

 

 

~/sap/hdbclient/hdbuserstore -i SET myDBAdmin 81095c17-3e52-424f-8924-b5e09da9a80a.hana.trial-us10.hanacloud.ondemand.com:443 DBAdmin
~/sap/hdbclient/hdbuserstore LIST

 

 

 

 

 

 

 

 

 

 Check that user credentials are correct by connecting to the database to run a sample query.

 

 

 

 

 

 

 

 

 

~/sap/hdbclient/hdbsql -U myDBAdmin -jA “SELECT Current_User FROM DUMMY”

 

 

 

 

 

 

 

 

 

 

 

 

 

 

​ 1. Set up your SAP HANA database in SAP HANA Cloud trialPlease note that it is recommended to use a Trial of the SAP Business Technology Platform (aka SAP BTP), and not a Free Tier or your organization’s account, if you do not have it yet: https://developers.sap.com/group.hana-cloud-get-started-1-trial.htmlMake sure that you know your database’s SQL endpoint and the DBAdmin’s password.2. Open your SAP Business Application StudioIf you are using the SAP BTP free trial, then open the SAP Business Application Studio trial from the “Quick Tool Access” section.Should you have issues opening SAP Business Application Studio (for example when you have had the account for a long time), then check the steps in this tutorial – Set Up SAP Business Application Studio for Development.3. Create a new Dev Space for the developer challengeGo to your instance of SAP Business Application Studio (further referred to as “BAS”).For this exercise create a new Dev Space called DevChallengeHANA24 of a kind Basic in BAS:Screen element ValueDev Space nameDevChallengeHANA24KindBasicOpen the dev space once it is in the state “Running”.Close the Get Started tab if it opens.4. Import the profile with the required extensionsYou want to customize extensions used in SAP BAS. By default it contains many extensions you will not need. At the same time, you need some extensions specific to working with Python and Jupyter notebooks.Import the profile `HANAwPy` from the gist: https://gist.github.com/Sygyzmundovych/1938132cf5810680c25f675fe3810630Create the profile only using Extensions and Code snippets…… and switch to this new profile. You should see fewer icons in the Activity Bar. When you click on the Extensions icon in the Activity Bar, you should see extensions like Jupyter and Python in the folder “DEV SPACE – INSTALLED.” As well the icon of the profile should change to the icon with a snake. 5. Open the TerminalEven though we’ll use Jupyter Notebooks in the exercises, for this setup exercise, we’ll stick solely to the terminal.Open it from the hamburger menu:Run a few commands in the terminal to explore the setup:      whoami
pwd
ls
hostname
echo ${WORKSPACE_ID}
clear      You can also maximize the terminal’s panel.Check the available locale and set the missing values.      locale -a
export LC_ALL=C.utf8
locale    6. Install SAP HANA Client from the SAP Development ToolsSAP Development Tools https://tools.hana.ondemand.com/#hanatools gives you access to the SAP HANA Client, which developers can use to connect client applications to SAP HANA databases.You need to agree to the SAP developer license https://tools.hana.ondemand.com/developer-license-3_2.txt to use these tools.Download the SAP HANA Client installer to your BAS Dev Space using the following commands in the terminal.           wget –no-cookies –header “Cookie: eula_3_2_agreed=tools.hana.ondemand.com/developer-license-3_2.txt” “https://tools.hana.ondemand.com/additional/hanaclient-latest-linux-x64.tar.gz” -O /tmp/hanaclient-latest.tar.gz

tar -xvf /tmp/hanaclient-latest.tar.gz -C /tmp/    Check and install the drivers and tools.    /tmp/client/hdbinst -l

/tmp/client/hdbinst –batch –hostname=${WORKSPACE_ID}    Note that the client has been installed in `~/sap/hdbclient` by default. 7. Use the HANA Client user store to store DBAdmin credentialsCheck the SQL endpoint of your SAP HANA database, e.g., in the example below, it is `81095c17-3e52-424f-8924-b5e09da9a80a.hana.trial-us10.hanacloud.ondemand.com:443`. Make sure to replace it with the value of the SQL endpoint of your own database when creating a key `myDBAdmin` to store the credentials of your database administrator user.         ~/sap/hdbclient/hdbuserstore -i SET myDBAdmin 81095c17-3e52-424f-8924-b5e09da9a80a.hana.trial-us10.hanacloud.ondemand.com:443 DBAdmin
~/sap/hdbclient/hdbuserstore LIST          Check that user credentials are correct by connecting to the database to run a sample query.         ~/sap/hdbclient/hdbsql -U myDBAdmin -jA “SELECT Current_User FROM DUMMY”                Read More Application Development Blog Posts articles 

#SAP

You May Also Like

More From Author

+ There are no comments

Add yours