<?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/1466775#M219776</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;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;LOOP at itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE itab2 with key field1 = itab1-field1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;write:/ itab1-field1, 'found' color col_positive.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;write:/ itab1-fiels1,  'not found' color col_negative.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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;HRA&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Aug 2006 08:07:17 GMT</pubDate>
    <dc:creator>dani_mn</dc:creator>
    <dc:date>2006-08-22T08:07:17Z</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/1466774#M219775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi everybody&lt;/P&gt;&lt;P&gt;i have two internal tables  ITAB1 AND ITAB2 &lt;/P&gt;&lt;P&gt;I WANT TO COMPARE THE CONTENTS OF THESE INTERNAL TABLES HOW TO DO THIS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REGARDS&lt;/P&gt;&lt;P&gt;HRIDHANJILI&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2006 08:05:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/1466774#M219775</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-22T08:05:20Z</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/1466775#M219776</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;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;LOOP at itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE itab2 with key field1 = itab1-field1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;write:/ itab1-field1, 'found' color col_positive.&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;write:/ itab1-fiels1,  'not found' color col_negative.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&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;HRA&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2006 08:07:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/1466775#M219776</guid>
      <dc:creator>dani_mn</dc:creator>
      <dc:date>2006-08-22T08:07: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/1466776#M219777</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi hridhaynjili,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Simple&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. IF ITAB1[]  = 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;  Note : a) both should have same structure&lt;/P&gt;&lt;P&gt;         b) [] is important&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;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2006 08:07:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/1466776#M219777</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-22T08:07:24Z</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/1466777#M219778</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hridhayanjili,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check FM ISB_RM_COMPARE_2_ITABS or COMPARE_TABLES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Lakshman&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2006 08:08:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/1466777#M219778</guid>
      <dc:creator>Lakshmant1</dc:creator>
      <dc:date>2006-08-22T08:08: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/1466778#M219779</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;Like other data objects, you can use internal tables as operands in logical expressions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e.g. IF &amp;lt;b&amp;gt;itab1 &amp;lt;operator&amp;gt; itab2.&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For &amp;lt;operator&amp;gt;, all operators listed in the table in Comparisons Between Data Types can be used (&amp;lt;b&amp;gt;EQ, =, NE, &amp;lt;&amp;gt;, &amp;gt;&amp;lt;, GE, &amp;gt;=, LE, &amp;lt;=, GT, &amp;gt;, LT, &amp;lt;).&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are using internal tables with header lines, remember that the header line and the body of the table have the same name. If you want to address the body of the table in a comparison, you must place two brackets ([ ]) after the table name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first criterion for comparing internal tables is the number of lines they contain. The more lines an internal table contains, the larger it is. If two internal tables contain the same number of lines, they are compared line by line, component by component. If components of the table lines are themselves internal tables, they are compared recursively. If you are testing internal tables for anything other than equality, the comparison stops when it reaches the first pair of components that are unequal, and returns the corresponding result. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will definitely help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Pragya&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2006 08:11:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/1466778#M219779</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-22T08:11:50Z</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/1466779#M219780</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;addition to Amit:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;by itabs (type standard/sorted/hashed tables ) without headerline you can compare like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if itab1 = itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2006 08:28:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/1466779#M219780</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2006-08-22T08:28: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/1466780#M219781</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Hridhayanjili &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The most detailed comparison is to use the same logic as change documents are prepared. Assuming both of your itabs are of structure struc_a. Then define the following type:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TYPES: BEGIN OF ty_s_itab_di.  
INCLUDE TYPE struc_a.
TYPES: CHIND  TYPE bu_chind.
TYPES: END OF ty_s_itab_di.
TYPES: ty_t_itab_di  TYPE STANDARD TABLE OF ty_s_itab_di 
                     WITH DEFAULT KEY.
DATA:  
  gt_itab_old  TYPE ty_t_itab_di,  
  gt_itab_new  TYPE ty_t_itab_di.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Fill itabs gt_Itab_old with the corresponding data of itab1 and gt_itab_new with the corresponding data of itab2.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Very important: sort you itabs either by all key fields or by all fields.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Call function CHANGEDOCUMENT_PREPARE_TABLES with the following parameters&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;- CHECK_INDICATOR = ' ' &lt;/P&gt;&lt;P&gt;- TABLE_NEW = gt_Itab_new&lt;/P&gt;&lt;P&gt;- TABLE_OLD = gt_itab_old&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The function module will remove identical lines from both itabs. New entries in gt_itab_New will have CHIND = 'I' and deleted entries in gt_itab_old will have CHIND = 'D'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read the documentation of the function module and play around with it. You will see that this a quite easy yet powerful approach for comparing itabs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2006 10:07:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/1466780#M219781</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2006-08-22T10:07:46Z</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/1466781#M219782</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi HRIDHANJILI,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check with this test code and if helpful Reward points.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: BEGIN OF line,&lt;/P&gt;&lt;P&gt;        col1 TYPE i,&lt;/P&gt;&lt;P&gt;        col2 TYPE i,&lt;/P&gt;&lt;P&gt;      END OF line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: itab LIKE TABLE OF line,&lt;/P&gt;&lt;P&gt;      jtab LIKE TABLE OF line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DO 3 TIMES.&lt;/P&gt;&lt;P&gt;  line-col1 = sy-index.&lt;/P&gt;&lt;P&gt;  line-col2 = sy-index ** 2.&lt;/P&gt;&lt;P&gt;  APPEND line TO itab.&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;MOVE itab TO jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;line-col1 = 10. line-col2 = 20.&lt;/P&gt;&lt;P&gt;APPEND line TO itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF itab GT jtab.&lt;/P&gt;&lt;P&gt;  WRITE / 'ITAB GT JTAB'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND line TO jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF itab EQ jtab.&lt;/P&gt;&lt;P&gt;  WRITE / 'ITAB EQ JTAB'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;line-col1 = 30. line-col2 = 80.&lt;/P&gt;&lt;P&gt;APPEND line TO itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF jtab LE itab.&lt;/P&gt;&lt;P&gt;  WRITE / 'JTAB LE ITAB'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;line-col1 = 50. line-col2 = 60.&lt;/P&gt;&lt;P&gt;APPEND line TO jtab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF itab NE jtab.&lt;/P&gt;&lt;P&gt;  WRITE / 'ITAB NE JTAB'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF itab LT jtab.&lt;/P&gt;&lt;P&gt;  WRITE / 'ITAB LT JTAB'.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2006 10:25:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/1466781#M219782</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-22T10:25:24Z</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/1466782#M219783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi hridhayanjili yaarlagadda  try this &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;&lt;/P&gt;&lt;P&gt;              read table itab2 index i.&lt;/P&gt;&lt;P&gt;        if itab2-line = itab1-line.&lt;/P&gt;&lt;P&gt;           write:/'correct'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        else.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          write:/'incorrect'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Oct 2006 07:17:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/compare-two-internal-tables/m-p/1466782#M219783</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-10-17T07:17:49Z</dc:date>
    </item>
  </channel>
</rss>

