<?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 two internal tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387542#M813405</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;  Take one more temparory internal table and append these 2 internal tables data to that. Then sort the temp table with key and do delete adjacent duplicates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND LINES ITAB1[] to ITAB_TEMP[].&lt;/P&gt;&lt;P&gt;APPEND LINES ITAB2[] TO ITAB_TEMP[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT ITAB_TEMP[] BY field1....&amp;lt;Key&amp;gt;.&lt;/P&gt;&lt;P&gt;DELETE ADJACENT DUPLICATES FROM ITAB_TEMP COMPARING field1.....&amp;lt;Key&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Bujji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 18 Feb 2008 09:35:39 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-18T09:35:39Z</dc:date>
    <item>
      <title>Compare two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387538#M813401</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi can any one tell me how to compare two internal tables&lt;/P&gt;&lt;P&gt;i have itab with 1,2,3,4,5 and&lt;/P&gt;&lt;P&gt;in itab1 i have 2,4,6,8,9&lt;/P&gt;&lt;P&gt;i compare both&lt;/P&gt;&lt;P&gt;and i want  2 get the output like 1,3,5,6,7,8,9&lt;/P&gt;&lt;P&gt;i.e which r same in itab and itab1 were do not dispaly&lt;/P&gt;&lt;P&gt;give me logic&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 18, 2008 2:27 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2008 09:27:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387538#M813401</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-18T09:27:49Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387539#M813402</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do like this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at itab.
read table itab1 with key field1 = itab-field1.
if sy-subrc ne 0.
write:\ itab-field1.
endif.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Vasanth&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2008 09:32:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387539#M813402</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-18T09:32:54Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387540#M813403</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;there are so many ways it might be easy logic..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  append itab1 to itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endllop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;so u got all the records into one table..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then wht u do is sort that table with key as the field that conatines the number..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then finalyy eliminate all the duplicates form the second internal table and u will get wht the records u want i hope i am clear to u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ex...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2008 09:33:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387540#M813403</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-18T09:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387541#M813404</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 am supposing that 1,2,3, 4,5 etc are values in a column of table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;not you can do it like this.........&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab into wa_itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table itab1 into wa_itab1 with key f1 = wa_itab-f1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc ne 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append wa_itab1 to itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&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;regards&lt;/P&gt;&lt;P&gt;vijay&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 18, 2008 2:28 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2008 09:34:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387541#M813404</guid>
      <dc:creator>Vijay</dc:creator>
      <dc:date>2008-02-18T09:34:14Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387542#M813405</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;  Take one more temparory internal table and append these 2 internal tables data to that. Then sort the temp table with key and do delete adjacent duplicates.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND LINES ITAB1[] to ITAB_TEMP[].&lt;/P&gt;&lt;P&gt;APPEND LINES ITAB2[] TO ITAB_TEMP[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT ITAB_TEMP[] BY field1....&amp;lt;Key&amp;gt;.&lt;/P&gt;&lt;P&gt;DELETE ADJACENT DUPLICATES FROM ITAB_TEMP COMPARING field1.....&amp;lt;Key&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rgds,&lt;/P&gt;&lt;P&gt;Bujji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2008 09:35:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387542#M813405</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-18T09:35:39Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387543#M813406</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;for example if&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;first table has records like 1, 2, 3&lt;/P&gt;&lt;P&gt;second table has records like 2,4,5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;then combine those as&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1,2,3,2,4,5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now by sort do like this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1, 2, 2, 3, 4, 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now eliminate adjacent duplicates like this..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1, 2, 3, 4, 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u r problem solved&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 18, 2008 2:28 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2008 09:37:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387543#M813406</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-18T09:37:13Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387544#M813407</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sort table itab2 by k1 k2 k3..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table itab2 with key k1 = itab1-k1&lt;/P&gt;&lt;P&gt;k2 = itab1-k2 binary search.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;delete itab2 index sy-index.&lt;/P&gt;&lt;P&gt;endif.&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;finally itab2 will have that sort of entries which are not in Itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;lt;REMOVED BY MODERATOR&amp;gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Alvaro Tejada Galindo on Feb 18, 2008 2:29 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2008 09:40:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387544#M813407</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-18T09:40:15Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387545#M813408</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;
data:begin of itab1 occurs 0,
        val type i,
        flg type c,
 end of itab1,

itab2 like table of itab1 with header line,
itab3 like table of itab1 with header line.

itab1-val = 1.
append itab1.
itab1-val = 2.
append itab1.
itab1-val = 3.
append itab1.
itab1-val = 4.
append itab1.
itab1-val = 5.
append itab1.


itab2-val = 5.
append itab2.
itab2-val = 7.
append itab2.
itab2-val = 8.
append itab2.
itab2-val = 2.
append itab2.
itab2-val = 1.
append itab2.

Loop at itab1.
read table itab2 with key val = itab1-val.
if sy-subrc = 0.
itab2-flg = 'X'.
modify itab2 index sy-tabix transporting flg.
else.
itab3-val = itab1-val.
append itab3.
endif.

at last.
loop at itab2 where flg &amp;lt;&amp;gt; 'X'.
 itab3-val =  itab2-val.
append itab3.
endloop.
endat.
endloop.
sort itab3.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now itab3 has ur values&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2008 10:13:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387545#M813408</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2008-02-18T10:13:32Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387546#M813409</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sunil Kumar idea is ver ggod..try that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;append lines of itab1 to itab3.&lt;/P&gt;&lt;P&gt;append lines of itab2 to itab3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort itab3.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from itab3.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2008 10:15:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387546#M813409</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2008-02-18T10:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387547#M813410</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;combine both the numbers and delete the adjacent duplicates.&lt;/P&gt;&lt;P&gt;next read the no from 1st table and 2 nd table if it exits in both the table then delete or else display&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2008 10:59:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387547#M813410</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-18T10:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387548#M813411</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Try the FM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CATSXT_COMPARE_STRUCTURES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CTVB_COMPARE_TABLES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However I think you might code it faster with a line-by-line comparison, within a LOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Chandru&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2008 11:04:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387548#M813411</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-18T11:04:54Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387549#M813412</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi friend,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;u r not mention the input 7 in any one of the table. no probs.&lt;/P&gt;&lt;P&gt;here it my logic given below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;REPORT  YTEST.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data : begin of it1 occurs 10,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;n1 type i,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;end of it1,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;begin of it2 occurs 10,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;n2 type i,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;end of it2,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;begin of it3 occurs 10,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;n3 type i,&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;end of it3.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;data: flag type i.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;it1-n1 = 1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;append it1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;it1-n1  = 2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;append it1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;it1-n1  = 3.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;append it1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;it1-n1  = 4.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;append it1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;it1-n1  = 5.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;append it1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        &lt;STRONG&gt;it2-n2 = 2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;append it2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;it2-n2  = 4.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;append it2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;it2-n2  = 6.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;append it2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;it2-n2  = 8.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;append it2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;it2-n2  = 9.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;append it2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;loop at it1 into it1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         &lt;STRONG&gt;loop at it2 into it2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              &lt;STRONG&gt;if it1-n1 = it2-n2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;              &lt;STRONG&gt;flag = 0.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;              &lt;STRONG&gt;exit.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              &lt;STRONG&gt;else .&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              &lt;STRONG&gt;flag = 1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;              &lt;STRONG&gt;endif.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;         &lt;STRONG&gt;endloop.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;            &lt;STRONG&gt;if flag  = 1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;            &lt;STRONG&gt;append  it1 to it3.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;            &lt;STRONG&gt;endif.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;endloop.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;     &lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;loop at it2 into it2.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;         &lt;STRONG&gt;loop at it1 into it1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              &lt;STRONG&gt;if it2-n2 = it1-n1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;              &lt;STRONG&gt;flag = 0.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;              &lt;STRONG&gt;exit.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              &lt;STRONG&gt;else .&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              &lt;STRONG&gt;flag = 1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;              &lt;STRONG&gt;endif.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;         &lt;STRONG&gt;endloop.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;            &lt;STRONG&gt;if flag  = 1.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;            &lt;STRONG&gt;append  it2 to it3.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;            &lt;STRONG&gt;endif.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;       &lt;STRONG&gt;endloop.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     &lt;STRONG&gt;loop at it3 into it3.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;     &lt;STRONG&gt;write:/ it3-n3.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;note : if the resultant internal table is not sorted form. sort it and then view the answer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;surender&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2008 11:38:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387549#M813412</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-18T11:38:22Z</dc:date>
    </item>
    <item>
      <title>Re: Compare two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387550#M813413</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Upender,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try it this way.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
data: v_count type i,
        v_tabix type sy-tabix.
itab2[] = itab[].
append lines of itab1 to itab2.
sort itab2 by value.
loop at itab2.
v_tabix = sy-tabix.
v_count = v_count + 1.
at end of value.
clear : v_count.
endat.
if v_count &amp;gt; 2.
delete itab2 where value = itab2-value.
endif.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;now itab2 will hold unduplicated values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Revert back for more help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naresh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Feb 2008 19:37:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/3387550#M813413</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-18T19:37:14Z</dc:date>
    </item>
  </channel>
</rss>

