Ansicht
Dokumentation

ABENBDL_DET_ACTION_EXT_ABEXA - BDL DET ACTION EXT ABEXA

ABENBDL_DET_ACTION_EXT_ABEXA - BDL DET ACTION EXT ABEXA

BAL Application Log Documentation   Vendor Master (General Section)  
This documentation is copyright by SAP AG.
SAP E-Book

- Extend Determine Action

This example demonstrates how a determine action is extended via a BDEF extension.

Data model

The CDS data model consists of the root entity DEMO_RAP_EXTENSIBILITY_DET_ACT and its child entity DEMO_RAP_EXT_DET_ACT_CHILD.

Root entity:

Child entity:

Behavior definition

The CDS behavior definition DEMO_RAP_EXTENSIBILITY_DET_ACT is defined in CDS BDL as shown below. It defines the determine action trigger_all, which triggers two determinations. The behavior definition is extensible and explicitly allows extensions to the determine action trigger_all.

Behavior extension

The BDEF extension DEMO_RAP_DET_ACT_EXT extends the determine action trigger_all by adding a new determination on save.

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_EXTENSIBILITY_DET_, see BP_DEMO_RAP_EXTENSIBILITY_DET_CCIMP. This global class implements three methods:

  • get_instance_authorizations: Checks the value of field CompanyCode. If the company code is ABCD, update requests are not allowed. If the company code has any other value, updates are allowed.
  • setID: determination on save that inserts a randomly generated integer into field SalesOrderId.
  • TotalPrice: determination on save that multiplies the number of sales order items with the price and adds the result of all categories, thus calculating the total price of all items of a sales order.

For the CDS extension behavior definition, one ABAP behavior pool (ABP) is created. The global class of the behavior pool is BP_DEMO_RAP_DET_ACT_EXT, see BP_DEMO_RAP_DET_ACT_EXT=======CCIMP. This global class implements the determination setStatustoNew. When called, this determination inserts value O (meaning open), into the field Status.

This is a simple example that serves demonstration purposes.

Source Code

Execute

Description

Access with ABAP using EML

The above source code uses and ABAP EML to access the RAP business object from an ABAP program:

  • It inserts two parent instances and two child instances directly into the database tables using INSERT. This is done to avoid triggering the determinations (all three of them are triggered by EML MODIFY ENTITIES CREATE).
  • It executes the determine action trigger_all.
  • Using the SELECT statement, the content of the parent table before and after executing the determine action is displayed. The fields SalesOrderId, AmountSum, and Status have values that were inserted via the determinations.

The RAP framework executes the implementations in the original and extension ABAP behavior pools in the following order:

  • get_instance_authorizations: Checks whether the operation on the root node is authorized.
  • setID, a determination from the root node of the original BDEF.
  • setStatustoNew, a determination from the root node extension.
  • get_instance_authorizations: Checks whether the operation on the child node is authorized.
  • TotalPrice, a determination from the child node of the original BDEF.





ROGBILLS - Synchronize billing plans   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.

Length: 6420 Date: 20240512 Time: 060859     sap01-206 ( 71 ms )