‎2008 Jul 02 10:04 AM
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
‎2008 Jul 02 10:06 AM
Hi,
if you modify an existing record you must specify the index of this record, else you must use append.
‎2008 Jul 02 10:07 AM
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
‎2008 Jul 02 10:07 AM
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.
‎2008 Jul 02 10:09 AM
Hi,
It might be giving you error at modify statement.
use modify itab from workarea transprting field where condition.
Regards,
Bharat
‎2008 Jul 02 10:10 AM
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.
‎2008 Jul 02 10:11 AM
‎2008 Jul 02 10:12 AM
hi.....
you can use modify itab index tab.
i have faced a similar situation earlier.
you cantry this.
‎2008 Jul 02 10:26 AM
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
‎2008 Jul 02 10:29 AM
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.