Right-click on workspace and choose Project from Template
New project
Make sure Cloud Foundry is the selected environment. Select SAP Cloud Platform Business Application and click Next
New project
Call the project APP and click Next
New project
Mark Use HTML5 application repository and click Next
New project
Change the database version to 2.0 SPS02
New project
Step 2Create database artifacts
+
Expand the db folder and double-click on data-model.cds to expand it
New project
Replace the content in data-model.cds with the following:
Text
namespace my.app;
entity Recipes{
key ID : Integer;
instructions : String;
dish : String;
time : Integer;
unit : String;
ingredients : association to many Ingredients on ingredients.recipe = $self;
};
entity Ingredients{
key ID : Integer;
recipe : association to Recipes;
quantity : Double;
unit : String;
ingredient : String;
};
For example:
New project
Step 3Create services to expose data
+
Navigate into the srv folder. Double-click on cat-service.cds.
New project
Replace the existing content in cat-service.cds with the following
Text
using my.app from '../db/data-model';
service CatalogService {
entity Recipes
@readonly
as projection on app.Recipes;
entity Ingredients
@readonly
as projection on app.Ingredients;
}
Save all files
New project
What is going on?
You can see Core Data and Services generating design time artifacts based on SAP HANA (.hdbcds) under a new folder called db\src\gen. You can also follow progress by opening the console.
New project
Step 4Build the database module
+
The .cds file in which you defined the entities for persistence was used to create files with extension .hdbcds. These files will be used by the deployment infrastructure to create physical objects, such as tables, in the database.
Right-click on the db folder and choose Build
Build database
You can follow progress in the Console:
Build database
Step 5Insert data into the ingredients table
+
Now that the database module has been built, you can explore the HDI container and the physical tables.
Right-click on db and choose Open HDI Container.
Build database
Click on Tables. Right-click on MY_APP_INGREDIENTS and choose Generate INSERT statement.
Build database
Make a note of the name of the schema and table, as you may need to adjust the code.
Use the following code to insert values into the table:
Hint: Ctrl+H allows you to replace the schema in the code above if necessary.
Press F8 or use the Run button to insert the records
Build database
Step 6Insert data into the recipes table
+
Repeat the previous steps for the table MY_APP_RECIPES and use the following SQL statements to create data:
SQL
INSERTINTO"APP_APP_HDI_CONTAINER"."MY_APP_RECIPES"VALUES(1,'Mix the egg, butter and flour into a cup. Incorporate Nutella. Bake in microwave for 2 minutes','Nutella cupcake',15,'min');INSERTINTO"APP_APP_HDI_CONTAINER"."MY_APP_RECIPES"VALUES(2,'Lay a piece of nori on sushi mat. Spread rice. Add salmon. Roll','Salmon roll',1,'h');INSERTINTO"APP_APP_HDI_CONTAINER"."MY_APP_RECIPES"VALUES(3,'Mix the macaroni, water, and salt in a microwaveable mug. Microwave for 2-3 minutes','Mac and Cheese',7,'min');
Right-click on MY_APP_RECIPES and choose Generate SELECT statement.
Change the select clause to count the number of records to complete the validation below
Build database
Step 7Build and run the OData services
+
Go back to the code editor.
Right-click on the srv folder and choose Build
Build Java
Wait until the process has finished and make sure the build has finished successfully in the console:
Build Java
Right-click on the module and choose Run as Java Application
Run Java
Once the application is running, click on the URL for the services.
Run Java
Step 8Add a Web module
+
Right-click on your app and choose HTML5 module
Build web
Choose SAP Fiori Worklist Application. Click Next
Run Java
Call the module web. Fill in the Title and Namespace and click Next
Run Java
Choose CatalogService and click Next
Run Java
Complete the data binding as follows and click Finish
Run Java
Step 9Run the application
+
Right-click on the web module and choose Run as Web Application
Run Java
Choose index.html
Run Java
If prompted, enter your credentials:
Run Java
Note: Your credentials are the same you used to log in to the SAP Cloud Platform trial account
Congratulations! You have created your first multi-target application using the Cloud Application Programming Model. You can read more about Multi Target applications and SAP HANA in this series of blogs posts or about the Cloud Application Programming Model in the official SAP Documentation
If you look into the SAP Cloud Platform Cockpit, you will see the Java micro-service running as an application:
Run JavaAnd the HDI container, with the SAP HANA database artifacts, listed in the services:
Share feedback on this tutorial or join the conversation in SAP Community.
Submit detailed feedbackDiscuss in Community
Steps
Step 1 of 9
1. Create a Project2. Create database artifacts3. Create services to expose data4. Build the database module5. Insert data into the ingredients table6. Insert data into the recipes table7. Build and run the OData services8. Add a Web module9. Run the application
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.