Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Assign Type conflict with field symbols

I have two tables tab1 & tab2, want to assign field values from tab1 to tab2 suing field symbols. Deatils are :

TYPES: BEGIN OF ty_tab1,
    item1   TYPE char20,
    item2   TYPE char20,
    val1 type i,
    val2 type i,
END OF ty_tab1,
 
BEGIN OF ty_tab2,
    item1 TYPE char20,
    item2 TYPE char20,
END OF ty_tab2.
 
DATA: it_tab1 TYPE TABLE OF ty_tab1, 
            it_tab2 TYPE TABLE OF ty_tab2. 

  FIELD-SYMBOLS <fs_tab1> TYPE ty_tab1.
                 <fs_tab2t> type ty_tab2.

  LOOP AT it_tab1 assigning <fs_tab1>.

    READ TABLE it_tab2  assigning <fs_tab2> WITH KEY item1 = <fs_tab1>-item1
                                                                                item2 = <fs_tab1>-item2.
           
    IF sy-subrc EQ 0.
      ASSIGN COMPONENT 'ITEM1' OF STRUCTURE <fs_tab1> TO <fs_tab2>.
     ASSIGN COMPONENT 'ITEM2' OF STRUCTURE <fs_tab1> TO <fs_tab2>.
    endif.
endloop.

Getting error msg

You attempted to assign a field to a typed field symbol, but the field does not have the required type.

whats the reason of error.

Edited by: Matt on May 27, 2011 8:59 AM - added tags

Former Member
Not what you were looking for? View more on this topic or Ask a question