ABAP_SYNTAX ... ${ INTO wa $[ transport_options>$] $}> $| ${ ASSIGNING <(><)> $[CASTING$] $[ELSE UNASSIGN$] $}> $| ${ REFERENCE INTO dref $}> $| ${ TRANSPORTING NO FIELDS $}.>
ABAP_ALTERNATIVES: 1 ... INTO wa $[transport_options$]> 2 ... ASSIGNING <(><)> $[CASTING$] $[ELSE UNASSIGN$]> 3 ... REFERENCE INTO dref> 4 ... TRANSPORTING NO FIELDS>
ABAP_PGL Output Behavior> ABAP_PGL_END
What does it do? Defines the output behavior of a READ> statement> for an internal table. There are four alternatives for the output behavior:
The addition INTO> assigns the content of the found line to a work area. This addition can be used regardless of how itab> is specified.
The addition ASSIGNING> assigns the found line to a field symbol <(><)>>. This addition is possibly only if an existing internal table is specified for itab>.
The addition REFERENCE INTO> creates a reference to the found line in a reference table. This addition is possibly only if an existing internal table is specified for itab>.
The addition TRANSPORTING NO FIELDS> specifies that only the relevant system fields are filled. This addition can be used regardless of how itab> is specified.
Latest notes: NON_V5_HINTS Outside of classes, the addition INTO> can also be specified together with TRANSPORTING NO FIELDS>, but this produces a warning in the syntax check ABAP_HINT_END
ABAP Alternative 1 ... INTO wa $[transport_options$]>
What does it do? The content of the found line is assigned to the work area wa>. The following can be specified for wa>:
An existing work area that matches the line type of the internal table. The line type must be compatible with or convertible to the data type of the work area. If the work area is incompatible with the line type of the internal table, the content of the table line is converted to the data type of the work area in accordance with the conversion rules>.
An inline declaration DATA(var)>> or FINAL(var)>>, where a work area with the line type of the internal table is declared. The line type must be known statically and completely. If no line is found, wa> remains unchanged or initial. If a conversion error occurs in the assignment to wa>, the exception cannot be handled using CX_SY_CONVERSION_ERROR> and the associated runtime error occurs instead. If the additions transport_options>> are used, the work area wa> must be compatible with the line type of the internal table.
Latest notes: NON_V5_HINTS For READ TABLE>, an obsolete short form > exists where INTO wa> can be omitted if the internal table has an identically named header line > itab>. INTO itab> is then implicitly added to the statement. This short form is independent of the obsolete key specification>, which also evaluates the header line. ABAP_HINT_END
ABAP_EXAMPLE_VX5 Reading of a particular line in the internal table sflight_tab> and assignment to a work area sflight_wa> declared inline. After a successful assignment, the content of a component of the line is changed in the internal table. ABEXA 00537 ABAP_EXAMPLE_END
ABAP Alternative 2 ... ASSIGNING <(><)> $[CASTING$] $[ELSE UNASSIGN$]>
ABAP Addition 1 ... CASTING> 2 ... ELSE UNASSIGN>
What does it do? The found table line is assigned to a field symbol. After the statement READ TABLE>, the field symbol points to the table line in the memory. The addition cannot be specified if itab> is specified as the return value or result of a functional method>, a constructor expression>, or a table expression>, since this value no longer exists once the statement has been executed. The following can be specified for <(><)>>:
An existing field symbol whose typing matches the line type of the internal table. The optional addition CASTING> can be used to perform a casting.
An inline declaration FIELD-SYMBOL( <(><)>)>>, where a field symbol with the line type of the internal table is declared. If this cannot be known statically, the field symbol is declared with the generic type any> and is assigned the constant space>> initially. The addition CASTING> is not possible after an inline declaration. If no table line is found, the state of <(><)>> depends on the addition ELSE UNASSIGN>. As long as the field symbol points to the line, assignments to the field symbol modify the line in the internal table. The following restrictions apply with respect to modifications to key fields of the primary> and secondary table keys>: