After completing this lesson, you will be able to create and configure a data model
Create and Configure a Data Model
Business Scenario
Your company is planning to develop a set of cloud-based applications based on the SAP Cloud Application Programming Model (CAP), and these applications will be deployed to SAP Business Technology Platform (BTP) as extension applications for the SAP core back-end systems.
In this exercise, you will perform the following tasks:
Create a data model.
Add properties to the data model.
Create an association.
Now, you can start the development of your application. At first, you will model your application, and define the database table and the relationship between the entities.
Note
Note that some of the services that this learning journey links to can incur costs.
If you are concerned about charges, you can opt to skip the corresponding exercises.
Task 1: Create Data Models
Steps
Create the required two Data Models, "Risks" and "Mitigations", to hold the data in this application.
Open the SAP Business Application Studio.
Select Project Overview from the menu on the left to open the Storyboard.
Select the Storyboard entry from the Project Overview by opening Project Actions.
Under the Storyboard, look for the tile Data Models.
Choose the entry corresponding to the namespace that you created before, for example RiskManagement. From the menu that open select Add Data Model Entity.
Configure the Risks entity.
Use the following properties:
Property Name
Property Type
Max Length
title
string
100
prio
string
5
descr
string
100
impact
integer
criticality
integer
The new entity is shown in the schema.cds tab.
Change the name in the header of the entity to Risks.
Choose the Show Details icon to be able to add properties.
A new menu opens on the right side of the screen.
Choose the + icon in the properties table. Enter the properties from the preceding table.
Create the entity named Mitigations.
Use the following properties:
Property Name
Property Type
Max Length
createdAt
string
100
createdBy
string
100
description
string
100
owner
string
100
timeline
string
100
Go back to the schema.cds tab. Choose the Add Entity button in the menu on the top to add another entity.
Drop the new entity somewhere on the screen.
Choose the entity’s header, and enter the Entity name as Mitigations.
Choose the + icon in the Properties menu to add the properties from the preceding table.
If the menu is not visible, choose the entity’s header and choose the Show Details icon.
Now, you can see two properties in the schema.cds.
Describe the interconnection between those entities by defining a relationship between risks and mitigations.
Use the following data:
Field
Value
Type
Association
Direction
Bidirectional (default)
Key Property
No (default)
Multiplicity
To-many
Name
risks
Backlink Property
miti
Find the entry of Mitigations, and choose the header of the table.
Choose the Add Relationship icon in the menu on the right.
Connect the line to the Risks entity by selecting the Risks entity and configure the relationship in the pop-up screen.
Enter the data from the preceding table and choose Create.