<?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 to Optimize in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize/m-p/3328607#M797294</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Vijay,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't see why this piece of code would need any improvement because from a database perspective you are using 2 select single statements and all correctly mentioning the primary key. The only possible aspect that could be slowing this code is if you are calling this subroutine within a loop of table XKNB1. If that is the case select data from tables KNC1 and KNC3 into separate internal tables outside this loop and replace the select statements with read statements. However I doubt that your performance issue has much to do with this subroutine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 25 Jan 2008 15:12:00 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-01-25T15:12:00Z</dc:date>
    <item>
      <title>How to Optimize</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize/m-p/3328604#M797291</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Friends,&lt;/P&gt;&lt;P&gt;How to optimize the following Code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM ORDERINVOICE.&lt;/P&gt;&lt;P&gt;  SELECT SINGLE * FROM KNC1 WHERE BUKRS EQ COMPANY AND KUNNR EQ&lt;/P&gt;&lt;P&gt;         XKNB1-KUNNR AND GJAHR EQ SY-DATUM+0(4).&lt;/P&gt;&lt;P&gt;  IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;    DEBITS = KNC1-UM01S + KNC1-UM02S + KNC1-UM03S + KNC1-UM04S + KNC1-UM05S&lt;/P&gt;&lt;P&gt;         + KNC1-UM06S + KNC1-UM07S + KNC1-UM08S + KNC1-UM09S + KNC1-UM10S +&lt;/P&gt;&lt;P&gt;           KNC1-UM11S + KNC1-UM12S + KNC1-UM13S + KNC1-UM14S + KNC1-UM15S +&lt;/P&gt;&lt;P&gt;                  KNC1-UM16S.&lt;/P&gt;&lt;P&gt;    CREDITS = KNC1-UM01H + KNC1-UM02H + KNC1-UM03H + KNC1-UM04H + KNC1-UM05H&lt;/P&gt;&lt;P&gt;         + KNC1-UM06H + KNC1-UM07H + KNC1-UM08H + KNC1-UM09H + KNC1-UM10H +&lt;/P&gt;&lt;P&gt;           KNC1-UM11H + KNC1-UM12H + KNC1-UM13H + KNC1-UM14H + KNC1-UM15H +&lt;/P&gt;&lt;P&gt;                  KNC1-UM16H.&lt;/P&gt;&lt;P&gt;    ZNORMAL = DEBITS - CREDITS + KNC1-UMSAV.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    ZNORMAL = 0.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;  SELECT SINGLE * FROM KNC3 WHERE KUNNR EQ XKNB1-KUNNR AND&lt;/P&gt;&lt;P&gt;        BUKRS =  COMPANY AND SHBKZ = 'W' AND GJAHR = SY-DATUM+0(4).&lt;/P&gt;&lt;P&gt;  IF SY-SUBRC = 0.&lt;/P&gt;&lt;P&gt;    ZPDC = KNC3-SALDV + KNC3-SOLLL - KNC3-HABNL.&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;    ZPDC = 0.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;  ZVARA = LIMIT - ( ZNORMAL + ZPDC ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                               " ORDERINVOICE&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regds.&lt;/P&gt;&lt;P&gt;Vijay&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2008 12:41:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize/m-p/3328604#M797291</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-24T12:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to Optimize</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize/m-p/3328605#M797292</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The first question is always 'why' zo optimize?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Run the SQL Trace, go for the summary on SQL Statements, and Check the minimal and averge&lt;/P&gt;&lt;P&gt;number time per record. If these are around 1ms then there is room for improvement, it is already&lt;/P&gt;&lt;P&gt;optimal.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;see for details:&lt;/P&gt;&lt;P&gt;/people/siegfried.boes/blog/2007/09/05/the-sql-trace-st05-150-quick-and-easy&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here you have 2 select single with fully specified primary key, what do you want to improve?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2008 14:39:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize/m-p/3328605#M797292</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-24T14:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to Optimize</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize/m-p/3328606#M797293</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's not really a performance problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But you can use the DO VARYING construct after your first check of sy-subrc. This wil make the code less spaghetti-like.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2008 14:45:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize/m-p/3328606#M797293</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-24T14:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to Optimize</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize/m-p/3328607#M797294</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Vijay,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't see why this piece of code would need any improvement because from a database perspective you are using 2 select single statements and all correctly mentioning the primary key. The only possible aspect that could be slowing this code is if you are calling this subroutine within a loop of table XKNB1. If that is the case select data from tables KNC1 and KNC3 into separate internal tables outside this loop and replace the select statements with read statements. However I doubt that your performance issue has much to do with this subroutine.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 25 Jan 2008 15:12:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize/m-p/3328607#M797294</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-25T15:12:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to Optimize</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize/m-p/3328608#M797295</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;Use following statment&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ADD KNC1-UM01S  THEN KNC1-UM02S &lt;/P&gt;&lt;P&gt;                UNTIL KNC1-UM16S &lt;/P&gt;&lt;P&gt;                GIVING wa_sum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;L.Velu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Jan 2008 07:57:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize/m-p/3328608#M797295</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-01-28T07:57:35Z</dc:date>
    </item>
  </channel>
</rss>

