Saturday 28 May 2016

Internal Table

Internal Table

  • Internal table is like table which can be able to hold multiple records. 
  • Syntax :
    DATA :        < variable name> type table of <structure/table name >.  


Ex :

Source Code


Types BEGIN OF TY_STR,
        NAME(12TYPE C,
        AGE   TYPE I,
        PLACE(20TYPE 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.

ENDLOOP.



Save->Check->Activate->Execute.



Output





No comments:

Post a Comment