11-13-2009 5:44 PM
hi all,
my modify statement is not working proerply. can any one help me in this regard...
IF NOT i_vetvg IS INITIAL.
SELECT mblnr mjahr bwart FROM mseg
INTO TABLE i_gr
FOR ALL ENTRIES IN i_vetvg
WHERE ebeln EQ i_vetvg-vbeln.
LOOP AT i_gr INTO wa_gr.
CASE wa_gr-bwart.
WHEN '643'.
wa_final-gr = wa_gr-mblnr.
MODIFY i_final FROM wa_final index sy-tabix TRANSPORTING gr.
WHEN '101'.
wa_final-in_gr = wa_gr-mblnr.
MODIFY i_final FROM wa_final index sy-tabix TRANSPORTING in_gr.
ENDCASE.
ENDLOOP.
ENDIF.
i_gr exapmle data
1 2009 643
2 2009 101
5 2009 643
6 2009 101
here my second modify statement is not working. first statemet is working perfectly.
11-13-2009 7:16 PM
Hi Senthil,
Try this your problem will be solved:
Assign sy-tabix to a local variable and the use it .
Also check the number of records in i_final, is that index persent?
Edited by: Harsh Bhalla on Nov 14, 2009 12:49 AM
11-13-2009 6:19 PM
i cant say for sure, becuase i am not sure what is is you are trying to do, but what is in i_final at the beginning of all of this? you are looping over i_gr and modifying i_final using the tabix from i_gr.. this assumes that i_gr and i_final are identical GOING IN to your loop, or it wont work.
11-13-2009 6:23 PM
Hello,
What is the structure of i_final? Even i think the problem is because of using the modify statement using sy-tabix which may not yield desireable results. If you have any common field between i_final and i_gr, the results would be more accurate
Vikranth
11-13-2009 6:30 PM
correct. you need to READ an entry with a key or some other method from i_final before you change the data and MODIFY it.
11-13-2009 7:16 PM
Hi Senthil,
Try this your problem will be solved:
Assign sy-tabix to a local variable and the use it .
Also check the number of records in i_final, is that index persent?
Edited by: Harsh Bhalla on Nov 14, 2009 12:49 AM
11-14-2009 8:20 PM
Hi Senthil Kumar,
please post code as
code
where and how do you populate itab i_final? How do you know that sy-tabix of table i_gr always matches i_final.
This does not look like good programming.
Regards,
Clemens
11-15-2009 7:03 AM