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

Modify itab - assignment of Values dynamically to transporting

Former Member
0 Likes
635

Hi,

Using dynamic fieldlist based on certain conditions in SELECT statement.

data: fdlist TYPE STANDARD TABLE OF line WITH HEADER LINE.

create fieldlist as which can have n no of fields

concatenate FDLIST wfieldcat-fieldname into fDList.

Now want to select from table and want to modify only those fields of internal table which are getting modified.

loop at itab into wa_itab.

SELECT single (fdlist) from BSEG into

corresponding fields of itab

WHERE BELNR = wa_itab-BELNR.

modify itab from wa_itab transporting (fdlist)

where belnr = wa_itab_BELNR.

endloop.

this loop is working fine for one field but in case of more than one gives error. The dynamic works fine if no of fields are specified as (f1) (f2) (f3).

how to determine dynamically the no of fields. and specify.How can I assign vlues dynamically to fields to transporting statement.

Thanks

pa

Hi,

Using dynamic fieldlist based on certain conditions in SELECT statement.

data: fdlist TYPE STANDARD TABLE OF line WITH HEADER LINE.

create fieldlist as which can have n no of fields

concatenate FDLIST wfieldcat-fieldname into fDList.

Now want to select from table and want to modify only those fields of internal table which are getting modified.

loop at itab into wa_itab.

SELECT single (fdlist) from BSEG into

corresponding fields of itab

WHERE BELNR = wa_itab-BELNR.

modify itab from wa_itab transporting (fdlist)

where belnr = wa_itab_BELNR.

endloop.

this loop is working fine for one field but in case of more than one gives error. The dynamic works fine if no of fields are specified as (f1) (f2) (f3).

how to determine dynamically the no of fields. and specify.How can I assign vlues dynamically to fields to transporting statement.

Thanks

pa

1 REPLY 1
Read only

Former Member
0 Likes
361

Hi Anya,

I don't know how to specifiy a list of filed in istruction "modify... transporting".

Anyway, you could use:

modify itab from wa_itab transporting (FIELD_1) (FIELD_2) (FIELD_3) (FIELD_4).... (FIELD_N),

if you have for example only 2 fields to update, you must set the value of field_1 and field_2. field_3 to field_n will be not considered from modify instruction.

If you have more than n fields to update, you could use a do/enddo until all your fields are updated.

Hope this could be helpful.

Regards

Andrea