06-29-2009 6:43 AM
Hi abapers,
loop at itab.
read table ifinal with key kunnr = itab-kunnr.
if sy-subrc = 0.
move: ifinal-dmbtr to itab-dmbtr.
modify itab index sy-tabix.
endif.
endloop.
Now the problem is that when i am using modify index sy-tabix it creating an additional entry
and when i am using only modify itab its working fine so wat could be the reason that modify index sy-tabix is
not working propertly.
Thanks
06-29-2009 6:47 AM
Hi,
Try with the following code
Data: lv_index type sytabix.
loop at itab.
lv_index = sy-tabix.
read table ifinal with key kunnr = itab-kunnr.
if sy-subrc = 0.
move: ifinal-dmbtr to itab-dmbtr.
modify itab index lv_index .
endif.
endloop.
Regards,
Raju.
06-29-2009 6:47 AM
Hi,
Try with the following code
Data: lv_index type sytabix.
loop at itab.
lv_index = sy-tabix.
read table ifinal with key kunnr = itab-kunnr.
if sy-subrc = 0.
move: ifinal-dmbtr to itab-dmbtr.
modify itab index lv_index .
endif.
endloop.
Regards,
Raju.
06-29-2009 6:51 AM
thanks all of u for ur quick response,
see actually i have already solved the problem,
the only thing that i wanted to know that why is this happening...
like any reason..
06-29-2009 6:53 AM
Hi Aarif,
When you read the internal table your SY_TABIX changes and it takes the SY_TABIX of internal table(READ) and not the Loop one.
So, by assigning SY-tabix to lv_tabix after the Loop, solves your problem.
Hope this resolves your query.
Regards,
Manish
06-29-2009 6:56 AM
06-29-2009 6:48 AM
Hi Arif,
try this..
loop at itab.
read table ifinal with key kunnr = itab-kunnr.
if sy-subrc = 0.
move: ifinal-dmbtr to itab-dmbtr.
modify itab transporting dmbtr.
endif.
endloop.
06-29-2009 6:50 AM
Hi,
The problem with your code is the right sy-tabix not used.
Try out this.
loop at itab.
read table ifinal with key kunnr = itab-kunnr.
v_index = sy-tabix.
if sy-subrc = 0.
move: ifinal-dmbtr to itab-dmbtr.
modify itab index v_index.
endif.
endloop.
06-29-2009 6:50 AM
Hi Aarif,
I am assuming there is one-to-one relationship between itab and ifinal.
Try using following code.
sort itab by kunnr.
sort ifinal by kunnr.
data: l_index like sy-tabix.
l_index = 1.
loop at itab.
loop at ifinal from l_index.
if ifinal-kunnr eq itab-kunnr.
move: ifinal-dmbtr to itab-dmbtr.
elseif ifinal-kunnr gt itab-kunnr.
move sy-tabix to l_index.
exit.
endif.
endloop.
modify itab transporting dmbtr.
endloop.
Regards,
Anil Salekar
06-29-2009 6:51 AM
assign sy-tabix value to one varaible and then use modify statement
regards,
Prajakta
06-29-2009 6:51 AM