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: 

Modify ITAB from work area

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member

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

4 REPLIES 4

Former Member
0 Kudos

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.

0 Kudos

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

Former Member
0 Kudos

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.

Former Member

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