INSERT KEYWORD

INSERT: - 

        Insert is the keyword to transfer the data from work area to internal table based on the key field.

Syntax: - Insert <wa>  into table <it>

Ex: - Insert WA into table IT. 

Note: - If we use insert keyword to standard internal table then it acts like append.

PROGRAM:

*&---------------------------------------------------------------------*
*& Report  ZR_INSERT_KEYWORD
*&
*&---------------------------------------------------------------------*
REPORT ZR_INSERT_KEYWORD.
Typesbegin of ty,
       Eid
(10type C,
       Ename
(25type C,
       
End of ty.
Data WA type ty.
Data IT like sorted table of WA with unique key Eid.

WA
-Eid '1'.
WA
-Ename 'Vidya'.
Insert WA into table IT.

WA
-Eid '3'.
WA
-Ename 'Latha'.
Insert WA into table IT.
Loop at IT into WA.
Write / WA-EidWA-Ename.
Endloop.
Uline.
WA
-Eid '2'.
WA
-Ename 'Satiah'.
Insert WA into table IT.
Loop at IT into WA.
Write/ WA-EidWA-Ename.
 
Endloop.