Ansicht
Dokumentation

ABENEML_MODIFY_AUGMENTING_ABEXA - EML MODIFY AUGMENTING ABEXA

ABENEML_MODIFY_AUGMENTING_ABEXA - EML MODIFY AUGMENTING ABEXA

General Material Data   rdisp/max_wprun_time - Maximum work process run time  
This documentation is copyright by SAP AG.
SAP E-Book

- MODIFY AUGMENTING ENTITY

This example demonstrates the MODIFY statement with the addition AUGMENTING with a RAP projection business object.

Base BDEF

The base BDEF is the managed CDS behavior definition DEMO_MANAGED_ROOT_WAS. It defines the behavior for two entities which are connected via a CDS composition relation.

Projection BDEF

The projection BDEF reuses the standard operations from the base BDEF and augments the create, update, and create-by-association operations.

Behavior implementation

For the above projection BDEF, one behavior pool is created. The global class of the behavior pool is BP_DEMO_MANAGED_ROOT_PROJ. The actual behavior implementation takes place in local classes that are defined and implemented in the BP_DEMO_MANAGED_ROOT_PROJ=====CCIMP of the behavior pool. In the behavior pool, operation augmentation is implemented in the following methods:

  • augment_create
Augments an original base instance for the operation create. Whenever new instances are created, the value of field field1 is set to create_augment.
  • augment_update
Augments an original base instance for the operation update. Whenever an existing entity instance is updated, the value of field field4 is set to 222.
  • augment_cba_child
Augments an original base instance for the operation create by association. Whenever new child instances are created via the parent entity, the value of field field2 is set to cba_augment.

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:

  • Using an MODIFY statement, two parent entity instances are created. In the same request, one of the created instances gets updated. The operation augmentation automatically adds the value create_augment for field field1 for each entity instance. For the updated entity instance, field4 is set to 222.
  • With a further MODIFY statement, a child entity instance for each parent entity instance is created via a create-by-association operation. The operation augmentation automatically adds the value cba_augment for field field2 for each newly created child entity instance.
  • The output window shows the database entries of the root and child entities' tables.





General Data in Customer Master   RFUMSV00 - Advance Return for Tax on Sales/Purchases  
This documentation is copyright by SAP AG.

Length: 4254 Date: 20240418 Time: 113144     sap01-206 ( 58 ms )