Ansicht
Dokumentation
ABAPREAD_ENTITY_ENTITIES_OP - READ ENTITY ENTITIES OP
Fill RESBD Structure from EBP Component Structure CL_GUI_FRONTEND_SERVICES - Frontend ServicesThis documentation is copyright by SAP AG.
READ ENTITY, ENTITIES, operations
... $[field_spec RESULT result_tab$]
$[BY \_assoc field_spec
RESULT result_tab $[LINK link_tab$]$]
$[EXECUTE function field_spec $[REQUEST request$]
RESULT result_tab $] ...
Variants:
1. ... field_spec RESULT result_tab ...
2. ... BY \_assoc field_spec RESULT result_tab LINK link ...
3. ... EXECUTE function field_spec $[REQUEST request$] RESULT result_tab ...
Effect
The READ statement includes three kinds of operations:
- Read operations: Read entities directly via key fields.
- Read-by-association operations: Read child entities via key fields of the parent entity. It is also possible to read parent entities via the child entities, however, only from within the implementation class.
- Execute functions: Carry out a self-defined read operation, for example, if parameters are required.
All read operations require an internal table (field_spec) as input parameter to specify, for example, whether all fields or only a specific set of fields should be read from RAP BO entities. Read operations always have a result, which is stored in an internal table (result_tab).
Notes
- After the keyword BY for read-by-association operations, it is required to insert the backslash (\) before the associations are displayed via the code completion.
- In case of read-by-association operations, the explicit specification of the full_rba parameter is only possible for the dynamic form of the READ statement
(READ ENTITIES OPERATIONS). With the short form
(READ ENTITY) and long form
(READ ENTITIES), the explicit
specification of the full_rba parameter is not possible. In these cases, the specification is irrelevant because it is anyway specified if the links
(link_rba parameter) or the data are requested.
Variant 1
... field_spec RESULT result_tab ...
Effect
Used to read directly from a RAP BO entity, either a root or child entity, with input parameters specified in field_spec.
The keyword RESULT is the only additional mandatory keyword. The internal table result_tab is used to store the result of the read operation. It must be typed with a BDEF derived type that depends on the read operation variant. See more details in the documentation for RESULT result_tab.
Example
The following source code section taken from DEMO_RAP_EML_READ_OPERATIONS demonstrates a READ operation directly from a RAP BO entity.
Variant 2
... BY \_assoc field_spec RESULT result_tab LINK link_tab ...
Addition:
Effect
Used for read-by-association operations, that is, to read RAP BO instances of associated entities via the keys of the parent entity. This includes associated child entities that are part of the composition tree but also cross-BO entities that are not part of it. It is also possible to read parent entities via the child entities, however, only from within the implementation class. _assoc is the name of the association as specified in the underlying CDS view. As a prerequisite, child entities to be read from must be defined in the same BDEF. For read access to a cross-BO entity, it is a prerequisite that behavior is defined for it in another BDEF.
field _spec is an
internal table specifying the input parameters for the read-by-association operation. The internal table
RESULT result_tab is used to store the result of the read operation. It must be typed with a
BDEF derived
type that depends on the read operation variant. The component %target must be filled in the in the internal table field_spec.
Addition
... LINK link_tab
Effect
The statement provides an additional target variable
(link_tab) after the LINK keyword. link_tab is an internal table containing keys
of the source (i. e. the parent, or the child respectively if instances are read from the parent via
the child) and keys of the target (associated entity) as nested structures. link_tab must be
typed with the BDEF derived type TYPE TABLE FOR READ LINK.
Example
The following source code section taken from DEMO_RAP_EML_READ_OPERATIONS demonstrates a read-by-association operation.
Variant 3
... EXECUTE function field_spec $[REQUEST request$] RESULT result_tab ...
Addition:
Effect
The keyword EXECUTE triggers a function for a read-only operation. In both managed and unmanaged scenarios, the function must be self-implemented in a behavior pool.
field _spec is an internal table specifying the input parameters for the operation. The internal table result_tab is used to store the result of the read operation. It must be typed with a BDEF derived type that depends on the read operation variant. See more details in the documentation for RESULT result_tab.
Example
The following source code section taken from DEMO_RAP_EML_READ_OP_FUNC demonstrates a read operation executing a function.
Addition
... REQUEST request
Effect
Used to specify whether the result should be returned completely or only parts of it (for example, only the keys) for the purpose of improving performance. request must be typed with the required BDEF derived type: TYPE STRUCTURE FOR FUNCTION REQUEST. The components of the structure are all key and data fields of the RAP BO entity. They are of type ABP_BEHV_FLAG and can be flagged whether to include the respective fields or not.
It is optional and can only be used for functions specified in the BDEF with the addition
result selective.
- The example READ: Operations and Field Selection demonstrates several different variants of field selection with a simple managed RAP BO.
- For more examples on READ operations in general, see Examples for ABAP EML READ.
rdisp/max_wprun_time - Maximum work process run time BAL_S_LOG - Application Log: Log header data
This documentation is copyright by SAP AG.
Length: 10932 Date: 20240426 Time: 033117 sap01-206 ( 266 ms )