<?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: How WHere is executed in LOOP ENDLOOP in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-where-is-executed-in-loop-endloop/m-p/6296744#M1390540</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can put one condition in loop vbap as take one variable vbeln and pass the vbeln each time of the loop itration adn compare the vbeln with next iteration. if it is not equal at 3 rd record write EXIT command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at vbap  where vbeln = vbak-vbeln index l_index.&lt;/P&gt;&lt;P&gt;   l_vbeln = vbak-vbeln.&lt;/P&gt;&lt;P&gt;  l1_vbeln = vbap-vbeln.&lt;/P&gt;&lt;P&gt;  if l_vbeln ne l1_vbeln.&lt;/P&gt;&lt;P&gt;   exit.&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;May be this is useful for improve the performace also&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 12 Nov 2009 07:43:16 GMT</pubDate>
    <dc:creator>former_member774351</dc:creator>
    <dc:date>2009-11-12T07:43:16Z</dc:date>
    <item>
      <title>How WHere is executed in LOOP ENDLOOP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-where-is-executed-in-loop-endloop/m-p/6296737#M1390533</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;I got to know that Parellel cursor is better that Nested loop. But before that i want to know how WHERE condition is executed in LOOP ENDLOOP. i.e.,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP it_vbak assigning &amp;lt;VBAK&amp;gt; .&lt;/P&gt;&lt;P&gt;   LOOP it_VBAP assigning &amp;lt;VBAP&amp;gt; where VBELN eq &amp;lt;vbak&amp;gt;-vbeln.&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;In the above case does it search from 1 row of it_VBAP table for every record eq vbak vbeln, or how it search the records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rajiv&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2009 06:27:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-where-is-executed-in-loop-endloop/m-p/6296737#M1390533</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-12T06:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: How WHere is executed in LOOP ENDLOOP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-where-is-executed-in-loop-endloop/m-p/6296738#M1390534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It searches from first row of the record all the time. I don't think it will use evern BINARY SEARCH.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2009 06:38:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-where-is-executed-in-loop-endloop/m-p/6296738#M1390534</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-12T06:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: How WHere is executed in LOOP ENDLOOP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-where-is-executed-in-loop-endloop/m-p/6296739#M1390535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;can we use Binary search in LOOP ENDLOOP&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2009 06:59:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-where-is-executed-in-loop-endloop/m-p/6296739#M1390535</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-12T06:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: How WHere is executed in LOOP ENDLOOP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-where-is-executed-in-loop-endloop/m-p/6296740#M1390536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Use following program so that system will not check it_vbap from first record&lt;/P&gt;&lt;P&gt;LOOP it_vbak assigning &amp;lt;VBAK&amp;gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table it_vbap assigning &amp;lt;vbap&amp;gt; where VBELN eq &amp;lt;vbak&amp;gt;-vbeln.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0 . &lt;/P&gt;&lt;P&gt;lv_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;LOOP it_VBAP assigning &amp;lt;VBAP&amp;gt; where VBELN eq &amp;lt;vbak&amp;gt;-vbeln from lv_tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2009 07:02:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-where-is-executed-in-loop-endloop/m-p/6296740#M1390536</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-12T07:02:44Z</dc:date>
    </item>
    <item>
      <title>Re: How WHere is executed in LOOP ENDLOOP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-where-is-executed-in-loop-endloop/m-p/6296741#M1390537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is one case where the whole internal table will not be read, you must declare the internal table with a SORTED TYPE using the same keys in the same sequence than in the WHERE CLAUSE.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;DATA: it_vbap TYPE SORTED TABLE OF vbap WITH NON-UNIQUE KEY vbeln.
* Or
DATA: it_vbap TYPE SORTED TABLE OF vbap WITH UNIQUE KEY vbeln posnr.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Use F1 on LOOP statement on WHERE logexp addition :&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;When you use the WHERE condition with a STANDARD or HASHED table, a full table scan is always required. &lt;/P&gt;&lt;P&gt;If you are working with a SORTED TABLE, the partial sequential processing can be optimized so that only the entries that actually satisfy the WHERE condition are processed. This optimization requires that the WHERE condition be specified in the form &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WHERE k1 = v1 AND k2 = v2 AND ... AND kn = vn &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;where the components k1, ..., kn are in the same sequence as the beginning of the table key. &lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;If you don't want to use a SORTED TABLE type, SORT the table and begin the LOOP with the index from a READ TABLE BINARY SEARCH, exit the LOOP when the key changes.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SORT it_vbap BY vbeln posnr.
" ...
LOOP it_vbak ASSIGNING &amp;lt;vbak&amp;gt; .
  " ...
  READ TABLE it_vbap TRANSPORTING NO FIELDS BINARY SEARCH
    where vbeln eq &amp;lt;vbak&amp;gt;-vbeln.
  IF sy-subrc = 0 .
    lv_tabix = sy-tabix.
    LOOP it_vbap ASSIGNING &amp;lt;vbap&amp;gt; FROM lv_tabix.
      IF &amp;lt;vbap&amp;gt;-vbeln NE &amp;lt;vbak&amp;gt;-vbeln. EXIT. ENDIF.
      " ...
    ENDLOOP.
  ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Raymond&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2009 07:09:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-where-is-executed-in-loop-endloop/m-p/6296741#M1390537</guid>
      <dc:creator>RaymondGiuseppi</dc:creator>
      <dc:date>2009-11-12T07:09:39Z</dc:date>
    </item>
    <item>
      <title>Re: How WHere is executed in LOOP ENDLOOP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-where-is-executed-in-loop-endloop/m-p/6296742#M1390538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ashwin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In ur logic suppose 1000 entries are there in VBAP itab we are searching from that Index to last, suppose in for a condition only 2 records may come, then that time it searches from the Index to last, so it may also be unncessary. They what will be the logic&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2009 07:16:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-where-is-executed-in-loop-endloop/m-p/6296742#M1390538</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-12T07:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: How WHere is executed in LOOP ENDLOOP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-where-is-executed-in-loop-endloop/m-p/6296743#M1390539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hope, following program will solve your concern&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort it_vbap  by vbeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP it_vbak assigning &amp;lt;VBAK&amp;gt; .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;read table it_vbap assigning &amp;lt;vbap&amp;gt; where VBELN eq &amp;lt;vbak&amp;gt;-vbeln binary search.&lt;/P&gt;&lt;P&gt;if sy-subrc = 0 . &lt;/P&gt;&lt;P&gt;lv_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;LOOP it_VBAP assigning &amp;lt;VBAP&amp;gt; where VBELN eq &amp;lt;vbak&amp;gt;-vbeln from lv_tabix.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if &amp;lt;vbap&amp;gt;-vbeln NE &amp;lt;vbak&amp;gt;-vbeln .&lt;/P&gt;&lt;P&gt; EXIT.&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;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2009 07:41:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-where-is-executed-in-loop-endloop/m-p/6296743#M1390539</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-11-12T07:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: How WHere is executed in LOOP ENDLOOP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-where-is-executed-in-loop-endloop/m-p/6296744#M1390540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;you can put one condition in loop vbap as take one variable vbeln and pass the vbeln each time of the loop itration adn compare the vbeln with next iteration. if it is not equal at 3 rd record write EXIT command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at vbap  where vbeln = vbak-vbeln index l_index.&lt;/P&gt;&lt;P&gt;   l_vbeln = vbak-vbeln.&lt;/P&gt;&lt;P&gt;  l1_vbeln = vbap-vbeln.&lt;/P&gt;&lt;P&gt;  if l_vbeln ne l1_vbeln.&lt;/P&gt;&lt;P&gt;   exit.&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;May be this is useful for improve the performace also&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 12 Nov 2009 07:43:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-where-is-executed-in-loop-endloop/m-p/6296744#M1390540</guid>
      <dc:creator>former_member774351</dc:creator>
      <dc:date>2009-11-12T07:43:16Z</dc:date>
    </item>
  </channel>
</rss>

