<?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: looping internal tables in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521220#M239338</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Eg:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM ebkn&lt;/P&gt;&lt;P&gt;    INTO TABLE ITAB2&lt;/P&gt;&lt;P&gt;    FOR ALL ENTRIES IN&lt;/P&gt;&lt;P&gt;          ITAB2&lt;/P&gt;&lt;P&gt;    WHERE (your condition).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please reward if useful.&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Aug 2006 05:05:18 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-08-24T05:05:18Z</dc:date>
    <item>
      <title>looping internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521214#M239332</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;I have an internal table filled with data. I need to take up a single record at a time and compare with all the other records of the internal table. This I need to do for all the records of the internal table.&lt;/P&gt;&lt;P&gt;Please tell me the best way of doing this. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thx..&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2006 04:58:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521214#M239332</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-24T04:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: looping internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521215#M239333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use READ statement..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Mohan.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2006 05:02:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521215#M239333</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-24T05:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: looping internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521216#M239334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;use&lt;/P&gt;&lt;P&gt;FOR All entries in ITAB1 into ITAB2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do not put a select query in a loop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2006 05:03:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521216#M239334</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-24T05:03:16Z</dc:date>
    </item>
    <item>
      <title>Re: looping internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521217#M239335</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;use &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT itab1.

 READ table itab2 with key field1 = itab1-field1 
                           field2 = itab1-field2.
                         

ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;OR&amp;lt;/b&amp;gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT itab1.

 LOOP AT itab2.
     if itab1-field1 = itab2-field1 AND 
        itab1-field2 = itab2-field2.

     endif.
 ENDLOOP.

ENDLOOP.&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;P&gt;Regards,&lt;/P&gt;&lt;P&gt;HRA&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2006 05:03:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521217#M239335</guid>
      <dc:creator>dani_mn</dc:creator>
      <dc:date>2006-08-24T05:03:24Z</dc:date>
    </item>
    <item>
      <title>Re: looping internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521218#M239336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt; i will give some sample code.&lt;/P&gt;&lt;P&gt;Loop at abc.&lt;/P&gt;&lt;P&gt;read table xys key xys-fieldname = abc-firlsname.&lt;/P&gt;&lt;P&gt;if sy-sybrc = 0.&lt;/P&gt;&lt;P&gt;do the comparision or any opration as requried.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table lmn key lmn-fieldname = abc-firlsname.&lt;/P&gt;&lt;P&gt;if sy-sybrc = 0.&lt;/P&gt;&lt;P&gt;do the comparision or any opration as requried.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;endloop&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will help&lt;/P&gt;&lt;P&gt;If it help you please don't forget to give ratting &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with regards&lt;/P&gt;&lt;P&gt;Dhananjay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2006 05:04:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521218#M239336</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-24T05:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: looping internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521219#M239337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi pradipta..&lt;/P&gt;&lt;P&gt;u can use READ statement.&lt;/P&gt;&lt;P&gt;Read table itab with key &amp;lt;&amp;gt;.&lt;/P&gt;&lt;P&gt;it will bring the record one by one to the work area.&lt;/P&gt;&lt;P&gt;Then u can process the record in this work area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Naveen&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2006 05:05:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521219#M239337</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-24T05:05:04Z</dc:date>
    </item>
    <item>
      <title>Re: looping internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521220#M239338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Eg:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT * FROM ebkn&lt;/P&gt;&lt;P&gt;    INTO TABLE ITAB2&lt;/P&gt;&lt;P&gt;    FOR ALL ENTRIES IN&lt;/P&gt;&lt;P&gt;          ITAB2&lt;/P&gt;&lt;P&gt;    WHERE (your condition).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please reward if useful.&lt;/P&gt;&lt;P&gt;cheers,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2006 05:05:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521220#M239338</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-24T05:05:18Z</dc:date>
    </item>
    <item>
      <title>Re: looping internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521221#M239339</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;  LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT ITAB.&lt;/P&gt;&lt;P&gt;          Do the comparison...&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;  ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2006 05:06:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521221#M239339</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-24T05:06:45Z</dc:date>
    </item>
    <item>
      <title>Re: looping internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521222#M239340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Apologies!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I misinterprited the question..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2006 05:06:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521222#M239340</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-24T05:06:51Z</dc:date>
    </item>
    <item>
      <title>Re: looping internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521223#M239341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;You can either loop on internal table and do comparision. To simplify the code you can create a copy of your internal table &lt;/P&gt;&lt;P&gt;ITAB_COPY[] = ITAB_ORIGINAL[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT ITAB_ORIGINAL.&lt;/P&gt;&lt;P&gt; LOOP AT ITAB_COPY.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;If you want to compare the whole row(all columns)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  IF ITAB_COPY = ITAB_ORIGINAL.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   Do what you want &lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  ENDIF.&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 required you can use the &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE ITAB_ORIGINAL INDIX SY-TABIX.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;TO remove duplicate rows:&lt;/P&gt;&lt;P&gt;SORT ITAB_ORIGIBAL.&lt;/P&gt;&lt;P&gt;Use...DELETE ADJACENT DUPLICATE ..COMPARING &amp;lt;FIELDS&amp;gt;&amp;lt;fields&amp;gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps !!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Vishal&lt;/P&gt;&lt;P&gt;Rewardif helpful &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2006 05:09:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521223#M239341</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-24T05:09:23Z</dc:date>
    </item>
    <item>
      <title>Re: looping internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521224#M239342</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;try doing this...&lt;/P&gt;&lt;P&gt;sort itab1.&lt;/P&gt;&lt;P&gt;loop at itab2.&lt;/P&gt;&lt;P&gt;read table itab1 with key field1 = itab2-field1 binary search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab2-fld1 = itab1-fdl1.&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;append itab2.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2006 05:10:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521224#M239342</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-24T05:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: looping internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521225#M239343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT ITAB1.
v_tabix = sy-tabix.
LOOP AT ITAB1.
 *--For each ITAB1 record you will be looping with all other records.
  if sy-tabix = v_tabix.
    continue.
*--this is the same record.no need to check this.
   endif.
write your code to compare &amp;amp; place to any other itab
ENDLOOP.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2006 07:13:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521225#M239343</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-24T07:13:24Z</dc:date>
    </item>
    <item>
      <title>Re: looping internal tables</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521226#M239344</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;The best possible soln would depend on your detail requirement but as per the given details below can be one of the solutions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--itab and itab1 have the same structure.&lt;/P&gt;&lt;P&gt;--your data is in itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;itab1[] = itab[].&lt;/P&gt;&lt;P&gt;loop at itab.&lt;/P&gt;&lt;P&gt;  clear itab1.&lt;/P&gt;&lt;P&gt;  loop at itab1. {where condition}&lt;/P&gt;&lt;P&gt;    --comparing the fields of itab with itab1.&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;regards&lt;/P&gt;&lt;P&gt;Anurag&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Aug 2006 08:00:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/looping-internal-tables/m-p/1521226#M239344</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-08-24T08:00:35Z</dc:date>
    </item>
  </channel>
</rss>

