<?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: internal tables. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/4513141#M1067238</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can loop on ITAB1 and read the ITAB2 with the same account number.&lt;/P&gt;&lt;P&gt;If you found the entry don't do anything&lt;/P&gt;&lt;P&gt;If you don't found the entry than move it to some other table and update some flag column in the ITAB1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 29 Sep 2008 20:04:23 GMT</pubDate>
    <dc:creator>naimesh_patel</dc:creator>
    <dc:date>2008-09-29T20:04:23Z</dc:date>
    <item>
      <title>internal tables.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/4513140#M1067237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have two internal tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tab1 contains 20 records with a/c number as the key field&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;tab2 contains 15 records of tab1 with the a/c number as the key field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to get only the 5 records from the tab1 which is not in tab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I do this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can any one give some suggestions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Shree.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Sep 2008 19:58:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/4513140#M1067237</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-29T19:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: internal tables.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/4513141#M1067238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can loop on ITAB1 and read the ITAB2 with the same account number.&lt;/P&gt;&lt;P&gt;If you found the entry don't do anything&lt;/P&gt;&lt;P&gt;If you don't found the entry than move it to some other table and update some flag column in the ITAB1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Naimesh Patel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Sep 2008 20:04:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/4513141#M1067238</guid>
      <dc:creator>naimesh_patel</dc:creator>
      <dc:date>2008-09-29T20:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: internal tables.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/4513142#M1067239</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;Same as what Naimesh said.......&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 a/c number = itab1-a/c number.&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;   itab1-flag = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    modify itab1.&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;Now you have 5 records flagged in itab1  which are the different from itab2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;DNP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Sep 2008 20:44:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/4513142#M1067239</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-09-29T20:44:42Z</dc:date>
    </item>
    <item>
      <title>Re: internal tables.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/4513143#M1067240</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Assuming that the number of records that you gave is just an example and that you actually have to process a larger number of records, there are a few ways to process the records:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- loop + loop&lt;/P&gt;&lt;P&gt;- loop + sequential read&lt;/P&gt;&lt;P&gt;- loop + binary search&lt;/P&gt;&lt;P&gt;- loop + loop using a parallel cursor&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;These will of course vary in performance.  Your best tehnique for comparing two tables with a large number of records would be a parallel cursor technique.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;A parallel cursor technique will actaully get you a performance of n+m (where n is the number of records in the first table and m is the number of records in the second)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The following is an example of this code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
v_pos1 = 0.

clear wa_trdir1.
loop at i_trdir1 into wa_trdir1.

  clear v_found.
  clear wa_trdir2.
  loop at i_trdir2 into wa_trdir2
  from v_pos1.

    v_pos1 = sy-tabix.

    if     wa_trdir2-name &amp;lt; wa_trdir1-name.
      write:/ wa_trdir2-name, 'in table 2 but not in table 1'.
    elseif wa_trdir2-name &amp;gt; wa_trdir1-name.
      exit.
    else.
      v_found = 'X'.
    endif.

    clear wa_trdir2.
  endloop.

  if v_found is initial.
    write:/ wa_trdir1-name, 'in table 1 but not in table 2'.
  else.
    write:/ wa_trdir1-name, 'in table 1 and in table 2'.
  endif.

  clear wa_trdir1.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;~Ian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 Sep 2008 20:49:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/internal-tables/m-p/4513143#M1067240</guid>
      <dc:creator>ian_maxwell2</dc:creator>
      <dc:date>2008-09-29T20:49:14Z</dc:date>
    </item>
  </channel>
</rss>

