<?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 VERY IMPORTANT: Performance Optimization for the following Code in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/very-important-performance-optimization-for-the-following-code/m-p/2293978#M500714</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;Here is my current code in the program that I working on:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT SUM( KLMENG ) INTO I_ZDAILY_MVMT-DLY_BO&lt;/P&gt;&lt;P&gt;    FROM VBAP&lt;/P&gt;&lt;P&gt;       WHERE MATNR = I_ZDAILY_MVMT-MATNR AND&lt;/P&gt;&lt;P&gt;             WERKS = I_ZDAILY_MVMT-WERKS AND&lt;/P&gt;&lt;P&gt;             ERDAT = V_DATE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that this code seems to be a bottleneck in the program, using about 50-52 seconds per record/matnr that is processes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I crease performance?&lt;/P&gt;&lt;P&gt;I have tried table VAPMA, but VAPMA doesn't include KLMENG as a field.&lt;/P&gt;&lt;P&gt;Are there any other work-around's (joins on vbak, indexes and etc)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All responses will be rewarded and highly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 27 May 2007 19:03:05 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-05-27T19:03:05Z</dc:date>
    <item>
      <title>VERY IMPORTANT: Performance Optimization for the following Code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/very-important-performance-optimization-for-the-following-code/m-p/2293978#M500714</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;Here is my current code in the program that I working on:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    SELECT SUM( KLMENG ) INTO I_ZDAILY_MVMT-DLY_BO&lt;/P&gt;&lt;P&gt;    FROM VBAP&lt;/P&gt;&lt;P&gt;       WHERE MATNR = I_ZDAILY_MVMT-MATNR AND&lt;/P&gt;&lt;P&gt;             WERKS = I_ZDAILY_MVMT-WERKS AND&lt;/P&gt;&lt;P&gt;             ERDAT = V_DATE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem is that this code seems to be a bottleneck in the program, using about 50-52 seconds per record/matnr that is processes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I crease performance?&lt;/P&gt;&lt;P&gt;I have tried table VAPMA, but VAPMA doesn't include KLMENG as a field.&lt;/P&gt;&lt;P&gt;Are there any other work-around's (joins on vbak, indexes and etc)?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All responses will be rewarded and highly appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 May 2007 19:03:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/very-important-performance-optimization-for-the-following-code/m-p/2293978#M500714</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-27T19:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: VERY IMPORTANT: Performance Optimization for the following Code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/very-important-performance-optimization-for-the-following-code/m-p/2293979#M500715</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why don't use Group clause..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT SUM( KLMENG ) INTO I_ZDAILY_MVMT-DLY_BO&lt;/P&gt;&lt;P&gt;FROM VBAP&lt;/P&gt;&lt;P&gt;WHERE MATNR = I_ZDAILY_MVMT-MATNR AND&lt;/P&gt;&lt;P&gt;WERKS = I_ZDAILY_MVMT-WERKS AND&lt;/P&gt;&lt;P&gt;ERDAT = V_DATE&lt;/P&gt;&lt;P&gt;group by klmeng.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if it is taking again then use sum operation in loop endloop by using internal table events.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Reward Points if it is helpful&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Seshu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 May 2007 19:25:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/very-important-performance-optimization-for-the-following-code/m-p/2293979#M500715</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-27T19:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: VERY IMPORTANT: Performance Optimization for the following Code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/very-important-performance-optimization-for-the-following-code/m-p/2293980#M500716</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;Thank you for the suggestions. However, both methods are unsatisfactory and don not show a difference (except for "group by KLMENG) which increases performance by 1-2 seconds, which isn't very significant, considering the 52 seconds.)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you offer anything else, or is an index my best solution?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks, &lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 May 2007 20:47:32 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/very-important-performance-optimization-for-the-following-code/m-p/2293980#M500716</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-27T20:47:32Z</dc:date>
    </item>
    <item>
      <title>Re: VERY IMPORTANT: Performance Optimization for the following Code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/very-important-performance-optimization-for-the-following-code/m-p/2293981#M500717</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;index would be the best option&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 May 2007 22:05:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/very-important-performance-optimization-for-the-following-code/m-p/2293981#M500717</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-05-27T22:05:21Z</dc:date>
    </item>
    <item>
      <title>Re: VERY IMPORTANT: Performance Optimization for the following Code</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/very-important-performance-optimization-for-the-following-code/m-p/2293982#M500718</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello John&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Perhaps you could try the following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(1) Select all required records from VBAP:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
TYPES: BEGIN OF ty_s_select.
TYPES:   matnr    TYPE matnr.
TYPES:   werks    TYPE werks.
TYPES:   erdat    TYPE erdat.
TYPES:   klmeng   TYPE klmeng.
TYPES: END OF ty_s_select.
TYPES: ty_t_select    TYPE STANDARD TABLE OF ty_s_select
                      WITH DEFAULT KEY.

DATA:
  gs_select    TYPE ty_s_select,
  gt_select    TYPE ty_t_select,
  gt_collect   TYPE ty_t_select.


START-OF-SELECTION.

  SELECT matnr werks erdat klmeng FROM  vbap
    INTO TABLE gt_select
    WHERE matnr IN o_matnr
    AND   werks IN o_werks
    AND   erdat IN o_erdat.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;(2) Collect the records into a new itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  LOOP AT gt_select INTO gs_select.
    COLLECT gs_select INTO gt_data.
  ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;  Uwe&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 27 May 2007 22:35:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/very-important-performance-optimization-for-the-following-code/m-p/2293982#M500718</guid>
      <dc:creator>uwe_schieferstein</dc:creator>
      <dc:date>2007-05-27T22:35:19Z</dc:date>
    </item>
  </channel>
</rss>

