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

Assign Statement not working

vallamuthu_madheswaran2
Active Contributor
0 Likes
2,261

Hi Friends,

Kindly find the attached code. I have tried the assign statement. all the statement gives an error.

LOOP AT t_t682z INTO DATA(lwa_varkey) WHERE qufna CS lv_qufna.
              lv_fieldname    = lwa_varkey-qustr.
              lv_fieldname+31 = '-'.
              lv_fieldname+32 = lwa_varkey-qufna.
              CONDENSE lv_fieldname NO-GAPS.
              CONCATENATE '''' lv_fieldname '''' INTO w_field.
              lv_fld = w_field.
              ASSIGN (w_field) TO <fs_qunfa>.
              ASSIGN (w_field) TO <f>.
              ASSIGN (lv_fld) TO <fs_qunfa>.
              ASSIGN (lv_fld) TO <f>.
              IF sy-subrc = 0.
                <fs_qunfa> = <fs_field>.
              ENDIF.
          ENDLOOP.<br>

Thanks with regards,
Vallamuthu M

7 REPLIES 7
Read only

jens_michaelsen
Participant
0 Likes
2,152

I can't see the ASSIGN for <fs_field>???

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,152

What error message?

Read only

Eduardo-CE
Active Participant
0 Likes
2,152
DATA: BEGIN OF line,
        col1 TYPE i VALUE 11,
        col2 TYPE i VALUE 22,
        col3 TYPE i VALUE 33,
      END OF line.

DATA comp(5) TYPE c VALUE 'COL3'.

FIELD-SYMBOLS: <f1> TYPE ANY, <f2> TYPE ANY, <f3> TYPE ANY.

ASSIGN line TO <f1>.
ASSIGN comp TO <f2>.

  DO 3 TIMES.
  ASSIGN COMPONENT sy-index OF STRUCTURE <f1> TO <f3>.
  WRITE <f3>.
  ENDDO.

ASSIGN COMPONENT <f2> OF STRUCTURE <f1> TO <f3>.
Read only

0 Likes
2,152

I have assign the field to KOMK and KOMP field.

Thanks with regards,

Vallamuthu M.

Read only

vallamuthu_madheswaran2
Active Contributor
0 Likes
2,152

Hi Sandra Rossi,

Thanks for your update.

sy-subrc = 4.

Thanks with regards,

Vallamuthu M.

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,152

If you do that:

ASSIGN (w_field) TO <fs_qunfa>.

the variable W_FIELD must contain a variable name WITHOUT QUOTES, so, instead of doing this:

CONCATENATE '''' lv_fieldname '''' INTO w_field.

you should just do that:

w_field = lv_fieldname.

ASSIGN (w_field) TO <fs_qunfa>.
Read only

matt
Active Contributor
2,152

Love it. Prefixing field-symbols with FS. As though < > wasn't sufficient identifier!