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

Refine the Object Page with Annotations

Display data in fields and tables on the object page using annotations.

Overview

🎓 beginner 40 min. SAP FioriBeginnerSAP Fiori Tools

You will learn

  • โœ”How to add a title and a subtitle to the object page header
  • โœ”How to add key data to the object page header
  • โœ”How to add a section and use field groups to structure data
  • โœ”How to add a table
  • โœ”How to include pictures in a table
  • โœ”How to modify an SAP Fiori elements application to add features like flexible column layout and initial load of data
  • โœ”How to update the metadata in your frontend application
  • โœ”How to add side effects using guided development
Unknown U Unknown October 9, 2025
Created by October 10, 2023
Contributors

Prerequisites

Prerequisites

Steps

Intro

Whenever your unique suffix for creating objects is needed, the object names within this tutorial are named with suffix “######”. For the screenshots the suffix “000100” was used.


Step 1 Add title and subtitle to object page header
โ€”

Clicking on any item of the list report will show the object page for this item. The object page currently shows only some standard buttons and does not contain any further fields or actions. In this step you will add annotations to show a title and a subtitle in the object page header.

  1. Open the metadata extensions for the Travel view ZC_FE_TRAVEL_######. In the previous tutorial Refine the List Report with Additional Annotations you already defined header information in step 3. Now you will enhance the annotation @UI.headerInfo with a title and a description property.

    CDS
    ...
    
    @UI: {
        headerInfo: {
            typeName: 'Travel',
            typeNamePlural: 'Travels',
            title: {
                type: #STANDARD, value: 'Description'
            },
            description: {
                value: 'TravelID'
            }
        },
    ...

Choose Save and Activate.

  • Refresh the app preview. You will see an object page containing a title and a subtitle in the header and an empty content section.

    App object page title
    App object page title

  • Step 2 Add data points to object page header
    +

    Choose Save and Activate.

  • Refresh the app preview. The two new data points show up in the object page header. The labels are taken from property title, the color of Status from property criticality of the datapoint annotations .

    App Data Points
    App Data Points

  • Step 3 Add new section with title
    +
    Step 4 Add 2 field groups to section
    +
    Step 5 Show Bookings Table in new section
    +
    CDS
    @EndUserText.label: 'Airline'
    @ObjectModel.text.element: ['CarrierName']
    CarrierID,
    _Carrier.Name as CarrierName,

    Choose Save and Activate.

    1. Refresh the app preview. The booking table is now displayed in the new Bookings section of the object page with descriptions for Customer and Airline.

      App booking table
      App booking table

    Step 6 Add airline pictures in Bookings table
    +
    Step 7 Activate flexible column layout
    +
    Step 8 Activate initial loading of data
    +
    Step 9 Update the metadata in your frontend application
    +
    Step 10 Add side effects using guided development
    +

    Choose Save and Activate.

  • Implement the method calculateTotalPrice.

    Via a quick fix assist (Ctrl+Shift+1), you can generate the method declaration in the behavior pool directly from the behavior definition editor (your method will be in the implementation class ZBP_I_FE_TRAVEL_######->LHC_TRAVEL).

    Implementation: Execute the action recalcPrice when the trigger fields are changed.

    Add the following code lines to the method calculateTotalPrice. Replace ###### in ZI_FE_Travel_###### with your number.

    ABAP
    METHOD calculateTotalPrice.
        MODIFY ENTITIES OF ZI_FE_Travel_###### IN LOCAL MODE
            ENTITY Travel
            EXECUTE reCalcTotalPrice
            FROM CORRESPONDING #( keys ).
    ENDMETHOD.

    Choose Save and Activate.

    At this point the backend implementation for the total price recalculation is finished. Now if you start the application preview in SAP Business Application Studio, navigate from List Report to Object Page, click on Edit, change the booking fee and Save the data. The total price is recalculated. Note that Total Price field is read only now.

    With the next steps you will learn how to add side effects to update the total price after changing the booking fee directly. This means, if you change the field booking fee and jump into another field, the total price is already re-calculated without the need to save the data. For this we will use Guided Development.

  • Switch to the SAP Business Application Studio with your generated application.

    From the hamburger menu, open View->Command Palette…, type Guided Development, and select Fiori: Open Guided Development.

    In the Search guides field type side effects and then select the Configure side effects guide. This guide contains two steps.

    In the right upper corner you can use the Fullscreen button, to hide/show the search view.

    Open Configure Side Effects Guide
    Open Configure Side Effects Guide

  • Switch to the first step of the guide. Here you will configure the property BookingFee from Entity Type Travel as a source of the side effect.

    Add Side Effect Source Options
    Add Side Effect Source Options

    In the code snippet preview you will see the annotations and the file name, which will be changed.

    Choose Insert Snippet.

    Check and insert Code Snippet
    Check and insert Code Snippet

    The anonnotations.xml file editor opens with newly added annotations for side effect source.

    Annotations result in the file
    Annotations result in the file

  • Switch to the second step of the guide. Here you will configure the TotalPrice as a side effect target.

    Choose Insert Snippet.

    Check and insert Code Snippet
    Check and insert Code Snippet

    The anonnotations.xml is adopted with a new lines.

    Check and insert Code Snippet
    Check and insert Code Snippet

  • Refresh the application and choose Go to load data into the list report table. Select any of the items within the table to open the object page. Choose Edit to start chaining data of the draft.

    Change the amount of Booking Fee and step out of the field. The side effect is triggered and the Total Price is recalculated.

    Check and insert Code Snippet
    Check and insert Code Snippet

    Self study (OPTIONAL): at this point the recalculation is triggered if the Booking Fee amount is changed. What do you need to change in the backend and side effects to trigger Total Price recalculation, if the Flight Price of a Booking is changed on the UI? Hint: the Travel entity has an association to Booking entity with the property FlightPrice.

    Use the suggested solution in points 9-12 below for the self-check.

  • (OPTIONAL) Define the determination calculateTotalPrice in Booking behavior.

    The actual calculation of the total price is done by the action recalcTotalPrice. You need the determination in Booking behavior to execute the action.

    Define a determination on modify with operation trigger create and field triggers FlightPrice and CurrencyCode.

    In the behavior definition for the Travel ZI_FE_TRAVEL_###### add the following code lines.

    CDS
    define behavior for ZI_FE_Booking_###### alias Booking
    {
    ...
    determination calculateTotalPrice on modify { create; field FlightPrice, CurrencyCode; }
    ...
    }
  • Choose Save and Activate.

  • (OPTIONAL) Implement the method calculateTotalPrice.

    Via a quick fix assist (Ctrl+Shift+1), you can generate the method declaration in the behavior pool directly from the behavior definition editor (your method will be in the implementation class ZBP_I_FE_BOOKING_######->LHC_TRAVEL class).

    Implementation: Execute the reCalcTotalPrice on root node when the trigger fields are changed.

    Add the following code lines to the method calculateTotalPrice. Replace ###### in ZI_FE_Travel_###### with your number.

    ABAP
    METHOD calculateTotalPrice.
        " Read all parent UUIDs
        READ ENTITIES OF ZI_FE_Travel_###### IN LOCAL MODE
        ENTITY Booking BY \_Travel
            FIELDS ( TravelUUID  )
            WITH CORRESPONDING #(  keys  )
        RESULT DATA(travels).
    
        " Trigger Re-Calculation on Root Node
        MODIFY ENTITIES OF ZI_FE_Travel_###### IN LOCAL MODE
        ENTITY Travel
            EXECUTE reCalcTotalPrice
            FROM CORRESPONDING  #( travels ).
    ENDMETHOD. 

    The backend implementations is finished.

    Choose Save and Activate.

  • (OPTIONAL) Switch again to the SAP Business Application Studio and the Configure Side Effects Guide. Configure the property FlightPrice via navigation property Booking as a source and the property TotalPrice remains as a target for the new side effect.

    Change the side effect qualifier name as this will be an additional side effect.

    Add Side Effect Source Options
    Add Side Effect Source Options

    Choose Insert Snippet for source and then in step 2 insert corresponding snippet for TotalPrice as target.

    The resulting annotations.xml file opens with newly added source and target annotations for your second side effect.

    Annotations result in the file
    Annotations result in the file

  • (OPTIONAL) Refresh the application and choose Edit on object page to start changing data of the draft.

    Now change the amount of Flight Price and step out of the field. The side effect is triggered and the Total Price is recalculated.

    Check and insert Code Snippet
    Check and insert Code Snippet


  • Over the past four tutorials, you have used the SAP ABAP RESTful Application Programming Model, SAP Fiori tools and SAP Fiori elements for OData V4 to build this application. You have learned how to:

    All of these tools (and more) can be used with any of the available SAP Fiori elements page types. Enjoy your future projects!


    Resources

    Discussion

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

    Submit detailed feedback Discuss in Community
    Steps
    Step 1 of 10
    1. Add title and subtitle to object page header 2. Add data points to object page header 3. Add new section with title 4. Add 2 field groups to section 5. Show Bookings Table in new section 6. Add airline pictures in Bookings table 7. Activate flexible column layout 8. Activate initial loading of data 9. Update the metadata in your frontend application 10. Add side effects using guided development

    Learn more →