Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Obsolete Language Elements →  Obsolete Declarations →  Field Symbols 

FIELD-SYMBOLS - obsolete_typing

Short Reference

Other versions: 7.31 | 7.40 | 7.54

Obsolete Syntax

... { } | STRUCTURE struc DEFAULT dobj ...


1. ... { }
2. ... STRUCTURE struc DEFAULT dobj


These additions of the statement FIELD-SYMBOLS produce an obsolete typing of the field symbol and are forbidden in classes.

Addition 1

... { }


If no explicit type is specified after FIELD-SYMBOLS, the field symbol is typed implicitly with the fully generic type any. Also, the field symbol is assigned the predefined constant space when the context is loaded. This means that the field symbol is not initial directly after it has been declared, and a check using IS ASSIGNED is true.

Addition 2

... STRUCTURE struc DEFAULT dobj


If you specify the addition STRUCTURE for a field symbol, which is forbidden within classes, instead of typing, and struc is a local program structure (a data object, not a data type) or a flat structure from 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 inherits 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 distinguish between structured data objects and elementary data objects. For a structured data object dobj, the Unicode fragment view has to match the struc view. In the case of an elementary data object, the object must be character-like and flat, and struc must be purely character-like. 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 to 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.

DATA wa1 TYPE c LENGTH 512. 
<scarr1>-carrid = '...'. 

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

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

See also Field Symbols, Casting Structures.