<?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 this select statement better? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341149#M1639076</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Krishna Kishor Kammaje - There's nothing wrong with using NE on non-key fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 14 Nov 2011 15:06:31 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2011-11-14T15:06:31Z</dc:date>
    <item>
      <title>How to optimize this select statement better?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341142#M1639069</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Guys,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any ideas on how to improve the performance of this select statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT LIKP~VBELN LIKP~ZZST_OPERATION
           LIPS~VGBEL LIPS~POSNR LIPS~WERKS
      INTO (LIKP-VBELN,  LIKP-ZZST_OPERATION,
           LIPS-VGBEL, LIPS-POSNR, LIPS-WERKS)
      FROM LIKP JOIN LIPS
      ON LIKP~VBELN EQ LIPS~VBELN
      WHERE LIKP~KUNNR          EQ ZVXXSENDEN_MAST-KUNNR
      AND   LIKP~ZZST_OPERATION IN S_ZZST
      AND   LIPS~VGTYP          NE C_V.  "Only Deliveries based on SO
      ON CHANGE OF LIPS-VGBEL. "Document number of the reference documen
        MOVE C_NO TO W_ADD_RECORD.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moderator Message: Use "code" tags to format your code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Suhas Saha on Nov 11, 2011 1:26 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Nov 2011 07:40:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341142#M1639069</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-11T07:40:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to optimize this select statement better?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341143#M1639070</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please use an Internal Table for storing all values that you pick from LIKP and LIPS ( I think you are using a select endselect statement now).&lt;/P&gt;&lt;P&gt;The internal table that you will use will contain the fields VBELN ,ZZST_OPERATION,VGBEL, POSNR and WERKS&lt;/P&gt;&lt;P&gt;For the where condition -is there a possibility for using all entries of ZVXXSENDEN_MAST ? if yes do it .&lt;/P&gt;&lt;P&gt;(WHERE LIKP~KUNNR EQ ZVXXSENDEN_MAST-KUNNR&lt;/P&gt;&lt;P&gt;AND LIKP~ZZST_OPERATION IN S_ZZST)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And now you will have to use AT NEW statement for the operation in the end. But because VGBEL is the third field in the list , AT NEW statement might not be possible for this internal table as such. YOu wil have to create a new internal table with the fields in the order :  VBELN ,VGBEL, ZZST_OPERATION,POSNR and WERKS&lt;/P&gt;&lt;P&gt;Copy the data from first internal table to the second.&lt;/P&gt;&lt;P&gt;Sort this internal table by VBELN and VGBEL and finally use AT NEW STATEMENT for last functionality.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Arun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Nov 2011 07:52:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341143#M1639070</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-11T07:52:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to optimize this select statement better?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341144#M1639071</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks Arun! I will try this and let you know the results.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Nov 2011 07:57:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341144#M1639071</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-11T07:57:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to optimize this select statement better?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341145#M1639072</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The simple reason is that your WHERE condition does not use a primary or secondary index of table LIKP. Since you have KUNNR, I suggest you try including table VLKPA in your join select.&lt;/P&gt;&lt;P&gt;Please also look at SAP note 185530 and search for previous discussions of this topic.&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Nov 2011 09:35:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341145#M1639072</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2011-11-11T09:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: How to optimize this select statement better?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341146#M1639073</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I agree with Thomas. Please use VLKPA table for the fast selection using KUNNR field.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Nov 2011 14:55:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341146#M1639073</guid>
      <dc:creator>yuri_ziryukin</dc:creator>
      <dc:date>2011-11-11T14:55:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to optimize this select statement better?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341147#M1639074</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ignore&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Keshav.T on Nov 14, 2011 2:42 PM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Nov 2011 09:11:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341147#M1639074</guid>
      <dc:creator>kesavadas_thekkillath</dc:creator>
      <dc:date>2011-11-14T09:11:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to optimize this select statement better?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341148#M1639075</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would suggest not using 'NE'.&lt;/P&gt;&lt;P&gt;Instead try EQ 'all possible values'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also seems like this SELECT is inside a LOOP. You may try to get it outside the loop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Krishna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Nov 2011 11:14:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341148#M1639075</guid>
      <dc:creator>kammaje_cis</dc:creator>
      <dc:date>2011-11-14T11:14:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to optimize this select statement better?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341149#M1639076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Krishna Kishor Kammaje - There's nothing wrong with using NE on non-key fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 14 Nov 2011 15:06:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341149#M1639076</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-14T15:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to optimize this select statement better?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341150#M1639077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;@Rob Burbank&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cosnider a scneario:&lt;/P&gt;&lt;P&gt;If I know that VGTYP can be A or B and nothing else, then&lt;/P&gt;&lt;P&gt;Is it not better to use (LIPS&lt;SUB&gt;VGTYP EQ 'A' OR LIPS&lt;/SUB&gt;VGTYP EQ 'B' ) rather than using LIPS~VGTYP NE C_V?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Krishna&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2011 06:29:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341150#M1639077</guid>
      <dc:creator>kammaje_cis</dc:creator>
      <dc:date>2011-11-15T06:29:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to optimize this select statement better?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341151#M1639078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I would suggest not using 'NE'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please do not mix 2 recommendation:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+ &lt;STRONG&gt;If possible then change a negative condition into a positive condition.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;   For example:    x can be 1,2,3, and 4 and nothing else.&lt;/P&gt;&lt;P&gt;   Instead you writing   x &amp;amp;lt;&amp;amp;gt; '4'  , it is better to write   x IN ( '1', '2', '3' )&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;   But be aware, if a new value becomes possible, then the SELECT is incorrect.&lt;/P&gt;&lt;P&gt;   Sometimes it is clear, that there will be no change or it is possible to get the possible values from a&lt;/P&gt;&lt;P&gt;   buffered customizing table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;+ &lt;STRONG&gt;There is frequently the recommendation to skip the NE-conditions without replacement&lt;/STRONG&gt; (your sentence sounds like this)&lt;/P&gt;&lt;P&gt;   &lt;/P&gt;&lt;P&gt;   This is in general wrong, because it can imply then many more records are selected and transferred to the application &lt;/P&gt;&lt;P&gt;   server. It must be decided for the actual problem, whether the condition can have such an effect and whether it can&lt;/P&gt;&lt;P&gt;   have an negative effect on the optimizer to choose a suboptimal access path. Usually the condition is without effect on&lt;/P&gt;&lt;P&gt;   the access path, but with effect on the result set (on the database!)  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2011 08:58:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341151#M1639078</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-15T08:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to optimize this select statement better?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341152#M1639079</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I know that VGTYP can be A or B and nothing else, then&lt;/P&gt;&lt;P&gt;Is it not better to use (LIPS&lt;SUB&gt;VGTYP EQ 'A' OR LIPS&lt;/SUB&gt;VGTYP EQ 'B' ) rather than using LIPS~VGTYP NE C_V?&lt;/P&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Without trying it, I'd say that they would be about the same ("about" meaning not worth the while to determine the difference). If anything, I would expect the NE in this case to be somewhat quicker because it is ony checking one condition while the OR is checking two.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Avoid using NE on key fields when that would cause the database not to use the index though.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2011 14:10:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341152#M1639079</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2011-11-15T14:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to optimize this select statement better?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341153#M1639080</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Rob. That helped me to understand 'NE'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Nov 2011 03:41:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341153#M1639080</guid>
      <dc:creator>kammaje_cis</dc:creator>
      <dc:date>2011-11-17T03:41:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to optimize this select statement better?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341154#M1639081</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;Please check point 2 in SAP Note 185530.&lt;/P&gt;&lt;P&gt;Using the index table vlkpa  will be a better choice.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Nov 2011 06:37:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341154#M1639081</guid>
      <dc:creator>brian_zhu</dc:creator>
      <dc:date>2011-11-17T06:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to optimize this select statement better?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341155#M1639082</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try to use an internal table to get the data and do your modifications by looping the internal table. that would be good..&lt;/P&gt;&lt;P&gt;you try the following code..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;types: begin of ty_itbl,
	vgbel type LIPS-VGBEL,
	vbeln type LIKP-VBELN, 
        zzst_operation type LIKP-ZZST_OPERATION,
        posnr type LIPS-POSNR, 
	werks type LIPS-WERKS,
	end of ty_itbl.
data wt_itbl type table of ty_itbl,
data wa_itbl type ty_itbl.

SELECT LIKP~VBELN LIKP~ZZST_OPERATION
           LIPS~VGBEL LIPS~POSNR LIPS~WERKS
      INTO CORRESPONDING FIELDS OF TABLE WT_ITBL
      FROM LIKP JOIN LIPS
      ON   LIKP~VBELN EQ LIPS~VBELN
      WHERE LIKP~KUNNR          EQ ZVXXSENDEN_MAST-KUNNR
      AND   LIKP~ZZST_OPERATION IN S_ZZST
      AND   LIPS~VGTYP          NE C_V. 

LOOP AT WT_ITBL INTO WA_ITBL.
*/*use control breaks..and what u need to change.../
*/*AT new vgbel...endat...*/
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Nov 2011 03:07:55 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341155#M1639082</guid>
      <dc:creator>surajarafath</dc:creator>
      <dc:date>2011-11-18T03:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to optimize this select statement better?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341156#M1639083</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, this is how i will optimize this expensive SQL statement by using an internal tables for LIKP and LIPS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT from table&amp;nbsp; ZVXXSENDEN_MAST...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S52"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT &lt;/SPAN&gt;VBELN KUNNR ZZST_OPERATION &lt;SPAN class="L0S52"&gt;FROM &lt;/SPAN&gt;LIKP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;INTO &lt;/SPAN&gt;CORRESPONDING &lt;SPAN class="L0S52"&gt;FIELDS &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;OF &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;TABLE &lt;/SPAN&gt;T_LIKP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;WHERE &lt;/SPAN&gt;KUNNR &lt;SPAN class="L0S52"&gt;EQ &lt;/SPAN&gt;ZVXXSENDEN_MAST&lt;SPAN class="L0S70"&gt;-&lt;/SPAN&gt;KUNNR &lt;SPAN class="L0S52"&gt;AND &lt;/SPAN&gt;ZZST_OPERATION &lt;SPAN class="L0S52"&gt;IN &lt;/SPAN&gt;S_ZZST&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;IF &lt;/SPAN&gt;SY&lt;SPAN class="L0S70"&gt;-&lt;/SPAN&gt;SUBRC &lt;SPAN class="L0S52"&gt;EQ &lt;/SPAN&gt;&lt;SPAN class="L0S32"&gt;0&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;SELECT &lt;/SPAN&gt;VBELN VGBEL POSNR WERKS &lt;SPAN class="L0S52"&gt;FROM &lt;/SPAN&gt;LIPS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;INTO &lt;/SPAN&gt;CORRESPONDING &lt;SPAN class="L0S52"&gt;FIELDS &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;OF &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;TABLE &lt;/SPAN&gt;T_LIPS&amp;nbsp; &lt;SPAN class="L0S31"&gt;" T_LIPS&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;FOR &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;ALL &lt;/SPAN&gt;ENTRIES &lt;SPAN class="L0S52"&gt;IN &lt;/SPAN&gt;T_LIKP&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;WHERE &lt;/SPAN&gt;VBELN &lt;SPAN class="L0S52"&gt;EQ &lt;/SPAN&gt;T_LIKP&lt;SPAN class="L0S70"&gt;-&lt;/SPAN&gt;vbeln &lt;SPAN class="L0S52"&gt;AND &lt;/SPAN&gt;VGTYP &lt;SPAN class="L0S52"&gt;NE &lt;/SPAN&gt;C_V&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UNASSIGN &amp;lt;fs_output1&amp;gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;IF &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;NOT &lt;/SPAN&gt;T_LIPS[] &lt;SPAN class="L0S52"&gt;IS &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;INITIAL&lt;/SPAN&gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="L0S52"&gt;LOOP &lt;/SPAN&gt;&lt;SPAN class="L0S52"&gt;at &lt;/SPAN&gt;T_LIPS &lt;SPAN class="L0S52"&gt;ASSIGNING &lt;/SPAN&gt;&amp;lt;fs_output1&amp;gt;&lt;SPAN class="L0S55"&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "Processsing goes here....&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDLOOP.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&lt;/SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="L0S55"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Test it via ST12 for the SQL performance. Welcome your inputs too. Cheers !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 20 Jan 2016 07:34:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-optimize-this-select-statement-better/m-p/8341156#M1639083</guid>
      <dc:creator>vjreburiano</dc:creator>
      <dc:date>2016-01-20T07:34:51Z</dc:date>
    </item>
  </channel>
</rss>

