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

Error in Modify statement and getting dump while running in background.

Neslinn
Participant
0 Likes
2,123

Hi all,

While executing a program in background i am getting the dump with the error 'TABLE_ILLEGAL_STATEMENT'.

In the dump it is showing the error line as the modify statement.

Error code:-

LOOP AT gt_order_sub_data.

gt_list_subs-sel_flag = 'X'.

-> MODIFY gt_list_subs TRANSPORTING sel_flag.

Endloop.

Is there any issue with the modify statement?.

Regards,

Neslin.

6 REPLIES 6
Read only

Former Member
0 Likes
1,000

Hi Neslin,

use this code...

LOOP AT gt_order_sub_data.

gt_list_subs-sel_flag = 'X'.

MODIFY gt_list_subs index sy-tabix TRANSPORTING sel_flag .

Endloop.

Hope this would solved.

please do reward if solved.

Amit.

Read only

former_member609120
Contributor
0 Likes
1,000

Error code:-

LOOP AT gt_order_sub_data.

gt_list_subs-sel_flag = 'X'.

-> MODIFY gt_list_subs TRANSPORTING sel_flag.

Endloop.

I think the below code shud work

LOOP AT gt_order_sub_data.

Read table gt_list_subs with key < specify the fields >

if sy-subrc = 0

gt_list_subs-sel_flag = 'X'.

MODIFY gt_list_subs TRANSPORTING sel_flag.

endif.

ENDLOOP.

Instead of Read table you can use LOOP AT gt_list_subs also

OR

only MODIFY gt_list_subs index sy-tabix TRANSPORTING sel_flag .

Read only

Former Member
0 Likes
1,000

Hi,

The thing is you are looping on another table and modifying another table. If you have to modify another table then either loop on it or use MODIFY TABLE ...

Reward points if usefull.

Read only

0 Likes
1,000

Khusro Habib,

Thanks for pointing out tht. I have to be more attentive before posting the qns.:)

Thanks,

Neslin.

Read only

Former Member
0 Likes
1,000

Hi,

you are trying to modify a different table in the loop. if you want to modify a different table other than the table which you are looping try reading the internal table first basing on the loop table and then use modify statement with index.

Regards,

Aravind M