SAP EML MODIFY OP ABEXA



Get Example source ABAP code based on a different SAP table
  



ABAP_EML - MODIFY, Standard Operations (Managed)
This example demonstrates various standard operations to manipulate a simple managed RAP BO. It also includes the use of READ statements.
Data model
The CDS data model consists of the root entity DEMO_MANAGED_ROOT and its child entity DEMO_MANAGED_CHILD.
Root entity:
DDLS DEMO_MANAGED_ROOT
Child entity:
DDLS DEMO_MANAGED_CHILD
Behavior definition
The RAP behavior definition DEMO_MANAGED_ROOT is defined in RAP BDL as follows:
BDEF DEMO_MANAGED_ROOT
Behavior implementation
For the above RAP behavior definition, there is no ABAP behavior pool (ABP) created and needed since only standard CRUD operations are used in the example.

ABAP_SOURCE_CODE
DEMO CL_DEMO_RAP_EML_MODIFY_OP_2

ABAP_DESCRIPTION
Access with ABAP using EML
The above source code uses EML to access the RAP business object from an ABAP class:
Modify operations with CREATE and CREATE BY Three MODIFY ENTITY operations are executed to create data sets for the root entity using the CREATE statement as well as data sets for associations defined in the BDEF using CREATE BY. One associated entity is part of the composition tree, the other is not (cross-BO entity).
Modify operation with UPDATE Data sets of the root entity are updated.
Modify operation with DELETE Data sets of the root entity are deleted.
Read operation with READ and READ BY Data sets are read from the root and child entities.
For demonstration purposes, several internal tables with the required BDEF derived type are created to be used with the modify operations. They include demo values to be shown in the output. The RAP framework reads the data from the respective database tables into a managed transactional buffer in which the operations take place. The changes are saved with the statement COMMIT ENTITIES, and, thus, the changed data are persisted to the database tables.