<?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: using indexes. in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-indexes/m-p/6113301#M1362623</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Santosh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's strange system uses index Z01 rather than Z03 : have you checked if p_vkorg is filled? If not as there is less fields in Z01, it is normal that database optimizer uses this one since it should be smaller and thus faster...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if you want to force the use of an index (but you should avoid that if possible!), you can use database hint like this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT vkorg vkbur vtweg spart
  INTO TABLE it_vbak_tmp
  FROM vbak
    WHERE vkorg EQ p_vkorg AND
          vkbur IN s_off AND
          vtweg IN s_vtweg AND
          spart IN s_spart
  %_HINTS ORACLE 'INDEX("VBAK", "VBAK~Z03")'. 
" Hint for Oracle but you can adapt for other databases&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Samuel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Sep 2009 09:07:47 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-09-17T09:07:47Z</dc:date>
    <item>
      <title>using indexes.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-indexes/m-p/6113299#M1362621</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;I have executed below statement&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; select  vkorg&lt;/P&gt;&lt;P&gt;         vkbur&lt;/P&gt;&lt;P&gt;         vtweg&lt;/P&gt;&lt;P&gt;         spart&lt;/P&gt;&lt;P&gt; into table it_vbak_tmp&lt;/P&gt;&lt;P&gt; from vbak&lt;/P&gt;&lt;P&gt; where vkorg eq p_vkorg&lt;/P&gt;&lt;P&gt;   and vkbur in s_off&lt;/P&gt;&lt;P&gt;   and vtweg in s_vtweg&lt;/P&gt;&lt;P&gt;   and spart in s_spart.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have following index on vbak table&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NONUNIQUE  Index   VBAK~Z03&lt;/P&gt;&lt;P&gt;VKORG&lt;/P&gt;&lt;P&gt;VKBUR&lt;/P&gt;&lt;P&gt;VTWEG&lt;/P&gt;&lt;P&gt;SPART&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;when I am executing select statment above and simultaneously checking ST05, i find that index VBAK&lt;SUB&gt;z03 is not at all followed.  it still goes on index VBAK&lt;/SUB&gt;Z01 (MANDT, VBELN).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;what changes i need to do in above select statement so that index VBAK~z03 is followed on table VBAK ?&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;Regards,&lt;/P&gt;&lt;P&gt;Santosh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2009 08:44:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-indexes/m-p/6113299#M1362621</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-17T08:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: using indexes.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-indexes/m-p/6113300#M1362622</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are statistics for the index updated?&lt;/P&gt;&lt;P&gt;(you can check that also in ST05)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And yes, you are right, index Z03 should be used. In fact, even if you only had:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select  vkorg
         vkbur
         vtweg
         spart
 into table it_vbak_tmp
 from vbak.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;... then that should be enough to use the index (in this case, an index full scan).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2009 09:03:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-indexes/m-p/6113300#M1362622</guid>
      <dc:creator>Rui_Dantas</dc:creator>
      <dc:date>2009-09-17T09:03:51Z</dc:date>
    </item>
    <item>
      <title>Re: using indexes.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-indexes/m-p/6113301#M1362623</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Santosh,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That's strange system uses index Z01 rather than Z03 : have you checked if p_vkorg is filled? If not as there is less fields in Z01, it is normal that database optimizer uses this one since it should be smaller and thus faster...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But if you want to force the use of an index (but you should avoid that if possible!), you can use database hint like this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;SELECT vkorg vkbur vtweg spart
  INTO TABLE it_vbak_tmp
  FROM vbak
    WHERE vkorg EQ p_vkorg AND
          vkbur IN s_off AND
          vtweg IN s_vtweg AND
          spart IN s_spart
  %_HINTS ORACLE 'INDEX("VBAK", "VBAK~Z03")'. 
" Hint for Oracle but you can adapt for other databases&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Samuel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2009 09:07:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-indexes/m-p/6113301#M1362623</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-17T09:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: using indexes.</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/using-indexes/m-p/6113302#M1362624</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Santosh B,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Include/add &lt;STRONG&gt;MANDT&lt;/STRONG&gt; field in your INDEX &lt;STRONG&gt;Z03&lt;/STRONG&gt;..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Open SQL if you are not specifying the MANDT then also Optimizer includes it by itself... That is why it's not using &lt;STRONG&gt;Z03&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So Make the above change in your VBAK table index &lt;STRONG&gt;Z03&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Hope it will solve your problem..&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards&lt;/P&gt;&lt;P&gt;ilesh 24x7&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ilesh Nandaniya&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Sep 2009 09:24:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/using-indexes/m-p/6113302#M1362624</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-09-17T09:24:30Z</dc:date>
    </item>
  </channel>
</rss>

