06-15-2009 6:47 AM
HI Experts
I want to cpoy data from one row to another row in same internal table itab.
thanks
06-15-2009 7:19 AM
take one more work area and point your concerned row and copy that row into the new work area and insert that row into the table using the sy-tabix. sy-tabix is having the row index.
06-15-2009 6:59 AM
Hi,
Use explicit work area to read table for a particular row.
read table itab into wa index <index> or using key.
now read same internal table without workarea and copy the contents from work area to itab implicit workarea and then write modify statement using index sy-tabix.
Example:
read table itab index <index> or key.
modify itab from wa index sy-tabix.
Regards,
Kumar Bandanadham
06-15-2009 7:15 AM
Hi ,
if suppose ur itab1 contains all the data , and you want to add a same row to that itab, then first copy all data to another table itab2 and process the itab now .
itab2[] = itab1[].
loop at itab1 into wa.
read table itab1 into wa1 with key xyz where xyz = abc .
if sy-subrc is initial.
append wa1 to itab2. " here it appends the similar row to itab2 .
endif.
endloop.
Now itab2 contains all the rows you wanted , i.e like duplicate entries also.
Regards,
Aby
06-15-2009 7:16 AM
Hi ,
if suppose ur itab1 contains all the data , and you want to add a same row to that itab, then first copy all data to another table itab2 and process the itab now .
itab2[] = itab1[].
loop at itab1 into wa.
read table itab1 into wa1 with key xyz where xyz = abc .
if sy-subrc is initial.
append wa1 to itab2. " here it appends the similar row to itab2 .
endif.
endloop.
Now itab2 contains all the rows you wanted , i.e like duplicate entries also.
Regards,
Aby
06-15-2009 7:19 AM
take one more work area and point your concerned row and copy that row into the new work area and insert that row into the table using the sy-tabix. sy-tabix is having the row index.
06-15-2009 7:27 AM
hi,
data:
itab,
wa1 like line of itab,
wa2 like line of itab
read table itab into wa1 index <idx>.
wa2 = wa1.
insert wa1 into itab index <idx>// the row no. where u want to copy the contents
chk sy-subrc.
hope it helps..
Regards
Mdi.Deeba
06-15-2009 7:34 AM
Try like below.
READ TABLE itab INTO wa INDEX 1. " Reading a row into workarea
MODIFY itab INDEX 2 FROM wa. " Modifying already existing row