Skip to Content
avatar image
Former Member

Field Symbol not assign

hi experts,

can you help me on this on.

 data: dref type ref to data,
                     drefc type ref to data.

field-symbols: <itab type standard table,
                        <ctab> type standard table.

create data: dref type standard table of (s_tab).
create data: dfrefc type standard table of (s_ctab).

assign dref->* to <itab>.
assign drefc->* to <ctab>.

select * from (s_tab) into table <itab>.
loop at <itab> assigning <wa>.
move-corresponding <wa> to <wa_ctab>. -----> <wa_ctab> not assigned
insert into (s_ctab) values <wa_ctab>.
endloop.  commit work.

please help.

Thank You

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Jun 15, 2011 at 03:16 AM

    Hi Bernad,

    You have not mentioned how you have declared <wa> and <wa_ctab>. Is it TYPE ANY ?

    Regards

    Rajvansh

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      Try this

      DATA
           : g_TABNAME TYPE TABNAME.
      
      PARAMETERS : s_tab TYPE TABNAME,
                       s_ctab TYPE TABNAME.
      
       data: dref type ref to data,
                           dfrefc type ref to data,
                           dwaref TYPE REF TO data.
      
      field-symbols: <itab> type standard table,
                              <ctab> type standard table,
                              <wa> TYPE ANY,
                              <wa_ctab> TYPE ANY.
      
      create data: dref type standard table of (s_tab).
      create data: dfrefc type standard table of (s_ctab).
      create data: dwaref type (s_ctab).
      
      assign dref->* to <itab>.
      assign dfrefc->* to <ctab>.
      assign dwaref->* to <wa_ctab>.
      
      select * from (s_tab) into table <itab>.
      loop at <itab> assigning <wa>.
      move-corresponding <wa> to <wa_ctab>.
      insert into (s_ctab) values <wa_ctab>.
      endloop.  commit work.

      Regards

      Rajvansh

  • avatar image
    Former Member
    Jun 15, 2011 at 04:37 AM

    Hi,

    Try this code.

    
    tables dd02l.
    
    DATA: s_tab TYPE dd02l-tabname VALUE 'MARA',
          s_ctab TYPE dd02l-tabname VALUE 'MARC'.
    
    DATA: dref TYPE REF TO data,
                        drefc TYPE REF TO data.
    
    FIELD-SYMBOLS: <itab> TYPE STANDARD TABLE,
                   <ctab> TYPE STANDARD TABLE,
                   <wa> TYPE ANY,
                   <wa_ctab> TYPE ANY.
    
    CREATE DATA: dref TYPE STANDARD TABLE OF (s_tab).
    CREATE DATA: drefc TYPE STANDARD TABLE OF (s_ctab).
    
    ASSIGN dref->* TO <itab>.
    ASSIGN drefc->* TO <ctab>.
    
    SELECT * FROM (s_tab) INTO TABLE <itab>.
    LOOP AT <itab> ASSIGNING <wa>.
      INSERT INITIAL LINE INTO <ctab> INDEX sy-tabix. " Solution
      READ TABLE <ctab> ASSIGNING <wa_ctab> INDEX sy-tabix. "Solution
      MOVE-CORRESPONDING <wa> TO <wa_ctab>. "-----> Now this will work
      insert into (s_ctab) values <wa_ctab>.
    ENDLOOP.
    
    

    Regards,

    Lisa

    Add comment
    10|10000 characters needed characters exceeded