Creating a Data Model

Objective

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

  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 Overview from the menu on the left to open the Storyboard.

      System screenshot
    3. Select the Storyboard entry from the Project Overview by opening Project Actions.

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

    5. Choose the entry corresponding to the namespace that you created before, for example RiskManagement. From the menu that open select Add Data Model Entity.

      System screenshot
  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 entity to Risks.

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

      System screenshot

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

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

      System screenshot
  3. Create the entity named Mitigations.

    Use the following properties:

    Property NameProperty TypeMax Length
    createdAtstring100
    createdBystring100
    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.

      System screenshot
    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 preceding table.

      System screenshot

      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 between risks and mitigations.

    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.

      System screenshot
    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 preceding table and choose Create.

      System screenshot
    5. Choose Save.

Practice System

Log in to track your progress & complete quizzes