Creating a Data Model

Objectives

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 and watch the simulation instead.

Exercise Options

You can perform this exercise in two ways:

  1. Live Environment / Practice System: you can perform the steps provided below, either in your SAP BTP account or you use the "Practice System Access" provided below.
  2. Simulation: follow the step-by-step instructions within the simulation.
Note

You can try out this exercise in the practice system below. Open the system by clicking on the bottom on the end of this page.

Please note that the practice system access only covers access to the SAP Business Application Studio. When deploying to an SAP BTP runtime or consuming other SAP BTP services, you have to use an SAP BTP Trial Account, Free-Tier, or an Enterprise Account.

Note
We recommend performing the steps in the live environment first.

The following simulation reproduces the full exercise execution:

Task 1: Create Data Models

Steps

  1. Create the required two Data Models, "Risks" and "Mitigations", to hold the data in this application.

    1. Open the SAP Business Application Studio.

    2. Select Project Explorer from the menu on the left to open the Storyboard.

    3. Select the Storyboard entry from the Project Explorer.

    4. Under the Storyboard, look for the tile Data Models.

    5. Choose the + icon to add a new entity.

  2. Configure the Risks entity.

    Use the following properties:

    Property NameProperty TypeMax Length
    titlestring100
    priostring5
    descrstring100
    impactinteger 
    criticalityinteger 

    1. The new entity is shown in the schema.cds tab.

    2. Change the name in the header of the header of the entitiy to Risks.

    3. Choose the Show Details icon, to be able to add properties.

      A new menu opens on the right side of the screen.

    4. Choose the + icon in the properties table. Enter the properties from the table above.

  3. Create the entity named Mitigations.

    Use the following properties:

    Property NameProperty TypeMax Length
    descriptionstring100
    ownerstring100
    timelinestring100

    1. Go back to the schema.cds tab. Choose the Add Entity button in the menu on the top to add another entity.

    2. Drop the new entity somewhere on the screen.

    3. Choose the entity’s header, and enter the Entity name as Mitigations.

    4. Choose the + icon in the Properties menu to add the properties from the table above.

      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.

  4. Describe the interconnection between those entities by defining a relationship, so that each risk has a mitigation associated to it.

    Use the following data for the first relationship:

    FieldValue
    TypeAssociation
    DirectionUnidirectional
    Key PropertyNo
    MultiplicityTo-One
    Namemiti
    Backlink PropertyLeave empty (default)

    1. Find the entry of Risks, and choose the header of the table.

    2. Choose the Add Relationship icon in the menu on the right.

    3. Connect the line to the Mitigations entity by selecting the Mitigations entity and configure the relationship in the pop-up screen.

    4. Enter the data from the table above and choose Create.

  5. Create a second relationship.

    Use the following data:

    FieldValue
    TypeAssociation
    DirectionBidirectional (default)
    Key PropertyNo (default)
    MultiplicityTo-many
    Namerisks
    Backlink Propertymiti

    1. Find the entry of Mitigations, and choose the header of the table.

    2. Choose the Add Relationship icon in the menu on the right.

    3. Connect the line to the Risks entity by selecting the Risks entity and configure the relationship in the pop-up screen.

    4. Enter the data from the table above and choose Create.

    5. Choose Save.

  6. Include the Aspect managed.

    1. Back in the schema.cds tab, choose the header of the Risks entry.

    2. Choose the Aspects tabs in the appeared menu.

    3. Choose managed from the list of Included Aspects.

      The managed aspect allows to track changes made in the data.

  7. Repeat the step for Mitigations.

    1. Choose the header of the Mitigations entry.

    2. Choose the Aspects tab in the menu on the right side.

    3. Choose managed from the list of included Aspects.

Practice System

Log in to track your progress & complete quizzes