SAP Home Learn Build Integrate Model Operate Extend with AI ConnectTutorial navigator Knowledge Graph API Devtoberfest Developer Advocates App Space

Manage my Account SAP Devs YouTube ↗ Learnings ↗ Community ↗ Provide Feedback ↗
Logout
โคข Open full site

Enhance an ABAP Core Data Services (CDS) View in SAP Business Technology Platform (BTP) ABAP Environment

Add features like value help, aggregations, and calculated fields to an existing CDS entity

Overview

🎓 beginner 60 min. ABAP DevelopmentBeginnerSAP BTP ABAP EnvironmentSAP Business Technology Platform

You will learn

  • โœ”How to add value help using a filter
  • โœ”How to add textual information using associations
  • โœ”How to concatenate two elements, using a built-in function for CDS
  • โœ”How to convert currencies using a built-in function for CDS
  • โœ”How to create an object page
  • โœ”How to create a parent-child hierarchy in your business object
  • โœ”How to add a CASE statement
Julie Plummer J Julie Plummer November 14, 2024
Created by March 9, 2023
Contributors

Prerequisites

Steps

Intro

You can then use some of these features in productive development to make your applications more powerful and more user-friendly. By the end of this tutorial, your application should include a list page and an object page, which should look like this:

fep-final-enhance-no-CASE
fep-final-enhance-no-CASE

step13c-fep-CASE
step13c-fep-CASE

You can see the code at the end of this tutorial. Throughout the tutorial, objects name include a suffix, such as 000. Always replace this with your group number or initials.


Step 1 Add value help
โ€”

To make the input fields more useful, you will now add input value help to the field AgencyID.

  1. Specify the source of the value help. This works a bit like a join: You need to point to an entity, and field common to both the value help entity and your CDS entity. In this case, you will point to AgencyID in the CDS entity /DMO/I_Agency. Add the following annotation to your field AgencyID.

    CDS
    @Consumption.valueHelpDefinition: [{  entity: {name: '/DMO/I_Agency', element: 'AgencyID'}  }]
  2. You also need to expose this second entity in the OData service. To do this, add the entity /DMO/I_Agency to your service definition, so the complete definition looks like this:

    CDS
    @EndUserText.label: 'Service exposes Travel Data 000'
    define service Z_EXPOSE_TRAVEL_R_000 {
      expose Z_I_TRAVEL_R_000 as Travel;
      expose /DMO/I_Agency as Agency;
    }
  3. Format, save, and activate both CDS entity and service definition ( Shift+F1, Ctrl+S, Ctrl+3 ).

  4. Refresh your Fiori Elements preview and choose value help for the input field AgencyID.

    step13a-choose-value-help
    step13a-choose-value-help

  5. Now the value help appears. Enter the country key DE and choose Go. Only German agencies appear on the list.

    step13b-german-agencies
    step13b-german-agencies

  6. Repeat this step for CustomerID:

    CDS
    @Consumption.valueHelpDefinition: [{entity: {name: '/DMO/I_Customer', element: 'CustomerID' }}]
  7. Also, expose this entity in the service definition:

    CDS
    expose /DMO/I_Customer as Customer;
Step 2 Add text associations
+
Step 3 Merge two fields
+
Step 4 Add currency conversion
+
Step 5 Check code for CDS entity
+
Step 6 Test yourself
+
Step 7 Create object page
+
Step 8 Create CDS entity for booking
+
Step 9 Specify hierarchy
+
Step 10 Add annotations
+
Step 11 Create metadata extension for Z_I_BOOKING_000
+
Step 12 Add association from Travel to Booking
+
Step 13 Add Booking information to object page
+
Step 14 Add association from Booking to Connection
+
Step 15 Add CASE statement
+

Resources

Discussion

Share feedback on this tutorial or join the conversation in SAP Community.

Submit detailed feedback Discuss in Community
Steps
Step 1 of 16
1. Add value help 2. Add text associations 3. Merge two fields 4. Add currency conversion 5. Check code for CDS entity 6. Test yourself 7. Create object page 8. Create CDS entity for booking 9. Specify hierarchy 10. Add annotations 11. Create metadata extension for Z_I_BOOKING_000 12. Add association from Travel to Booking 13. Add Booking information to object page 14. Add association from Booking to Connection 15. Add CASE statement 16. More Information

Learn more →