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: 

Invalid Cursor when I want to modify itab with READ TABLE ?

Former Member
0 Kudos
71

Following code causes a core dump and says invalid cursor.

What should I do if I want to change gt_itab .?

REPORT ZEV_READ_TABLE.

data: begin of gt_itab occurs 0,

key like vbrk-vbeln,

name(10) type C,

amount type i,

end of gt_itab .

start-of-SELECTION.

gt_itab-key = 1.

gt_itab-name = 'erkan'.

gt_itab-amount = 10.

append gt_itab.

gt_itab-key = 2.

gt_itab-name = 'dilem'.

gt_itab-amount = 20.

append gt_itab.

LOOP AT gt_itab.

write:/ gt_itab-key,

gt_itab-name,

gt_itab-amount.

ENDLOOP.

Read table gt_itab with key Key = 1.

if sy-subrc = 0.

gt_itab-amount = 100.

modify gt_itab.

endif.

Kind Regards.

Erkan VAROL

1 ACCEPTED SOLUTION

former_member194669
Active Contributor
0 Kudos
29

Change the code this way & try


modify gt_itab index sy-tabix.

1 REPLY 1

former_member194669
Active Contributor
0 Kudos
30

Change the code this way & try


modify gt_itab index sy-tabix.