Enhance the Business Object Behavior With Instance Action
- How to define actions
- How to implement actions
- How to preview and test enhanced travel app
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) 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.
In the previous exercise, you’ve defined and implemented two validations.
In the present exercise, you will learn how to add different instance-bound actions (aka instance actions) to your application: instance non-factory actions w/o input parameters, instance non-factory action with input parameters, and instance-bound factory actions. For simplification reasons, _non-factory actions_ will be called _actions_ in the exercise description.
Please note: The purpose of the different exercises is to show you how to implement the different instance action types - and less on having the perfect business scenario.
Reminder: Do not forget to replace the suffix placeholder ### with your chosen or assigned group ID in the exercise steps below.
About: Actions
In the RAP context, an action is a non-standard operation that change the data of a BO instance. They are self-implemented operations.
Two main categories of actions can be implemented in RAP:
Non-factory actions: Defines a RAP action which offers non-standard behavior. The custom logic must be implemented in the RAP handler method
FOR MODIFY. An action per default relates to a RAP BO entity instance and changes the state of the instance. An action is related to an instance by default. If the optional keywordstaticis used, the action is defined as static action. Static actions are not bound to any instance of a RAP BO entity but relate to the complete entity.Factory actions: Factory actions are used to create RAP BO entity instances. Factory actions can be instance-bound (default) or static. Instance-bound factory actions can copy specific values of an instance. Static factory actions can be used to create instances with
prefilleddefault values.Further reading: Actions | CDS BDL - non-standard operations | Implicit Response Parameters | ABAP EML -
response_param
















