<?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: Select from an Internal Table. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-an-internal-table/m-p/2701984#M625773</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent...thanks so much !!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 29 Aug 2007 14:47:16 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-08-29T14:47:16Z</dc:date>
    <item>
      <title>Select from an Internal Table.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-an-internal-table/m-p/2701982#M625771</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Following is my urgent requirement:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have an Internal Table ITAB with several possible entries of Company Code under its field BUKRS. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From this ITAB I want to display only those records for which the column 'Company Code' occur more than twice and then display those records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CC     DOCNo&lt;/P&gt;&lt;P&gt;1000  100000011&lt;/P&gt;&lt;P&gt;1000  100000023&lt;/P&gt;&lt;P&gt;1000  120000021&lt;/P&gt;&lt;P&gt;1100  120000031&lt;/P&gt;&lt;P&gt;1100  120000033&lt;/P&gt;&lt;P&gt;1200  120000043&lt;/P&gt;&lt;P&gt;1200  120000055&lt;/P&gt;&lt;P&gt;1200  211130001&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In above case I have 3 occurence of 1000 and 1200....so I only want to show their records...while 1100 has only 2 instances...so I want those 2 records to be deleted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whats the best way to do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was wondering if there is a way to 'count' the number of records for 'distinct'  Company Codes....and if Count &amp;gt; 2 then move those records to a new ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please advise,&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Rohit.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Aug 2007 22:24:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-an-internal-table/m-p/2701982#M625771</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-28T22:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Select from an Internal Table.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-an-internal-table/m-p/2701983#M625772</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF itab_bukrs occurs 0,&lt;/P&gt;&lt;P&gt;bukrs LIKE t001-bukrs,&lt;/P&gt;&lt;P&gt;count TYPE i.&lt;/P&gt;&lt;P&gt;DATA: END OF itab_bukrs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itab.&lt;/P&gt;&lt;P&gt;itab_bukrs-bukrs = itab-bukrs.&lt;/P&gt;&lt;P&gt;itab_bukrs-count = 1.&lt;/P&gt;&lt;P&gt;COLLECT itab_bukrs.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DELETE itab_bukrs WHERE count &amp;lt; 3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now you know which company codes have more than 2 documents. You can either loop at your itab and read this itab_bukrs and proceed only if a record exists in here, else delete itab where bukrs = current itab-bukrs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE itab_bukrs WITH KEY bukrs = itab-bukrs.&lt;/P&gt;&lt;P&gt;IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;DELETE itab WHERE bukrs = itab-bukrs.&lt;/P&gt;&lt;P&gt;CONTINUE.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;.... show these records&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Aug 2007 22:42:10 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-an-internal-table/m-p/2701983#M625772</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-28T22:42:10Z</dc:date>
    </item>
    <item>
      <title>Re: Select from an Internal Table.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-an-internal-table/m-p/2701984#M625773</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Excellent...thanks so much !!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 29 Aug 2007 14:47:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/select-from-an-internal-table/m-p/2701984#M625773</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-08-29T14:47:16Z</dc:date>
    </item>
  </channel>
</rss>

