<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: filling dynamic internal table by append/insert in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/filling-dynamic-internal-table-by-append-insert/m-p/7243702#M1526701</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as you did not give any example of what you want or what is the underlying process it is hard to answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would not use &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ASSIGN COMPONENT sy-index OF STRUCTURE&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Better use CL_ABAP_STRUCTDESCR-&amp;gt;GET_COMPONENTS to get the fieldnames. Loop over the components table,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ASSIGN COMPONENT &amp;lt;component_table-name&amp;gt; OF STRUCTURE &amp;lt;wa_incoming_data&amp;gt; TO &amp;lt;in&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Do this for  &amp;lt;wa_incoming_data&amp;gt; and  &amp;lt;wa_outgoing_data&amp;gt;, if both are assigned, move &amp;lt;in&amp;gt; to &amp;lt;out&amp;gt; and APPEND  &amp;lt;wa_outgoing_data&amp;gt; to &amp;lt;fs_outgoing_data&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or simply move-corresponding  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;wa_incoming_data&amp;gt;  to  &amp;lt;wa_outgoing_data&amp;gt;.
 APPEND  &amp;lt;wa_outgoing_data&amp;gt; to &amp;lt;fs_outgoing_data&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 05 Oct 2010 15:23:25 GMT</pubDate>
    <dc:creator>Clemenss</dc:creator>
    <dc:date>2010-10-05T15:23:25Z</dc:date>
    <item>
      <title>filling dynamic internal table by append/insert</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/filling-dynamic-internal-table-by-append-insert/m-p/7243698#M1526697</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have Incoming data  and an outgoing structure created dynamicly. See code snippets. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;-   Incoming data&lt;/P&gt;&lt;P&gt;      CREATE DATA lt_incoming_data LIKE it_tr_str.&lt;/P&gt;&lt;P&gt;      ASSIGN  lt_incoming_data-&amp;gt;* TO &amp;lt;fs_incoming_data&amp;gt;.&lt;/P&gt;&lt;P&gt;      &amp;lt;fs_incoming_data&amp;gt; = it_tr_str.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;- Outgoing data&lt;/P&gt;&lt;P&gt;      CREATE DATA lt_outgoing_data TYPE HANDLE table_descr.&lt;/P&gt;&lt;P&gt;      ASSIGN lt_outgoing_data-&amp;gt;* TO &amp;lt;fs_outgoing_data&amp;gt;.&lt;/P&gt;&lt;P&gt;      wa_outgoing_data = cl_abap_structdescr=&amp;gt;create( comp_tab ).&lt;/P&gt;&lt;P&gt;      ASSIGN wa_outgoing_data TO &amp;lt;wa_outgoing_data&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to append/insert data to the dynamic created internal table from the incoming dynamic table:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FIELD-SYMBOLS: &amp;lt;fs_in&amp;gt;  TYPE data,&lt;/P&gt;&lt;P&gt;                     &amp;lt;fs_out&amp;gt; TYPE data.&lt;/P&gt;&lt;P&gt;      DATA: lv_subrc TYPE sy-subrc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      LOOP AT &amp;lt;fs_incoming_data&amp;gt; ASSIGNING &amp;lt;wa_incoming_data&amp;gt;.&lt;/P&gt;&lt;P&gt;        CLEAR wa_outgoing_data.&lt;/P&gt;&lt;P&gt;        lv_subrc = sy-subrc.&lt;/P&gt;&lt;P&gt;        WHILE lv_subrc = 0.&lt;/P&gt;&lt;P&gt;          ASSIGN COMPONENT sy-index OF STRUCTURE &amp;lt;wa_incoming_data&amp;gt; TO &amp;lt;fs_in&amp;gt;.&lt;/P&gt;&lt;P&gt;          lv_subrc = sy-subrc.&lt;/P&gt;&lt;P&gt;*&amp;amp;- Now put the &amp;lt;fs_in&amp;gt; value in the dynamic workarea of the outgoing data and append to lt_outgoing_data&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="------" /&gt;&amp;gt; What to do here ????&lt;P&gt;&lt;/P&gt;&lt;P&gt;        ENDWHILE.&lt;/P&gt;&lt;P&gt;      ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please advice what to do if possible ?/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers, John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Oct 2010 14:14:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/filling-dynamic-internal-table-by-append-insert/m-p/7243698#M1526697</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-05T14:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: filling dynamic internal table by append/insert</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/filling-dynamic-internal-table-by-append-insert/m-p/7243699#M1526698</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;just use INSERT statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;INSERT &amp;lt;wa_incoming_data&amp;gt; INTO TABLE &amp;lt;fs_incoming_data&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Oct 2010 14:39:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/filling-dynamic-internal-table-by-append-insert/m-p/7243699#M1526698</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-05T14:39:04Z</dc:date>
    </item>
    <item>
      <title>Re: filling dynamic internal table by append/insert</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/filling-dynamic-internal-table-by-append-insert/m-p/7243700#M1526699</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Same as&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
ASSIGN COMPONENT sy-index OF STRUCTURE &amp;lt;wa_incoming_data&amp;gt; TO &amp;lt;fs_in&amp;gt;.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;assign the component of dynamic workarea of the outgoing data to a field symbol say &amp;lt;fs_t&amp;gt; then move it like&lt;/P&gt;&lt;P&gt;&amp;lt;fs_t&amp;gt; = &amp;lt;fs_in&amp;gt;. once all the components in workarea of the outgoing data are populated the append the work area to the itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Somethig similar to this code&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
LOOP AT &amp;lt;fs_incoming_data&amp;gt; ASSIGNING &amp;lt;wa_incoming_data&amp;gt;.
CLEAR wa_outgoing_data.
DO.
ASSIGN COMPONENT sy-index OF STRUCTURE &amp;lt;wa_incoming_data&amp;gt; TO &amp;lt;fs_in&amp;gt;.
IF SY-SUBRC NE 0.
EXIT.
ENDIF.
ASSIGN COMPONENT sy-index OF STRUCTURE &amp;lt;wa_outgoing_data&amp;gt; TO &amp;lt;fs_t&amp;gt;.
CHECK sy-subrc = 0.
&amp;lt;fs_t&amp;gt; = &amp;lt;fs_in&amp;gt;.
ENDDO.
append &amp;lt;wa_outgoing_data&amp;gt; to it_outgoing.
ENDLOOP.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Oct 2010 14:48:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/filling-dynamic-internal-table-by-append-insert/m-p/7243700#M1526699</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2010-10-05T14:48:46Z</dc:date>
    </item>
    <item>
      <title>Re: filling dynamic internal table by append/insert</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/filling-dynamic-internal-table-by-append-insert/m-p/7243701#M1526700</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;   What is the type of &amp;lt;fs_in&amp;gt;, is that declared with TYPE ANY?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;FIELD-SYMBOLS: &amp;lt;fs_in&amp;gt;  TYPE ANY.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in the LOOP and ENDLOOP, add below logic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT &amp;lt;fs_incoming_data&amp;gt; ASSIGNING &amp;lt;wa_incoming_data&amp;gt;.

ASSIGN COMPONENT sy-index OF STRUCTURE &amp;lt;wa_outgoing_data&amp;gt; TO &amp;lt;fs_in&amp;gt;. " Give &amp;lt;wa_outgoing_data&amp;gt;
&amp;lt;fs_in&amp;gt; = &amp;lt;wa_incoming_data&amp;gt;-(1 st field).   " Give fields in the order of &amp;lt;wa_outgoing_data&amp;gt; structure which matches with incoming structure

ASSIGN COMPONENT sy-index OF STRUCTURE &amp;lt;wa_outgoing_data&amp;gt; TO &amp;lt;fs_in&amp;gt;.
&amp;lt;fs_in&amp;gt; = &amp;lt;wa_incoming_data&amp;gt;-(2nd field).

ASSIGN COMPONENT sy-index OF STRUCTURE &amp;lt;wa_outgoing_data&amp;gt; TO &amp;lt;fs_in&amp;gt;.
&amp;lt;fs_in&amp;gt; = &amp;lt;wa_incoming_data&amp;gt;-(3rd field).

....
...
...
INSERT &amp;lt;wa_outgoing_data&amp;gt;  INTO TABLE &amp;lt;fs_outgoing_data&amp;gt;.   

CLEAR : &amp;lt;fs_in&amp;gt;, &amp;lt;wa_outgoing_data&amp;gt;.

ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Bala Krishna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Oct 2010 15:06:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/filling-dynamic-internal-table-by-append-insert/m-p/7243701#M1526700</guid>
      <dc:creator>former_member585060</dc:creator>
      <dc:date>2010-10-05T15:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: filling dynamic internal table by append/insert</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/filling-dynamic-internal-table-by-append-insert/m-p/7243702#M1526701</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;as you did not give any example of what you want or what is the underlying process it is hard to answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would not use &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ASSIGN COMPONENT sy-index OF STRUCTURE&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;Better use CL_ABAP_STRUCTDESCR-&amp;gt;GET_COMPONENTS to get the fieldnames. Loop over the components table,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;ASSIGN COMPONENT &amp;lt;component_table-name&amp;gt; OF STRUCTURE &amp;lt;wa_incoming_data&amp;gt; TO &amp;lt;in&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Do this for  &amp;lt;wa_incoming_data&amp;gt; and  &amp;lt;wa_outgoing_data&amp;gt;, if both are assigned, move &amp;lt;in&amp;gt; to &amp;lt;out&amp;gt; and APPEND  &amp;lt;wa_outgoing_data&amp;gt; to &amp;lt;fs_outgoing_data&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or simply move-corresponding  &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;wa_incoming_data&amp;gt;  to  &amp;lt;wa_outgoing_data&amp;gt;.
 APPEND  &amp;lt;wa_outgoing_data&amp;gt; to &amp;lt;fs_outgoing_data&amp;gt;.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Clemens&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Oct 2010 15:23:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/filling-dynamic-internal-table-by-append-insert/m-p/7243702#M1526701</guid>
      <dc:creator>Clemenss</dc:creator>
      <dc:date>2010-10-05T15:23:25Z</dc:date>
    </item>
    <item>
      <title>Re: filling dynamic internal table by append/insert</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/filling-dynamic-internal-table-by-append-insert/m-p/7243703#M1526702</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks the most who have contributed. Based on the combination of your answers I was able to solve the issue.&lt;/P&gt;&lt;P&gt;Here it is the code snippet how it works now:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;-   Incoming data&lt;/P&gt;&lt;P&gt;      CREATE DATA lt_incoming_data LIKE it_tr_str.&lt;/P&gt;&lt;P&gt;      ASSIGN  lt_incoming_data-&amp;gt;* TO &amp;lt;fs_incoming_data&amp;gt;.&lt;/P&gt;&lt;P&gt;      &amp;lt;fs_incoming_data&amp;gt; = it_tr_str.&lt;/P&gt;&lt;P&gt;*&amp;amp;- Outgoing data&lt;/P&gt;&lt;P&gt;      CREATE DATA lt_outgoing_data TYPE HANDLE table_descr.&lt;/P&gt;&lt;P&gt;      ASSIGN lt_outgoing_data-&amp;gt;* TO &amp;lt;fs_outgoing_data&amp;gt;.&lt;/P&gt;&lt;P&gt;      CREATE DATA wa_outgoing_data TYPE HANDLE struct_descr.&lt;/P&gt;&lt;P&gt;      ASSIGN wa_outgoing_data-&amp;gt;* TO &amp;lt;wa_outgoing_data&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      LOOP AT &amp;lt;fs_incoming_data&amp;gt; ASSIGNING &amp;lt;wa_incoming_data&amp;gt;.&lt;/P&gt;&lt;P&gt;        CLEAR wa_outgoing_data.&lt;/P&gt;&lt;P&gt;        lv_subrc = sy-subrc.&lt;/P&gt;&lt;P&gt;        MOVE-CORRESPONDING &amp;lt;wa_incoming_data&amp;gt; TO &amp;lt;wa_outgoing_data&amp;gt;.&lt;/P&gt;&lt;P&gt;        ASSIGN COMPONENT 'DETAIL_GUID' OF STRUCTURE &amp;lt;wa_outgoing_data&amp;gt; TO &amp;lt;fs_guid&amp;gt;.&lt;/P&gt;&lt;P&gt;        SELECT SINGLE * FROM /rpm/item_d INTO wa_item_d&lt;/P&gt;&lt;P&gt;                        WHERE guid = &amp;lt;fs_guid&amp;gt;.&lt;/P&gt;&lt;P&gt;        LOOP AT lt_sl_fields INTO wa_sl_fields.&lt;/P&gt;&lt;P&gt;          CASE wa_sl_fields-ztable.&lt;/P&gt;&lt;P&gt;            WHEN '/RPM/ITEM_D'.&lt;/P&gt;&lt;P&gt;              ASSIGN COMPONENT wa_sl_fields-zfield OF STRUCTURE wa_item_d TO &amp;lt;fs_field&amp;gt;.&lt;/P&gt;&lt;P&gt;              ASSIGN &amp;lt;fs_field&amp;gt; TO &amp;lt;fs_out&amp;gt;.&lt;/P&gt;&lt;P&gt;            WHEN 'DPR_AREA_T'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            WHEN 'ZZZTPXR116USER'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          ENDCASE.&lt;/P&gt;&lt;P&gt;          ASSIGN COMPONENT wa_sl_fields-zfield OF STRUCTURE &amp;lt;wa_outgoing_data&amp;gt; TO &amp;lt;fs_temp&amp;gt;.&lt;/P&gt;&lt;P&gt;          &amp;lt;fs_temp&amp;gt; = &amp;lt;fs_out&amp;gt;.&lt;/P&gt;&lt;P&gt;        ENDLOOP.&lt;/P&gt;&lt;P&gt;        APPEND &amp;lt;wa_outgoing_data&amp;gt; TO &amp;lt;fs_outgoing_data&amp;gt;.&lt;/P&gt;&lt;P&gt;      ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;-   Append outgoing structure&lt;/P&gt;&lt;P&gt;      CREATE DATA ex_tab TYPE HANDLE table_descr.&lt;/P&gt;&lt;P&gt;      ASSIGN ex_tab-&amp;gt;* TO &amp;lt;ex_tab&amp;gt;.&lt;/P&gt;&lt;P&gt;      &amp;lt;ex_tab&amp;gt; = &amp;lt;fs_outgoing_data&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CATCH cx_sy_struct_creation&lt;/P&gt;&lt;P&gt;          cx_sy_table_creation INTO error.&lt;/P&gt;&lt;P&gt;      MESSAGE error TYPE ' I' DISPLAY LIKE 'E'.&lt;/P&gt;&lt;P&gt;      RETURN.&lt;/P&gt;&lt;P&gt;  ENDTRY.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Oct 2010 13:12:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/filling-dynamic-internal-table-by-append-insert/m-p/7243703#M1526702</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-06T13:12:49Z</dc:date>
    </item>
  </channel>
</rss>

