08-25-2008 11:21 PM
Hello,
I am modifying one internal table from a structure created which is similar to the itab structure.
I am getting short dump.
Data: wl_komv TYPE komv.
" FT_KOMV TYPE KOMV_TAB --> This is a tables parameter of a function module, So internal table.
MODIFY ft_komv from wl_komv.
So I am getting error as :
ST 22 Dump:
Runtime Error TABLE_ILLEGAL_STATEMENT
Error analysis
You attempted to change, delete or create a line in the
internal table 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
Please advice.
Thanks and rgds,
Anand
08-26-2008 2:43 AM
Hi
Can you try this:
If condition satisfies:
MODIFY ft_komv from wl_komv indes sy-tabix.
If condition not satisfies:
APPEND wl_komv TO ft_komv .
Hope it Helps.
Thanks
Praveen
08-25-2008 11:42 PM
Hi
Instead of using this way,
Data: wl_komv TYPE komv.
" FT_KOMV TYPE KOMV_TAB
you can actually create work area using the same table type(in FM) that u are using for internal table by defining work area as
data: wl_komv like line of KOMV_TAB.
now your work area will be in the same stucture as that of internal table.I think this may solve your problem
Regards,
Chinni.
08-26-2008 12:49 AM
Hi,
No, it did not solve the issue.
My que is;
I want to insert a row in ITAB if particular record with key (condition type ) does not exists.
I want to modify the existing record if it exists already.
But I am not able to do it and getting dump.
So pls. advice more info about the " modify itab" statement.
I do not have index of the table, as well as I do not have key to write a where clause. I cannot write transporting clause bcos field list is very huge.
Rgds,
Anand
08-26-2008 2:01 AM
Hi,
Data: wl_komv TYPE komv.
" FT_KOMV TYPE KOMV_TAB --> This is a tables parameter of a function module, So internal table.
MODIFY ft_komv from wl_komv.
wl_komv and ft_komb have different type.
so if you want to modify ft_komv,
use like this.
data: ft_komv type komv_tab
data: wa_komv like ft_komv.
Regards.
08-26-2008 2:43 AM
Hi
Can you try this:
If condition satisfies:
MODIFY ft_komv from wl_komv indes sy-tabix.
If condition not satisfies:
APPEND wl_komv TO ft_komv .
Hope it Helps.
Thanks
Praveen