Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

internal table query

former_member530652
Participant
0 Likes
525

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....

5 REPLIES 5
Read only

Former Member
0 Likes
505

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

Read only

Former Member
0 Likes
505

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 .

Read only

amit_khare
Active Contributor
0 Likes
505

Change it like this -

LOOP AT ITAB2.] into wa_itab2.

.

modify itab from wa_itab2 transporting gdatu1. (Check Syntax for Modify)

ENDLOOP.

Read only

Former Member
0 Likes
505

Hi,

try as follows

loop at itab2.

move itab2-gdatu1 to itab-gdatu1.

endloop.

Regards,

kk.

Read only

anub
Participant
0 Likes
505

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,