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: 

Field Symbol not assign

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Bernad,

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

Regards

Rajvansh

4 REPLIES 4

Former Member
0 Kudos

Hi Bernad,

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

Regards

Rajvansh

0 Kudos

hi,

field-symbols: <wa> type any,

<wa_ctab> type any.

thank you

0 Kudos

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

Former Member
0 Kudos

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