<?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/3691331#M888866</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi...&lt;/P&gt;&lt;P&gt;plz note....never ever in ur life use a select stmt inside a loop.....its coz if u do it, u r hittin de DB for that many entries in the loop. so plz avoid such stmts if u want very gud perfomance for ur program...&lt;/P&gt;&lt;P&gt;as 4 ur code....de alternative i can give u is....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT VBELN POSNR KALNR_KEKO &lt;/P&gt;&lt;P&gt;FROM KANZ &lt;/P&gt;&lt;P&gt;into TABLE IT_KANZ&lt;/P&gt;&lt;P&gt;for all entries in IT_SALE&lt;/P&gt;&lt;P&gt;WHERE VBELN = IT_SALE-VBELN&lt;/P&gt;&lt;P&gt;AND POSNR = IT_SALE-POSNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in this code u r entirely avoiding the loop stmt.&lt;/P&gt;&lt;P&gt;and in dis code,u will find that u r hittin the DB server onli once.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;likewise do the same 4 the other loop stmt also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;reward points if found useful&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Regards&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Winnie&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 08 Apr 2008 05:22:52 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-04-08T05:22:52Z</dc:date>
    <item>
      <title>Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3691326#M888861</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 am using KEPH table for fetching sale order cost. but it is taking lot of time and report is giving time out error.. Can anyboby tel me any alternative table for it or how to increase the performance of this table or is there any BAPI available for sale order costing?.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pls help me. its very urgent. I wil reward u points.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2008 05:01:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3691326#M888861</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-07T05:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3691327#M888862</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Shuba,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please, show me your select-statement. FYI: BAPIs are not intended for a query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Heinz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2008 05:36:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3691327#M888862</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-07T05:36: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/3691328#M888863</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi..&lt;/P&gt;&lt;P&gt;   my code is,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT IT_SALE.&lt;/P&gt;&lt;P&gt;  SELECT VBELN POSNR KALNR_KEKO FROM KANZ APPENDING CORRESPONDING FIELDS OF TABLE IT_KANZ&lt;/P&gt;&lt;P&gt;  WHERE VBELN = IT_SALE-VBELN&lt;/P&gt;&lt;P&gt;  AND POSNR = IT_SALE-POSNR.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT IT_KANZ.&lt;/P&gt;&lt;P&gt;  SELECT KALNR KST001 KST005 KST007 KST009 KST011 KST013 KST015 KST017 KST021 KST023 FROM KEPH&lt;/P&gt;&lt;P&gt;  APPENDING CORRESPONDING FIELDS OF TABLE IT_KEPH&lt;/P&gt;&lt;P&gt;  WHERE KALNR = IT_KANZ-KALNR_KEKO&lt;/P&gt;&lt;P&gt;  AND   KKZST &amp;lt;&amp;gt; 'X'&lt;/P&gt;&lt;P&gt;  AND TVERS = '1'&lt;/P&gt;&lt;P&gt;  AND BWVAR = 'ZT2'&lt;/P&gt;&lt;P&gt;  AND KEART = 'H'.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2008 05:48:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3691328#M888863</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-07T05:48: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/3691329#M888864</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is wrong Code................&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2008 08:01:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3691329#M888864</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-07T08:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3691330#M888865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ok fine. could pls give me the correct code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Apr 2008 08:39:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3691330#M888865</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-07T08:39:28Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3691331#M888866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi...&lt;/P&gt;&lt;P&gt;plz note....never ever in ur life use a select stmt inside a loop.....its coz if u do it, u r hittin de DB for that many entries in the loop. so plz avoid such stmts if u want very gud perfomance for ur program...&lt;/P&gt;&lt;P&gt;as 4 ur code....de alternative i can give u is....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT VBELN POSNR KALNR_KEKO &lt;/P&gt;&lt;P&gt;FROM KANZ &lt;/P&gt;&lt;P&gt;into TABLE IT_KANZ&lt;/P&gt;&lt;P&gt;for all entries in IT_SALE&lt;/P&gt;&lt;P&gt;WHERE VBELN = IT_SALE-VBELN&lt;/P&gt;&lt;P&gt;AND POSNR = IT_SALE-POSNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in this code u r entirely avoiding the loop stmt.&lt;/P&gt;&lt;P&gt;and in dis code,u will find that u r hittin the DB server onli once.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;likewise do the same 4 the other loop stmt also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;reward points if found useful&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Regards&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Winnie&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Apr 2008 05:22:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3691331#M888866</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-08T05:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3691332#M888867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Shuba,&lt;/P&gt;&lt;P&gt;BAPI is not good for most of the report as it deals mostly with a single business object.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this case you need to use SELECT for all entries instead of select inside loop. If you put loop inside select it will make a database connection (which us very costly operation) for each loop pass.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select for all entries internally retrieve all the data for every records in the driver table w/o individual database connection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do an initial check for the driver table (here it_sale). For more better result you can sort it based on the key on which data retrival will be done. Also can eliminate duplicate rows (better to use a temop table as)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data: l_it_sale like it_sale.&lt;/P&gt;&lt;P&gt;l_it_sale[] = it_sale[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;sort l_it_sale by vbeln posnr.&lt;/P&gt;&lt;P&gt;delete adjacent duplicates from l_it_sale comparing vbeln posnr.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;now use l_it_sale as the driver table&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;if l_it_sale[] is not initial.&lt;/P&gt;&lt;P&gt;  select....&lt;/P&gt;&lt;P&gt;  for all entries in l_it_sale&lt;/P&gt;&lt;P&gt;  WHERE VBELN = l_IT_SALE-VBELN&lt;/P&gt;&lt;P&gt;AND POSNR = l_IT_SALE-POSNR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Apr 2008 08:59:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3691332#M888867</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-08T08:59:38Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3691333#M888868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;1)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT IT_SALE.&lt;/P&gt;&lt;P&gt;SELECT VBELN POSNR KALNR_KEKO FROM KANZ APPENDING CORRESPONDING FIELDS OF TABLE IT_KANZ&lt;/P&gt;&lt;P&gt;WHERE VBELN = IT_SALE-VBELN&lt;/P&gt;&lt;P&gt;AND POSNR = IT_SALE-POSNR.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Replace with.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not it_sale is initial.&lt;/P&gt;&lt;P&gt;select VBELN POSNR KALNR_KEKO FROM KANZ &lt;/P&gt;&lt;P&gt;INTO TABLE IT_KANZ&lt;/P&gt;&lt;P&gt;for all entries in it_sale&lt;/P&gt;&lt;P&gt;WHERE VBELN = IT_SALE-VBELN.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT IT_SALE.&lt;/P&gt;&lt;P&gt;read table it_kanz with key vbeln = IT_SALE-VBELN.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your code : &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT IT_KANZ.&lt;/P&gt;&lt;P&gt;SELECT KALNR KST001 KST005 KST007 KST009 KST011 KST013 KST015 KST017 KST021 KST023 FROM KEPH&lt;/P&gt;&lt;P&gt;APPENDING CORRESPONDING FIELDS OF TABLE IT_KEPH&lt;/P&gt;&lt;P&gt;WHERE KALNR = IT_KANZ-KALNR_KEKO&lt;/P&gt;&lt;P&gt;AND KKZST 'X'&lt;/P&gt;&lt;P&gt;AND TVERS = '1'&lt;/P&gt;&lt;P&gt;AND BWVAR = 'ZT2'&lt;/P&gt;&lt;P&gt;AND KEART = 'H'.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Replace with &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not it_kanz is initial.&lt;/P&gt;&lt;P&gt;SELECT KALNR KST001 KST005 KST007 KST009 KST011 KST013 KST015 KST017 KST021 KST023 FROM KEPH&lt;/P&gt;&lt;P&gt;into TABLE IT_KEPH&lt;/P&gt;&lt;P&gt;for all entries in it_kanz&lt;/P&gt;&lt;P&gt;WHERE KALNR = IT_KANZ-KALNR_KEKO&lt;/P&gt;&lt;P&gt;AND KKZST 'X'&lt;/P&gt;&lt;P&gt;AND TVERS = '1'&lt;/P&gt;&lt;P&gt;AND BWVAR = 'ZT2'&lt;/P&gt;&lt;P&gt;AND KEART = 'H'.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT IT_KANZ.&lt;/P&gt;&lt;P&gt;read table it_keph with key KALNR = IT_KANZ-KALNR_KEKO&lt;/P&gt;&lt;P&gt;AND KKZST 'X'&lt;/P&gt;&lt;P&gt;AND TVERS = '1'&lt;/P&gt;&lt;P&gt;AND BWVAR = 'ZT2'&lt;/P&gt;&lt;P&gt;AND KEART = 'H'.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note : Make sure the internal table which you are using in FOR ALL ENTRIES must not be blank.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Apr 2008 05:19:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue/m-p/3691333#M888868</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-15T05:19:43Z</dc:date>
    </item>
  </channel>
</rss>

