Field Symbols in ABAP
Field Symbols in ABAP
ABAP Field Symbols are very powerful. Usage of Field-Symbols would provide performance
gain, but for that you must use it correctly otherwise you may run into issues.
Field-symbols can provide great performance over using workarea as I have mentioned in my
earlier article Use of Field-symbols vs Work area. I have mentioned many articles using Field-
Symbols but wanted to note down the basics as part of this code snippet.
FIELD-SYMBOLS:
* Append line
<lfs_mara>-matnr = '123456'.
* insert table
<lfs_mara>-matnr = 'ABCDEF'.
* Read table
READ TABLE t_mara ASSIGNING <lfs_mara>
IF sy-subrc EQ 0.
WRITE: <lfs_mara>-matnr.
ENDIF.
WRITE: <lfs_mara>-matnr.
ENDLOOP.
IF sy-subrc EQ 0.
<lfs_mara>-ersda = sy-datum.
ENDIF.
<lfs_mara>-ersda = sy-datum + 1
ENDLOOP.
IF <lfs_mara> IS ASSIGNED.
WRITE: 'Assigned'.
ELSE.
WRITE: 'Unassigned'.
ENDIF.
UNASSIGN <lfs_mara>.