ABAP Keyword Documentation → ABAP − Reference → ABAP RESTful Programming Model → Behavior Definitions → ABAP BDL → ABAP BDL - DEFINE BEHAVIOR
ABAP BDL - DEFINE BEHAVIOR, lock
Other versions:
7.31 | 7.40 | 7.54
Syntax
... lock master|dependent ( LocalField = MasterField )
Effect
A behavior definition can specify the following for an entity:
- The entity supports direct locks (by specifying the entity property lock master) or
- the entity is dependent on the lock status of a parent entity or root entity (by specifying the entity property lock dependent).
A foreign key relationship must be defined for any lock dependencies. This relationship describes which field in the child entity references which field in the parent entity, expressed using LocalField = MasterField in BDL syntax.
Remarks
- The ABAP RESTful Programming Model supports lock master for root nodes of the business object only.
- The lock property is only relevant for those entities that provide change operations (such as update).
Example
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 CDS view /DMO/I_Travel represents the root node of the business object for managing flight trips. The underlying business model is described in ABAP BDL - Example.
The following example shows the behavior definition for the root entity Travel.
define behavior for /DMO/I_Travel alias Travel
lock master
{
create;
update;
delete;
action set_status_booked result [1] $self;
}