2006 Oct 19 11:39 AM
Hi,
I would like to move fields from one internal table into corresponding fields of another internal table.
move-corresponding syntax seems only to work with structures. How do you accomplish this for internal tables? Do I have to use for loops?
regards
Baran
2006 Oct 19 11:48 AM
Hi baran,
yes u have to use the loop.
say one internal table is itab and the other is itab1
also workarea are wa_tab,wa_tab1 respectively.
Loop at itab into wa_tab.
move-corresponding wa_tab to wa_tab1.
append itab1 from wa_tab1.
clear : wa_tab,
wa_tab1.
Endloop.
regards,
Nagaraj
Hi baran,
yes u have to use the loop.
say one internal table is itab and the other is itab1
also workarea are wa_tab,wa_tab1 respectively.
Loop at itab into wa_tab.
move-corresponding wa_tab to wa_tab1.
append itab1 from wa_tab1.
clear : wa_tab,
wa_tab1.
Endloop.
regards,
Nagaraj
2006 Oct 19 11:40 AM
Loop at itab into wstab.
move-corresponding wstab to newtab.
append itab1 from newtab.
Endloop.
2006 Oct 19 11:48 AM
Hi baran,
yes u have to use the loop.
say one internal table is itab and the other is itab1
also workarea are wa_tab,wa_tab1 respectively.
Loop at itab into wa_tab.
move-corresponding wa_tab to wa_tab1.
append itab1 from wa_tab1.
clear : wa_tab,
wa_tab1.
Endloop.
regards,
Nagaraj
2006 Oct 19 11:49 AM
loop at itab.
move corresponding fields of itab to itab1.
append itab1.
clear itab1.
endloop.
2006 Oct 19 11:53 AM
Yes you have to use loops and move-correspoding statements unless you have all the common fields in the same order on both internal table and no different fields to the left most.
eg:
data: begin of itab1 occurs 0,
field1 type i,
end of itab1.
data: begin of itab2 occurs 0,
field1 type i,
field2(1),
end of itab2.
do 5 times.
itab1-field1 = sy-index.
append itab1.
enddo.
itab2[] = itab1[].
loop at itab2.
write:/ itab2-field1.
endloop.
The above code would give you some idea.
Regards,
ravi
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |