Ansicht
Dokumentation
ABENBDL_DRAFT_ACTION - BDL DRAFT ACTION
SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up Fill RESBD Structure from EBP Component StructureThis documentation is copyright by SAP AG.
- draft action
$[internal$] draft action
${$[($[authorization:none$]$[,
features: instance$])$]
$[Edit $[with additional implementation$];$]$}
$| $[Activate $[with additional implementation$];$]
$| $[Discard $[with additional implementation$];$]
$| $[Resume $[with additional implementation$];$]
$| $[draft determine action Prepare $[extensible$]
{
determination $[(always)$] DetName;
validation $[(always)$] ValName;
...
}$]
Variants:
1. ... draft action Edit;
2. ... draft action Activate;
3. ... draft action Discard;
4. ... draft action Resume;
5. ... draft determine action Prepare;
Additions
1. ... with additional implementation
Effect
Draft actions are available only for draft-enabled RAP BOs and they allow data to be manipulated on the RAP draft table. Draft actions are implicitly available for business objects as soon as RAP draft handling is enabled for a business object. It is recommended, but not mandatory, that the draft actions are defined explicitly in the behavior definition.
Draft actions can only be specified for lock master entities that are defined using the keyword lock master, as they always refer to the whole lockable subtree of a business object.
Draft actions are provided by the RAP managed draft provider. An implementation in the ABAP behavior pool is required only in the following cases:
- If the draft action Edit is specified with instance feature control, then an implementation for instance feature control is required. Per default, the draft action Edit is implicitly enabled with feature control and an implementation is required. To avoid this, Edit must be explicitly specified without feature control.
- If the optional addition with additional implementation is specified, the action must be implemented in the RAP handler method FOR MODIFY in the ABAP behavior pool.
In a projection BDEF that reuses RAP draft handling, the draft actions are reused implicitly. It is recommended that they are specified explicitly. In BDEF strict mode, it is mandatory to specify all draft actions in a draft-enabled projection BDEF. For details on reuse, see topic CDS BDL - use, projection BDEF.
The following CDS BDL operation additions are possible:
- internal: Available for all draft actions.
- (features:instance): Dynamic feature control is available only for Edit. For Edit, it is per default implicitly enabled.
- authorization:none: Available only for Edit.
Development guide for the ABAP RESTful Application Programming Model, topic Draft Actions.
Notes
- If BDEF strict mode is enabled, it is mandatory that all draft actions are explicitly defined in the CDS behavior definition.
- In draft-enabled scenarios, the names of the draft actions are reserved for the draft actions. Entities
that are not draft-enabled can use the names Edit, Activate, and so on, as names for
actions. But when addition
with draft; is used to draft-enable a business object, the names of draft actions are forbidden as names for actions.
Example - Managed, Edit, Discard, Prepare
The following example shows a managed BDEF based on the CDS root view entity DEMO_RAP_MANAGED_DRAFT_ACTIONS. The BDEF is draft-enabled and strict mode is switched on. Therefore, it is mandatory to explicitly declare all draft actions.
The program DEMO_RAP_MANAGED_DRAFT_ACTIONS accesses the business object using EML and carries out the following actions:
- It creates two active entity instances using the EML statement MODIFY ENTITY and commits them to the active database.
- It executes the draft action Edit for the two active instances. No changes are made, the only effect of the draft action Edit in this example is that the active instances are copied to the draft database table.
- The draft action Prepare is executed for the two draft instances that were copied from the persistent table to the draft table during the Edit. The assigned determination setCharField is executed and it inserts a value into field CharFieldRoot.
- The draft action Discard is executed. It deletes both instances from the draft database table.
The example above is explained in detail in the executable example CDS BDL - draft actions Edit, Discard, Prepare.
Another executable example for the draft action Activate can be found under
CDS BDL - draft action Activate.
Variant 1
... draft action Edit
Effect
The draft action Edit copies an active instance to the draft database table. Feature and
authorization
control is available for Edit, which
can optionally be defined to restrict the usage of the action. The optional addition with additional implementation is available.
Variant 2
... draft action Activate
Effect
The draft action Activate copies the content of the draft database table to the
persistent
database table and clears the draft database table. It includes all changes that were done on the
draft application buffer. The optional addition with additional implementation is available.
Variant 3
... draft action Discard
Effect
The draft action Discard clears all entries
from the draft database table. The optional addition with additional implementation is available.
Variant 4
... draft action Resume
Effect
The draft action Resume sets a lock for an entity instance on the persistent database table. It is executed automatically whenever there is a modification on a draft instance whose exclusive lock has expired.
In case of a new draft instances, the same feature and authorization control is executed as defined for the standard operation create. In case of draft instances that are already saved in the active database table, the same feature and authorization control is executed as defined for the draft action Edit.
The optional addition with additional implementation is available.
Variant 5
... draft determine action Prepare
Effect
The draft determine action Prepare is the draft-equivalent to the determine actions for active instances and the rules described in the topic about determine actions apply to Prepare as well. That means:
- Only validations and determinations defined as on save can be assigned.
- The optional addition (always) can be used.
- Determinations and validations of child entities can be included.
- Available for managed scenarios and for unmanaged and draft-enabled scenarios.
- The optional addition extensible allows a RAP BO consumer to add own validations or determinations to the draft determine action in question via a BDEF extension. For further details on extensibility enabling, see topic Extensibility Enabling.
Like all other draft actions, it is implicitly enabled as soon as the business object is draft enabled, but in this case, no determinations and validations are assigned to it. The assignment of determinations and validations must be done explicitly in the BDEF. Only determinations and validations that are defined and implemented for the BO can be used.
The purpose of the draft determine action Prepare is to validate draft data before the transition to active data.
Addition 1
... with additional implementation
Effect
The optional addition with additional implementation
is available for Edit,
Activate, Discard, and
Resume. If it is specified, an implementation for the respective draft action in the
RAP handler method FOR MODIFY in the local ABAP behavior pool is required.
BAL_S_LOG - Application Log: Log header data BAL Application Log Documentation
This documentation is copyright by SAP AG.
Length: 17732 Date: 20240423 Time: 130905 sap01-206 ( 178 ms )