<?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 Need a logic for Internal table processing in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-a-logic-for-internal-table-processing/m-p/7363029#M1542039</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a requirement...an internal table contains three fields material no, bin no, and Quantity&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mat. No    |         Bin No        |              Quantity&lt;/P&gt;&lt;P&gt;a              |              x1         |                   10&lt;/P&gt;&lt;P&gt;a              |              x1         |                   10 &lt;/P&gt;&lt;P&gt;a              |              x2         |                   20 &lt;/P&gt;&lt;P&gt;b              |              x3         |                   10  &lt;/P&gt;&lt;P&gt;c              |              x3         |                   20&lt;/P&gt;&lt;P&gt;c              |              x4         |                   30 &lt;/P&gt;&lt;P&gt;c              |              x4         |                   40&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this I need to append the records to new internal table say itab1 where multiple entries exist for some material no like mat no 'a' and 'c'  and&lt;/P&gt;&lt;P&gt;if the material no. exist only once in the table, it has to be moved to another new internal table say itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls suggest some logic that does not have performance issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Saravana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 20 Oct 2010 09:19:03 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-10-20T09:19:03Z</dc:date>
    <item>
      <title>Need a logic for Internal table processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-a-logic-for-internal-table-processing/m-p/7363029#M1542039</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a requirement...an internal table contains three fields material no, bin no, and Quantity&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mat. No    |         Bin No        |              Quantity&lt;/P&gt;&lt;P&gt;a              |              x1         |                   10&lt;/P&gt;&lt;P&gt;a              |              x1         |                   10 &lt;/P&gt;&lt;P&gt;a              |              x2         |                   20 &lt;/P&gt;&lt;P&gt;b              |              x3         |                   10  &lt;/P&gt;&lt;P&gt;c              |              x3         |                   20&lt;/P&gt;&lt;P&gt;c              |              x4         |                   30 &lt;/P&gt;&lt;P&gt;c              |              x4         |                   40&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this I need to append the records to new internal table say itab1 where multiple entries exist for some material no like mat no 'a' and 'c'  and&lt;/P&gt;&lt;P&gt;if the material no. exist only once in the table, it has to be moved to another new internal table say itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pls suggest some logic that does not have performance issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Saravana&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Oct 2010 09:19:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-a-logic-for-internal-table-processing/m-p/7363029#M1542039</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-20T09:19:03Z</dc:date>
    </item>
    <item>
      <title>Re: Need a logic for Internal table processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-a-logic-for-internal-table-processing/m-p/7363030#M1542040</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Loop and READ statements will work.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Oct 2010 09:31:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-a-logic-for-internal-table-processing/m-p/7363030#M1542040</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-20T09:31:27Z</dc:date>
    </item>
    <item>
      <title>Re: Need a logic for Internal table processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-a-logic-for-internal-table-processing/m-p/7363031#M1542041</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;a solution in brief...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: wa_itab1_a like itab1,
         wa_itab2_b like itab1,
         lv_tabix       type sytabix.

sort itab1 by matnr.

loop at itab1.
  wa_itab1_a = itab1.
  at new matnr.
    lv_tabix = sy-tabix + 1.
    clear wa_itab2_b.
    READ TABLE itab1 into wa_itab2_b
                        INDEX lv_tabix.
    if wa_itab2_b-matnr ne wa_itab1_a-matnr.
      append wa_itab1_a to itab2.
      delete itab1 where matnr = wa_itab1_a-matnr.
    endif.
  endat.
endloop.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;George Zervas&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: gzervas on Oct 20, 2010 12:08 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Oct 2010 10:07:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-a-logic-for-internal-table-processing/m-p/7363031#M1542041</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-20T10:07:45Z</dc:date>
    </item>
    <item>
      <title>Re: Need a logic for Internal table processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/need-a-logic-for-internal-table-processing/m-p/7363032#M1542042</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
sort itab by matnr.
clear lv_oldmatnr.
loop at itab.
  if itab-matnr NE lv_oldmatnr.
    append itab to itab2.
  else.
     read itab2 with key matnr = itab-matnr.
     if sy-subrc = 0.
       append itab2 to itab1.
       lv_index = sy-tabix.
       delete itab2 index lv_index.
     endif.
     append itab to itab1.
  endif.
  lv_oldmatnr = itab-matnr.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Pedro Guarita on Oct 20, 2010 11:22 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Oct 2010 10:19:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/need-a-logic-for-internal-table-processing/m-p/7363032#M1542042</guid>
      <dc:creator>PedroGuarita</dc:creator>
      <dc:date>2010-10-20T10:19:48Z</dc:date>
    </item>
  </channel>
</rss>

