Ansicht
Dokumentation

ABENDERIVED_TYPES_ISDRAFT_ABEXA - DERIVED TYPES ISDRAFT ABEXA

ABENDERIVED_TYPES_ISDRAFT_ABEXA - DERIVED TYPES ISDRAFT ABEXA

CL_GUI_FRONTEND_SERVICES - Frontend Services   PERFORM Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

Using %is_draft

This example demonstrates the use of the draft indicator %is_draft with an unmanaged RAP BO in a draft scenario.

Data model

The CDS data model consists of the root entity DEMO_UNMANAGED_ROOT_DRAFT and its child entity DEMO_UNMANAGED_CHILD_DRAFT. The child entity is not used in the example.

Root entity:

Behavior definition

The CDS behavior definition DEMO_UNMANAGED_ROOT_DRAFT is defined in CDS BDL as follows:

Behavior implementation

For the above CDS behavior definition, one ABP is created. The global class of the behavior pool is BP_DEMO_UNMANAGED_ROOT_DRAFT. The actual behavior implementation takes place in local classes that are defined and implemented in the BP_DEMO_UNMANAGED_ROOT_DRAFT==CCIMP of the behavior pool. See a detailed description of the RAP handler methods in this topic: Example for RAP Handler Methods.

Source Code

Execute

Description

Access with ABAP using EML

There are two modify requests that cover RAP modify operations:

  1. The first modify request covers a create operation to create new RAP BO instances and an update operation on those newly created instances. In this case, the RAP operations are executed on active instances since the draft indicator %is_draft is disabled for all instances. For demonstration purposes, the instances in the update operation are referred to using %tky. Within %tky, the key is referred in different ways just to visualize the component groups. All options have the same effect and refer to the same. With a COMMIT ENTITIES statement, the instances are saved to the database. The output shows the database table entries as well as the mapped responses for the root entity to visualize the mapping of %cid and the keys, including the draft indicator.
  2. The second modify request covers the creation of draft instances. In this case, the draft indicator %is_draft is enabled for all instances. With a COMMIT ENTITIES statement, the draft instances are saved to the draft table. The draft action activate which is followed by a COMMIT ENTITIES statement that finally saves the instances to the database table. The output shows the following:
  • Mapped responses after the RAP create operation and after the execution of the activate action, but before committing. It shows the change of the draft indicator, i. e. it is changed from disabled to enabled.

  • Tables are displayed that demonstrate the effect on the draft and database tables. The first two tables show the state of the draft and database table before the activation, i. e. new draft instances are created and, thus, available in the draft table. The data fields are changed due to the implementations in the ABAP behavior pool. At this stage, there have not been any changes to the database table. The next two tables show the state of the draft and database tables after the activation. The database table now includes the former draft instances that have been persisted to the database. The draft table is empty.






CL_GUI_FRONTEND_SERVICES - Frontend Services   SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up  
This documentation is copyright by SAP AG.

Length: 4888 Date: 20240512 Time: 030157     sap01-206 ( 72 ms )