<?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: Performance issue in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3995225#M954495</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;using two select single single statements will give u serious Performance Issues. To make ur code more efficient u should Either fetch the data into an internal table and the process from there. Use a READ statement while working with the Internal Table instead of LOOP AT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sumit Agarwal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 24 Jun 2008 07:26:09 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-24T07:26:09Z</dc:date>
    <item>
      <title>Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3995220#M954490</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;Kindly help on Performance issue..suggest some changes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT p0001.&lt;/P&gt;&lt;P&gt;    MOVE: p0001-pernr TO pernr.&lt;/P&gt;&lt;P&gt;    MOVE: p0001-pernr TO wa_data-pernr.&lt;/P&gt;&lt;UL&gt;&lt;UL&gt;&lt;LI level="2" type="ul"&gt;&lt;P&gt; Add name&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;/UL&gt;&lt;P&gt;    LOOP AT p0002 WHERE begda LE pn-endda&lt;/P&gt;&lt;P&gt;                  AND   endda GE pn-begda&lt;/P&gt;&lt;P&gt;                  AND   pernr =  p0001-pernr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      MOVE: p0002-vorna TO wa_data-vorna.&lt;/P&gt;&lt;P&gt;      MOVE: p0002-nachn TO wa_data-nachn.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT SINGLE land1&lt;/P&gt;&lt;P&gt;    INTO land1&lt;/P&gt;&lt;P&gt;    FROM t001&lt;/P&gt;&lt;P&gt;    WHERE bukrs = p0001-bukrs.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT SINGLE molga&lt;/P&gt;&lt;P&gt;    INTO user_molga&lt;/P&gt;&lt;P&gt;    FROM t500l&lt;/P&gt;&lt;P&gt;    WHERE intca = land1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        IF skip = 0.&lt;/P&gt;&lt;P&gt;      INSERT wa_data INTO TABLE it_data.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;    CLEAR wa_data.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2008 05:32:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3995220#M954490</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-24T05:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3995221#M954491</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi kiran ,&lt;/P&gt;&lt;P&gt;  Instead of using two select single statements select the values into an interbal table in the beginning and use READ TABLE statements within the loop. This should make the loop work faster.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2008 05:39:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3995221#M954491</guid>
      <dc:creator>AB27</dc:creator>
      <dc:date>2008-06-24T05:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3995222#M954492</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 p0001.&lt;/P&gt;&lt;P&gt;MOVE: p0001-pernr TO pernr.&lt;/P&gt;&lt;P&gt;MOVE: p0001-pernr TO wa_data-pernr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ tables pa0002, t001 and t500I here...instead of select stmts.&lt;/P&gt;&lt;P&gt;IF skip = 0.&lt;/P&gt;&lt;P&gt;INSERT wa_data INTO TABLE it_data.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;CLEAR wa_data.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2008 05:42:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3995222#M954492</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-24T05:42:02Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3995223#M954493</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi try avoiding the nested loop..try to use for all entries or read statements.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case, you find it is inevitable to avoid the loops.. use parallel cursor method.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check out these codes :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Conventional Method&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
loop at lt_vbpa into wa_vbpa.
  loop at lt_kna1 into wa_kna1 where kunnr = wa_vbpa-kunnr.

****** Your Actual logic within inner loop ******

  endloop.
endloop.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Parallel Cursor Method&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
sort: lt_vbpa by kunnr,  "Sorting by key is very important
      lt_kna1 by kunnr.  "Same key which is used for where condition is used here
loop at lt_vbpa into wa_vbpa.
  read lt_kna1 into wa_kna1     " This sets the sy-tabix
       with key kunnr = wa_vbpa-kunnr
       binary search.
  if sy-subrc = 0.              "Does not enter the inner loop
    v_kna1_index = sy-tabix.
    loop at lt_kna1 into wa_kna1 from v_kna1_index. "Avoiding Where clause
      if wa_kna1-kunnr &amp;lt;&amp;gt; wa_vbpa-kunnr.  "This checks whether to exit out of loop
        exit.
      endif.

****** Your Actual logic within inner loop ******

   endloop. "KNA1 Loop
  endif.
endloop.  " VBPA Loop

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward if helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2008 05:52:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3995223#M954493</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-24T05:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3995224#M954494</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;The most performance issue lies in SELECT SINGLE statement...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In substitution of SINGLE use &lt;STRONG&gt;UP TO 1 ROWS&lt;/STRONG&gt; before where clause in select statement and also in the inner to get value from internal tables its better you go for READ TABLE with KEY &amp;lt;key name&amp;gt; = &amp;lt;value&amp;gt;&lt;/P&gt;&lt;P&gt;You will have definetly change in the perfomance and the difference would be more...&lt;/P&gt;&lt;P&gt;Mostly never bother about SYSTEM effort,... Mainly think about the interaction with database first and then the system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you are interacting with database with &lt;EM&gt;select single&lt;/EM&gt; statment go for the substituion i had stated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this would be helpful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;please revert back if any suggestions needed.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Narin Nandivada&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2008 05:53:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3995224#M954494</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-24T05:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3995225#M954495</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;using two select single single statements will give u serious Performance Issues. To make ur code more efficient u should Either fetch the data into an internal table and the process from there. Use a READ statement while working with the Internal Table instead of LOOP AT statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward points if useful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sumit Agarwal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2008 07:26:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3995225#M954495</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-24T07:26:09Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3995226#M954496</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I believe that you would be using PNP LDB. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;GET PERNR will be bringing in data in P0001 &amp;amp; P0002&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For an employee you could not change the company code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) So both the SELECT Statmenst for finding out LAND1 and MOLGA will be moved out of the loop. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Insted of looping at P0002 - Use provide-endprovide block on P0002.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
Loop at p0001.

  provide * from p002 between pn-begda and pn-endda.
    move...
  endprovide.

endloop.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 24 Jun 2008 07:38:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3995226#M954496</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-24T07:38:24Z</dc:date>
    </item>
  </channel>
</rss>

