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 the Business Object Behavior With Determinations

Enhance the business object behavior using determination with SAP BTP ABAP environment.

Overview

🎓 beginner 15 min. SAP BTP ABAP EnvironmentBeginnerABAP DevelopmentSAP Business Technology Platform

You will learn

  • How to define determinations
  • How to implement determinations
  • How to preview and test enhanced travel app In the previous exercise, you’ve defined and implemented the early numbering for assigning automatically an identifier (ID) for a new instance of the BO entity Travel. In the present exercise, you will define and implement a determination, setStatusToOpen, which will be used to set a default value for the overall status of a Travel entity instance. You will use the Entity Manipulation Language (EML) to implement the transactional behavior of the Travel business object.
Merve Temel M Merve Temel April 17, 2024
Created by March 9, 2023
Contributors

Prerequisites

Prerequisites

  • You need to have access to an SAP BTP, ABAP environment, or SAP S/4HANA Cloud, ABAP environment or SAP S/4HANA (release 2022 or higher) system. For example, you can create free trial user on SAP BTP, ABAP environment.
  • You have downloaded and installed the [latest ABAP Development Tools (ADT)] (https://tools.hana.ondemand.com/#abap) on the latest Eclipse© platform.
  • You have created an ABAP Cloud Project.
  • Make sure, your system has the ABAP flight reference scenario. If your system hasn’t this scenario. You can download it here. The trial systems have the flight scenario included.

Steps

Intro

Reminder: Do not forget to replace the suffix placeholder ### with your chosen or assigned group ID in the exercise steps below.

About: Determinations

A determination is an optional part of the business object behavior that modifies instances of business objects based on trigger conditions. A determination is implicitly invoked by the RAP framework if the trigger condition of the determination is fulfilled. Trigger conditions can be modify operations and modified fields.

Further reading: Determinations

About: Entity Manipulation Language (EML)

The Entity Manipulation Language (EML) is an extension of the ABAP language which offers an API-based access to RAP business objects. EML is used to implement the transactional behavior of RAP business objects and also access existing RAP business objects from outside the RAP context.

PS: Some EML statements can be used in the so-called local mode - by using the addition IN LOCAL MODE - to exclude feature controls and authorization checks. This addition can currently only be used in RAP business object implementations for the particular RAP business object itself, i. e. not for other RAP business objects.

The EML reference documentation is provided in the ABAP Keyword Documentation.
You can use the classic F1 Help to get detailed information on each statement by pressing F1 in the ABAP editors.

Further reading: ABAP for RAP Business Objects

Step 1 Define determination setStatusToOpen

Define the determination setStatusToOpen in the behavior definition of the Travel entity. This determination will be used to set the default value of the field OverallStatus to open (O) at the creation time new Travel instances.

  1. Go to the behavior definition of the Travel BO entity

    bdef icon
    bdef icon
    ZRAP100_R_TravelTP_### and insert the following statement after the statement delete; as shown on the screenshot below:

  2. Add following code:

    ABAP
    determination setStatusToOpen on modify { create; }

    Travel BO Definition
    Travel BO Definition

    Short explanation:
    The statement specifies the name of the new determination, setStatusToOpen and on modify as the determination time when creating new travel instance ({ create }).

  3. Save

    save icon
    save icon
    and activate
    activate icon
    activate icon
    the changes.

  4. Now, declare the required method in behavior implementation class with ADT Quick Fix.

    Set the cursor on the determination name setStatusToOpen and press Ctrl+1 to open the Quick Assist view and select the entry Add method for determination setStatusToOpen of entity zrap100_i_travel_### in the view.

    As result, the FOR DETERMINE method setStatusToOpen will be added to the local handler class lcl_travel of the behavior pool of the Travel BO entity

    class icon
    class icon
    ZRAP100_BP_TRAVEL_###.

    Travel BO Behavior Pool
    Travel BO Behavior Pool

  5. Save

    save icon
    save icon
    and activate
    activate icon
    activate icon
    the changes.

You are through with the definition of the determination.

Step 2 Implement determination setStatusToOpen
+
Step 3 Preview and test enhanced travel app
+
Step 4 Test yourself
+

Resources

Discussion

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

Submit detailed feedback Discuss in Community
Steps
Step 1 of 4
1. Define determination setStatusToOpen 2. Implement determination setStatusToOpen 3. Preview and test enhanced travel app 4. Test yourself

Learn more →