Ansicht
Dokumentation

ABENBDL_ENTITY_PROJ_EXT_1_ABEXA - BDL ENTITY PROJ EXT 1 ABEXA

ABENBDL_ENTITY_PROJ_EXT_1_ABEXA - BDL ENTITY PROJ EXT 1 ABEXA

rdisp/max_wprun_time - Maximum work process run time   PERFORM Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

- BDEF Projection Extension, Field Extension

This example demonstrates how extension fields are added and behavior-enabled in a projection BDEF extension scenario.

Original RAP BO

DDIC data model

The DDIC data model consists of one database table: DEMO_ROOT_EXT:

This database table includes structure DEMO_EXTENSION.

CDS data model

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

Behavior definition

The CDS behavior definition DEMO_RAP_FIELD_EXT is defined in CDS BDL as shown below. It defines global authorization control and adds field attributes to several fields.

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_FIELD_EXT, see BP_DEMO_RAP_FIELD_EXT=========CCIMP. This global class implements two methods:

  • get_instance_features: Implements dynamic feature control for field DataField: If field CharField has value A, then field DataField is read-only. If field CharField has any other value, then field DataField can be accessed without any restrictions.
  • get_global_auth: Defines global feature control for the complete RAP BO: Update requests are generally authorized and delete requests are generally unauthorized.

Extension RAP BO

DDIC data model extension

Extension fields are added to the DDIC data model via the structure extension DEMO_EXTEND_STR:

CDS data model extension

The extension fields are added to the CDS data model via the CDS view entity extension DEMO_EXTENSION_RAP_BO:

BDEF extension

The BDEF extension DEMO_EXTENSION_RAP_BO adds field attributes to the extension fields.

ABP extension

The ABP extension is implemented in the global class BP_DEMO_EXTENSION_RAP_BO, see BP_DEMO_EXTENSION_RAP_BO======CCIMP. This global class implements dynamic feature control for the extension field NumFieldExt: If the value of field IntFieldExt is greater than 1000, then field NumFieldExt is read-only. If the value of field IntFieldExt is equal to or smaller than 1000,access to field NumFieldExt is unrestricted.

Projection Layer

Data model projection

The projection view DEMO_RAP_PROJ_EXT_FIELD projects the root node:

View entity extension

The CDS view entity extension DEMO_RAP_PV_EX extends the original CDS projection view. It includes the extension fields in the projection layer.

Behavior projection

The CDS projection behavior definition DEMO_RAP_PROJ_EXT_FIELD projects the original BDEF.

BDEF projection extension

The BDEF projection extension DEMO_RAP_PROJ_BDEF_EXT extends the projection behavior definition. Its adds field attributes to the extension fields.

Source Code

Execute

Description

Access with ABAP using EML

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

Field attributes from the original BO, from the projection BO, and from the extensions are considered. Fields declared as read-only on any layer must not be updated. CharFieldExt is not available in the derived types, since it has been suppressed.






ABAP Short Reference   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.

Length: 6461 Date: 20240511 Time: 213826     sap01-206 ( 64 ms )