<?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: comapring two internal tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/comapring-two-internal-tables/m-p/1533550#M243568</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Thangaraj&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;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>Sun, 03 Sep 2006 22:23:17 GMT</pubDate>
    <dc:creator>uwe_schieferstein</dc:creator>
    <dc:date>2006-09-03T22:23:17Z</dc:date>
    <item>
      <title>comapring two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/comapring-two-internal-tables/m-p/1533544#M243562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi genius&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;i am having two internal tables itab1 and itab2.i would like to compare these two tables(say each having five fields f1,f2,f3,f4,f5 same structure)and if two tables are equal,i should move that into itab3,during comparision if one field of itab1(f2) dosent match with the field of itab2(f2) it should raise an error.how to do that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Sep 2006 13:17:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/comapring-two-internal-tables/m-p/1533544#M243562</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-01T13:17:47Z</dc:date>
    </item>
    <item>
      <title>Re: comapring two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/comapring-two-internal-tables/m-p/1533545#M243563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi thangaraj,&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;3. For assigning to 3rd internal table,&lt;/P&gt;&lt;P&gt;  just use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; ITAB3[]  = ITAB1[]&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>Fri, 01 Sep 2006 13:26:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/comapring-two-internal-tables/m-p/1533545#M243563</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-01T13:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: comapring two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/comapring-two-internal-tables/m-p/1533546#M243564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thangaraj,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT t_1.&lt;/P&gt;&lt;P&gt;    READ TABLE t_2 WITH KEY f1 = t_1-f1&lt;/P&gt;&lt;P&gt;                            f2 = t_1-f2.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      MOVE-CORRESPONDING t_1 TO t_3.&lt;/P&gt;&lt;P&gt;      APPEND t_3.&lt;/P&gt;&lt;P&gt;      CLEAR  t_3.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    raise error&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Sep 2006 13:31:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/comapring-two-internal-tables/m-p/1533546#M243564</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-01T13:31:13Z</dc:date>
    </item>
    <item>
      <title>Re: comapring two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/comapring-two-internal-tables/m-p/1533547#M243565</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;check this sample prog&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:begin of itab1 occurs 0,&lt;/P&gt;&lt;P&gt;f1(10) type c,&lt;/P&gt;&lt;P&gt;end of itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:begin of itab2 occurs 0,&lt;/P&gt;&lt;P&gt;f1(10) type c,&lt;/P&gt;&lt;P&gt;end of itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:begin of itab3 occurs 0,&lt;/P&gt;&lt;P&gt;f1(10) type c,&lt;/P&gt;&lt;P&gt;end of itab3.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab1-f1 = 'abc'.&lt;/P&gt;&lt;P&gt;append itab1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab2-f1 = 'abc'.&lt;/P&gt;&lt;P&gt;append itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if itab1[] = itab2[].&lt;/P&gt;&lt;P&gt;itab3[] = itab1[].&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;write:/ 'tables are not same'.  (or)&lt;/P&gt;&lt;P&gt;message e000(zz) with 'tables are not same'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at itab3.&lt;/P&gt;&lt;P&gt;write:/ itab3-f1.&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;Sowjanya.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Sep 2006 13:32:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/comapring-two-internal-tables/m-p/1533547#M243565</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-01T13:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: comapring two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/comapring-two-internal-tables/m-p/1533548#M243566</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;if (itab1[] = itab2[]).&lt;/P&gt;&lt;P&gt;  itab3[] = itab1[].&lt;/P&gt;&lt;P&gt;else.&lt;/P&gt;&lt;P&gt;  "raise the error here.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(itab1[] = itab2[]). this statemetn compares all the contents of the two tables and itab3[] = itab1[]. statement assigns all the contents of itab1 (all the rows) to the itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Richa&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Sep 2006 13:44:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/comapring-two-internal-tables/m-p/1533548#M243566</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-09-01T13:44:58Z</dc:date>
    </item>
    <item>
      <title>Re: comapring two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/comapring-two-internal-tables/m-p/1533549#M243567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Thangaraj,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check demo program DEMO_INT_TABLES_COMPARE&lt;/P&gt;&lt;P&gt;Also check FM 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>Fri, 01 Sep 2006 14:07:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/comapring-two-internal-tables/m-p/1533549#M243567</guid>
      <dc:creator>Lakshmant1</dc:creator>
      <dc:date>2006-09-01T14:07:28Z</dc:date>
    </item>
    <item>
      <title>Re: comapring two internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/comapring-two-internal-tables/m-p/1533550#M243568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Thangaraj&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;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>Sun, 03 Sep 2006 22:23:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/comapring-two-internal-tables/m-p/1533550#M243568</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2006-09-03T22:23:17Z</dc:date>
    </item>
  </channel>
</rss>

