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

Problem with dynamic internal table updation

Former Member
0 Likes
690

Hello Folks,

I created a dynamic internal table

CALL METHOD cl_alv_table_create=>create_dynamic_table
      EXPORTING
        it_fieldcatalog           = i_fieldcat
      IMPORTING
        ep_table                  = i_dyntab
      EXCEPTIONS
        generate_subpool_dir_full = 1
        OTHERS                    = 2.
ASSIGN i_dyntab->* TO <f_dyntable>. 

and created a work area

 CREATE DATA wg_f_split LIKE LINE OF <f_dyntable>.
    ASSIGN wg_f_split->* TO <f_wg_dyntable>.

My requirement is that , i have to loop a normal internal table and append those records to the filed symbol internal table.

READ TABLE i_normal_itab INTO wg_split INDEX wl_rows-index.
      IF sy-subrc EQ 0.
        ASSIGN wg_split to <f_wg_dyntable>.
         APPEND <f_wg_dyntable> to <f_dyntable>.
       endif.

here i am geeting dump as "MOVE src TO dst" ... i can get the data in the work area FSymbol but cannot append it in Internal table Field Symbol.. Please help..

<Added code tags>

Edited by: Suhas Saha on Aug 3, 2011 10:52 AM

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
0 Likes
661

Hi Charan-SAP,


ASSIGN wg_split to <f_wg_dyntable>.

because of this statement, you changed the field symbol so it does not refer to the line of the dynamical internal table.

Instead, I think you want to do something like:


MOVE-CORRESPONDING wg_split to <f_wg_dyntable>.

BR

Sandra

6 REPLIES 6
Read only

Sandra_Rossi
Active Contributor
0 Likes
662

Hi Charan-SAP,


ASSIGN wg_split to <f_wg_dyntable>.

because of this statement, you changed the field symbol so it does not refer to the line of the dynamical internal table.

Instead, I think you want to do something like:


MOVE-CORRESPONDING wg_split to <f_wg_dyntable>.

BR

Sandra

Read only

0 Likes
661

Hello Sandra,

Thanks for the reply..

First i tried appending the normal work area to the fieldsymbol internal table.

append wg_split to <f_dyntable>

This is hiting dump the same dump and so i created a fieldsymbol work area. ( <f_wg_dyntable>.)and tried to append the field symbol internal table with this work area. which is again giving the dump

APPEND <f_wg_dyntable> to <f_dyntable>. ( Again a Dump)

Edited by: Charan-SAP on Aug 2, 2011 9:40 PM

Edited by: Charan-SAP on Aug 2, 2011 9:42 PM

Read only

0 Likes
661

Try this way:

ASSIGN i_dyntab->* TO <f_dyntable>. and created a work area 

field-symbols: <fs_dyntable> type line of <f_dyntable>. 

READ TABLE i_normal_itab INTO wg_split INDEX wl_rows-index.
IF sy-subrc EQ 0.
<fs_dyntable> = wg_split.
APPEND <fs_dyntable> to <f_dyntable>.
endif.

Read only

0 Likes
661

APPEND <f_wg_dyntable> to <f_dyntable>.

If it dumps, it means that you changed the assignment of <f_wg_dyntable> right before, you shouldn't.

But could you explain what you want to achieve, what fields are in wg_split , are they the same as in <f_wg_dyntable> or do they have fields with same name? (then MOVE-CORRESPONDING should work)

Sandra

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
661

Hello Charan,

The following code snippet works for me:


  LOOP AT gt_data INTO gs_data. "LOOP on static table
*   Append the line to the dynamic table
    APPEND INITIAL LINE TO <gt_dyn> ASSIGNING <gs_dyn>.
    IF sy-subrc = 0.
      MOVE-CORRESPONDING gs_data TO <gs_dyn>.
    ENDIF.

  ENDLOOP.

Read only

0 Likes
661

At this time Move-corresponding worked.. Thanks for you help