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

Dynamic Transporting fields in Modify Internal table

Former Member
4,732

Hi,

Need to modify an internal table by transporting many fields but in dynamic way. As of now it is working good for one field. When I tried with multiple fields it is throwing error.

Below code is working fine for one field.

DATA lv_fields TYPE string.
lv_fields = 'BSART'.
MODIFY lt_data FROM lw_data TRANSPORTING (lv_fields) WHERE ebeln = lw_temp-ebeln.

Below code is throwing error as two fields are used.

DATA lv_fields TYPE string.
lv_fields = 'BSART BSTYP'.
MODIFY lt_data FROM lw_data TRANSPORTING (lv_fields) WHERE ebeln = lw_temp-ebeln.

Please provide a suggestion to use dynamic transporting with multiple fields.

Thanks in advance.

Regards,

Senthil kumar K

1 ACCEPTED SOLUTION
Read only

retired_member
Product and Topic Expert
Product and Topic Expert
3,102
DATA lv_field1 TYPE string.
DATA lv_field2 TYPE string.
lv_field1 = 'BSART'.
lv_field2 = 'BSTYP'.
MODIFY lt_data FROM lw_data TRANSPORTING (lv_field1) (lv_field2) WHERE ebeln = lw_temp-ebeln.
5 REPLIES 5
Read only

retired_member
Product and Topic Expert
Product and Topic Expert
3,103
DATA lv_field1 TYPE string.
DATA lv_field2 TYPE string.
lv_field1 = 'BSART'.
lv_field2 = 'BSTYP'.
MODIFY lt_data FROM lw_data TRANSPORTING (lv_field1) (lv_field2) WHERE ebeln = lw_temp-ebeln.
Read only

0 Likes
3,102

Hi Horst,

Thanks for your quick response. Very much appreciated.

So for each field we need to declare separate data object.

Thought there will be an option to have only one data object for N fields. So in that case it will become fully dynamic thus helping developer not to consider number of data objects to be declared even if the fields count are varying.

Thanks and Regards,

Senthil kumar K

Read only

0 Likes
3,102

Yep, as documented. No internal table solution here, as we have it for SORT.

You have to prepare a set of fields and leave those empty, which you don't need.

Read only

former_member196331
Active Contributor
0 Likes
3,102

What is the error.?

Read only

0 Likes
3,102

Getting error as ITAB_ILLEGAL_COMPONENT