Ansicht
Dokumentation

ABENBDL_ACTION3_ABEXA - BDL ACTION3 ABEXA

ABENBDL_ACTION3_ABEXA - BDL ACTION3 ABEXA

CL_GUI_FRONTEND_SERVICES - Frontend Services   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.
SAP E-Book

- Factory Action

This example demonstrates how factory actions are defined, implemented, and consumed in a managed RAP BO.

Data model

The CDS data model consists of a single root entity DEMO_RAP_FACTORY_ACTION:

Behavior definition

The CDS behavior definition DEMO_RAP_FACTORY_ACTION is defined in CDS BDL as follows:

Action definition

Two factory actions are defined:

  • The instance factory action copy_instance copies all values of the requested entity instance and assigns a new key value.
  • The static factory action new_instance creates new entity instances with default values.

Behavior implementation

For the above CDS behavior definition, one ABAP behavior pool (ABP) is created. The global class of the behavior pool is BP_DEMO_RAP_FACTORY_ACTION. This global class implements the local handler class LHC_DEMO_RAP_FACTORY_ACTION, which contains two methods, copy_instance and new_instance, to implement the factory actions. The actual implementation takes place in the BP_DEMO_RAP_FACTORY_ACTION====CCIMP:

copy_instance:

new_instance:

Source Code

Execute

Description

Access with ABAP using EML

The above source code uses EML to access the RAP business object from an ABAP program:

  • Two BO entity instances are created with the statement MODIFY ENTITY.
  • The action copy_instance is executed on one of the two instances with the statement EXECUTE and the changes that were performed by the action in the transactional buffer are committed to the database with the statement COMMIT ENTITIES.
  • The action new_instance is executed with the statement EXECUTE and the changes that were performed by the action in the transactional buffer are committed to the database with the statement COMMIT ENTITIES.
  • A SELECT statement is used to read the changed data from the persistent table DEMO_DBTAB_ROOT. As a result, two new entity instances are created: one is a duplicate of the entity instance with key value '1', but is has a new key value. One is created with default values.





RFUMSV00 - Advance Return for Tax on Sales/Purchases   ABAP Short Reference  
This documentation is copyright by SAP AG.

Length: 3705 Date: 20240511 Time: 224142     sap01-206 ( 57 ms )