Short Reference


FIELD-SYMBOLS <fs> { typing | STRUCTURE struc DEFAULT dobj }.


1. ... typing

2. ... STRUCTURE struc DEFAULT dobj


The FIELD-SYMBOLS statement declares a field symbol <fs>. The naming conventions apply to the name fs. The angle brackets of the field symbols indicate the difference to data objects and are obligatory. You can declare field symbols in any procedure and in the global declaration section of an ABAP program, but not in the declaration section of a class or an interface. You can use a field symbol in any operand position in which it is visible and which match the typing defined using typing.

After its declaration, a field symbol is initial - that is, it does not reference a memory area. You have to assign a memory area to it (normally using the ASSIGN statement) before you can use it as an operand. Otherwise an exception will be triggered.

Addition 1

... typing


You can use the addition typing to type the field symbol. The syntax of typing is described under Syntax of Typing. The typing specifies which memory areas can be assigned to the field symbol (see Checking the Typing) and in which operand positions it can be used.


You can omit the addition typing outside of methods. In this case, the field symbol has the complete generic type any and is implicitly assigned the predefined constant space during the declaration.

Addition 2

... STRUCTURE struc DEFAULT dobj


If you specify the addition STRUCTURE instead of typing for a field symbol, and struc is a local program structure (a data object, not a data type) or a flat structure from the ABAP Dictionary, this structure is cast for the field symbol <fs>. You have to specify a data object dobj that is initially assigned to the field symbol.

The field symbol copies the technical attributes of structure struc as if it were completely typed. When you assign a data object using the addition DEFAULT, or later using ASSIGN, its complete data type is not checked in non- Unicode programs. Instead, the system merely checks whether it has at least the length of the structure and its alignment.

In Unicode programs, we differentiate between structured and elementary data objects. For a structured data object dobj, its Unicode fragment view has to match the one of struc. In the case of an elementary data object, the object must be character-type and flat, and struc must be purely character-type. The same applies to assignments of data objects to field symbols typed using STRUCTURE when using the ASSIGN statement.


Field symbols declared using the addition STRUCTURE are a mixture of typed field symbols and a utility for casting structured data types. You should use the additions TYPE or LIKE for the FIELD-SYMBOLS statement to type field symbols, while the addition CASTING of the ASSIGN statement is used for casting.


The first example shows the obsolete usage of the addition STRUCTURE.

<scarr1>-carrid = '...'.

The second example shows the replacement of STRUCTURE with the additions TYPE and CASTING.

FIELD-SYMBOLS <scarr2> TYPE scarr.
ASSIGN wa2 TO <scarr2> CASTING.
<scarr2>-carrid = '...'.