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 Field mapping

Former Member
0 Likes
690

Hi,

I need to map the fields from Internal table to Database table. I have the fieldnames as rows from excel sheet. Need to update the value in Database table. Example,

My internal table has following records.

fieldname1 value

fieldname2 value

fieldname3 value

....

....

fieldname50 value

Need to compare the field name with the Database field name and update the value from the field value.

Please advice me the best method.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
551

Best method = using field symbols.

Example:

table KNA1, fields KUNNR and NAME1.

Internal table itab row 1 :

itab-fieldname KNA1-KUNNR

itab-value 123456

FIELD-SYMBOLS <f>

ASSIGN (itab-fieldname) TO <f>.

<f> = itab-value.

Result : KNA1-KUNNR will be filled with 123456

1 REPLY 1
Read only

Former Member
0 Likes
552

Best method = using field symbols.

Example:

table KNA1, fields KUNNR and NAME1.

Internal table itab row 1 :

itab-fieldname KNA1-KUNNR

itab-value 123456

FIELD-SYMBOLS <f>

ASSIGN (itab-fieldname) TO <f>.

<f> = itab-value.

Result : KNA1-KUNNR will be filled with 123456