SAP EML READ OP FIELDS ABEXA



Get Example source ABAP code based on a different SAP table
  



ABAP_EML - READ, Field Specification Expressions
This example demonstrates read operations using various variants of field specification expressions so as to read from a simple managed RAP BO .
The example covers read and read-by-association operations as well as a read operation executing a function. The following field specification alternatives are covered in the example:
FROM
FIELDS (...) WITH
ALL FIELDS WITH
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:
DDLS DEMO_SPFLI_FLIGHTS
Child entity:
DDLS DEMO_SFLIGHT
Behavior definition
The RAP behavior definition DEMO_SPFLI_FLIGHTS is defined in RAP BDL as follows:
BDEF DEMO_SPFLI_FLIGHTS
Behavior implementation
For the above RAP behavior definition, there is an ABAP behavior pool (ABP) available. 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. In managed scenarios, the implementation for standard operations is carried out by the managed RAP BO provider. Hence, only the function FunctionResultEntity which is executed in a read operation in the example is relevant here. See the example READ: Operation Executing Functions that focuses on this very function execution for details.

ABAP_SOURCE_CODE
DEMO CL_DEMO_RAP_EML_READ_OP_FIELDS

ABAP_DESCRIPTION
Access with ABAP using EML
The above source code uses EML to access the RAP business object from an ABAP class:
Using the short syntax form READ ENTITY, several separate read and read-by-association operations are carried out in the example showcasing the various variants of field specification that are possible to specify input parameters for the read operation in an internal table. In this case, the internal table is always created at an operand position using the value operator . The table gets the required BDEF derived type automatically. Depending on the operation and key words ( FROM, for example), the internal tables require specific components.
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 respective additions. Each result of the individual read operations is output. For the sake of completeness, an example for the read operation executing a function is covered here as well. Refer to the separate example READ: Operation Executing Functions for the details.