<?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: Help with timeout for select inside loop in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-timeout-for-select-inside-loop/m-p/6766685#M1462559</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the helping code and for the reading.&lt;/P&gt;&lt;P&gt;And Sorry.. I´m trying to do my best and your right... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bye !&lt;/P&gt;&lt;P&gt;JCO&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 18 Apr 2010 02:01:45 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-04-18T02:01:45Z</dc:date>
    <item>
      <title>Help with timeout for select inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-timeout-for-select-inside-loop/m-p/6766682#M1462556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone, im a little confused with this code. Can you help me to optimize it? Its giving Timeout dump.&lt;/P&gt;&lt;P&gt;Thanks so much, I´m new in abap and I tried hard, but its getting worse.&lt;/P&gt;&lt;P&gt;Any idea is welcomed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT it_lips.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT SINGLE *&lt;/P&gt;&lt;P&gt;      FROM vbak&lt;/P&gt;&lt;P&gt;     WHERE vbeln = it_lips-vgbel.&lt;/P&gt;&lt;P&gt;    IF sy-subrc &amp;lt;&amp;gt; 0 OR vbak-vbtyp &amp;lt;&amp;gt; 'C'.&lt;/P&gt;&lt;P&gt;      CONTINUE.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT SINGLE *&lt;/P&gt;&lt;P&gt;      FROM vbup&lt;/P&gt;&lt;P&gt;     WHERE vbeln = it_lips-vgbel&lt;/P&gt;&lt;P&gt;       AND posnr = it_lips-vgpos.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0 AND vbup-lfgsa = 'C'.&lt;/P&gt;&lt;P&gt;      READ TABLE it_likp WITH KEY vbeln = it_lips-vbeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      IF it_likp-wadat &amp;lt; it_likp-wadat_ist.&lt;/P&gt;&lt;P&gt;        it_data-statu = 'N'.&lt;/P&gt;&lt;P&gt;        v_countn = v_countn + 1.&lt;/P&gt;&lt;P&gt;      ELSE.&lt;/P&gt;&lt;P&gt;        it_data-statu = 'S'.&lt;/P&gt;&lt;P&gt;        v_counts = v_counts + 1.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;      CONTINUE.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    it_data-vbeln = it_lips-vgbel.&lt;/P&gt;&lt;P&gt;    it_data-posnr = it_lips-vgpos.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT SINGLE matnr arktx kwmeng vrkme&lt;/P&gt;&lt;P&gt;      INTO (it_data-matnr, it_data-arktx, it_data-mengs, it_data-vrkme)&lt;/P&gt;&lt;P&gt;      FROM vbap&lt;/P&gt;&lt;P&gt;     WHERE vbeln = it_lips-vgbel&lt;/P&gt;&lt;P&gt;       AND posnr = it_lips-vgpos.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    it_data-menge = it_data-mengs.&lt;/P&gt;&lt;P&gt;    it_data-kunnr = vbak-kunnr.&lt;/P&gt;&lt;P&gt;    SELECT SINGLE name1&lt;/P&gt;&lt;P&gt;      INTO it_data-name1&lt;/P&gt;&lt;P&gt;      FROM kna1&lt;/P&gt;&lt;P&gt;     WHERE kunnr = it_data-kunnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    it_data-edatu = it_likp-wadat.&lt;/P&gt;&lt;P&gt;    it_data-wadat = it_likp-wadat_ist.&lt;/P&gt;&lt;P&gt;    it_data-vkorg = it_likp-vkorg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    APPEND it_data.&lt;/P&gt;&lt;P&gt;    CLEAR: it_data, vbak, it_vbep, vbap, kna1, it_lips, it_likp.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Apr 2010 18:06:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-timeout-for-select-inside-loop/m-p/6766682#M1462556</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-17T18:06:09Z</dc:date>
    </item>
    <item>
      <title>Re: Help with timeout for select inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-timeout-for-select-inside-loop/m-p/6766683#M1462557</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;It is not recommended to use Select inside loop. Use select with for all entries. Something like below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT SINGLE *
  FROM vbak
  INTO TABLE it_vbap
  FOR ALL ENTRIES IN it_lips
  WHERE vbeln = it_lips-vgbel.

LOOP AT it_lips.

READ TABLE it_vbak WITH KEY vbeln = it_lips-vgbel
IF sy-subrc EQ 0 OR it_vbak-vbtyp EQ 'C'.
  CONTINUE.
ENDIF.

ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[http://www.thespot4sap.com/articles/SAPABAPPerformanceTuning_ForAllEntries.asp]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Apr 2010 20:32:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-timeout-for-select-inside-loop/m-p/6766683#M1462557</guid>
      <dc:creator>asik_shameem</dc:creator>
      <dc:date>2010-04-17T20:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: Help with timeout for select inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-timeout-for-select-inside-loop/m-p/6766684#M1462558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;im a little confused with this code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Yeah, we all are, but not only about the code. Who assigns performance optimization tasks to newbies instead of giving them first the opportunity to do a little reading? And if the newbies are out to optimize the code it makes me wonder what the skill level is of the people writing the code originally... &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please, there's tons of stuff of documentation out there. I know it's overwhelming, but I feel generous today (maybe because the sun was shining), so let me help start you off with a small list of recommended reading:&lt;/P&gt;&lt;P&gt;&amp;lt;ul style="list-style:square"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;li&amp;gt;Before posting, check out thread &lt;SPAN __jive_macro_name="thread" id="1283414"&gt;&lt;/SPAN&gt; and &lt;SPAN __jive_macro_name="thread" id="1315156"&gt;&lt;/SPAN&gt;&amp;lt;/li&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;li&amp;gt;Try to read some previous postings in this forum &lt;SPAN __jive_macro_name="forum" id="234"&gt;&lt;/SPAN&gt; (and I'd recommend following postings by by &amp;lt;em&amp;gt;Hermann Gahm&amp;lt;/em&amp;gt; or &amp;lt;em&amp;gt;Siegfried Boes&amp;lt;/em&amp;gt;, who always have nice detailed explanations).&amp;lt;/li&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;li&amp;gt;Have a look at some of the blogs on ABAP performance (e.g. Siegfried Boes' blog on [ST05|http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/7205] &lt;B&gt;[original link is broken]&lt;/B&gt; &lt;B&gt;[original link is broken]&lt;/B&gt; &lt;B&gt;[original link is broken]&lt;/B&gt;;)&amp;lt;/li&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;li&amp;gt;Most importantly, never underestimate the power of the ABAP online documentation, e.g. check out [SQL performance|http://help.sap.com/abapdocu_70/en/ABENOPEN_SQL_PERFO.htm] and for example the [FOR ALL ENTRIES|http://help.sap.com/abapdocu_70/en/ABENWHERE_LOGEXP_ITAB.htm] reference as pointed out by the previous poster above (this will immediately give you lots of ideas like using joins, avoiding reading all columns, etc.)&amp;lt;/li&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/ul&amp;gt;&lt;/P&gt;&lt;P&gt;Cheers, harald&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 17 Apr 2010 22:54:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-timeout-for-select-inside-loop/m-p/6766684#M1462558</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-17T22:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: Help with timeout for select inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-timeout-for-select-inside-loop/m-p/6766685#M1462559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the helping code and for the reading.&lt;/P&gt;&lt;P&gt;And Sorry.. I´m trying to do my best and your right... &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Bye !&lt;/P&gt;&lt;P&gt;JCO&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Apr 2010 02:01:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-timeout-for-select-inside-loop/m-p/6766685#M1462559</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-18T02:01:45Z</dc:date>
    </item>
    <item>
      <title>Re: Help with timeout for select inside loop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-timeout-for-select-inside-loop/m-p/6766686#M1462560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The issue of SELECTing within a LOOP is much overblown. All of the SELECTs are SELECT SINGLE using the fully qualified primary key. Using a JOIN or FOR ALL ENTRIES might speed this up a bit, but dollars to doughnuts, the problem is here: &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;READ TABLE it_likp WITH KEY vbeln = it_lips-vbeln.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;If it_likp is a standard table, you will be reading half of all of the entries, on average, every time you do the read. If you don't want to change it to a sorted or hashed table, SORT it_likp by vbeln before going into the loop and use the addition BINARY SEARCH on the READ statement. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rob Burbank on Apr 18, 2010 9:34 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Rob Burbank on Apr 19, 2010 10:15 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Apr 2010 20:21:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/help-with-timeout-for-select-inside-loop/m-p/6766686#M1462560</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-04-18T20:21:28Z</dc:date>
    </item>
  </channel>
</rss>

