<?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 Select Query ? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-select-query/m-p/7305471#M1534765</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;First, please ignore the above suggestion to use for all entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To optimize a query you need to know how the data is restricted. From what you've shown we know that you are selecting data from one sales organization ( = p_vkorg) but nothing more.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What are the contents of s_vstel?&lt;/P&gt;&lt;P&gt;What are the contents of s_lfart?&lt;/P&gt;&lt;P&gt;What are the contents of s_erdat?&lt;/P&gt;&lt;P&gt;What are the contents of s_wadat?&lt;/P&gt;&lt;P&gt;What are the contents of s_podat?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rui Dantas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 07 Oct 2010 09:48:12 GMT</pubDate>
    <dc:creator>Rui_Dantas</dc:creator>
    <dc:date>2010-10-07T09:48:12Z</dc:date>
    <item>
      <title>Performance Issue in Select Query ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-select-query/m-p/7305469#M1534763</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;Can anyone suggest the correct us of the Select query in order to avoid performance constraint.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; SELECT likp~vkorg     "Sales organization
         likp~vstel     "Shipping point/receiving point
         likp~vbeln     "Delivery
         lips~posnr     "Delivery item
         likp~lfart     "Delivery type
         likp~wadat     "Planned goods movement date
         likp~podat     "Date (proof of delivery)
         likp~kunnr     "Ship-to party
         likp~erdat     "Date on which the record was created
         likp~lfdat     "Delivery date
         likp~bolnr     "Actual POD date
         likp~wadat_ist "Actual goods movement date
         likp~waerk     "SD document currency
         lips~matnr     "Material number
         lips~lfimg     "Actual quantity delivered (in sales units)
         lips~vrkme     "Sales unit
         lips~vgbel     "Document number of the reference document
         lips~vgpos     "Item number of the reference item
    FROM ( likp AS likp INNER JOIN lips AS lips ON
           likp~vbeln = lips~vbeln )
    INTO CORRESPONDING FIELDS OF TABLE gt_do
   WHERE likp~vkorg = p_vkorg
     AND likp~vstel IN s_vstel
     AND likp~lfart IN s_lfart
     AND likp~erdat IN s_erdat
     AND likp~wadat IN s_wadat
     AND likp~podat IN s_podat. &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Above c ode takes tooo much time to ftch the data .&lt;/P&gt;&lt;P&gt;Can it be corrected inorder to get teh data as fast as possible.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Saurabh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Oct 2010 06:21:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-select-query/m-p/7305469#M1534763</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-07T06:21:21Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue in Select Query ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-select-query/m-p/7305470#M1534764</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Saurabh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;instead of join try to use for all entries&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Bala Duvvuri&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moderator message: please ignore the above advice from someone who hasn't read* &lt;SPAN __jive_macro_name="thread" id="1174072"&gt;&lt;/SPAN&gt; *even though it's a sticky on this forum&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Matt on Oct 7, 2010 11:55 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Oct 2010 09:40:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-select-query/m-p/7305470#M1534764</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-07T09:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue in Select Query ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-select-query/m-p/7305471#M1534765</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;First, please ignore the above suggestion to use for all entries.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To optimize a query you need to know how the data is restricted. From what you've shown we know that you are selecting data from one sales organization ( = p_vkorg) but nothing more.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What are the contents of s_vstel?&lt;/P&gt;&lt;P&gt;What are the contents of s_lfart?&lt;/P&gt;&lt;P&gt;What are the contents of s_erdat?&lt;/P&gt;&lt;P&gt;What are the contents of s_wadat?&lt;/P&gt;&lt;P&gt;What are the contents of s_podat?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rui Dantas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Oct 2010 09:48:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-select-query/m-p/7305471#M1534765</guid>
      <dc:creator>Rui_Dantas</dc:creator>
      <dc:date>2010-10-07T09:48:12Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue in Select Query ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-select-query/m-p/7305472#M1534766</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Saurabhgoels ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1)  The fields which your are fetching is not in a proper order as they are in table.  I have corrected their order...see below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)  Dont use into corresponding fields of itab, instead use into fields for better performance. So declare an internal table based on the order of fields of your select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3)  Even in the where condition, the fields are not in proper order and they are in the table.  Also I have corrected their order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Select likp~VBELN&lt;/P&gt;&lt;P&gt;likp~ERDAT&lt;/P&gt;&lt;P&gt;likp~VSTEL&lt;/P&gt;&lt;P&gt;likp~VKORG&lt;/P&gt;&lt;P&gt;likp~LFART&lt;/P&gt;&lt;P&gt;likp~WADAT&lt;/P&gt;&lt;P&gt;likp~LFDAT&lt;/P&gt;&lt;P&gt;likp~KUNNR&lt;/P&gt;&lt;P&gt;likp~WAERK&lt;/P&gt;&lt;P&gt;likp~BOLNR&lt;/P&gt;&lt;P&gt;likp~WADAT_IST&lt;/P&gt;&lt;P&gt;likp~PODAT&lt;/P&gt;&lt;P&gt;lips~POSNR&lt;/P&gt;&lt;P&gt;lips~MATNR&lt;/P&gt;&lt;P&gt;lips~LFIMG&lt;/P&gt;&lt;P&gt;lips~VRKME&lt;/P&gt;&lt;P&gt;lips~VGBEL&lt;/P&gt;&lt;P&gt;lips~VGPOS&lt;/P&gt;&lt;P&gt;FROM ( likp AS likp INNER JOIN lips AS lips ON&lt;/P&gt;&lt;P&gt;           likp&lt;SUB&gt;vbeln = lips&lt;/SUB&gt;vbeln )&lt;/P&gt;&lt;P&gt;    INTO TABLE gt_do&lt;/P&gt;&lt;P&gt;WHERE likp~erdat IN s_erdat&lt;/P&gt;&lt;P&gt;     AND likp~vstel IN s_vstel&lt;/P&gt;&lt;P&gt;     AND likp~lfart IN s_lfart&lt;/P&gt;&lt;P&gt;     AND likp~vkorg = p_vkorg &lt;/P&gt;&lt;P&gt;     AND likp~wadat IN s_wadat&lt;/P&gt;&lt;P&gt;     AND likp~podat IN s_podat. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will definitely improve the performance of your select query.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Md Ziauddin&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Oct 2010 10:48:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-select-query/m-p/7305472#M1534766</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-07T10:48:57Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue in Select Query ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-select-query/m-p/7305473#M1534767</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;gt; 1)  The fields which your are fetching is not in a proper order as they are in table.  I have corrected their order...see below.&lt;/P&gt;&lt;P&gt;&amp;gt; 2)  Dont use into corresponding fields of itab, instead use into fields for better performance. So declare an internal table based on the order of fields of your select query.&lt;/P&gt;&lt;P&gt;&amp;gt; 3)  Even in the where condition, the fields are not in proper order and they are in the table.  Also I have corrected their order.&lt;/P&gt;&lt;P&gt;&amp;gt; This will definitely improve the performance of your select query.&lt;/P&gt;&lt;P&gt;&amp;gt; Md Ziauddin&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again, please ignore there recommendations. They all have very minor or no impact on performance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Oct 2010 11:09:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-select-query/m-p/7305473#M1534767</guid>
      <dc:creator>Rui_Dantas</dc:creator>
      <dc:date>2010-10-07T11:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue in Select Query ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-select-query/m-p/7305474#M1534768</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;Split your query in 2 part&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) First Read data from table LIKP into internal table &lt;/P&gt;&lt;P&gt;2) Check where data read from likp table is not empty&lt;/P&gt;&lt;P&gt;3) Read data from lips using &lt;STRONG&gt;for all entries&lt;/STRONG&gt; of data likp which priviouslly read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Some cases join condition is not gives better performance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If likp table has large volume of data then create the index otherwise no need to create the index.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Oct 2010 13:03:40 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-select-query/m-p/7305474#M1534768</guid>
      <dc:creator>ravi_lanjewar</dc:creator>
      <dc:date>2010-10-07T13:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue in Select Query ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-select-query/m-p/7305475#M1534769</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;as written above the only useful comment is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What is in the IN-conditions&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
   WHERE likp~vkorg = p_vkorg
     AND likp~vstel IN s_vstel
     AND likp~lfart IN s_lfart
     AND likp~erdat IN s_erdat
     AND likp~wadat IN s_wadat
     AND likp~podat IN s_podat. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;With selective conditions it will be fast, with not selective conditions it will be slow.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Oct 2010 14:32:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-select-query/m-p/7305475#M1534769</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-07T14:32:02Z</dc:date>
    </item>
    <item>
      <title>Re: Performance Issue in Select Query ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-select-query/m-p/7305476#M1534770</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;split the code and check..it may be faster than ur join.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT likp~vkorg     "Sales organization&lt;/P&gt;&lt;P&gt;            likp~vstel     "Shipping point/receiving point&lt;/P&gt;&lt;P&gt;           likp~vbeln     "Delivery&lt;/P&gt;&lt;P&gt;         likp~lfart     "Delivery type&lt;/P&gt;&lt;P&gt;         likp~wadat     "Planned goods movement date&lt;/P&gt;&lt;P&gt;         likp~podat     "Date (proof of delivery)&lt;/P&gt;&lt;P&gt;         likp~kunnr     "Ship-to party&lt;/P&gt;&lt;P&gt;         likp~erdat     "Date on which the record was created&lt;/P&gt;&lt;P&gt;         likp~lfdat     "Delivery date&lt;/P&gt;&lt;P&gt;         likp~bolnr     "Actual POD date&lt;/P&gt;&lt;P&gt;         likp~wadat_ist "Actual goods movement date&lt;/P&gt;&lt;P&gt;         likp~waerk     "SD document currency&lt;/P&gt;&lt;P&gt;    FROM likp   INTO TABLE &amp;lt;Table 1&amp;gt;   &lt;/P&gt;&lt;P&gt;WHERE likp~vkorg = p_vkorg&lt;/P&gt;&lt;P&gt;     AND likp~vstel IN s_vstel&lt;/P&gt;&lt;P&gt;     AND likp~lfart IN s_lfart&lt;/P&gt;&lt;P&gt;     AND likp~erdat IN s_erdat&lt;/P&gt;&lt;P&gt;     AND likp~wadat IN s_wadat&lt;/P&gt;&lt;P&gt;     AND likp~podat IN s_podat. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and second query for getting the values from LIPS&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT  lips~vbeln     "Delivery&lt;/P&gt;&lt;P&gt;              lips~posnr     "Delivery item&lt;/P&gt;&lt;P&gt;           lips~matnr     "Material number&lt;/P&gt;&lt;P&gt;         lips~lfimg     "Actual quantity delivered (in sales units)&lt;/P&gt;&lt;P&gt;         lips~vrkme     "Sales unit&lt;/P&gt;&lt;P&gt;         lips~vgbel     "Document number of the reference document&lt;/P&gt;&lt;P&gt;         lips~vgpos     "Item number of the reference item&lt;/P&gt;&lt;P&gt;    FROM lips &lt;/P&gt;&lt;P&gt;    INTO TABLE &amp;lt;table 2&amp;gt;   WHERE likp~vkorg = p_vkorg&lt;/P&gt;&lt;P&gt;for all entries in &amp;lt;Table 1&amp;gt;&lt;/P&gt;&lt;P&gt;     where vbeln = table1-vbel.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;else..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;in ur original querry try to avoid INTO CORRESPONDING FIELDS..IT MAY HELP A LITTLE BIT..and in your query you havent used key field..so it will take lot time as that delivery table has lot of entries &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;THANKS &lt;/P&gt;&lt;P&gt;SHANKAR&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: shankar on Oct 8, 2010 12:18 PM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: shankar on Oct 8, 2010 12:19 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Oct 2010 10:17:09 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/performance-issue-in-select-query/m-p/7305476#M1534770</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-10-08T10:17:09Z</dc:date>
    </item>
  </channel>
</rss>

