Ansicht
Dokumentation

ABENBDL_AUGMENT_ABEXA - BDL AUGMENT ABEXA

ABENBDL_AUGMENT_ABEXA - BDL AUGMENT ABEXA

BAL_S_LOG - Application Log: Log header data   General Data in Customer Master  
This documentation is copyright by SAP AG.
SAP E-Book

- Operation Augmentation

This example demonstrates how to define and implement the operation augmentation in a RAP projection business object.

Base BDEF

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

Projection BDEF

The projection behavior definition is defined as shown below. It reuses the standard operations from the base BDEF and augments the create, update, and create-by-association operations.

Behavior implementation

In the ABAP behavior pool, the operation augmentation is implemented in three methods: augment_create, augment_update, and augment_cba_child.

augment_create implements the following:

  • it augments an original base instance for the operation create. Whenever new instances are created, the value of field CharFieldRoot is set to A.
  • it augments the operation create by adding new instances. Whenever a create operation is performed, the augmentation adds an additional entity instance. The key value for this new entity instance is a random integer.

augment_update augments an original base instance for the operation update. Whenever an existing entity instance is updated, the value of field DecFieldRoot is set to 100.2.

augment_cba_child implements the following:

  • it 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 DataField is set to AAA.
  • it augments the operation create by association by adding new child instances. For each parent instance, an additional child instance with the key value 26 is added.

For the full implementation, see BP_DEMO_RAP_PROJ_AUGMENT======CCIMP

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:

  • It creates two parent entity instances. The operation augmentation automatically adds the value A for field CharFieldRoot for each entity instance. Moreover, it adds a third entity instance with a random integer as key value.
  • It updates one of the entity instances. The operation augmentation automatically adds the value 100.2 for field DecFieldRoot for all updated entity instances.
  • It creates a child entity instance for each parent entity instance via a create-by-association operation. The operation augmentation automatically adds the value AAA for field DataFieldRoot for each newly created child entity instance. Moreover, it adds an additional child entity instance for each parent entity instance with the child entity key 26.





rdisp/max_wprun_time - Maximum work process run time   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Length: 4496 Date: 20240424 Time: 232817     sap01-206 ( 62 ms )