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: 

A new value is not to be assigned to the field symbol

0 Kudos
1,389

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_NAMETO <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 ?

1 ACCEPTED SOLUTION

jrg_wulf
Active Contributor
0 Kudos
426

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

8 REPLIES 8

Former Member
0 Kudos
426

Hi,

try to change field type of it_demand-fsc_seq to character and try.

matt
Active Contributor
0 Kudos
426

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?

0 Kudos
426

Hi,

i changed IT_OUT's related fields and problem was fixed.Thank you..

Best Regards.

robson_soares
Participant
0 Kudos
426

Before moving the value to the field symbol check whether it was assigned. I think the value of L_FIELD_NAME does not exist.

jrg_wulf
Active Contributor
0 Kudos
427

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

0 Kudos
426

Hi,

Thank you for your answer.:)

i changed  it_out fields from DMDnn to DMDnnn and problem was fixed..


Best regards..

former_member200338
Active Contributor
0 Kudos
426

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.

0 Kudos
426

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..