2007 Apr 03 11:25 AM
Hi,
I want to transfer data from one internal table to another.Both are having different structures.
eg
types : begin of st_stokes,
include type stokes,
count type i,
end of st_stokes.
data : itab1 type table of stokes,
itab2 type table of st_stokes.
itab1 is having the required data.
Thanks
Hi,
I want to transfer data from one internal table to another.Both are having different structures.
eg
types : begin of st_stokes,
include type stokes,
count type i,
end of st_stokes.
data : itab1 type table of stokes,
itab2 type table of st_stokes.
itab1 is having the required data.
Thanks
2007 Apr 03 11:26 AM
2007 Apr 03 11:27 AM
try
itab2[] = itab1[].
if it doesn't work, you have to do this:
loop at itab1.
move-corresponding itab1 to itab2.
append itab2.
clear itab2.
endloop.
Regards,
Ravi
2007 Apr 03 12:24 PM
hi,
Once i move data from itab1 to itab2 and then i am performing:
loop at itab1 into w1.
move-corresponding w1 to w2.
write : / sytabix , w2-col , w2-str.
append w2 to itab2.
clear w2.
endloop.
it shows error that STR and COL is not the component of itab2.
2007 Apr 03 12:25 PM
Hi..,
What r u trying to write in the loop ???
i hope this meets ur requirement....
types : begin of st_stokes,
include type stokes,
count type i,
end of st_stokes.
data : itab1 type table of stokes,
itab2 type table of st_stokes,
<b>wa1 type stokes,
wa2 type st_stokes.
loop at itab1 into wa1.
move-corresponding wa1 to wa2.
wa2-count = sy-tabix.
append wa2 to itab2.
clear wa2.
endloop.</b>
regards,
sai ramesh
2007 Apr 03 12:34 PM
Hi,
theirs some value in wa2-str and wa2-col ,which i have to print?
Thanks.
2007 Apr 03 12:39 PM
hi,
pls chk these fields str and col are available in stokes structure.
Rgds
anversha
2007 Apr 03 12:42 PM
HI..,
while including a structure i mean INCLUDE <structure> the definition style will change..
<u>check its working here...
the definition of st_stokes should be like this ( when u are using INCLUDE structure )...</u>
<b>types begin of st_stokes.
include type stokes.
types count type i.
types end of st_stokes.</b>
data : itab1 type table of stokes,
itab2 type table of st_stokes,
wa1 type stokes,
wa2 type st_stokes.
loop at itab1 into wa1.
move-corresponding wa1 to wa2.
wa2-count = sy-tabix.
write : wa2-str, wa2-col.
append wa2 to itab2.
clear wa2.
endloop.
plz do rememeber to close the thread, when ur problem is solved !! thanks,
reward points if helpful..
sai ramesh
2007 Apr 03 11:27 AM
hi,
check this.
data : begin of itab1 occurs 0. "itab with work area.
key_field1 like ztable1-key_field1,
field1 like ztable1-field1,
field2 like ztable1-field2,
endof itab1.
data : begin of itab2 occurs 0. "itab with work area.
key_field2 like ztable2-key_field2,
field3 like ztable2-field3,
field4 like ztable2-field4,
endof itab2.
data : begin of itab_final occurs 0.
key_field1 like ztable1-key_field1,
field1 like ztable1-field1,
field2 like ztable1-field2,
field3 like ztable2-field3,
field4 like ztable2-field4,
endof itab_final.
put the date final(merged) internal table
*****************************************
1. loop at itab1.
read table itab2 with key keyfield2 = itab1-keyfield1.
if sy-surc = 0.
itab_final-key_field1 = itab1-keyfield1
itab_final-field1 = itab1-field1.
itab_final-field2 = itab1-keyfield2.
itab_final-field3 = itab2-field2.
itab_final-field4 = itab2-keyfield2.
append itab_final.
clear itab_final.
endif.
endloop.
or
LOOP AT ITAB1.
MOVE-CORRESPONDING TO ITAB1 to ITAB_FINAL.
READ TABLE ITAB2 WITH KEY FILED1 = ITAB1-FIELD1.
if sy-subrc = 0.
MOVE-CORRESPONDING TO ITAB2 to ITAB_FINAL.
endif,
READ TABLE ITAB3 WITH KEY FILED1 = ITAB1-FIELD1.
if sy-subrc = 0.
MOVE-CORRESPONDING TO ITAB2 to ITAB_FINAL.
endif,
append itab_final.
clear itab_final.
endloopRgds
Anversha
2007 Apr 03 11:28 AM
Hi..
assuming ur tables with header lines..
loop at itab1.
move-corresponding itab1 to itab2.
append itab2.
endloop.
2007 Apr 03 12:30 PM
Hi,
Try this:
loop at itab1.
move corrosponding itab1 into itab2.
append itab2.
endloop.
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |