Application Development 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: 

Field symbols

Former Member
0 Kudos
99

Hi Friends,

I have an internal table where I want to assign values into fields as below using field symbols. How do I get the value back into the workarea.

DATA : BEGIN OF it_out OCCURS 0,

m011 TYPE curr_tax_bvl_ly,

m021 TYPE curr_tax_bvl_ly,

m012 TYPE curr_tax_bvl_ly,

m022 TYPE curr_tax_bvl_ly,

m013 TYPE curr_tax_bvl_ly,

m023 TYPE curr_tax_bvl_ly,

END OF it_out.

FIELD-SYMBOLS: <fs_fld> TYPE ANY.

DATA : l_field(15) TYPE c.

CONCATENATE 'it_out-m' '02' '1' INTO l_field.

ASSIGN (l_field) TO <fs_fld>.

<fs_fld> = bsad-wrbtr.

Value of it_out-m021 is still initial ?

Please let me know how to get value into it_out-m021.

Thanks in advance

1 ACCEPTED SOLUTION

Former Member
0 Kudos
70

I modified your code so that I could test it. It appears your code is working fine. Perhaps your value in bsad-wrbtr is initial. Perhaps you are not MODIFYing it_out after filling the field.

This is what I tested and it worked fine.



DATA : BEGIN OF it_out,
  m011(10),
  m021(10),
  m012(10),
  m022(10),
  m013(10),
  m023(10),
END OF it_out.

DATA: my_value(10).

FIELD-SYMBOLS: <fs_fld> TYPE ANY.

DATA : l_field(15) TYPE c.

my_value = 'Got it'.

CONCATENATE 'it_out-m' '02' '1' INTO l_field.
ASSIGN (l_field) TO <fs_fld>.
<fs_fld> = my_value.

WRITE:/ it_out-m021.

2 REPLIES 2

Former Member
0 Kudos
71

I modified your code so that I could test it. It appears your code is working fine. Perhaps your value in bsad-wrbtr is initial. Perhaps you are not MODIFYing it_out after filling the field.

This is what I tested and it worked fine.



DATA : BEGIN OF it_out,
  m011(10),
  m021(10),
  m012(10),
  m022(10),
  m013(10),
  m023(10),
END OF it_out.

DATA: my_value(10).

FIELD-SYMBOLS: <fs_fld> TYPE ANY.

DATA : l_field(15) TYPE c.

my_value = 'Got it'.

CONCATENATE 'it_out-m' '02' '1' INTO l_field.
ASSIGN (l_field) TO <fs_fld>.
<fs_fld> = my_value.

WRITE:/ it_out-m021.

former_member589029
Active Contributor
0 Kudos
70

The coding looks good to me, if I execute it like this (replaced bsad-wrbtr with '15') it_out-m021 does get the value 15.

I assume you build up the field name dynamically. Make sure that the value is 02 and not 2. Go into the debugger and check where the assign fails, make sure to double check the values in l_field and bsad-wrbtr.

Hope that helps,

Michael