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

Internal Table modify transporting...

Former Member
0 Likes
1,392

Hi all,

I have a peculiar problem. I have an internal table in which i want to modify a perticular cell ( not the whole row) but which cell has to be modified should be decided dynamically in the program. I will explain this with code.

READ TABLE itab INTO wa WITH KEY key1 = 'ABC'.

IF sy-subrc IS INITIAL.

MODIFY itab FROM wa_new INDEX sy-tabix TRANSPORTING field1.

ELSE.

APPEND wa_new TO itab.

ENDIF.

field1 has to be decided at runtime...

Best regards,

Saurabh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
748

Try the below code.


field1 = 'FIELD1'.
read table itab into wa_new with key key1 = 'ABC'.
if sy-subrc is initial.
  modify itab from wa_new index sy-tabix transporting (field1).
else.
  append wa_new to itab.
endif.

Hope this helps.

Thanks,

Balaji

2 REPLIES 2
Read only

Sm1tje
Active Contributor
0 Likes
748

And based on what criteria is to be decided which field FIELD1 is?

Generally when doing dynamic 'stuff' you should use field-symbols.

Read only

Former Member
0 Likes
749

Try the below code.


field1 = 'FIELD1'.
read table itab into wa_new with key key1 = 'ABC'.
if sy-subrc is initial.
  modify itab from wa_new index sy-tabix transporting (field1).
else.
  append wa_new to itab.
endif.

Hope this helps.

Thanks,

Balaji