<?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: Poor performance select from bsak in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/poor-performance-select-from-bsak/m-p/1925633#M384129</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 internal table structure is not exactly same as your selection fields then make it according to selection fields as written in select statement &amp;amp; replace INTO CORRESPONDING FIELDS OF TABLE i_bseg  &lt;/P&gt;&lt;P&gt;with  INTO TABLE i_bseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ashven&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Feb 2007 13:39:25 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-02-08T13:39:25Z</dc:date>
    <item>
      <title>Poor performance select from bsak</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/poor-performance-select-from-bsak/m-p/1925631#M384127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;i need to select data first from BSAS this is processed quickly but the second select statement is very poor. But I dont know why because number of records are cca the same and indexes are on the same fields. Should I have remove "corresponding" statement? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; SELECT bsas&lt;SUB&gt;bukrs bsas&lt;/SUB&gt;hkont bsas&lt;SUB&gt;augbl bsas&lt;/SUB&gt;zuonr bsas~gjahr&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        bsas&lt;SUB&gt;belnr  bsas&lt;/SUB&gt;buzei bsas&lt;SUB&gt;blart bsas&lt;/SUB&gt;shkzg bsas~dmbtr&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;        bsas&lt;SUB&gt;wrbtr bsas&lt;/SUB&gt;sgtxt bsas&lt;SUB&gt;kostl bsas&lt;/SUB&gt;pswsl bsas~pswbt&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; FROM bsas INNER JOIN bkpf&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; ON     bsas&lt;SUB&gt;bukrs = bkpf&lt;/SUB&gt;bukrs&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    AND bsas&lt;SUB&gt;augbl = bkpf&lt;/SUB&gt;belnr&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    AND bsas&lt;SUB&gt;augdt = bkpf&lt;/SUB&gt;budat&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; INTO CORRESPONDING FIELDS OF TABLE i_bseg&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; WHERE    bkpf~bukrs = p_bukrs&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      AND ( bkpf&lt;SUB&gt;blart = c_ab OR bkpf&lt;/SUB&gt;blart = c_sa )&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      AND bkpf~cpudt IN r_date&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      AND bkpf~cputm &amp;gt;= w_utime&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      AND bkpf~cputm &amp;lt;= w_utime1.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; SELECT bsak&lt;SUB&gt;bukrs bsak&lt;/SUB&gt;lifnr bsak&lt;SUB&gt;augbl bsak&lt;/SUB&gt;zuonr&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       bsak&lt;SUB&gt;gjahr bsak&lt;/SUB&gt;belnr bsak&lt;SUB&gt;buzei bsak&lt;/SUB&gt;blart&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       bsak&lt;SUB&gt;shkzg bsak&lt;/SUB&gt;dmbtr bsak&lt;SUB&gt;wrbtr bsak&lt;/SUB&gt;sgtxt bsak~hkont&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       bsak&lt;SUB&gt;kostl bsak&lt;/SUB&gt;xref2 bsak&lt;SUB&gt;pswbt bsak&lt;/SUB&gt;pswsl&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; FROM bsak INNER JOIN bkpf&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   ON    bsak&lt;SUB&gt;bukrs = bkpf&lt;/SUB&gt;bukrs&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     AND bsak&lt;SUB&gt;augbl = bkpf&lt;/SUB&gt;belnr&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     AND bsak&lt;SUB&gt;augdt = bkpf&lt;/SUB&gt;budat&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   APPENDING corresponding fields of table i_bseg&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   WHERE bkpf~bukrs = p_bukrs&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     AND ( bkpf&lt;SUB&gt;blart = c_ab OR bkpf&lt;/SUB&gt;blart = c_sa )&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     AND bkpf~cpudt IN r_date&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     AND bkpf~cputm &amp;gt;= w_utime&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     AND bkpf~cputm &amp;lt;= w_utime1.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Feb 2007 13:33:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/poor-performance-select-from-bsak/m-p/1925631#M384127</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-08T13:33:23Z</dc:date>
    </item>
    <item>
      <title>Re: Poor performance select from bsak</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/poor-performance-select-from-bsak/m-p/1925632#M384128</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi is ur internal table structure exactly same as ur selection fields, in that case u remove the corresponding addition there&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suppose there is an internal table like this&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: begin of itab,&lt;/P&gt;&lt;P&gt;      matnr like mara-matnr,&lt;/P&gt;&lt;P&gt;      mtart like mara-mtart,&lt;/P&gt;&lt;P&gt;      end of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;now if use&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;select * from mara into corresponding fields of itab.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will search all the field names in MARA to match strcture of itab. this detiorates performance&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;reward points if found helpful&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Feb 2007 13:36:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/poor-performance-select-from-bsak/m-p/1925632#M384128</guid>
      <dc:creator>rahulkavuri</dc:creator>
      <dc:date>2007-02-08T13:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: Poor performance select from bsak</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/poor-performance-select-from-bsak/m-p/1925633#M384129</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 internal table structure is not exactly same as your selection fields then make it according to selection fields as written in select statement &amp;amp; replace INTO CORRESPONDING FIELDS OF TABLE i_bseg  &lt;/P&gt;&lt;P&gt;with  INTO TABLE i_bseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ashven&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Feb 2007 13:39:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/poor-performance-select-from-bsak/m-p/1925633#M384129</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-08T13:39:25Z</dc:date>
    </item>
    <item>
      <title>Re: Poor performance select from bsak</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/poor-performance-select-from-bsak/m-p/1925634#M384130</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;the secondary index tables (BSAS and BSAK) are really only meant to be used when you know the GL account or vendor, which in this case you don't know.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I would re-write the SELECTS to first go against BKPF and then use FOR ALL ENTRIES to go against BSEG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Yout SELECT against BKPF doesn't use the index very well, but if you check out this, it will show you how to speed that up as well:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/people/rob.burbank/blog/2006/09/13/using-an-index-when-you-dont-have-all-of-the-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>Thu, 08 Feb 2007 14:37:21 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/poor-performance-select-from-bsak/m-p/1925634#M384130</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-08T14:37:21Z</dc:date>
    </item>
    <item>
      <title>Re: Poor performance select from bsak</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/poor-performance-select-from-bsak/m-p/1925635#M384131</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Triska,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Since you have BUKRS and BLART (C_ab, c_sa....) along with all other possible parameters,&lt;/P&gt;&lt;P&gt;Write a query seperately on BKPF,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and after that use BSAS &amp;amp; BSAK seperately, for all entries in t_bkpf..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: &lt;/P&gt;&lt;P&gt;        MANJUNATHA KS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Feb 2007 15:11:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/poor-performance-select-from-bsak/m-p/1925635#M384131</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-02-08T15:11:46Z</dc:date>
    </item>
  </channel>
</rss>

