Ansicht
Dokumentation

ABAPREAD_ENTITY_ENTITIES_FIELDS - READ ENTITY ENTITIES FIELDS

ABAPREAD_ENTITY_ENTITIES_FIELDS - READ ENTITY ENTITIES FIELDS

PERFORM Short Reference   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.
SAP E-Book

READ ENTITY, ENTITIES, field_spec

...  ${ FROM fields_tab $}
   $| ${ FIELDS ( comp1 comp2 ... ) WITH fields_tab $}
   $| ${ ALL FIELDS WITH fields_tab $} ...


Variants:

1. ... FROM fields_tab ...

2. ... FIELDS ( comp1 comp2 ... ) WITH fields_tab ...

3. ... ALL FIELDS WITH fields_tab ...

Effect

The field specification expressions are used to specify input parameters on whose basis read operations can be performed for on RAP BO instances. All variants can be used for direct read and read-by-association operations. The variant FROM is the only option for read operations executing functions (using the keyword EXECUTE).

The parameters that are taken into account for read operations must be specified in an internal table (fields_tab). It is essential that the internal table is typed with the required BDEF derived type. Depending on the operation and the variant, the parameters of the internal table comprise special components.

The following table provides an overview on the operations, which field specification expressions are possible for the operations, and which type and components of the required internal table are relevant:

Operation Field Specification Expression Type of Internal Tablefields_tab Components of Internal Table
Direct read operation (for example, READ ENTITY bdef FROM) FROM \lbr FIELDS (...) WITH \lbr ALL FIELDS WITH TYPE TABLE FOR READ IMPORT bdef %control \lbr %key \lbr %pky \lbr %tky \lbr \lbr In case of FROM, %control must be filled explicitly.
Read-by-association operation (... BY \_assoc ...) FROM \lbr FIELDS (...) WITH \lbr ALL FIELDS WITH TYPE TABLE FOR READ IMPORT bdef\_assoc %control \lbr %key \lbr %pky \lbr %tky \lbr \lbr In case of FROM, %control must be filled explicitly.
Read operation executing a function (using the keyword EXECUTE) FROM TYPE TABLE FOR FUNCTION IMPORT bdef~function %key \lbr %pky \lbr %tky

bdef is the root entity name, _assoc the name of the association defined in the underlying CDS view of the root entity, and function the name of a function specified in the BDEF. See the details on the components in the documentation for Components of BDEF Derived Types.

Notes

  • The read statement must be completed by specifying a result after fields_tab. Optionally, response_param can also be specified after fields_tab.
  • Depending on the context, the components listed in the Components column of the overview table might cover more than mentioned there. For example, the draft indicator %is_draft is available in case of drafts only. %pid is only available in late numbering scenarios.
  • In the internal table (fields_tab), all key fields must be specified, otherwise the read operation fails. In read-by-association operations, all key fields of an associated entity are returned by default.

Variant 1

... FROM fields_tab ...


Effect

The read operation considers input parameters specified in an internal table (fields_tab). It can be used for all operations and it is the only option for EXECUTE.

The %control structure must be filled explicitly in fields_tab. For specifying the values of the fields in the %control structure, the constants provided in the interface IF_ABAP_BEHV can be used: IF_ABAP_BEHV=>MK-.... For example, if fields are set with the value IF_ABAP_BEHV=>MK-ON, they are respected by the operation. In combination with EXECUTE, %control is not available.

Example

The following source code section taken from DEMO_RAP_EML_READ_OP_FIELDS shows the use of FROM with a READ operation. The %control structure shows that some fields are requested, some are not.

Variant 2

... FIELDS ( comp1 comp2 ... ) WITH fields_tab ...


Effect

Fields to be returned by the read operation are specified in a field list in brackets after the keyword FIELDS. The input parameters for the read operation are specified in an internal table (fields_tab). The fields (comp1, comp2, etc.) can be any of the entity's fields. Key fields can but need not be explicitly specified since they are read and returned by default even if not specified. At least one field must be specified in the field list. The fields are not separated by a comma. The order of the fields is irrelevant. However, the order of the columns, for example, of the read result table corresponds to the order in the database table.

The variant is a convenience variant and shortcut for FROM. It cannot be used for EXECUTE. %control is filled implicitly in fields_tab.

Example

The following source code section taken from DEMO_RAP_EML_READ_OP_FIELDS shows the use of FIELDS ... WITH with a read-by-association operation.

Variant 3

... ALL FIELDS WITH fields_tab ...


Effect

All fields of an instance are read according to input parameters for the read operation specified in an internal table (fields_tab).

The variant is a convenience variant and shortcut for FROM. It cannot be used for EXECUTE. %control is filled implicitly in fields_tab.

Example

The following source code section taken from DEMO_RAP_EML_READ_OP_FIELDS shows the use of ALL FIELDS WITH with a READ operation.

Variant 4

... SET FIELDS WITH fields_tab


Effect

Only for operation EXECUTE. Convenience variant. Shortcut for FROM. %control is filled implicitly.

The addition affects the function parameter %param which itself has a %control component because of parameter selective.






RFUMSV00 - Advance Return for Tax on Sales/Purchases   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.

Length: 10114 Date: 20240426 Time: 024238     sap01-206 ( 142 ms )