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

Fieldsymbol assignment

Former Member
0 Likes
455

Hi,

I want to perform a field symbol assign for a dynamic data type(Structure).But i am not sure how the components

of the structure need to be accessed at runtime.

Ex:

'text' - VARIABLE which contains the structure name.

...................................

DATA : ls_DATA TYPE REF TO DATA.

field-symbols: <fs_list> type any.

CREATE DATA ls_DATA TYPE (text).

assign ls_data->* to <fs_list>.

.................................................

.............................

In all the target structures a field named 'VALUE' will be present.And i want to populate it with some value.

How do i access that at runtime?

<fs_list>-VALUE cannot be used DIRECTLY?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
426

You need to know the column name that you want to access.

ASSIGN COMPONENT 'COLUMN1' OF STRUCTURE XXX TO <FS_ANY>.

Now, you have the value of column1 in <FS_ANY>.

You can even have a variable that holds the column name.

ASSIGN COMPONENT (COLUMN1) OF STRUCTURE XXX TO <FS_ANY>.

Regards,

Ravi

Note : Please mark all the helpful answers

4 REPLIES 4
Read only

andreas_mann3
Active Contributor
0 Likes
426

hi,

use command:

do.
 assign component sy-index of structure <fs_list> to <f>.
 if sy-subrc <> 0.
  exit.
 endif.
...
enddo.

regards Andreas

Read only

Former Member
0 Likes
426

DO.

ASSIGN COMPONENT SY-INDEX OF (STRUCTURE) TO <FS>.

WRITE: <FS>.

ENDDO.

Read only

Former Member
0 Likes
427

You need to know the column name that you want to access.

ASSIGN COMPONENT 'COLUMN1' OF STRUCTURE XXX TO <FS_ANY>.

Now, you have the value of column1 in <FS_ANY>.

You can even have a variable that holds the column name.

ASSIGN COMPONENT (COLUMN1) OF STRUCTURE XXX TO <FS_ANY>.

Regards,

Ravi

Note : Please mark all the helpful answers

Read only

0 Likes
426

Thanks a ton Ravi!Solved the problem