The concept of field symbols is very important in order to increase the performance of SAP applications, but unethical use of field-symbols leads to application issues.
Field symbol name should always be within
<>
, example:<FS_MARA>
.Syntax for declaring a field symbol.
FIELD-SYMBOLS : <FIELD_SYMBOL> TYPE MARA-MATNR. "here MARA-MATNR is a variable type FIELD-SYMBOLS : <FIELD_SYMBOL> TYPE MARA. "here MARA is a structure FIELD-SYMBOLS : <FIELD_SYMBOL> TYPE REF TO DATA . "here DATA is a reference type
In the below example we are going to use field symbol as work area.
REPORT ZTEST_FIELDSYMBOLS. DATA : IT_MARA TYPE TABLE OF MARA. DATA : WA_MARA TYPE MARA. FIELD-SYMBOLS : <FS_MARA> TYPE MARA. SELECT * FROM MARA INTO TABLE IT_MARA UP TO 50 ROWS. LOOP AT IT_MARA ASSIGNING <FS_MARA>. IF <FS_MARA> IS ASSIGNED. WRITE :/ <FS_MARA>-MATNR, <FS_MARA>-MTART, <FS_MARA>-MEINS. ENDIF. ENDLOOP.
Serkan AKKAVAK
Computer Engineer
serkurumsal@yandex.com
Social Plugin