- Internal table is like table which can be able to hold multiple records.
- Syntax :
DATA : < variable name> type table of <structure/table name >.
Source Code
Types : BEGIN OF TY_STR,
NAME(12) TYPE C,
AGE TYPE I,
PLACE(20) TYPE C,
END OF TY_STR.
DATA : WA_STR TYPE TY_STR.
DATA : IT_STR TYPE TABLE OF TY_STR.
WA_STR-NAME = 'APPLEX'.
WA_STR-AGE = 12.
WA_STR-PLACE = 'MANGALORE'.
APPEND WA_STR TO IT_STR.
NAME(12) TYPE C,
AGE TYPE I,
PLACE(20) TYPE C,
END OF TY_STR.
DATA : WA_STR TYPE TY_STR.
DATA : IT_STR TYPE TABLE OF TY_STR.
WA_STR-NAME = 'APPLEX'.
WA_STR-AGE = 12.
WA_STR-PLACE = 'MANGALORE'.
APPEND WA_STR TO IT_STR.
Note : "Append keyword is used to append a record from work area to internal table ".
CLEAR WA_STR.
WA_STR-NAME = 'MANGOX'.
WA_STR-PLACE = 'BANGALORE'.
APPEND WA_STR TO IT_STR.
LOOP AT IT_STR INTO WA_STR.
WRITE : / WA_STR-NAME ,WA_STR-AGE , WA_STR-PLACE.
CLEAR WA_STR.
WA_STR-NAME = 'MANGOX'.
WA_STR-PLACE = 'BANGALORE'.
APPEND WA_STR TO IT_STR.
LOOP AT IT_STR INTO WA_STR.
WRITE : / WA_STR-NAME ,WA_STR-AGE , WA_STR-PLACE.
ENDLOOP.
Serkan AKKAVAK
Computer Engineer
SAP Department Deputy Manager
Contact : serkurumsal@yandex.com
0 Comments