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

modify

Former Member
0 Likes
913

hi experts

when i run this code(part of big program):

LOOP AT tline1.

MOVE eban-banfn TO ltext-req.

MOVE eban-bnfpo TO ltext-num.

MOVE tline1-tdline TO ltext-text1.

MODIFY ltext.

ENDLOOP.

it gives me an abap runtime error TABLE_ILLEGAL_STATEMENT:

You attempted to change, delete or create a line in the

internal table "\PROGRAM=Z110M07R\DATA=LTEXT[]", but no valid cursor exists

for the table.

Possible reasons:

1. The relevent ABAP/4 statement does not include the addition

"...INDEX...", although the statement is not

inside a "LOOP...ENDLOOP" loop processing this table.

2. The relevent ABAP/4 statement was called from within a

"LOOP...ENDLOOP" loop after a DELETE "\PROGRAM=Z110M07R\DATA=LTEXT[]".

i did this a lot of times in the past what's wrong now.

thanks

Amit

9 REPLIES 9
Read only

Former Member
0 Likes
880

Hi,

if you modify an existing record you must specify the index of this record, else you must use append.

Read only

Former Member
0 Likes
880

READ TABLE ltext WITH key <condition>

MODIFY ltext INDEX sy-tabix.

This will work

Swarup

Edited by: swarup basagare on Jul 2, 2008 11:08 AM

Read only

Former Member
0 Likes
880

There is no statement to have access to your internal table ltext. Use either a READ or LOOP statement on this table to find the correct entry in ltext you want to modify.

Regards,

John.

Read only

Former Member
0 Likes
880

Hi,

It might be giving you error at modify statement.

use modify itab from workarea transprting field where condition.

Regards,

Bharat

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
880

You cannot modify ltext without specying the index...

try like this

LOOP AT tline1.

read table ltext with _____ <----


use this statement

if sy-subrc = 0.

v_tabix = sy-tabix.

MOVE eban-banfn TO ltext-req.

MOVE eban-bnfpo TO ltext-num.

MOVE tline1-tdline TO ltext-text1.

MODIFY ltext index v_tabix.

endif.

ENDLOOP.

Read only

Former Member
0 Likes
880

Hello

APPEND ltext.

Read only

Former Member
0 Likes
880

hi.....

you can use modify itab index tab.

i have faced a similar situation earlier.

you cantry this.

Read only

Former Member
0 Likes
880

Dear Amit,

When u declare ur table it may contain one records or many records and if you want it to be changed then u pass data inside loop as u did but anywhere it is not getting modify it means it doesn't know, on which number it has to attack, before endloop write modify itab index sy-tabix from wa.

It will work .

regards

Rag

Read only

Former Member
0 Likes
880

Hi,

You are looping one table and trying to modify some other table.

That is the reason you are getting the dump.

Thanks,

Sriram POnna.