<?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 on SELECT from VBAP in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-select-from-vbap/m-p/3672610#M884533</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;few suggestion....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Check if there is an index in VBAP for MATNR. And if possible then create and use that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Try following Code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: s_cursor TYPE cursor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not t_mara[] is initial.&lt;/P&gt;&lt;P&gt;OPEN CURSOR WITH HOLD s_cursor FOR&lt;/P&gt;&lt;P&gt;SELECT vbeln&lt;/P&gt;&lt;P&gt;posnr&lt;/P&gt;&lt;P&gt;matnr&lt;/P&gt;&lt;P&gt;matkl&lt;/P&gt;&lt;P&gt;kwmeng&lt;/P&gt;&lt;P&gt;vrkme&lt;/P&gt;&lt;P&gt;werks&lt;/P&gt;&lt;P&gt;FROM vbap&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN i_mara&lt;/P&gt;&lt;P&gt;WHERE matnr EQ i_mara-matnr&lt;/P&gt;&lt;P&gt;AND matkl IN s_matkl&lt;/P&gt;&lt;P&gt;AND werks IN s_werks.&lt;/P&gt;&lt;P&gt;DO.&lt;/P&gt;&lt;P&gt;  FETCH NEXT CURSOR s_cursor&lt;/P&gt;&lt;P&gt;             APPENDING&lt;/P&gt;&lt;P&gt;             TABLE i_vbap&lt;/P&gt;&lt;P&gt;             PACKAGE SIZE '2000'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    CLOSE CURSOR s_cursor.&lt;/P&gt;&lt;P&gt;    EXIT.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Apr 2008 13:29:16 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-04-09T13:29:16Z</dc:date>
    <item>
      <title>Performance issue on SELECT from VBAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-select-from-vbap/m-p/3672606#M884529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi experts,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  SELECT vbeln&lt;/P&gt;&lt;P&gt;         posnr&lt;/P&gt;&lt;P&gt;         matnr&lt;/P&gt;&lt;P&gt;         matkl&lt;/P&gt;&lt;P&gt;         kwmeng&lt;/P&gt;&lt;P&gt;         vrkme&lt;/P&gt;&lt;P&gt;         werks&lt;/P&gt;&lt;P&gt;    FROM vbap&lt;/P&gt;&lt;P&gt;    INTO TABLE i_vbap&lt;/P&gt;&lt;P&gt;     FOR ALL ENTRIES IN i_mara&lt;/P&gt;&lt;P&gt;   WHERE matnr EQ i_mara-matnr&lt;/P&gt;&lt;P&gt;     AND matkl IN s_matkl&lt;/P&gt;&lt;P&gt;     AND werks IN s_werks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to compute for all open sales order quantity of a material in that select above but I'm having problem because the select is taking way too long resulting into a runtime error. Can you suggest other solution? Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Marc Winston Ng on Apr 9, 2008 2:46 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 12:45:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-select-from-vbap/m-p/3672606#M884529</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-09T12:45:51Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue on SELECT from VBAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-select-from-vbap/m-p/3672607#M884530</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;If there is a parent child relationship between two tables it is better to go for INNER JOIN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If there are any indexes available, search them whether any thing is available with fields in the where condition.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If any thing is there follow the order of the fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If u can't find any thing, try to create a secondary index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Angi.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 12:53:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-select-from-vbap/m-p/3672607#M884530</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-09T12:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue on SELECT from VBAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-select-from-vbap/m-p/3672608#M884531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is already index on MATNR in VBAP, this query shouldn't take much time unless  i_mara is empty.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;check i_mara[] is not initial before select stmt.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 13:02:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-select-from-vbap/m-p/3672608#M884531</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-09T13:02:35Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue on SELECT from VBAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-select-from-vbap/m-p/3672609#M884532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I don't see an index on MATNR for VBAP (at least in 4.7), however there is table VAPMA which allows for quick access to sales document items via material number.&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 13:06:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-select-from-vbap/m-p/3672609#M884532</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2008-04-09T13:06:03Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue on SELECT from VBAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-select-from-vbap/m-p/3672610#M884533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;few suggestion....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Check if there is an index in VBAP for MATNR. And if possible then create and use that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Try following Code&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;DATA: s_cursor TYPE cursor.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if not t_mara[] is initial.&lt;/P&gt;&lt;P&gt;OPEN CURSOR WITH HOLD s_cursor FOR&lt;/P&gt;&lt;P&gt;SELECT vbeln&lt;/P&gt;&lt;P&gt;posnr&lt;/P&gt;&lt;P&gt;matnr&lt;/P&gt;&lt;P&gt;matkl&lt;/P&gt;&lt;P&gt;kwmeng&lt;/P&gt;&lt;P&gt;vrkme&lt;/P&gt;&lt;P&gt;werks&lt;/P&gt;&lt;P&gt;FROM vbap&lt;/P&gt;&lt;P&gt;FOR ALL ENTRIES IN i_mara&lt;/P&gt;&lt;P&gt;WHERE matnr EQ i_mara-matnr&lt;/P&gt;&lt;P&gt;AND matkl IN s_matkl&lt;/P&gt;&lt;P&gt;AND werks IN s_werks.&lt;/P&gt;&lt;P&gt;DO.&lt;/P&gt;&lt;P&gt;  FETCH NEXT CURSOR s_cursor&lt;/P&gt;&lt;P&gt;             APPENDING&lt;/P&gt;&lt;P&gt;             TABLE i_vbap&lt;/P&gt;&lt;P&gt;             PACKAGE SIZE '2000'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;    CLOSE CURSOR s_cursor.&lt;/P&gt;&lt;P&gt;    EXIT.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDDO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 13:29:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-select-from-vbap/m-p/3672610#M884533</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-09T13:29:16Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue on SELECT from VBAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-select-from-vbap/m-p/3672611#M884534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marc,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First of all below are my comments on your &lt;STRONG&gt;SELECT&lt;/STRONG&gt; statement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;1.&lt;/STRONG&gt; There is no check as to whether &lt;STRONG&gt;&lt;/STRONG&gt;&lt;PRE&gt;&lt;STRONG&gt;&lt;CODE&gt;i_mara[] is initial or not.&lt;/CODE&gt;&lt;/STRONG&gt;&lt;/PRE&gt; When ever we're using &lt;STRONG&gt;FOR ALL ENTRIES&lt;/STRONG&gt; considering the performance it is MANDATORY to have the check as &lt;STRONG&gt;&lt;/STRONG&gt;&lt;PRE&gt;&lt;STRONG&gt;&lt;CODE&gt;IF I_MARA[] IS NOT INITIAL.&lt;/CODE&gt;&lt;/STRONG&gt;&lt;/PRE&gt; &lt;STRONG&gt;Then write the SELECT statement.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;2.&lt;/STRONG&gt; All the KEY FIELDS of the table VBAP (VBELN, POSNR) are not included in this SELECT statement. &lt;STRONG&gt;It is suggestable to use the Key fields in the where condition to increase the performance.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;3.&lt;/STRONG&gt; If you cannot include the key fields in your select statement then try creating a secondary index with the fields what you have used in the where condition.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;4.&lt;/STRONG&gt; In the Selection Screen instead of leaving blank make the fields as MANDATORY fields for input.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;5.&lt;/STRONG&gt; Also we can use inner joins between tables (not more than 2 or 3 tables).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By taking the above precautions we can ensure that the performance is increased.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope these steps solves your problem. Reward accordingly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and Regards,&lt;/P&gt;&lt;P&gt;Maddineni Bharath.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 14:27:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-select-from-vbap/m-p/3672611#M884534</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-09T14:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: Performance issue on SELECT from VBAP</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-select-from-vbap/m-p/3672612#M884535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;no need for a new secondary index...use table &lt;STRONG&gt;VAPMA&lt;/STRONG&gt; as I suggested already.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Apr 2008 14:38:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-on-select-from-vbap/m-p/3672612#M884535</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2008-04-09T14:38:41Z</dc:date>
    </item>
  </channel>
</rss>

