SAP BDL DRAFT ACTION1 ABEXA



Get Example source ABAP code based on a different SAP table
  



ABAP_RAP - Draft Action Activate
This example demonstrates how the draft action Activate is defined, implemented, and consumed in a managed RAP BO.
Data model
The CDS data model consists of the root entity DEMO_RAP_MANAGED_DRAFT_1.
Root entity:
DDLS DEMO_RAP_MANAGED_DRAFT_1
Behavior definition
The RAP behavior definition DEMO_RAP_MANAGED_DRAFT_1 is defined in RAP BDL as shown below. It has all mandatory syntax elements required for a draft scenario:
with draft; is defined in the RAP behavior definition header.
The draft table DEMO_DBTAB_DRAFT is defined.
The total ETag field Time stamp is defined in the correct position, namely directly after the lock master
The draft action Edit is defined explicitly ABAP_NOTE If the draft action Edit is enabled implicitly, then it automatically comes with instance feature control and an implementation in the ABAP behavior pool is required. In this example, it is enabled explicitly without feature control, so that it can be handled by the managed RAP BO provider.
The draft is completely handled by the RAP framework; no implementation in the ABAP behavior pool is required.
ABAP_NOTE This example does not fully meet the requirements of the RAP BO contract. It is intentionally kept short and simple and serves demonstration purposes only. See more information on the RAP BO contract in the Development guide for the ABAP RESTful Application Programming Model.
BDEF DEMO_RAP_MANAGED_DRAFT_1

ABAP_SOURCE_CODE
DEMO CL_DEMO_RAP_MANAGED_ACTIVATE

ABAP_DESCRIPTION
Access with ABAP using EML
The above source code uses EML to access the RAP business object from an ABAP class:
Two draft instances are created with the statement MODIFY ENTITY .
The draft action Activate is executed on both instances with the statement EXECUTE.
Using the AB-SQL SELECT statement, the content of the draft and persistent table before and after activation is displayed. Before the activation, the draft table contains the two new draft instances. After the activation, the instances are copied to the persistent table and the content from the draft table is cleared.