Ansicht
Dokumentation

ABENEML_READ_OP_FIELDS_ABEXA - EML READ OP FIELDS ABEXA

ABENEML_READ_OP_FIELDS_ABEXA - EML READ OP FIELDS ABEXA

General Material Data   BAL_S_LOG - Application Log: Log header data  
This documentation is copyright by SAP AG.
SAP E-Book

- 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:

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, 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.

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:

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.






ABAP Short Reference   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.

Length: 4369 Date: 20240425 Time: 165406     sap01-206 ( 68 ms )