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

Modify statement not working properly inside the loop

Former Member
0 Likes
2,108

Hi All,

My internal table is having 6 fields among them 4 fields are filled with some values and i need to fill the other 2 fields using filled fields.

so i am looping the internal table into work area and filling the remaining 2 fields using 'MODIFY' and Sy-TABIX commond.

when i execute in debugging mode the empty 2 fields are filling in to the corresponding row properly, but when i loop the internal table after filling all empty fields of each row, the values are getting interchanged.

i used MODIFY itab from WA index sy-tabix.

i am not getting a clue why the calculated values are getting inter changed??????????? plz suggest

Thanks,

Harish

4 REPLIES 4
Read only

Former Member
0 Likes
840

Hi Harish,

It will be better to understand the problem if you paste your code snippet here.

Regards,

Santanu Mohapatra.

Read only

vinoth_aruldass
Contributor
0 Likes
840

hi harish,

while looping your internal table itself you do one thing,

data : int type i.

loop at itab into wa.

int = sy-tabix.

do the changes

and

modify itab from wa index int.

try this will work

hope it helps,

Vinoth

Read only

kakshat
Product and Topic Expert
Product and Topic Expert
0 Likes
840

Hi Harish,

Why don't you use a field-symbol? Then, you won't have to use the MODIFY statement at all.

LOOP AT itab ASSIGNING <field-symbol>

Read only

Former Member
0 Likes
840

Hi Harish,

Please try to add keyword TRANSPORTING on the MODIFY command.

     MODIFY itab from WA index sy-tabix TRANSPORTING field1 field2.

And make sure the MODIFY command is executed inside the loop.

Regards,

Oki