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

type any

Former Member
0 Likes
1,330

Hi,

i have a variable from type any.

data lv_xyz type any.

How can refer to its components while

runtime. I dont the syntax.

MAybe something with assign ?

regards

sas

1 ACCEPTED SOLUTION
Read only

matt
Active Contributor
0 Likes
1,287

Assuming CREATED_BY is first field in the structure of your data, both ASSIGN COMPONENTS below will work. You probably want the second one.

FIELD-SYMBOLS: <some_data>  TYPE ANY,
               <some_field> TYPE ANY.

DATA: l_field TYPE fieldname VALUE 'CREATED_BY'.

ASSIGN COMPONENT 1 OF STRUCTURE <some_data> TO <some_field>.

ASSIGN COMPONENT l_field OF STRUCTURE <some_data> TO <some_field>.

matt

4 REPLIES 4
Read only

Former Member
0 Likes
1,287

you can refer only using fieldsymbols.

it is not possible to define TYPE ANY using DATA.

field-symbols: <fs> type any.

after field-symbol assignment , you can access the components in it , using the assign component.

Read only

Former Member
0 Likes
1,287

Hi u can't define data type like type any.

it used to define only for field-symbols.

Read only

0 Likes
1,287

Hello this is not possible,

data lv_bu_pa_guid type PARTNER_GUID.

FIELD-SYMBOLS: <fs_is_he_line> TYPE ANY.

ASSIGN IS_HDR_LINE TO <fs_is_he_line>.

*if <fs_is_he_line>-CREATED_BY <> GS_USER_INFO-USER_NAME.

I get erromessage is not a structure therefore

it hasn't a component named CREATED_BY

Read only

matt
Active Contributor
0 Likes
1,288

Assuming CREATED_BY is first field in the structure of your data, both ASSIGN COMPONENTS below will work. You probably want the second one.

FIELD-SYMBOLS: <some_data>  TYPE ANY,
               <some_field> TYPE ANY.

DATA: l_field TYPE fieldname VALUE 'CREATED_BY'.

ASSIGN COMPONENT 1 OF STRUCTURE <some_data> TO <some_field>.

ASSIGN COMPONENT l_field OF STRUCTURE <some_data> TO <some_field>.

matt