‎2008 May 12 5:55 AM
data: begin of itab occurs 0,
.
.
.
.
gdatu1(10) type c,
end of itab.
DATA: BEGIN OF ITAB2 OCCURS 0,
GDATU1(10) TYPE C,
END OF ITAB2.
there are more than one line items in itab...i want to trnsfer
data from itab2 to itab....
i tried this one:
LOOP AT ITAB2.
MOVE-CORRESPONDING ITAB2 TO ITAB.
modify itab." transporting gdatu1.
ENDLOOP.
but it shows run time error at the endloop statement....when i use modify itab transporting gdatu1.
it shows runtime error on this line..
any solution....
‎2008 May 12 6:03 AM
Hi Sandeep,
Whenever if you use Move-Corresponding see that the structure in both the internal tables are same(in your case ITAB and ITAB2). Instead move the single field as per your requirement(move itab2-xxxx to itab-xxxx).
Regards,
Naresh
*Please Reward points if found useful
‎2008 May 12 6:05 AM
hi,
use index while using modify.
Loop AT itab.
Read itab1 ..with key.. field = itab-field.
v_index = sy-tabix.
Modify itab index v_index from itab-field
ENDLOOP.
please reward if helpful .
‎2008 May 12 6:05 AM
Change it like this -
LOOP AT ITAB2.] into wa_itab2.
.
modify itab from wa_itab2 transporting gdatu1. (Check Syntax for Modify)
ENDLOOP.
‎2008 May 12 6:06 AM
Hi,
try as follows
loop at itab2.
move itab2-gdatu1 to itab-gdatu1.
endloop.
Regards,
kk.
‎2008 May 12 6:33 AM
hi,
As far as i understood ur query, your table ITAB2 has only one field which you want to update in table ITAB. But do you have any primary or common field in both ur tables?? Or is it that you require whatever data there is in itab2 to ur itab... if that is the case y do u need to fill the data in itab2 table because there is no one to one correspondence in both the tables. it would be better that you take the gdatu as a variable and not in a table. then you can loop at table itab and modify its records with the gdatu field. for eg
data : sgdatu like ....-gdatu.
loop at itab .
itab-gdatu = sgdatu.
modify itab index sy-index.
endloop.
Try this.
Hope it is helpful to you.
Reward if useful.
Regards,
Anu,