2008 Mar 25 1:20 PM
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
2008 Mar 25 1:33 PM
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.
2008 Mar 25 1:33 PM
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.
2008 Mar 25 1:42 PM
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