<?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: Finding duplicate in same internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/finding-duplicate-in-same-internal-table/m-p/6497778#M1421241</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;You can try this: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. sort itab by fields F1 and F3. &lt;/P&gt;&lt;P&gt;2. Delete adjacent duplicates comparing F1 and F3. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Komal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 21 Jan 2010 06:35:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-01-21T06:35:04Z</dc:date>
    <item>
      <title>Finding duplicate in same internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/finding-duplicate-in-same-internal-table/m-p/6497776#M1421239</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;I have an internal table which has three fields(F1,F2,F3).&lt;/P&gt;&lt;P&gt;Now suppose I have 5 records and I have to compare whether the fields(F1 and F3) of record 1st and 3rd are same or not(F2 is common for both records).Can you suggest any syntax?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 06:24:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/finding-duplicate-in-same-internal-table/m-p/6497776#M1421239</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T06:24:30Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate in same internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/finding-duplicate-in-same-internal-table/m-p/6497777#M1421240</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;I don't think there is a dirrent command.We may need to put logic around the internal table to compare the records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Gaurav Arora&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 06:34:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/finding-duplicate-in-same-internal-table/m-p/6497777#M1421240</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T06:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate in same internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/finding-duplicate-in-same-internal-table/m-p/6497778#M1421241</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;You can try this: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. sort itab by fields F1 and F3. &lt;/P&gt;&lt;P&gt;2. Delete adjacent duplicates comparing F1 and F3. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Komal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 06:35:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/finding-duplicate-in-same-internal-table/m-p/6497778#M1421241</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T06:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate in same internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/finding-duplicate-in-same-internal-table/m-p/6497779#M1421242</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 test the following Sample Code hope will solve out your problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES:  BEGIN OF ty_test,
        f1(3),
        f2(3),
        f3(3),
        END OF ty_test.
DATA: it_test TYPE STANDARD TABLE OF ty_test WITH HEADER LINE,
      old_f1(3),
      old_f3(3).

it_test-f1 = 'AAA'. it_test-f2 = 'AAA'. it_test-f3 = 'DDD'. APPEND it_test.
it_test-f1 = 'BBB'. it_test-f2 = 'AAA'. it_test-f3 = 'CCC'. APPEND it_test.
it_test-f1 = 'AAA'. it_test-f2 = 'AAA'. it_test-f3 = 'AAA'. APPEND it_test.
it_test-f1 = 'BBB'. it_test-f2 = 'AAA'. it_test-f3 = 'CCC'. APPEND it_test.

SORT: it_test by f1 f3.

LOOP AT it_test.
  IF old_f1 = it_test-f1 and old_f3 = it_test-f3.
    WRITE: 'There is Duplicate Record on Index ', sy-tabix.
  ENDIF.
  old_f1 = it_test-f1.
  old_f3 = it_test-f3.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please Reply if any problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Faisal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 06:35:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/finding-duplicate-in-same-internal-table/m-p/6497779#M1421242</guid>
      <dc:creator>faisalatsap</dc:creator>
      <dc:date>2010-01-21T06:35:12Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate in same internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/finding-duplicate-in-same-internal-table/m-p/6497780#M1421243</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi  Ginger ..&lt;/P&gt;&lt;P&gt;You need to sort at the internal table and than compare the record and delete if same&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;sort it_tab  by F1 F2.
delete adjacent duplicates from it_tab  comparing F1 F2.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 06:40:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/finding-duplicate-in-same-internal-table/m-p/6497780#M1421243</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T06:40:30Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate in same internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/finding-duplicate-in-same-internal-table/m-p/6497781#M1421244</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;Exactly, I did not get what you trying to say, but what I have understand is that, in your internal table you have to check if the record 1 , 3, or on any number is same or not , ie. value of F1 &amp;amp; F3 field, is same or not, and value of F2 is common in both the records,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, you can sort the table on F1, F3 &amp;amp; F2 and if you want to remove the duplicate entries you can use delete adjuscent duplicates,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or you can populate same data in one internal table say ITAB1 and then , you can loop at ITAB AND READ TABLE iITAB1 WITH KEY F1-ITAB-F1 AND F3-ITAB-F3 AND IF SY-SUBRC EQ 0, YOU CAN FIND THE records where you are getting duplicates, then according to your next program logic you can proceed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this may helpful to you&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rani&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 06:41:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/finding-duplicate-in-same-internal-table/m-p/6497781#M1421244</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T06:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: Finding duplicate in same internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/finding-duplicate-in-same-internal-table/m-p/6497782#M1421245</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;sort the inetrnal table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;use read stmt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE itab INTO wa COMPARING f1 f2 ...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;SUbha&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 21 Jan 2010 06:42:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/finding-duplicate-in-same-internal-table/m-p/6497782#M1421245</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-01-21T06:42:40Z</dc:date>
    </item>
  </channel>
</rss>

