Defining Services

Objective

After completing this lesson, you will be able to create service entities

Define Services

Business Scenario

Your company is planning to develop a set of cloud-based applications based on the SAP Cloud Application Programming Model (CAP). These applications will be deployed to the SAP Business Technology Platform (BTP) as extension applications for the SAP core back end systems.

In this exercise, you will perform the following task: create service entities.

Now, you will create service entities for Risks and Mitigations, to define which parts of the data models you created are exposed to the application.

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 Services

Steps

  1. Create a new service.

    1. Go back to the Storyboard.

    2. Find the Services tile.

    3. Choose the entry corresponding to the namespace that you created before, for example RiskManagementService. From the menu that open select Add Service Entity.

      System screenshot

      The service.cds screen opens

    4. Make sure thatEnable Draft editing is selected. Select RiskManagement.Risks as type for this projection and save your changes.

      System screenshot
    5. Check that a new entity displays in the service.cds tab.

      System screenshot
  2. Check that the service is set to draft editing.

    A draft is a temporary version of a business entity that has not yet been explicitly saved as an active version. Drafts are used:

    • To keep unsaved changes if an editing activity is interrupted, allowing users to resume editing later.
    • To prevent data loss if an app terminates unexpectedly.
    • As a locking mechanism to prevent multiple users from editing the same object at the same time, and to make users aware when there are unsaved changes by another user.
    1. Select the Risks entity in the service.cds tab.

    2. Choose the entity’s header. Choose the Show Details.

      This allows to add properties to it. System screenshot

      A menu displays on the right side of the screen.

    3. Choose the Settings tab. Check that the Draft Editing checkbox is selected.

      System screenshot
  3. Configure a new entity.

    1. In the service.cds tab, choose Add Entity.

      ystem screenshot

      A new entity displays.

    2. Drop this new entity somewhere on the service.cds tab.

      The Projection section opens on the right.

    3. Make sure thatEnable Draft editing is selected. Select RiskManagement.Mitigations as the type for this projection and save your changes.

      System screenshot
    4. Check that a new entity displays in the service.cds tab.

      System screenshot
  4. Check that the service is set to draft editing.

    1. In the service.cds tab, select the Mitigations entity by double-clicking on its name.

      Note that the properties for Mitigations are displayed in the menu on the right side.

    2. If you don’t see the details menu on the right, choose the entity’s header and choose the Show Details icon.

      System screenshot
    3. Find the Settings tab in the menu on the right side. Check that the Draft Editing checkbox is selected.

      System screenshot

Log in to track your progress & complete quizzes