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.
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.
Step 1Create an HDI Container
โ
Important: If you have been using an instance provisioned under Other Environments as shown in the prerequisite tutorials, you must map that instance to a Cloud Foundry organization and optionally a space.
In the SAP BTP Cockpit Overview page, verify that the Cloud Foundry environment is enabled and that a space exists.
Check the Cloud Foundry Environment
Take note of the the Org Name under the Cloud Foundry Environment tab as this will be needed in the next step.
If a Cloud Foundry space does not exist, create one.
Check if a Cloud Foundry space exists
The list of users that can access a space can be found under Space Members once a space has been opened.
Open SAP HANA Cloud Central. Click on the SAP HANA Cloud database instance used for this tutorial, select Manage Configurations from the actions menu. Select Instance Mapping. Select the option to Sign Into the Cloud Foundry Environment.
Instance Mapping
Then select Add Mapping and select your Cloud Foundry organization.
Instance mapping
Once finished, press Review and Save.
In the SAP BTP Cockpit, go to Instances and Subscriptions. Click Create.
create service
Select SAP HANA Schemas & HDI containers under Service. Choose the hdi-shared plan and provide an Instance Name, such as HDI_Tutorial. This is the HDI container you will use in your SAP Business Application Studio project.
Create HDI container
Press next. Here you will specify the instance parameters. To associate the HANA Cloud instance (that you have just mapped to Cloud Foundry) with the HDI container instance, specify the following parameters. Be sure to replace the contents in database_id with your SAP HANA database instance ID.
JSON
{"schema":"HDI_Tutorial","database_id":"<SAP HANA Cloud database instance ID>"}
You can copy your SAP HANA Cloud database instance ID from SAP HANA Cloud Central, through the three dots menu under the Actions column.
Copy instance ID
JSON parameters for HDI containers
Review and create your instance.
When completed, the HDI container will appear as shown below. The calculation view created in the next tutorial will be deployed into this HDI container.
HDI Container created
Step 2Create your development space
+
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. If you are unsure how to open it, please check out Tutorial 4 of this mission.
Ensure that your user has the correct permissions to manage the SAP Business Application Studio (i.e. Business Application Studio Administrator). You can check the assigned roles of your users under Security > Users > Select your user > Select the three dots > Assign Role Collection. Ensure your user has the Business_Application_Studio_Administrator role.
Business Application Studio Administrator role
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.
You are now ready to create your first development space.
Open SAP Business Application Studio
open BAS from subaccount
If you have yet to subscribe to SAP Business Application Studio application, you can create one by clicking Create on the top right-hand corner of the screen.
Once you have opened Business Application Studio, click on Create Dev Space.
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.
Create Dev Space2
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 couple of minutes to start.
Once the status changes to Running, you can click on the name of the development space to open it.
Create Dev Space3
Step 3Create your development project
+
Now you can create a development project within your new space. Follow these steps:
On the Get Started page, click on New Project from Template.
Start from Template
Next, click on SAP HANA Database Project, and then click on Start at the very bottom of the screen.
HANA project
Give your project a name, such as BestRunTravel, and then click on Next.
The module name defaults to db. Click on Next.
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 HANA Cloud and Bind the database tutorial to a Cloud Foundry service instance is set to Yes.
DB Information
To bind your project to your SAP HANA Cloud, SAP HANA database, you must log on to Cloud Foundry if you have not already done so.
bind to HDI
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 and login.
Cloud Foundry API URL
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.
CF Org and Space selection
Under Create a new HDI service instance, select No. This will prompt you to choose a Cloud Foundry service. Select the HDI Container service you created earlier in this tutorial.
Bind to HDI service
Click on Finish to create the project.
Your project will be generated, which takes a few minutes to complete.
Once the project is complete, it can be opened if it isn’t open already.
open project
The structure can be seen on the left-hand panel.
Open in New Workspace
Step 4Get to know the SAP HANA Project Panel
+
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.
SAP HANA Projects panel
Moving your cursor to the name of an object, folder, or connection in this panel, you will see different icons:
This iconContainerwill open the HDI container in SAP HANA database explorer
This iconDeploywill deploy an object, folder or the whole project to the HDI container or other connected database.
This iconAdd DB connection(only on the Database Connections level) allows you to create a new database connection.
This iconBind green/Bind greyallows you to bind (green color) or unbind (grey color) a database connection.
Command Palette
An important function that can help you get the commands you need, is the Command Palette.
When you open the side menu, click View, and select Command Palette, 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.
Find command
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.
Find Command HDB artifact
To open the Command Palette, you can also use the key combination Ctrl + Shift + P or F1.
Step 5Create a user-provided service
+
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 (Add DB connection) will appear. This option allows you to add a new database connection. Click on the icon.
Project panel add DB connection
In the field Select connection type, choose the option Create user-provided service instance from the drop-down menu.
Enter the name MyUPS for your service name and provide the user name UPS_GRANTOR and password Password1 for this user previously created in step 2 of the Create Users and Manage Roles and Privileges tutorial.
USP UI1
Select the Generate hdbgrants file checkbox.
You will assign a set of privileges to many users directly from your project in an .hdbgrants file. This file will specify that the user-provided service will be used to grant the privileges entered in the .hdbgrants file 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.
Click on Add. The user-provided service will be created.
USP created
Step 6Modify the hdbgrants file
+
In File explorer, open the .hdbgrants file with the option Open With … Text Editor. Here, you can see a template of all different types of privileges you could grant to different user groups. There is a dedicated section for object owner users and application users.
Open .hdbgrants file
For the purposes of this tutorial, we would like to grant the roles we have previously created to object owners and application users. To view this tutorial, click here. The object owner will be assigned the role genericRoleForOO and the application user the role genericRoleForAP.
To do so, replace the contents of the hdbgrants file with the following:
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.
Next to your project name, you will see a small icon in the shape of a rocket(Deploy). 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.
Deployment successful
To establish a connection from the SAP HANA database explorer to the HDI Container, navigate to the SAP HANA Projects and go to Database Connections. Click on the iconContainerto open the HDI Container as shown below.
Open HDI container in dbx
This will create a connection to the HDI container in the SAP HANA database explorer, allowing you to query and view its contents. Execute the below SQL to see the current user and schema.
SQL
SELECTCURRENT_USER,CURRENT_SCHEMAFROMDUMMY;
current user and schema
Notice that you can now access the tables in the SFLIGHT schema which is in the SAP HANA Cloud database instance from within the HDI container.
SQL
SELECT*FROMSFLIGHT.SAIRPORT;
accessing SFLIGHT schema
Well done!
You have completed the eighth 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 .hdbgrants file. 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.
Share feedback on this tutorial or join the conversation in SAP Community.
Submit detailed feedbackDiscuss in Community
Steps
Step 1 of 8
1. Create an HDI Container2. Create your development space3. Create your development project4. Get to know the SAP HANA Project Panel5. Create a user-provided service6. Modify the hdbgrants file7. Deploy your project8. Knowledge Check
Joule
AI Notice
Joule is an AI assistant. Generative AI may produce inaccurate, incomplete, or biased information. Always verify important details before acting on them.
Conversations are sent to SAP-hosted large language models for processing. Do not include personal data, credentials, or confidential information in your messages.
Joule's responses are based on the SAP tutorial catalog and may not reflect the latest product changes. For authoritative guidance, consult the linked tutorials and official SAP documentation.