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

Modifying Internal Table

Former Member
0 Likes
1,696

Hi all,

When i try to use modify statement for an internal table.... the sy-subrc after the Modify statement is 4 and hence the internal table is not modified... can you help me how 2 solve this error?

The code is as given below:

<b>loop at g_t_p0014 where lgart eq p_lgart and begda eq p_begda.

if sy-subrc EQ 0.

g_f_chck = 'X'.

Endif.

itab-check = g_f_chck.

MODIFY itab transporting check where check = g_f_chck.

ENDLOOP.

The contents of itab are: pernr and check.</b>

Message was edited by: Abhijith H

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,362

Hello,

Use

MODIFY itab index 1.

Reward if useful.

Regards,

Vasanth

10 REPLIES 10
Read only

Former Member
0 Likes
1,362

hello,

Please use the index addition with modify statement in order to modify the internal table properly.

May be The flag 'X' is not found in the internal table..

That may also cause your sy-subrc eq 4.

Reward if it helps.

Regards,

krishnakumar

Message was edited by: Krishnakumar

Read only

Former Member
0 Likes
1,363

Hello,

Use

MODIFY itab index 1.

Reward if useful.

Regards,

Vasanth

Read only

Former Member
0 Likes
1,362

Hi abhijit ,

use modify stmnt withoit where clause.

Regards,

Sumit.

Read only

Former Member
0 Likes
1,362

Abhijith

loop at g_t_p0014 where lgart eq p_lgart and begda eq p_begda.

if sy-subrc EQ 0.

g_f_chck = 'X'.

Endif.

itab-check = g_f_chck.

<b>MODIFY itab Transporting check where check = space.</b>

ENDLOOP.

Thanks

Jack

<b>Allot points if my post helps!!!</b>

Message was edited by: Jack

Read only

Former Member
0 Likes
1,362

What are you trying to do here?

Can you tell us what is your requierement?

Regards,

ravi

Read only

Former Member
0 Likes
1,362

hi abhijit,

you please check ur code carefully. I guess ur requirement is to mark the field itab-check = 'X' in the table itab for all the pernr available in the table g_t_p0014. In ur code u havent related both the tables using pernr.

i think following is the code u required.just paste the following code and try ...

data : g_index like sy-tabix.

loop at g_t_p0014 where lgart eq p_lgart and

begda eq p_begda.

clear : g_index .

itab-check = 'X'.

read table itab with key pernr = g_t_p0014-pernr.

g_index = sy-tabix.

if sy-subrc = 0.

MODIFY itab index sy-tabix.

endif.

ENDLOOP.

Read only

Former Member
0 Likes
1,362

<deletded>

for which pernr u want to modify the check

Message was edited by: Chandrasekhar Jagarlamudi

Read only

Former Member
0 Likes
1,362

Hi Abhijith,

As your syntax is fine, why don't you try a index as

MODIFY itab [FROM wa] [INDEX idx].

Here your internal table is g_t_p0014 and check you define your index value please and can send me your program here please try like this:

Modify itab index sy-tabix transporting check where check = g_f_chck.

Ankur Grag.

Message was edited by: Ankur Garg

Read only

Former Member
0 Likes
1,362

Thanks all of u ... the problem is solved..

<b>Modify itab index 1</b>.... this statement works.

Read only

0 Likes
1,362

if u modify with index 1, always the first row of itab table only will be updated..