SAP ABAP Syntax for Field Symbols

Basic form

FIELD-SYMBOLS .

Additions

1. ... STRUCTURE s DEFAULT wa
2. ... TYPE t
3. ... TYPE LINE OF t
4. ... LIKE s
5. ... LIKE LINE OF s


Effect

This statement declares a symbolic field called . At run time, you can assign a concrete field to the field symbol using ASSIGN . All operations performed with the field symbol then directly affect the field assigned to it.

You can only use one of the additions.

Example

Output aircraft type from the table SFLIGHT using a field symbol:

FIELD-SYMBOLS .
TABLES SFLIGHT.
...
ASSIGN SFLIGHT-PLANETYPE TO .
WRITE .
Addition 1
... STRUCTURE s DEFAULT wa

Effect

Assigns any (internal) field string or structure to the field symbol from the ABAP/4 Dictionary ( s ). All fields of the structure can be addressed by name: -fieldname . The structured field symbol points initially to the work area wa specified after DEFAULT .

The work area wa must be at least as long as the structure s . If s contains fields of the type I or F, wa should have the structure s or at least begin in that way, since otherwise alignment
problems may occur.

Example

Address components of the flight bookings table SBOOK using a field symbol:

DATA SBOOK_WA LIKE SBOOK.
FIELD-SYMBOLS STRUCTURE SBOOK
DEFAULT SBOOK_WA.
...
WRITE: -BOOKID, -FLDATE.



RELATED POST

SAP ABAP SYNTAX FOR FETCH

MySAP CRM System architecture and design
MySAP CRM architecture and E procurement introduction

1 comment :