Ansicht
Dokumentation

ABENEML_MODIFY_ALTERNATIVES_ABEXA - EML MODIFY ALTERNATIVES ABEXA

ABENEML_MODIFY_ALTERNATIVES_ABEXA - EML MODIFY ALTERNATIVES ABEXA

CPI1466 during Backup   General Material Data  
This documentation is copyright by SAP AG.
SAP E-Book

- MODIFY, Variants

This example demonstrates the variants of the MODIFY statement to manipulate a simple managed RAP BO:

  • MODIFY ENTITY bdef
  • MODIFY ENTITIES OF bdef
  • MODIFY ENTITIES OPERATIONS op_tab

Data model

The CDS data model consists of the root entity DEMO_MANAGED_ROOT and its child entity DEMO_MANAGED_CHILD. Furthermore, it contains an association to an entity (DEMO_MANAGED_ASSOC) that is not part of the composition tree.

Root entity:

Child entity:

Behavior definition

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

Behavior implementation

For the above CDS behavior definition, there is no ABAP behavior pool (ABP) created and needed since only standard CRUD operations are used in the example.

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:

  • MODIFY ENTITY bdef
Two create operations are executed with the statement MODIFY ENTITY for single entities. The one for the root entity, the other for the child entity. For that purpose, two internal tables with the required BDEF derived type are created. They include demo values to be shown in the output. The RAP query engine reads the data from the respective database tables into a managed transactional buffer in which the create operations take place using the SET FIELDS additions. The changes are saved with the statement COMMIT ENTITIES, and, thus, the changed data are persisted to the database tables.
  • MODIFY ENTITIES OF bdef
Multiple operations are executed on multiple RAP BO entities. In this case, the following is demonstrated: an update and create operation on data sets of the root entity, a create by association operation and an update operation on the child entity directly. The addition SET FIELDS is used while the internal tables are created inline holding demo data.
  • MODIFY ENTITIES OPERATIONS op_tab
The example demonstrates a dynamic modify operation. There are various operations on data sets of the root and child entity. For that purpose, an internal table with type ABP_BEHV_CHANGES_TAB must be defined. This table includes parameters (in this case, among others, other tables holding demo data and being typed with the required BDEF derived type) to carry out the modifications.





ROGBILLS - Synchronize billing plans   CPI1466 during Backup  
This documentation is copyright by SAP AG.

Length: 4296 Date: 20240328 Time: 164905     sap01-206 ( 64 ms )