ABAP Keyword Documentation → ABAP - Reference → Declarative statemnts → Field Symbols
FIELD-SYMBOLS
Other versions: 7.31 | 7.40 | 7.54
Syntax
FIELD-SYMBOLS <fs> { typing | obsolete_typing }.
Addition
Effect
The FIELD-SYMBOLS
statement declares a field symbol <fs>
. The
naming conventions apply to the name fs
.
The angle brackets of the field symbols distinguish them from 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
.
A field symbol is initial directly after its declaration (with the exception of
obsolete typings without an explicit type),
which means that 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 is raised.
Addition
... typing
Effect
You can use the addition typing
to type the field symbol. The syntax of typing
is described under
Typing. The typing specifies which memory areas
can be assigned to the field symbol and in which operand positions it can be used.
Note
Alongside the typings that use typing
,
you can also (outside methods) use an obsolete typing obsolete_typing
.
Example
Types a field symbol <itab>
as an internal table and a field symbol <wa>
with a fully generic type.
FIELD-SYMBOLS: <itab> TYPE ANY TABLE,
<wa> TYPE any.
...
READ TABLE <itab>
WITH TABLE KEY ('...') = '...'
ASSIGNING <wa>.