<?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: append data from one itab to another in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-data-from-one-itab-to-another/m-p/1643547#M286564</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: wa_idx          like sy-tabix,            
      wa_itab         like itab,
      wa_itab_detail  like itab_detail .

loop at itab into wa_itab.    
  read table itab_detail                 
       with key charg = wa_itab-charg
                werks = wa_itab-werks   
       transporting no fields.      
  
  if sy-subrc = 0.        
    wa_idx = sy-tabix.  
    wa_itab_detail-vbeln = wa_itab-vbeln.
    wa_itab_detail-matnr = wa_itab-matnr.
    modify itab_detail index wa_idx from wa_itab_detail  
           transporting vbeln matnr. 
  else.
    move-correponding wa_itab to wa_itab_detail.
    append wa_itab_detail to itab_detail.
  endif.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ferry Lianto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 30 Oct 2006 23:49:54 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-10-30T23:49:54Z</dc:date>
    <item>
      <title>append data from one itab to another</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-data-from-one-itab-to-another/m-p/1643544#M286561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to append data from one internal table to another.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The 1st Itab is:&lt;/P&gt;&lt;P&gt;data: begin of itab occurs 0,&lt;/P&gt;&lt;P&gt;       vbeln like lips-vbeln, &lt;/P&gt;&lt;P&gt;       matnr like lips-matnr,&lt;/P&gt;&lt;P&gt;       werks like lips-werks,&lt;/P&gt;&lt;P&gt;       charg like lips-charg,&lt;/P&gt;&lt;P&gt;       ......................&lt;/P&gt;&lt;P&gt;       ......................&lt;/P&gt;&lt;P&gt;       ......................&lt;/P&gt;&lt;P&gt;       ......................&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      end of itab.&lt;/P&gt;&lt;P&gt;it has data like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;vbeln   matnr  werks   charg &lt;/P&gt;&lt;P&gt;80004   1045   p157    5789&lt;/P&gt;&lt;P&gt;80005   1042   p157    5789&lt;/P&gt;&lt;P&gt;80005   1098   p157    5789&lt;/P&gt;&lt;P&gt;80005   1065   p157    5789&lt;/P&gt;&lt;P&gt;80005   1030   p157    5789&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2nd itab:&lt;/P&gt;&lt;P&gt;data: begin of itab_detail occurs 0,&lt;/P&gt;&lt;P&gt;         vbeln like lips-vbeln,&lt;/P&gt;&lt;P&gt;         posnr like lips-posnr,&lt;/P&gt;&lt;P&gt;         matnr like mara-matnr,&lt;/P&gt;&lt;P&gt;         charg like mcha-charg,&lt;/P&gt;&lt;P&gt;         werks like marc-werks,&lt;/P&gt;&lt;P&gt;         .....................&lt;/P&gt;&lt;P&gt;         .....................&lt;/P&gt;&lt;P&gt;         .....................&lt;/P&gt;&lt;P&gt;        end of itab_detail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;it has data like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;charg   werks vbeln posnr  matnr &lt;/P&gt;&lt;P&gt;5656    p157&lt;/P&gt;&lt;P&gt;5789    p157&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now i would want to append all the data of itab to itab_detail for the records that exist in itab_detail.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tried to look into couple of similar issues posted but could not found to get solution&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;could anybody of you please help me.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks much.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: sey ni&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Oct 2006 22:48:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-data-from-one-itab-to-another/m-p/1643544#M286561</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-30T22:48:38Z</dc:date>
    </item>
    <item>
      <title>Re: append data from one itab to another</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-data-from-one-itab-to-another/m-p/1643545#M286562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: ITAB_DETAIL_TMP LIKE ITAB_DETAIL OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB_DETAIL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  MOVE-CORRESPONDING ITAB_DETAIL TO ITAB_DETAIL_TMP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT ITAB WHERE CHARG = ITAB_DETAIL-CHARG&lt;/P&gt;&lt;P&gt;               AND   WERKS = ITAB_DETAIL-WERKS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    MOVE-CORRESPONDING ITAB TO ITAB_DETAIL_TMP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    APPEND ITAB_DETAIL_TMP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&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;The internal table ITAB_DETAIL_TMP will contain all the data..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Oct 2006 23:03:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-data-from-one-itab-to-another/m-p/1643545#M286562</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-30T23:03:13Z</dc:date>
    </item>
    <item>
      <title>Re: append data from one itab to another</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-data-from-one-itab-to-another/m-p/1643546#M286563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Narendran,&lt;/P&gt;&lt;P&gt;It worked!!!&lt;/P&gt;&lt;P&gt;But 1 record did not transported to itab_detail_tmp.&lt;/P&gt;&lt;P&gt;i.e, charg = 5656 &lt;/P&gt;&lt;P&gt;     werks = p157.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Could you please suggest what might be the reason?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Oct 2006 23:42:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-data-from-one-itab-to-another/m-p/1643546#M286563</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-30T23:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: append data from one itab to another</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-data-from-one-itab-to-another/m-p/1643547#M286564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please try like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;data: wa_idx          like sy-tabix,            
      wa_itab         like itab,
      wa_itab_detail  like itab_detail .

loop at itab into wa_itab.    
  read table itab_detail                 
       with key charg = wa_itab-charg
                werks = wa_itab-werks   
       transporting no fields.      
  
  if sy-subrc = 0.        
    wa_idx = sy-tabix.  
    wa_itab_detail-vbeln = wa_itab-vbeln.
    wa_itab_detail-matnr = wa_itab-matnr.
    modify itab_detail index wa_idx from wa_itab_detail  
           transporting vbeln matnr. 
  else.
    move-correponding wa_itab to wa_itab_detail.
    append wa_itab_detail to itab_detail.
  endif.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ferry Lianto&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Oct 2006 23:49:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-data-from-one-itab-to-another/m-p/1643547#M286564</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-30T23:49:54Z</dc:date>
    </item>
    <item>
      <title>Re: append data from one itab to another</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/append-data-from-one-itab-to-another/m-p/1643548#M286565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try this..I missed the sy-subrc check..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: ITAB_DETAIL_TMP LIKE ITAB_DETAIL OCCURS 0 WITH HEADER LINE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB_DETAIL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MOVE-CORRESPONDING ITAB_DETAIL TO ITAB_DETAIL_TMP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB WHERE CHARG = ITAB_DETAIL-CHARG&lt;/P&gt;&lt;P&gt;AND WERKS = ITAB_DETAIL-WERKS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MOVE-CORRESPONDING ITAB TO ITAB_DETAIL_TMP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND ITAB_DETAIL_TMP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;IF SY-SUBRC &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  APPEND ITAB_DETAIL_TMP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDIF.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&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;Thanks,&lt;/P&gt;&lt;P&gt;Naren&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Oct 2006 23:52:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/append-data-from-one-itab-to-another/m-p/1643548#M286565</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-30T23:52:31Z</dc:date>
    </item>
  </channel>
</rss>

