Ansicht
Dokumentation

ABENBDL_ENTITY_PROJ_EXT_ABEXA - BDL ENTITY PROJ EXT ABEXA

ABENBDL_ENTITY_PROJ_EXT_ABEXA - BDL ENTITY PROJ EXT ABEXA

ABAP Short Reference   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.
SAP E-Book

- BDEF Projection Extension, Node Extension

This example demonstrates how the behavior of a projection BDEF is extended by means of a projection BDEF extension.

Original RAP BO

Data model

The CDS data model consists of one root node without child entities:

Behavior definition

The CDS behavior definition DEMO_RAP_BEH_EXT is defined in CDS BDL as shown below. It defines implementation-relevant components and extension points.

Behavior implementation

For the CDS behavior definition, one ABAP behavior pool (ABP) is created. The global class of the behavior pool is BP_DEMO_RAP_BEH_EXT, see BP_DEMO_RAP_BEH_EXT===========CCIMP. This global class implements the following methods:

  • get_instance_features: Instance feature control for the standard operation update. If the value of field int_field1 is more than 50, updates are not allowed. If the value is equal to or smaller than 50, updates are allowed.
  • get_global_authorizations: Global authorization control defines that create, update, and delete are always allowed.
  • Limit: Validation that checks the value of field int_field2. If the value is more than 500, the validation fails and the entity instance is not saved.

Extension RAP BO

Data model extension

A child node is added to the RAP BO:

A composition association is added to the root node via a CDS view entity extension:

Behavior extension

The BDEF extension DEMO_RAP_BEH_EXT_CH extends the root node and defines behavior for the extension child node.

ABP extension

The ABP extension is implemented in the global class BP_DEMO_RAP_BEH_EXT_CH, see BP_DEMO_RAP_BEH_EXT_CH========CCIMP. This global class implements the following methods:

  • Extension of the parent entity
  • get_global_features: Global feature control for the action setValue. This action can only be executed in the time period between 6 am and 10 pm (day shift).

  • get_global_authorizations: The original RAP BO defines global authorization control. RAP BO operations added via an extension require an own implementation of the global authorization control. This method generally allows execution of the method setValue. There are no access restrictions.

  • setValue: Action that sets field int_field2 to value 888.

  • Extension entity behavior definition for the child entity
  • get_global_authorizations: The original RAP BO defines global authorization control. For the action ActionExt, defined in the child node, a separate implementation of the authorization control method is required. The implementation generally allows execution of the method ActionExt. There are no access restrictions.

  • myDet: Determination on modify. Sets the value of field int_field1 to 777.

  • ActionExt: Action that updates field char_field1 for all requested entity instances.

Projection Layer

Data model projection

Projection of the root node:

Projection of the child node:

View entity extension DEMO_RAP_VE_EXTENSION that establishes a composition between original root node and extended child node:

Behavior Projection

The projection BDEF defines behavior for the root node. It declares the root node as extensible and exposes the RAP BO standard operations.

BDEF projection extension

The BDEF projection extension DEMO_RAP_PROJ_EXT_BEH_1 extends the root node and defines behavior for the extension child node.

Source Code

Execute

Description

Access with ABAP using EML

The above source code uses ABAP EML to access the projection BO from an ABAP program:

  • It inserts two parent entity instances and two child entity instances.
  • It updates the two parent entity instances
  • It executes the action setValue from the projection extension.
  • It executes the action ActionExt from the extension to the original RAP BO.

The screen output includes a table that lists the execution order of handler methods of the ABAP behavior pool. This shows which methods in which order are executed when accessing the RAP BO.






CPI1466 during Backup   BAL Application Log Documentation  
This documentation is copyright by SAP AG.

Length: 7531 Date: 20240511 Time: 151203     sap01-206 ( 70 ms )