Get Example source ABAP code based on a different SAP table
Local Consumption of RAP Business Events This example demonstrates the local consumption of RAP business events> using a managed RAP business object>. Data model> The CDS data model consists of the root entity DEMO_RAP_EVENT_M>. Root entity: DDLS DEMO_RAP_EVENT_M Behavior definition> The RAP behavior definition> DEMO_RAP_EVENT_M>> is defined in RAP BDL> as follows: BDEF DEMO_RAP_EVENT_M Behavior implementation> For the above RAP behavior definition, one ABP> is created. The global class of the behavior pool is BP_DEMO_RAP_EVENT_M>>. The actual behavior implementation takes place in local classes that are defined and implemented in the BP_DEMO_RAP_EVENT_M===========CCIMP>> of the behavior pool. RAP event handler class> The global class of the RAP event handler class is CL_DEMO_RAP_EVENT_HANDLER>>. The events are handled in the CL_DEMO_RAP_EVENT_HANDLER=====CCIMP>>.
ABAP_SOURCE_CODE DEMO CL_DEMO_RAP_EVENTS
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 three ABAP_EML modify requests: a RAP create, update and delete operation. For each of the operations, an event is raised using a RAISE ENTITY EVENT>> statement. The events are raised in the save_modified> > RAP saver method. When the events are raised, the RAP event handler methods>, which are implemented in the CCIMP include of the CL_DEMO_RAP_EVENT_HANDLER>> class, are called asynchroneously. To demonstrate the effect of the events, messages are created and added to the Business Application Log. In the output of the example, the content of an internal table is displayed that demonstrates the effect of the RAP operations. The internal table is filled by selecting from the database table where the RAP BO instances> are persisted to. Additionally, the content of an internal table is displayed including the messages that have been inserted into the Business Application Log by the event handler methods.