Ansicht
Dokumentation
ABENBDL_FIELD_EXT_ABEXA - BDL FIELD EXT ABEXA
rdisp/max_wprun_time - Maximum work process run time ROGBILLS - Synchronize billing plansThis documentation is copyright by SAP AG.
- Field Extension
This example demonstrates how extension fields are added and behavior-enabled in a RAP BO 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.
Source Code
Description
Access with ABAP using EML
The above source code uses ABAP EML to access the RAP business object from an ABAP program:
- It inserts two entity instances using MODIFY ENTITIES CREATE.
- It updates both entity instances using MODIFY ENTITIES UPDATE.
For the entity instance with key value 1, both fields DataField and NumFieldExt are dynamically set to read-only by the field feature control. These two fields are not updated, but error messages are returned.
Execution order for CREATE:
- Global authorization control specified in the original ABP.
Execution order for UPDATE:
- Global authorization control specified in the original ABP.
- Field feature control specified in the original ABP.
- Field feature control specified in the extension ABP.
PERFORM Short Reference rdisp/max_wprun_time - Maximum work process run time
This documentation is copyright by SAP AG.
Length: 5947 Date: 20240511 Time: 151954 sap01-206 ( 60 ms )