Get Example source ABAP code based on a different SAP table
Checking RAP Transactional Phases This example demonstrates the use of the methods GET_CURRENT_PHASE > and GET_CURRENT_HANDLER_KIND> of the class CL_ABAP_BEHV_AUX>>. Data model> The CDS data model consists of the root entity DEMO_UMANAGED_ROOT_LATE_NUM2>. Root entity: DDLS DEMO_UMANAGED_ROOT_LATE_NUM2 Behavior definition> The RAP behavior definition> DEMO_UMANAGED_ROOT_LATE_NUM2>> is defined in RAP BDL> as follows: BDEF DEMO_UMANAGED_ROOT_LATE_NUM2 Behavior implementation> For the above RAP behavior definition, one ABP> is created. The global class of the behavior pool is BP_DEMO_UMANAGED_ROOT_LATE_NU2>>. The actual behavior implementation takes place in local classes that are defined and implemented in the BP_DEMO_UMANAGED_ROOT_LATE_NU2CCIMP>> of the behavior pool.
ABAP_DESCRIPTION Access with ABAP using EML> The above source code uses EML> to access the RAP business object from an ABAP class. The example contains four RAP create operations using an ABAP_EML MODIFY> statement:
Two RAP create operations fail. One operation intentionally fails in the finalize>> RAP saver method>. Another operations fails in the check_before_save>> method.
Two RAP create operations are successful.
The example is implemented in a way that in the RAP handler and saver methods a log table is filled. The log table includes, among others, information about the current RAP transactional phase (retrieved using CL_ABAP_BEHV_AUX=>GET_CURRENT_PHASE>) and the current handler kind (retrieved using CL_ABAP_BEHV_AUX=>GET_CURRENT_HANDLER_KIND>).
The log table and the database table entries as result of the RAP create operations are displayed.
The log table for the failed instances shows that the RAP late save phase> is not reached, but only the RAP interaction phase> and the RAP early save phase>. The RAP transaction is concluded with the RAP cleanup phase> demonstrated by the successful RAP create operations.