<?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: Alternative for nested loops in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-nested-loops/m-p/5815792#M1314092</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;Thanks for the reply but I do need both of the tables for some other reasons. I am not selecting data in them, but putting data in them based on certain restrictions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 19 Jun 2009 14:57:45 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-06-19T14:57:45Z</dc:date>
    <item>
      <title>Alternative for nested loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-nested-loops/m-p/5815788#M1314088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Gurus,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following problem :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are 2 internal tables namely 1 &amp;amp;2.&lt;/P&gt;&lt;P&gt;Now there is a field in table 1 'AUGBL' which should be equal to  field in Table2-BELNR.&lt;/P&gt;&lt;P&gt;Now if there is a match between TABLE1-AUGBL and TABLE2-BELNR, &lt;/P&gt;&lt;P&gt;so we move to table 2 to look for 'augbl' associated with 'belnr' in the same table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I have to give the following logic -&lt;/P&gt;&lt;P&gt;If table2-belnr = table2-augbr,&lt;/P&gt;&lt;P&gt;   Then do nothing.&lt;/P&gt;&lt;P&gt;Else.&lt;/P&gt;&lt;P&gt;Check, for the Augbl which will equal Belnr in a different position in table 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For ex:&lt;/P&gt;&lt;P&gt;Table1-AUGBL = 2.&lt;/P&gt;&lt;P&gt;So now we have to search a field when Table1-augbl = Table2-belnr = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now for this record in table2, there are 2 conditions:&lt;/P&gt;&lt;P&gt;When Table2-augbl = 2, (in which case we do nothing)&lt;/P&gt;&lt;P&gt;or,&lt;/P&gt;&lt;P&gt;Table2-augbl NE 2, or Table2-augbl = 3.&lt;/P&gt;&lt;P&gt;In the latter case,  there will be another field in Table2-BELNR = 3. So we go to this record now and check for the associated AUGBL and do the same checks above.&lt;/P&gt;&lt;P&gt;We keep on continuing for this till the time we do not get the Table2-belnr = Table2-augbl in the end for the same record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I want to achieve this without using nested loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kindly help as I already have wated a lot of time.&lt;/P&gt;&lt;P&gt;Please let me know if there are any clarifications.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jun 2009 14:25:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-nested-loops/m-p/5815788#M1314088</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-19T14:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative for nested loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-nested-loops/m-p/5815789#M1314089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try to use Join in select query with common fields..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or send the query you used so we wil try to optimize and send the better solution..&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jun 2009 14:32:11 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-nested-loops/m-p/5815789#M1314089</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-19T14:32:11Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative for nested loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-nested-loops/m-p/5815790#M1314090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please see [The Performance of Nested Loops|/people/rob.burbank/blog/2006/02/07/performance-of-nested-loops]&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jun 2009 14:32:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-nested-loops/m-p/5815790#M1314090</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-19T14:32:46Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative for nested loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-nested-loops/m-p/5815791#M1314091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey..&lt;/P&gt;&lt;P&gt;Before u get the data into two internal tables through SELECT stmts.&lt;/P&gt;&lt;P&gt;U can use JOIN instead of two SELECT stmts ..that wud fetch the data into single internal table..&lt;/P&gt;&lt;P&gt;and that may ease ur validations and further process..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;try this out..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;KC&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jun 2009 14:41:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-nested-loops/m-p/5815791#M1314091</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-19T14:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative for nested loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-nested-loops/m-p/5815792#M1314092</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;Thanks for the reply but I do need both of the tables for some other reasons. I am not selecting data in them, but putting data in them based on certain restrictions.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jun 2009 14:57:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-nested-loops/m-p/5815792#M1314092</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-19T14:57:45Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative for nested loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-nested-loops/m-p/5815793#M1314093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This works &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;loop at itab into wa_itab1.

read table itab2 into wa_itab2 index sy-index / sy-tabix. " (optional: Binary search with sort )
if sy-subrc eq 0.

endif.

endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 19 Jun 2009 16:41:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-nested-loops/m-p/5815793#M1314093</guid>
      <dc:creator>former_member156446</dc:creator>
      <dc:date>2009-06-19T16:41:02Z</dc:date>
    </item>
    <item>
      <title>Re: Alternative for nested loops</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-nested-loops/m-p/5815794#M1314094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2009 09:17:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alternative-for-nested-loops/m-p/5815794#M1314094</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-06-24T09:17:49Z</dc:date>
    </item>
  </channel>
</rss>

