FIELD-SYMBOL>, Inline Declaration for Field Symbols
ABAP_SYNTAX ... FIELD-SYMBOL(<(><)>) ...>
What does it do? A declaration expression with the declaration operator FIELD-SYMBOL > declares a field symbol> <(><)>> to which a memory area is assigned in the current operand position. The declared field symbol is visible statically in the program from FIELD-SYMBOL(<(><)>)> and is valid in the current context>. The declaration is made when the program is compiled, regardless of whether the statement is actually executed. The declaration operator FIELD-SYMBOL> can be specified in every valid declaration position>, which involves assignments of the memory area only. The typing of the field symbol is determined using the statically known type of the assigned memory area. It can be generic and complete. A field symbol <(><)>> declared inline cannot be used in a read position of the same statement.
ABAP_PGL Only use inline declarations locally >. ABAP_PGL_END
Latest notes:
A valid statement with an inline declaration of a field symbol can generally be interpreted as a short form for a declaration statement used as a direct prefix. FIELD-SYMBOLS <(><)> TYPE ...> ... <(><)> ...> Exceptions to this rule occur only if an identically named field symbol from a more global context is used in the same statement. This data object is still valid in the statement and is only hidden after the statement. BEGIN_SECTION SAP_INTERNAL_HINT The opposite direction is not always possible, namely if the same variable is used multiply in one statement and if the sequence rule cannot be fulfilled. END_SECTION SAP_INTERNAL_HINT
Just like the statement FIELD-SYMBOLS>, an inline declaration does not open a local context for the current statement block. An inline declaration for a field symbol can only be made once within a context and the field symbol must not have been declared there using FIELD-SYMBOLS>.
If the type of the assigned memory area is defined by reference to a data type of the ABAP Dictionary, it is inherited with its semantic properties, such as field help, input help, or conversion routines. BEGIN_SECTION SAP_INTERNAL_HINT If a structure component named field-symbol> is already declared in a context, the syntax field-symbol(...)> at an operand position is not an inline declaration but an offset length access to field-symbol>. END_SECTION SAP_INTERNAL_HINT NON_V5_HINTS ABAP_HINT_END
ABAP_EXAMPLE_VX5 Inline declaration of a field symbol for an internal table in an ASSIGN> statement and inline declaration of a field symbol for the lines of the table in a LOOP>. ABEXA 01027 ABAP_EXAMPLE_END