17/11/2011

Transferring Data between Internal Tables


Transferring Data between Internal Tables
We can Able to transfer in 3 ways
·         Direct Processing
·         Header to Header
·         Memory To Memory


1.   Direct  Processing
      The Table which Have The Same Structure And then the able is copied
Syntax

 Ptab[]=  tab[].

Example
     Data : itab like temp occurs o with header line.
 Data : ptab like temp occurs 0 with header line.
Itab-no  =  123.
Itab-name =  ‘SAPUSER’.
---------------  populating the data into the table ------------------------

Ptab[] = itab[].
Loop at ptab.
Write : / ptab-no , ptab-name .
Endloop.


2.   Header to header
The data which is going to transfer f one table is fetched to header of the table from interna table then it will transferred to another header of internal table.

Loop at itab.
Append itab to ptab.
Endloop.
Loop at itab into ptab.
Write :  / ptab-no, ptab-name.
Endloop.



3.   Memory to Memory
It transfer the memory of the table to new location of emory it wil copy the able vale and data as same as the original table.
 Example
    Data : itab like mara occurs o with header line.
Select * from mara into table itab.
Loop at itab.
Write :/ Itab-matnr.
Endloop.