Application Development 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: 

modify statement problem

Former Member
0 Kudos

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.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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

6 REPLIES 6

Former Member
0 Kudos

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.

Former Member
0 Kudos

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

0 Kudos

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.

Former Member
0 Kudos

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

Clemenss
Active Contributor
0 Kudos

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

matt
Active Contributor
0 Kudos

What Clemens Li means is, when you post code, surround it with