ABAP Addition 1 ... with additional implementation>
What does it do? 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 TITLE >. The following RAP 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>.
ABAP_FURTHER_INFO Development guide for the ABAP RESTful Application Programming Model, topic Draft Actions>.
Latest notes:
If BDEF strict mode> is enabled, it is mandatory that all draft actions are explicitly defined in the RAP 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 the addition with draft;> is used to draft-enable a business object, the names of draft actions are forbidden as names for actions. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 - 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. BDEF DEMO_RAP_MANAGED_DRAFT_ACTIONS The class CL_DEMO_RAP_MNGD_DRAFT_ACTNS> > 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. ABAP_EXAMPLE_END
ABAP_EXAMPLE_ABEXA The example above is explained in detail in the executable example RAP BDL - draft actions Edit>, Discard>, Prepare>>. Another executable example for the draft action Activate> can be found under RAP BDL - draft action Activate>. ABAP_EXAMPLE_END
ABAP_VARIANT_1 ... draft action Edit>
What does it do? 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.
ABAP_VARIANT_2 ... draft action Activate>
What does it do? 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.
ABAP_VARIANT_3 ... draft action Discard>
What does it do? The draft action Discard> clears all entries from the draft database table. The optional addition with additional implementation > is available.
ABAP_VARIANT_4 ... draft action Resume>
What does it do? 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.
What does it do? 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 validations and determinations to be added to the draft determine action Prepare> in question by means of BDEF extensions>. For further details on extensibility enabling, see topic TITLE >. 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.
ABAP Addition
What does it do? 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.