Ansicht
Dokumentation
ABAPCLASS_FOR_BEHAVIOR_OF - CLASS FOR BEHAVIOR OF
TXBHW - Original Tax Base Amount in Local Currency ABAP Short ReferenceThis documentation is copyright by SAP AG.
CLASS, FOR BEHAVIOR OF
CLASS class DEFINITION
PUBLIC $[ABSTRACT$] $[FINAL$]
FOR BEHAVIOR OF bdef.
...
ENDCLASS.
Effect
The addition FOR BEHAVIOR OF to the definition of a global class defines an ABAP behavior pool (ABP) for the CDS behavior definition (BDEF) specified in bdef. The name of the global class (class) of an ABAP behavior pool usually starts with the prefix BP_. The global class must be defined as ABSTRACT and FINAL. It can have static methods, CLASS-DATA, CONSTANTS and TYPES.
If a BDEF defines operations with self-defined logic, such as nonstandard operations, determinations or validations, an implementation of those operations is required in one or more behavior pools. Any number of behavior pools can be assigned to a BDEF allowing applications a structuring into multiple units (see the topic CDS BDL - implementation grouping).
The actual implementation of the transactional behavior of RAP BOs happens in the CCIMP include of a behavior pool. There, two types of special local classes can be defined: one or more handler classes to implement the RAP interaction phase and a saver class to implement the RAP save sequence of the business object behavior.
Notes
- Currently, global classes of behavior pools cannot be instantiated or inherited.
- ABPs can be unit tested with class CL_ABAP_BEHV_TEST.
Example
The following source code section taken from the global class BP_DEMO_MANAGED_ADDITIONAL_SAV shows a class definition.
CLASS bp_demo_managed_additional_sav DEFINITION PUBLIC
ABSTRACT FINAL FOR BEHAVIOR OF demo_managed_additional_save.
PUBLIC SECTION.
CLASS-DATA: var_req_c TYPE REQUEST
FOR CHANGE demo_managed_additional_save,
var_req_d TYPE REQUEST
FOR DELETE demo_managed_additional_save,
var_tab_c TYPE TABLE
FOR CHANGE demo_managed_additional_save,
var_struc_c TYPE STRUCTURE
FOR CHANGE demo_managed_additional_save.
ENDCLASS.
CLASS bp_demo_managed_additional_sav IMPLEMENTATION.
ENDCLASS.
General Material Data CL_GUI_FRONTEND_SERVICES - Frontend Services
This documentation is copyright by SAP AG.
Length: 5273 Date: 20240426 Time: 223220 sap01-206 ( 55 ms )