Documentation View

We are hiring and constantly growing! Have a look through our vacancies to find the right role for you!

ABAPREAD_ENTITY_ENTITIES_OP - READ ENTITY ENTITIES OP

ABAPREAD_ENTITY_ENTITIES_OP - READ ENTITY ENTITIES OP

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

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:

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

... LINK link_tab

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:

... REQUEST request

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.






CPI1466 during Backup   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.

Length: 10932 Date: 20230206 Time: 102107     sap01-206 ( 188 ms )