What does it do? 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.
ABAP Alternative 1 ... REF type( dobj )>
What does it do? 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>:
A non-generic data type dtype> that satisfies the rules of upcasts in data references>.
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>.
Latest 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>. NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 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. ABEXA 00903 ABAP_EXAMPLE_END
ABAP Alternative 2 ... REF type( tab_exp )>
What does it do? 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>.
ABAP_EXAMPLE_VX5 The result of the operator REF> is a data reference variable that points to the fifth line of the internal table itab>. ABEXA 00904 ABAP_EXAMPLE_END