Create a Development Project in SAP Business Application Studio
- How to create a development space and project in SAP Business Application Studio
- How to establish a connection to your database
- How to create a user-provided service
- How to create an
- How to deploy a project
- Sign up for the SAP HANA Cloud trial.
- If you have a production environment of SAP HANA Cloud, SAP HANA database, you may also follow the steps described in this tutorial.
- Provision an instance of SAP HANA Cloud, SAP HANA database.
- Import the sample data needed for this mission.
- Download the sample code files from our public GitHub repository.
Reminder: This tutorial is part of a mission, in which you will help Alex, the CEO of Best Run Travel, to answer a concrete business question with SAP HANA Cloud, SAP HANA database.
Alex needs to know the top 5 partners of their agency and wants to find out the days with maximum booking of each partner.
This mission consists of 9 modules that contain the necessary steps you need to follow in your mission to help Alex:
Start using an SAP HANA Cloud trial in SAP BTP Cockpit
Provision an instance of SAP HANA Cloud, SAP HANA database
Tools to manage and access the SAP HANA Cloud, SAP HANA Database
Create users and manage roles and privileges
Import data into SAP HANA Cloud, SAP HANA Database
Query the database using SQL statements
You are here
Create a calculation view
Grant access to Calculation Views
In this tutorial, you will learn how to start preparations to create a calculation view by setting up a project in SAP Business Application Studio and establishing a connection to your database.
You can follow the steps in this tutorial also by watching this video:
About this video
This video is meant as additional support material to complete the tutorial. However, we recommend that you only use it for visual guidance but primarily focus on the written steps in this tutorial.
- Step 1
Reminder: What is SAP Business Application Studio?
SAP Business Application Studio is a service within SAP Business Technology Platform that provides a development environment for SAP Cloud Foundry. This is an important tool to any kind of development with SAP HANA Cloud, SAP HANA database, including creating calculation views.
SAP Business Application Studio is already included in your trial account. You can access it on the Trial home page. If you are unsure how to open it, please check out Tutorial 3 of this mission.
The first step in the SAP Business Application Studio is to create your development space. Development spaces are like isolated virtual machines in the cloud containing tailored tools and pre-installed runtimes per business scenario, such as an SAP HANA development project.
To create your first development space, follow these steps:
Open SAP Business Application Studio.
On the top right-hand corner, click on Create Dev Space.
Give your development space a name. You can choose any name you prefer, but you cannot use spaces in this name.
Under the name, you need to choose the kind of application you will create. To use SAP HANA tools, such as calculation views, please make sure to check SAP HANA Native Application in the list.
On the right-side of the screen, you will see a list of the pre-defined extensions included in this project. You can also choose to select additional extensions to your project, if necessary.
Then, click on Create Dev Space on the bottom right-side of the screen. You will return to the list of existing development spaces. Your newly created space is now on the list and you can see the status as Starting. This should take no more than a few seconds to start.
Once the status changes to Running, you can click on the name of the development space to open it.
- Step 2
Now you can create a development project within your new space. Follow these steps:
On the Welcome page in the middle of the screen, click on Start from template.
Next, click on SAP HANA Database Project, and then click on Start at the very bottom of the screen.
Give your project a name and then click on Next.
Now you can change the name of your database module, but you can also choose the default name, which is
In the step Set Database Information, you can choose to determine a Namespace and a Schema Name. These are not mandatory and for the purpose of this mission, we recommend you leave these fields empty.
Make sure the SAP HANA database version is set to
SAP HANA Cloud.
Then, click on Yes under Bind the database module to a Cloud Foundry service instance.
Finally, click on Next.
To bind your project to your SAP HANA Cloud, SAP HANA database, you must log on to a Cloud Foundry environment in the SAP BTP subaccount, where SAP HANA database is deployed in the next step.
Check and update, if needed, the API URL to match the URL displayed in SAP BTP Cockpit for the Cloud Foundry environment you plan to use.
Insert your email address and your password. On the right corner of the password field, click on theicon to login.
Once the login is complete, your organization and space are automatically selected. If you are part of multiple organizations or spaces, you can adjust the preselected options via the drop-down menus.
Under Create a new HDI service instance select Yes.
Then, enter a unique name for your service instance. You can keep the default name.
You can leave the last option Use the default database instance of the selected Cloud Foundry space? checked as Yes.
Click on Finish to create the project.
Your project will be generated, which takes a few minutes to complete. You can follow the status of your project creation on the bottom right corner of the screen.
Once the project is complete, you will see a notification on the bottom right-corner of the screen. Click on Open in New Workspace. Your project will open, and you can see the structure on the left-hand panel.
- Step 3
On the left panel, you can now see your workspace where you have your files, and the SAP HANA Project panel underneath where you can deploy your project and open the HDI container in the SAP HANA Database Explorer.
What is an HDI container?
Applications are bound to an SAP HANA Cloud instance through a schema or an HDI container. HDI containers ensure isolation, and within an SAP HANA database you can define an arbitrary number of HDI containers. HDI containers are isolated from each other by means of schema-level access privileges. You can read more in this technical documentation .
Whenever you add a new database object that can be deployed to your HDI container, it will appear in this panel and you can deploy it. In this area you can also check the database connections of your project.
Moving your cursor to the name of an object, folder, or connection in this panel, you will see different icons:
- This icon will open the HDI container in SAP HANA Database Explorer
- This icon will deploy an object, folder or the whole project to the HDI container or other connected database.
- This icon (only on the Database Connections level) allows you to create a new database connection.
- This icon /allows you to bind (green color) or unbind (grey color) a database connection.
An important function that can help you get the commands you need, is the
When you click on View on the top menu and select Find command, a prompt will open at the top center of the screen. In this field, you can search for all commands available and select the one you need.
The most important one for SAP HANA Cloud, SAP HANA database development is the command Create SAP HANA Database Artifact. This command will open a UI that allows you to create many database objects, like tables, roles, services and many more.
To open the Find command prompt, you can also use the key combination
Ctrl + Shift + P.
- This icon
- Step 4
To avoid using the super-user
DBADMIN, we will now first create a new user that has limited rights but will be used for the subsequent steps of this tutorial.
- Open your instance in the SAP HANA Database Explorer.
- Open a SQL console and enter the following statements. These statements will first create two roles and assign these roles select privileges, the object owner role
genericRoleForOOwill be assigned a grant option. Then, a new user
UPSGRANTORwill be created who will be assigned the object owner role.SQLCopy
-- create SQL roles create role "genericRoleForOO"; create role "genericRoleForAP"; -- assign privileges that these roles should grant grant select on schema SFLIGHT to "genericRoleForOO" with grant option; grant select on schema SFLIGHT to "genericRoleForAP"; -- create a database user that should assign these privileges create user UPS_GRANTOR password "DnATBG!1" NO FORCE_FIRST_PASSWORD_CHANGE; -- allow UPS_GRANTOR to grant the respective roles grant "genericRoleForOO" to UPS_GRANTOR WITH ADMIN OPTION; grant "genericRoleForAP" to UPS_GRANTOR WITH ADMIN OPTION;
Execute the statements.
- Go back to SAP Business Application Studio.
- Step 5
Now that your project is created and you know the basics of how to navigate SAP Business Application Studio, your next step is to create a user-provided service, which will allow the project to access the data within the database.
In the SAP HANA Projects Panel, expand your project.
Hover your cursor over the section Database Connections, and a plus icon () will appear. This option allows you to add a new database connection. Click on theicon.
In the field Select connection type, choose the option Create user-provided service instance from the drop-down menu.
Enter a name for your service, for example
Now you have two options to establish the connection to the database. Selecting Use deployment target container database only requires you to provide the credentials of the database your HDI container is in. In this case, enter
UPS_GRANTORand the password for this user and click on Add.
If you select the other option Provide database information, you can manually enter the database you want to connect to. In this case, you need to enter host name host port.
Where can I find host name and host port of my database?
Go to SAP HANA Cloud Central, select your database, click on the three dots in the Actions column and select Copy SQL Endpoint.
Not sure where to find SAP HANA Cloud Central? Please revisit Tutorial 3 of this mission.
When you copy the endpoint, it will look something like this:
The sequence of characters before the
:represent your host name.
443is the SAP HANA Cloud host port.
Once you entered all your database information, click on Add. The user-provided service will be created.
- Step 6
Now that you have a connection to your database, it is important to grant privileges to the object owner and application users so they can access the data in the database. You could do that by creating individual roles, which are
.hdbrolesdatabase objects that you would have to assign to users in the SAP HANA Database Explorer.
A more convenient option to assign a set of privileges to many users directly from your project is an
.hdbgrantsfile. This file will specify that the user-provided service will be used to grant the privileges entered in the
.hdbgrantsfile in the connected database.
This step only has to be done once in the beginning for a project. You will only have to modify the file if you need additional privileges.
We have prepared an
.hdbgrantsfile that is ready for you to use and import to your project but also added instructions here to create an
.hdbgrantsfile yourself. Select one of the options below this step title:
.hdbgrantsto import a ready-made
.hdbgrantsfile to your project.
.hdbgrantsto learn how to create it yourself.
- Step 7
Now that the connection to your database is established and the grants file is created, you can deploy the project.
Go to the lower left corner of the screen, where you can see the SAP HANA Projects pane.
Expand the items under your project name. Next to the name of the user provided service you see the plug icon (). Click on it to bind your user provided service.
When the prompt in the top of the screen comes up, select Bind a user provided service.
Then, select the name of your user provided service from the list. Press
Next to your project name, you will see a small icon in the shape of a rocket(). Click on it to deploy your project.
Once the deployment is successfully completed, you will see the completion message in the bottom area of your screen.
You have completed the seventh tutorial of this mission! You learned how to set up a development project in SAP Business Application Studio and connecting it to your database with a user-provided service and an
.hdbgrantsfile. You are all set now to create a calculation view.
Learn in the next tutorial how to create a calculation view to achieve your mission objective.
- Step 8
In SAP Business Application Studio, you have the File Explorer and the SAP HANA Projects panel. One of the icons you see there is this rocket. What purpose does this icon have?