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 assign

Former Member
0 Likes
284

Hi guys,

searched a long time, but didn't find anything. My problem:

I receive a table with following structure:

ls_struc-tabname

ls_struc-fieldname

ls_struc-value

Now, i need to save this value in given tab and field, e.g. the table consists this data

ls_struc-tabname = 'SFLIGHT'.

ls_struc-fieldname = 'CARRID'.

ls_struc-value = 'AA'.

ls_struc-tabname = 'SFLIGHT'.

ls_struc-fieldname = 'CONNID'.

ls_struc-value = '1234'.

With this data i have to fill the structure ls_sflight (type sflight) (table name is known, only field/value can be different/change):

ls_sflight-carrid = 'AA'.

ls_sflight-connid = '1234'.

How to get this data in this structure? Tried it with field symbols, but can't define the field dynamically

assign value of structure ls_struc to <fs_sflight>-[ls_struc-fieldname] ??? something like this possible?

1 ACCEPTED SOLUTION
Read only

MarcinPciak
Active Contributor
0 Likes
265

Hi Christopher


data: ls_sflight type sflight,
        field(50) type c.

field-symbols <fs> type any.
 
concatenate 'LS_SFLIGHT-' ls_struc-fieldname into field.
condense field.

assing (field) to <fs>.
<fs> = ls_struc-value.

Regards

Marcin

1 REPLY 1
Read only

MarcinPciak
Active Contributor
0 Likes
266

Hi Christopher


data: ls_sflight type sflight,
        field(50) type c.

field-symbols <fs> type any.
 
concatenate 'LS_SFLIGHT-' ls_struc-fieldname into field.
condense field.

assing (field) to <fs>.
<fs> = ls_struc-value.

Regards

Marcin