04-09-2007 7:44 AM
hi,
I have 5 record in one internal table.
for eg.
loop at itab.
if cond. is success
copy the first record to another internal table.
endif.
endloop.
can anyone help me how to copy one record alone and insert it into another table if the condition is ok.
please help me.
Thanks,
Camila
04-09-2007 7:45 AM
hi,
try this:
loop at itab into wa where cond.
append itab2 from wa.
clear wa.
endloop.
Regards
Subramanian
04-09-2007 7:45 AM
Hi..,
assuming ur tables have Headerlines,
<b>loop at itab1.
if condition satisfies..
itab2 = itab1. <i>** copying that particular record into second internal table's work area..</i>
append itab2. <i>** Inserting that record into the second internal table</i>
endif.
endloop.</b>
regards,
sai ramesh
04-09-2007 7:48 AM
loop at itab.
if cond. is success
ITAB2 = ITAB.
< OR YOU CAN USE MOVE COMMAND ALSO IF ITAB2 AND ITAB DOES NOT HAVE THE SAME FIELDS.. THEN YOU HAVE TO WRITE
MOVE ITAB-F3 TO ITAB2-F1 LIKE THAT FOR EACH FIELD >
APPEND ITAB2.
endif.
endloop.
REGARDS
SHIBA DUTTA
04-09-2007 7:49 AM
Hi ....
Try this code......
loop at itab1.
if cond. is success
read table itab1 index 1 into wa. " Every time u need only first record
append wa to itab2. " copy the first record to another internal table.
endif.
endloop.
hope it helps u.
Reward points if useful......
Suresh......
04-09-2007 9:52 AM
hi
use the following code.
loop at itab where condition.
if sy-subrc = 0.
select single * from <database table> into corresponding fields of <itab>.
endif.
endloop.
it will work
regards ravish
<b>plz reward if helpful</b>
04-09-2007 10:08 AM
Hi,
loop at itab into wa where condition.
append wa to itab1.
exit.
endloop.
04-09-2007 10:12 AM
Hi Joseph...
use this code...
************************************************************************
loop at itab1.
if <condition>.
move-corresponding itab1 to itab2.
append itab2.
clear itab2.
endif.
endloop.
************************************************************************
<b>Reward points if this helps,</b>
Regards,
Tejas