<?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: Optimize Query for Table S983 in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimize-query-for-table-s983/m-p/3442171#M826646</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;Thanks for the reply. I used ST05. I noticed that when I added the column MANDT the estimated cost dropped to 1. Should I add MANDT too in my ABAP SQL statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;sid&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 22 Feb 2008 06:05:20 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-02-22T06:05:20Z</dc:date>
    <item>
      <title>Optimize Query for Table S983</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimize-query-for-table-s983/m-p/3442169#M826644</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;I used to have the following code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 from S983
        where
          sptag ge SALE_DATE_S
          and sptag le SALE_DATE_E
          and vtweg eq '10'
          and werks eq v_werks
          and lifnr eq TBL_REPORT-LIFNR
              matnr eq TBL_ARTICLES-MATNR
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But it's slow in our production although the first 4 columns in the where clause are keys. Then i found another index in the table that contains the fields "mandt, matnr". And so i recode the above into this:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
 from S983
        where
          matnr eq TBL_ARTICLES-MATNR
          and sptag ge SALE_DATE_S
          and sptag le SALE_DATE_E
          and vtweg eq '10'
          and werks eq v_werks
          and lifnr eq TBL_REPORT-LIFNR
          
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I expect this should yield better result because when i query the table S983 in SE16 using only MATNR input, it was faster. But when I run the second code in debug mode in our production environment it doesn't perform at acceptable level. I think the system doesn't see the appropriate index to use. Please help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Tnx in advance,&lt;/P&gt;&lt;P&gt;sid&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 01:32:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimize-query-for-table-s983/m-p/3442169#M826644</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-22T01:32:39Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize Query for Table S983</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimize-query-for-table-s983/m-p/3442170#M826645</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can run a performance trace (ST05) and use its "explain" function to see which index is used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 04:33:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimize-query-for-table-s983/m-p/3442170#M826645</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-22T04:33:00Z</dc:date>
    </item>
    <item>
      <title>Re: Optimize Query for Table S983</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/optimize-query-for-table-s983/m-p/3442171#M826646</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Rob,&lt;/P&gt;&lt;P&gt;Thanks for the reply. I used ST05. I noticed that when I added the column MANDT the estimated cost dropped to 1. Should I add MANDT too in my ABAP SQL statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;sid&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 22 Feb 2008 06:05:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/optimize-query-for-table-s983/m-p/3442171#M826646</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-02-22T06:05:20Z</dc:date>
    </item>
  </channel>
</rss>

