Get Example source ABAP code based on a different SAP table
ABAP_EML - Responses (Dynamic Forms of ABAP_EML Statements) This example demonstrates responses for the dynamic form of the ABAP_EML MODIFY> and READ> statements with a simple managed RAP BO>. Data model> The CDS data model consists of the root entity DEMO_MANAGED_ROOT> and its child entity DEMO_MANAGED_CHILD>. Root entity: DDLS DEMO_MANAGED_ROOT Child entity: DDLS DEMO_MANAGED_CHILD Behavior definition> The RAP behavior definition> DEMO_MANAGED_ROOT>> is defined in RAP BDL> as follows: BDEF DEMO_MANAGED_ROOT Behavior implementation> For the above RAP behavior definition, there is no ABAP behavior pool (ABP)> created.
ABAP_DESCRIPTION Access with ABAP using EML> The above source code uses EML> to access the RAP business object from an ABAP class:
Dynamic ABAP_EML modify operations using MODIFY ENTITIES OPERATIONS> Various operations on data sets of the root and child entity are executed. For that purpose, an internal table with type ABP_BEHV_CHANGES_TAB>> must be defined. This table includes parameters (in this case, among others, other tables holding demo data and being typed with the required BDEF derived type) to carry out the modifications. Errors are intentionally caused for the modify operations so that the response parameters for FAILED> and REPORTED> are filled with entries. Furthermore, the MAPPED> response is included. All three response parameters are of type ABP_BEHV_RESPONSE_TAB>>. The class provides methods to display selected parts of those responses that are put into internal tables that are displayed in the output screen as well as the database table entries after the modifications. The saving of the modification is triggered by a COMMIT ENTITIES> statement.
Dynamic ABAP_EML read operations using READ ENTITIES OPERATIONS> Various read operations on data sets of the root and child entity are executed. For that purpose, an internal table with type ABP_BEHV_RETRIEVALS_TAB>> must be defined. This table includes parameters (in this case, among others, other tables holding demo data and being typed with the required BDEF derived type) to carry out the reading. Errors are intentionally caused for the read operations so that the parameter for FAILED> is filled with entries (the REPORTED > parameter does not get filled by the RAP BO provider> in this example). Also here, the response parameter is of type ABP_BEHV_RESPONSE_TAB>>. Same as above, the responses are put into an internal table that are displayed in the output screen (note that this internal table is shared for the output of failures for the modify and read operations in this example, i. e. the columns for create, delete and update are not relevant for read operations and must be ignored) as well as the database table entries after the read operation.