Exercise: Creating Custom CDS Views

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

After completing this lesson, you will be able to:

  • Create Custom CDS Views

Create Custom CDS Views

Description

Using in-app extensibility features, create a custom CDS View.

Prerequisites

For the execution of this exercise, you need to access SAP S/4HANA Cloud by means of a user with administrator rights.

Information for execution

In this exercise, replace ### with your user number. This number was introduce to allow multiple users to execute the same exercise in a shared system. It can be any number between 000 and 999.

After every step description, you can choose the [play] link to open a recorded simulation of the described actions.

Steps

  1. Log on to your SAP S/4HANA Cloud tenant.

  2. Assign your user with the following roles: [play]

    Business RoleBusiness Role ID
    AdministratorBR_ADMINISTRATOR
    Configuration ExpertBR_BPC_EXPERT
    Project Manager - Commercial ServicesBR_PROJ_MANAGE_COMM
    Sales ManagerBR_SALES_MANAGER
    Internal Sales RepresentativeBR_INTERNAL_SALES_REP
    1. Open the Maintain Business Users app.

    2. Search and choose your user.

    3. In the Maintain Business User window, look foe the Assigned Business Roles section, choose Add.

    4. Search and apply the required business roles.

    5. Back to the main window, save the user information.

    6. Back to the home view, refresh the browser page choosing F5.

  3. Create a custom CDS view using the Quotation Period ### name (replace ### with your user number), based on the I_SalesQuotation data source, related to sales quotations. Use the following data: [play]

    FieldValue
    LabelQuotation Period ###
    NameYY1_QuotationPeriod###
    ScenarioStandard CDS View
    1. Open the Custom CDS Views app in the Extensibility catalog. All the available data sources are listed on the initial screen.

    2. On the Custom CDS Views screen, choose Create.

    3. On the Create Custom CDS View pop-up window, enter the values from the table.

    4. Choose Create.

    5. In the Select: Primary Data Source window, search and select I_SalesQuotation. The data source is added.

  4. Add the following columns to the view: [play]

    Item
    CreationDate
    SalesOrganization
    SoldToParty
    1. Switch to the Elements tab.

    2. Choose AddElements.

    3. Search and select the Item fields listed in the table.

    4. Choose OK.

  5. Add a calculated column, named QuotationPeriod, based on the following formula: [play]

    Code snippet
    concat(substring(I_SalesQuotation.BindingPeriodValidityStartDate,1,6),concat('/',substring(I_SalesQuotation.BindingPeriodValidityEndDate,1,6)))
    Copy code

    Use the following data:

    FieldValue
    NameQuotationPeriod
    LabelQuotation Period
    Formula (under the previous fields)concat(substring(I_SalesQuotation.BindingPeriodValidityStartDate,1,6),concat('/',substring(I_SalesQuotation.BindingPeriodValidityEndDate,1,6)))

    1. In the Elements tab, choose AddCalculation.

    2. In the Add Calculation dialog window, enter the values from the table.

    3. Choose Apply.

  6. Publish and preview the view. [play]

    1. Choose Publish.

    2. Note
      In case a window with a warning message appears, just close the window.
    3. Choose Preview.

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