Ansicht
Dokumentation

ABENEML_READ_ALTERNATIVES_ABEXA - EML READ ALTERNATIVES ABEXA

ABENEML_READ_ALTERNATIVES_ABEXA - EML READ ALTERNATIVES ABEXA

PERFORM Short Reference   ABAP Short Reference  
This documentation is copyright by SAP AG.
SAP E-Book

- READ, Variants

This example demonstrates the variants of the READ statement to read data from a simple managed RAP BO:

  • READ ENTITY bdef
  • READ ENTITIES OF bdef
  • READ ENTITIES OPERATIONS dynop

Data model

The CDS data model consists of the root entity DEMO_SPFLI_FLIGHTS and its child entity DEMO_SFLIGHT. The root entity represents flight schedule data and the child entity represents flight details.

Root entity:

Child entity:

Behavior definition

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

Behavior implementation

For the above CDS behavior definition, one ABAP behavior pool (ABP) is created. The global class of the behavior pool is BP_DEMO_SPFLI_FLIGHTS. This global class implements the local handler class LHC_DEMO_SPFLI_FLIGHTS. The actual implementation takes place in the BP_DEMO_SPFLI_FLIGHTS=========CCIMP. The details of the behavior implementation are not relevant for this example since no custom operations are used here.

Source Code

Execute

Description

Access with ABAP using EML

The above source code uses EML to access the RAP business object from an ABAP program:

  • READ ENTITY bdef
Two read operations are executed with the statement READ ENTITY for single entities. The one for the root entity, the other for the child entity using a read-by-association operation. The mandatory results of the read operations are stored in an internal table which is declared inline. In doing so, the internal table gets the required BDEF derived type. The RAP query engine reads the data from the respective database tables into a managed transactional buffer in which the read operations take place using the ALL FIELDS WITH addition.
  • READ ENTITIES OF bdef
Multiple operations are executed on multiple RAP BO entities. In this case, read operations on the root entity, the child entity directly (mentioning the alias name defined in the BDEF) as well as a read-by-association operation (here, it is the association to the child entity) are covered.
  • READ ENTITIES OPERATIONS dynop
The example demonstrates a dynamic read operation on the root entity and a dynamic read-by-association operation on the child entity. For that purpose, an internal table with type ABP_BEHV_RETRIEVALS_TAB must be defined. This table includes specific parameters that must be filled, among others, references to other internal tables holding components according to which the dynamic read operation should be carried out.





BAL_S_LOG - Application Log: Log header data   PERFORM Short Reference  
This documentation is copyright by SAP AG.

Length: 4244 Date: 20240426 Time: 152323     sap01-206 ( 64 ms )