Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

regarding field symbols

what are field symbols in abap ?

Tags:
Former Member
Former Member replied

Hi,

Field-Symbols are place holders for existing fields.

A Field-Symbol does not physically reserve space for a field but points to a field, which is not known until run time of the program.

Field-Symbols are like Pointers in Programming language ‘ C ‘.

Syntax check is not effective.

Syntax :

Data : v1(4) value ‘abcd’.
Field-symbols <fs>.
Assign v1 to <fs>.
Write:/ <fs>.

DATA: BEGIN OF LINE,
COL1 TYPE I,
COL2 TYPE I,
END OF LINE.

DATA ITAB LIKE SORTED TABLE OF LINE WITH UNIQUE KEY COL1.

FIELD-SYMBOLS <FS> LIKE LINE OF ITAB.

DO 4 TIMES.
LINE-COL1 = SY-INDEX.
LINE-COL2 = SY-INDEX ** 2.
APPEND LINE TO ITAB.
ENDDO.

READ TABLE ITAB WITH TABLE KEY COL1 = 2 ASSIGNING <FS>.
<FS>-COL2 = 100.

READ TABLE ITAB WITH TABLE KEY COL1 = 3 ASSIGNING <FS>.
DELETE ITAB INDEX 3.

IF <FS> IS ASSIGNED.
WRITE '<FS> is assigned!'.
ENDIF.

LOOP AT ITAB ASSIGNING <FS>.
WRITE: / <FS>-COL1, <FS>-COL2.
ENDLOOP.

The output is:

1 1

2 100

4 16

Check the below Links :

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/content.htm

http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3860358411d1829f0000e829fbfe/frameset.htm

http://www.erpgenie.com/abap/code/chap2401.txt

http://help.sap.com/saphelp_nw04/helpdata/en/16/0dce0a0cf711d3b9360000e8353423/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3930358411d1829f0000e829fbfe/content.htm

Thanks.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question