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

Refer to a variable via another variable

Former Member
0 Likes
417

Hi all,

I have a structure with many fields eg

begin of struc

field01

field02

fieldnn

end of struc

I then work out a variable to get to one field in struc eg

concatenate 'struc-field' lv_num into lv_temp.

(lv_temp now has 'struc-field15' in it as a value).

I would like to use something like:

move '12345' to lv_temp. (where I want the value 12345 to end up in struc-field15 not in lv_temp).

Any help will be appreciated.

Regards

Michael

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
393

Hi,

Use field-symbols ..

Ex..

FIELD-SYMBOLS: <FS>.

ASSIGN (LV_TEMP) TO <FS>.

<FS> = '1234'.

Working example..

-


data: begin of struc,

field1(10),

end of struc.

DATA: lv_temp type char30.

lv_temp = 'STRUC-FIELD1'.

FIELD-SYMBOLS: <FS>.

ASSIGN (LV_TEMP) TO <FS>.

<FS> = '1234'.

WRITE: / STRUC-FIELD1.

Thanks,

Naren

Message was edited by: Narendran Muthukumaran

3 REPLIES 3
Read only

Former Member
0 Likes
394

Hi,

Use field-symbols ..

Ex..

FIELD-SYMBOLS: <FS>.

ASSIGN (LV_TEMP) TO <FS>.

<FS> = '1234'.

Working example..

-


data: begin of struc,

field1(10),

end of struc.

DATA: lv_temp type char30.

lv_temp = 'STRUC-FIELD1'.

FIELD-SYMBOLS: <FS>.

ASSIGN (LV_TEMP) TO <FS>.

<FS> = '1234'.

WRITE: / STRUC-FIELD1.

Thanks,

Naren

Message was edited by: Narendran Muthukumaran

Read only

0 Likes
393

Thanks Narendran

I was using field symbols but was missing the brackets around lv_temp, so I couldnt get it to work.

Many thanks for your help.

Points awared.

Regards

Michael

Read only

Former Member
0 Likes
393

.