
To specify the business object's behavior, the behavior definition of the corresponding development object is used. A business object behavior definition (behavior definition for short) is an ABAP Repository object that describes the behavior of a business object in the context of the ABAP RESTful application programming model. A behavior definition is defined using the Behavior Definition Language (BDL).
A behavior definition always refers to a CDS data model. It relies directly on the CDS root entity. One behavior definition refers exactly to one root entity and one CDS root entity has at most one behavior definition (which also handles all included child entities that are included in the composition tree).

You can create behavior definitions like any other repository object, that is, using the context menu in the project explorer, starting from the package or from its Core Data Services subnode.
However, it is easier to open the context menu on the data definition of the root view of the business object and choose New Behavior Definition. In this way, the Root Entity field is prefilled by the development tool.

When creating a behavior definition, you cannot specify a name for the new repository object directly. Instead, the name of the behavior definition is derived from the name of the CDS View that is used to define the root entity of the business object. For this reason, you must specify the CDS root view at this early stage.
You must also specify the implementation type of the business object. The possible values depend on the nature of the related CDS view. For data definition views, you can choose between Managed and Unmanaged. In behavior definitions for projection views, only the Projection implementation type is supported.

The template for a behavior definition includes the implementation type of the business object and the behavior definition for the chosen root entity.
It also contains the strict( 2); statement which affects the strictness of the syntax check. It is possible but not recommended to remove the strict( 2 ) statement or replace it with the strict; statement to slacken the syntax checks. This should only be done in code that has to be compatible with older releases.
Caution
If the implementation type is managed, an additional persistent table is required for each entity of the BO to allow write access to the related database table. The template already contains this statement. The persistent table is derived from the definition of the CDS view entity.
For the managed implementation type, it is also mandatory to set a lock type and an authorization type for each entity. The root entity is always used as lock master and authorization master.
The standard operations (create, update, delete) are part of the template for behavior definitions. They are not mandatory and can be commented or removed if not required.
The template also inserts a field ( readonly ) statement for all key fields of the view. To prevent changes to the primary key.
Note









