CLASS class_name DEFINITION PUBLIC
FOR BEHAVIOR OF CDS_entity_behavior.
CLASS class_name IMPLEMENTATION.
The behavior definition CDS_entity_behavior specifies the behavior of the business object. ABAP Compiler derives both the operations to implement and the structure types and table types used from behavior definitions. The behavior pool depends on the behavior definition: Changes to the behavior definition lead to its regeneration.
Any number of behavior pools can be assigned to a behavior definition (1:n relation) This way, applications can structure their implementations in multiple units.
The behavior pool can have static methods, CLASS-DATA, CONSTANTS and TYPES.
The actual substance of a behavior pool is located in the local classes. Two types of special local classes can be defined:
- one or more handler classes to implement the interaction phase of the business object behavior
- and a saver class to implement the save phase of the business object behavior.
The behavior pool is not instantiated or inherited.
In the following example, the data from the ABAP flight data reference scenario (or flight data scenario for short) is used. It represents a legacy business logic that can be used to create and edit flight bookings. The root entity Travel represents the business object for managing flight trips. The underlying data model and the behavior of the root entity Travel are described in ABAP BDL - Example.
The following example shows the global class of the behavior implementation of the business object.
FOR BEHAVIOR OF travel.
CLASS zcl_travel IMPLEMENTATION.