‎2008 Apr 16 7:19 AM
hi experts,
how to move internal table data to final internal table for process data in the output.
thanks.
‎2008 Apr 16 7:21 AM
Hi,
loop the internal table which u want to move to final internal table and move the field data to the fields of the final internal table and now append the final internal table.
Itab1 has fng fields say A, B, C, D.
Itab2 has fng fields say D, E.
Itab3 is final table
To combine itab1 and itab2,,,
loop at itab1
itab3-fld1 = itab1-fld1.
itab3-fld2 = itab1-fld2.
itab3-fld3 = itab1-fld3.
append itab3.
clear itab3.
endloop.
loop at itab2.
itab3-fld4 = itab1-fld4.
itab3-fld5 = itab1-fld5.
append itab3.
clear itab3.
endloop.
reward if helpful
raam
‎2008 Apr 16 7:22 AM
move itab to final_tab.
move-correspondig fields itab to final_itab
‎2008 Apr 16 7:23 AM
You can use the MOVE statement. You can do a F1 Help for the MOVE statement.
example :
move it_vbap-vbeln to it_final-vbeln.
move it_vbap-posnr to it_final-posnr.Please be more specific while posting a question, and also do not post multiple posts.
Regards
Gopi
‎2008 Apr 16 7:23 AM
Hi,
What is the purpose of moving sata from one internal table to other internal table, you can use the first internal table for output.
See code below, if you want to copy contents of one internal table to other:
Append lines of itab to new_tab.
OR
new_tab [] = itab1 [].
Thanks,
Sriram Ponna.
‎2008 Apr 16 7:24 AM
hi,
You can move like this
Loop at <Current internal table>
<final internal table>-val1 = <Current internal table>-val1.
<final internal table>-val2 = <Current internal table>-val2.
append <final internal table>.
endloop.
‎2008 Apr 16 7:27 AM
Hi,
If your internal table and final internal table is having same fields then do
i_final[] = i_itab[].
If some fields are different then
LOOP AT i_itab.
MOVE-CORRESPONDING i_itab TO i_final.
APPEND i_final.
CLEAR i_final.
ENDLOOP.
Pls. reward if useful...
‎2008 Apr 16 7:32 AM
Hi,
Think that you have four internal tables
itab, itab1, itab2 and it_final.
data: begin of itab occurs 0,
field1,
end of itab1.
data: begin of itab1 occurs 0,
field1,
field2,
end of itab1.
data: begin of itab2 occurs 0,
field1,
field4,
end of itab1.
data: begin of it_final occurs 0,
field1,
field2,
field4,
end of itab1.
Firstly you fill the internal tables itab itab1 and itab2.
loop at itab.
it_final-field1 = itab-field1.
read table itab1 with key field1 = itab-field1.
if sy-subrc = 0.
it_final-field2 = itab1-field2.
endif.
read table itab2 with key field1 = itab-field1.
if sy-subrc = 0.
it_final-field4 = itab2-field4.
endif.
append it_final.
clear it_final.
endloop.
‎2008 Apr 16 7:42 AM
Hi,
If the two internal tables structure is same then u can use the following code
itab1 = firstinternal table
itab2 = second internal table
move : wa_itab1 to wa_itab2.
append wa_itab2 to itab2.
By this code u can move all the contents to final interna table