2015 Jan 16 3:03 PM
Hi,
i defined field symbol like this:
FIELD-SYMBOLS: <LFS_01> .
i changed it_demand-fsc_seq field type from num2 to num3..i have below loop..
LOOP AT it_demand.
MOVE-CORRESPONDING it_demand TO IT_OUT.
CONCATENATE 'IT_OUT-DMD' it_demand-fsc_seq INTO L_FIELD_NAME.
ASSIGN (L_FIELD_NAME) TO <LFS_01>.
<LFS_01> = it_demand-demand.-------> on here.. an error accured.
COLLECT IT_OUT.
CLEAR IT_OUT.
ENDLOOP.
Error message...ST22
A new value is to be assigned to the field "<LFS_01>", although this field is
entirely or partly protected against changes.
The following are protected from change:
- Character literals or numerical literals.
- CONSTANTS.
- Parameters of the category IMPORTING REFERENCE in functions and
methods.
Before i changed it_demand-fsc_seq field type, there was no error..How can i fix that ?
2015 Jan 16 10:52 PM
Hi,
in your structure it_out, do the fieldnames match the pattern DMDnnn? Since you changed the type to num3 , the assign would search for field of e.g. name IT_OUT-DMD001.
If the fieldname is still DMD01, the assign would fail, leaving whatever was assigned to <LFS_01> before (if any).
Besides, it is never a good idea to use a dynamically assigned field-symbol whithout checking SY-SUBRC first.
Best regards - Jörg
2015 Jan 16 3:13 PM
Hi,
try to change field type of it_demand-fsc_seq to character and try.
2015 Jan 16 7:12 PM
The runtime objects to you changing the value of a field like IT_OUT-DMD<some_suffix>.
What is IT_OUT? How is it defined? Is it an importing parameter for example?
2015 Jan 19 7:10 AM
Hi,
i changed IT_OUT's related fields and problem was fixed.Thank you..
Best Regards.
2015 Jan 16 9:09 PM
Before moving the value to the field symbol check whether it was assigned. I think the value of L_FIELD_NAME does not exist.
2015 Jan 16 10:52 PM
Hi,
in your structure it_out, do the fieldnames match the pattern DMDnnn? Since you changed the type to num3 , the assign would search for field of e.g. name IT_OUT-DMD001.
If the fieldname is still DMD01, the assign would fail, leaving whatever was assigned to <LFS_01> before (if any).
Besides, it is never a good idea to use a dynamically assigned field-symbol whithout checking SY-SUBRC first.
Best regards - Jörg
2015 Jan 19 7:07 AM
Hi,
Thank you for your answer.:)
i changed it_out fields from DMDnn to DMDnnn and problem was fixed..
Best regards..
2015 Jan 19 4:50 AM
I guess your field names are stored as IT_OUT-DMD01, IT_OUT-DMD02, IT_OUT-DMD03 ........ and so on.
When you change it_demand-fsc_seq to numc3, it will result in IT_OUT-DMD001, IT_OUT-DMD002, IT_OUT-DMD003 ........ and so on.
These fields doesn't exist and hence you are receiving error message. Either change the name of fields or use numc2.
2015 Jan 19 7:08 AM
Hi,
Thank you for your answer..i changed as T_OUT-DMD001, IT_OUT-DMD002, IT_OUT-DMD003 ........ and so on. Problem was fixed..
Best Regards..