Ansicht
Dokumentation

ABENCONSTRUCTOR_EXPRESSION_REF - CONSTRUCTOR EXPRESSION REF

ABENCONSTRUCTOR_EXPRESSION_REF - CONSTRUCTOR EXPRESSION REF

RFUMSV00 - Advance Return for Tax on Sales/Purchases   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.
SAP E-Book

REF, Reference Operator

... REF type( dobj $| table_exp ) ...

Alternatives:

1. ... REF type( dobj )

2. ... REF type( table_exp )

Effect

A constructor expression with the reference operator REF creates either a data reference variable that points to the argument dobj or controls a table expression table_exp.

Existing data objects and table expressions can be specified as an argument, but no other expressions or function calls.

Alternative 1

... REF type( dobj )


Effect

If a data object dobj is specified as an argument, the operator REF works like the statement GET REFERENCE and creates a data reference variable as a result that points to the specified data object dobj. type determines the static type of the result. The following can be specified for type:

  • The generic data type data.
  • The # character for a data type that is determined by the following hierarchy:
  • If the data type required in an operand position is unique and known completely, the operand type is used.

  • If the operand type cannot be derived from the context, the data type of dobj is used.

  • If the data type of dobj is not known statically, the generic type data is used.

The parentheses must contain exactly one unnamed argument dobj. If offsets/lengths (+off(len)) are specified, the data type dobj here cannot be string or xstring.

Notes

  • The conversion operator REF is suitable for avoiding declarations of helper variables that are only necessary, for example, to specify data reference variables as actual parameters.
  • No empty parentheses can be specified after REF.

Example

Filling of an internal table with the value operator VALUE, where the component dref is given a value using REF. This is an excerpt from the executable example for the class CL_ABAP_BROWSER. Other use cases can be found in the executable examples of ADBC, where parameter bindings are used.

Alternative 2

... REF type( tab_exp )


Effect

If a table expression table_exp is specified as an argument, the operator REF controls the type of its result and enables a default value to be specified for unfound lines, as described in the related section.

Example

The result of the operator REF is a data reference variable that points to the fifth line of the internal table itab.






BAL Application Log Documentation   TXBHW - Original Tax Base Amount in Local Currency  
This documentation is copyright by SAP AG.

Length: 5078 Date: 20240420 Time: 050646     sap01-206 ( 67 ms )