Creating a Data Model

Objectives
After completing this lesson, you will be able to:

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. 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 – by using the instructions provided below, you can perform the steps in your SAP BTP account.
  2. Platform Simulation – follow the step-by-step instructions within the simulation.
Note
We strongly recommend to perform 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. To create a data model, open SAP Business Application Studio.

    2. To open the Home tab, select Project Explorer from the menu on the left.

    3. From the Project Explorer select the Home entry.

    4. Under the Home tab, look for the tile Data Models.

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

  2. Configure the Entity Risks.

    Use the following properties:

    Property NameProperty TypeMax Length
    titlestring100
    priostring5
    descrstring100
    impactinteger 
    criticalityinteger 

    1. As Entity Name enter Risks.

    2. Choose the + icon in the table, and enter the properties from the table above.

    3. Choose Create.

  3. Create the entity named Mitigations.

    Use the following properties:

    Property NameProperty TypeMax Length
    descriptionstring100
    ownerstring100
    timelinestring100

    1. Back in the Data Model Editor, choose the Add Entity button in the menu on the top to add another entity.

    2. To edit the entity, choose the entity’s header, and choose the Edit Entity icon.

    3. Enter the Entity name Mitigations, and choose the + icon in the table to add the properties from the table above:

    4. Enter the Entity name Mitigations.

    5. Choose the + icon in the table, and add the properties from the table above

    6. Choose Update to finish.

  4. Now you can see two properties in the Data Model Editor. In a next step, you will describe the interconnection between those entities by defining a relationship, so that each risk has a mitigation associated to it.

    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. Connect the line to the Mitigations entity by selecting the Mitigations entity, and configure the relationship in the pop-up.

  5. In the pop-up screen, enter all the required details:

    FieldValue
    RelationshipAssociation
    Relationship TypeTo-one
    Property namemiti
    1. Enter the data from the table above.

    2. Choose Create.

  6. Repeat the step for Mitigations.

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

    2. Choose the Add a 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.

  7. In the pop-up screen, select all the required details:

    FieldValue
    Backlink Propertymiti
    Property Namerisks
    Relationship typeTo-many
    RelationshipAssociation
    1. Add the required details.

    2. Choose Create.

  8. Include the Aspect global.managed.

    1. Back in the Data Model Editor, choose the header of the Risks entry

    2. Choose the Include Aspects icon in the appeared menu. This allows us to be flexible and extend definitions to new elements, as well as override properties and annotations.

    3. In the pop-up, choose managed from the list, and choose Select.

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

  9. Repeat the steps for Mitigations.

    1. Choose the header of the Mitigations entry, and choose the Include Aspects icon in the appeared menu.

    2. In the pop-up, choose managed from the list, and choose Select.

Save progress to your learning plan by logging in or creating an account

Login or Register