<?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: compare records within single internal table in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-records-within-single-internal-table/m-p/3064965#M726259</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;data : l_lines type sy-tabix.
describe table itab lines l_lines.
loop at itab into watab.
l_tabix = sy-tabix + 1.
loop at itab into wtemp from l_tabix to l_lines where matnr = watab-matnr.
write :/ 'duplicate record exists'.
endloop.
clear : l_tabix,
          watab,
          wtemp.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Nov 2007 04:03:14 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-11-16T04:03:14Z</dc:date>
    <item>
      <title>compare records within single internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-records-within-single-internal-table/m-p/3064962#M726256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can we compare records within single internal table.how to do it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2007 03:46:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-records-within-single-internal-table/m-p/3064962#M726256</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-16T03:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: compare records within single internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-records-within-single-internal-table/m-p/3064963#M726257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;loop at it into wa. "read same itenal table&lt;/P&gt;&lt;P&gt;read table itab from wa with key wa-field wa-field.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2007 03:50:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-records-within-single-internal-table/m-p/3064963#M726257</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-16T03:50:36Z</dc:date>
    </item>
    <item>
      <title>Re: compare records within single internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-records-within-single-internal-table/m-p/3064964#M726258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you want to compare the same field or different fields from the internal table.?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Atish&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2007 03:53:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-records-within-single-internal-table/m-p/3064964#M726258</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-16T03:53:29Z</dc:date>
    </item>
    <item>
      <title>Re: compare records within single internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-records-within-single-internal-table/m-p/3064965#M726259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;data : l_lines type sy-tabix.
describe table itab lines l_lines.
loop at itab into watab.
l_tabix = sy-tabix + 1.
loop at itab into wtemp from l_tabix to l_lines where matnr = watab-matnr.
write :/ 'duplicate record exists'.
endloop.
clear : l_tabix,
          watab,
          wtemp.
endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2007 04:03:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-records-within-single-internal-table/m-p/3064965#M726259</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-16T04:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: compare records within single internal table</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-records-within-single-internal-table/m-p/3064966#M726260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Suganya,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yes, we can compare records within single internal table.&lt;/P&gt;&lt;P&gt;ex:&lt;/P&gt;&lt;P&gt;Case1:  Want to compare only the key fields.&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;    i_tab is the internal table without work area.&lt;/P&gt;&lt;P&gt;    w_tab is the external work area for the table i_tab.&lt;/P&gt;&lt;P&gt;    w2_tab is the second external work area for the table i_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; loop at i_tab into w_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  loop at i_tab into w2_tab where field1 = w_tab-field and&lt;/P&gt;&lt;P&gt;                                                field2 = w_tab-field.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;If the control enter the second loop, the duplicate record exits.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If u want to count the number of duplicate records exist in the single internal record, then set a counter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex :  i_tab is the internal table without work area.&lt;/P&gt;&lt;P&gt;    w_tab is the external work area for the table i_tab.&lt;/P&gt;&lt;P&gt;    w2_tab is the second external work area for the table i_tab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Declare the structure to count the dup records in the same internal table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt; types : begin of s_dup_cnt ,&lt;/P&gt;&lt;P&gt;           record type i,&lt;/P&gt;&lt;P&gt;           count type i.&lt;/P&gt;&lt;P&gt;         end of s_dup_cnt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Declare the internal table &amp;amp; work area&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;data : t_dup_cnt type standard table of s_dup_cnt.&lt;/P&gt;&lt;P&gt;         w_dup_cnt type s_dup_cnt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; loop at i_tab into w_tab.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;get the record number&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   w_dup_cnt-record = SY-TABIX.&lt;/P&gt;&lt;P&gt;   w_dup_cnt-count  = 0.&lt;/P&gt;&lt;P&gt;  loop at i_tab into w2_tab where field1 = w_tab-field and&lt;/P&gt;&lt;P&gt;                                                field2 = w_tab-field.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;   w_dup_cnt-count  = w_dup_cnt-count + 1.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;  append  w_dup_cnt to  t_dup_cnt.&lt;/P&gt;&lt;P&gt;  clear  w_dup_cnt.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at  t_dup_cnt into w_dup_cnt.&lt;/P&gt;&lt;P&gt;  write w_dup_cnt-record .&lt;/P&gt;&lt;P&gt;   write w_dup_cnt-count.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;t_dup_cnt now contains the record number &amp;amp; the number of times the record repeated * in the same internal table,&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Nov 2007 05:15:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-records-within-single-internal-table/m-p/3064966#M726260</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-11-16T05:15:09Z</dc:date>
    </item>
  </channel>
</rss>

