<?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: Bseg data Reading slow in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162937#M120999</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Prakash&lt;/P&gt;&lt;P&gt;1. dont use nested selects.&lt;/P&gt;&lt;P&gt;2.dont use Select and Endselect. &lt;/P&gt;&lt;P&gt;3.Dont use  CORRESPONDING fields &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my be this help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. try to use select single on the table bkpf by giving all the key fields in the where condition then have a "is not  initial" check then you can do a select on bseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this will help you to improve your speed in getting data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards &lt;/P&gt;&lt;P&gt;Lakshmikanth.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Feb 2006 12:48:05 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2006-02-21T12:48:05Z</dc:date>
    <item>
      <title>Bseg data Reading slow</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162926#M120988</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have done some programs for g/l balance frm bseg table ,its very slow to retriving records,even i declared proper where  conditions in select query...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;advise fast retrive...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;any thing like indexing the oracle table ??? or any performance programing ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2006 12:12:41 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162926#M120988</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-21T12:12:41Z</dc:date>
    </item>
    <item>
      <title>Re: Bseg data Reading slow</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162927#M120989</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi prakash,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. If everything is fine,&lt;/P&gt;&lt;P&gt;   then try secondary indexes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. try it from se11 itself.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. It will IMPROVE the performance&lt;/P&gt;&lt;P&gt;  DRASTICALLY !&lt;/P&gt;&lt;P&gt;&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;amit m.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2006 12:20:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162927#M120989</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-21T12:20:02Z</dc:date>
    </item>
    <item>
      <title>Re: Bseg data Reading slow</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162928#M120990</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Prakash,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;           Could you please specify what sort of queries you have used on the BSEG table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Yogeshwari Agashe.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2006 12:23:43 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162928#M120990</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-21T12:23:43Z</dc:date>
    </item>
    <item>
      <title>Re: Bseg data Reading slow</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162929#M120991</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;since BSEG is a big table in application server  ..try to access it for minimum number of times..try to fetch the data at a  time  from the table and put it in some internal tables(presentation server) and use these tables for further operations..&lt;/P&gt;&lt;P&gt;reward if useful...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2006 12:26:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162929#M120991</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-21T12:26:45Z</dc:date>
    </item>
    <item>
      <title>Re: Bseg data Reading slow</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162930#M120992</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;for G/L use table bsas/bsad if possible&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;otherwise try to use tables GLT0 or Cosp for balances.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you need single items, start your selection with&lt;/P&gt;&lt;P&gt;bkpf and indicated fields / key-fields &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2006 12:27:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162930#M120992</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2006-02-21T12:27:51Z</dc:date>
    </item>
    <item>
      <title>Re: Bseg data Reading slow</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162931#M120993</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;check this link if it helps u.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="jive_macro jive_macro_message" href="https://community.sap.com/" __jive_macro_name="message" modifiedtitle="true" __default_attr="1257785"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2006 12:30:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162931#M120993</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-21T12:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: Bseg data Reading slow</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162932#M120994</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SELECT * FROM bkpf INTO CORRESPONDING FIELDS OF t_bkpf WHERE gjahr in ( p_gjahr,wa_gjahr)AND  budat IN  &lt;/P&gt;&lt;P&gt;                         p_budat AND   blart EQ 'RE'.&lt;/P&gt;&lt;P&gt;    SELECT * FROM bseg INTO CORRESPONDING FIELDS OF t_bseg    WHERE  belnr EQ t_bkpf-belnr  AND&lt;/P&gt;&lt;P&gt;  gjahr EQ t_bkpf-gjahr  AND&lt;/P&gt;&lt;P&gt;  hkont EQ p_hkont       AND&lt;/P&gt;&lt;P&gt;  ebeln NE space         AND&lt;/P&gt;&lt;P&gt;  augbl EQ space         AND&lt;/P&gt;&lt;P&gt;  bschl IN ('86','96','40','50') AND&lt;/P&gt;&lt;P&gt;  bustw EQ 'RE01'.&lt;/P&gt;&lt;P&gt;  t_po-low  = t_bseg-ebeln .&lt;/P&gt;&lt;P&gt;  t_po-sign = 'I'.&lt;/P&gt;&lt;P&gt;  t_po-option = 'EQ'.&lt;/P&gt;&lt;P&gt;  APPEND t_po.&lt;/P&gt;&lt;P&gt;  APPEND t_bseg.&lt;/P&gt;&lt;P&gt;      MOVE-CORRESPONDING t_bseg TO t_re.&lt;/P&gt;&lt;P&gt;      APPEND t_re.&lt;/P&gt;&lt;P&gt;    ENDSELECT.&lt;/P&gt;&lt;P&gt;  ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR t_bseg.&lt;/P&gt;&lt;P&gt;  SORT t_po BY low.&lt;/P&gt;&lt;P&gt;  DELETE ADJACENT DUPLICATES FROM t_po.&lt;/P&gt;&lt;P&gt;  SELECT * FROM bseg INTO CORRESPONDING FIELDS OF wa_bdc&lt;/P&gt;&lt;P&gt;                             WHERE&lt;/P&gt;&lt;P&gt;                                   hkont NE p_hkont  AND&lt;/P&gt;&lt;P&gt;                                   gjahr EQ p_gjahr  AND&lt;/P&gt;&lt;P&gt;                                   ebeln IN t_po   AND&lt;/P&gt;&lt;P&gt;                                   bschl IN&lt;/P&gt;&lt;P&gt;                                  ('89','99','86','96','40','50') AND&lt;/P&gt;&lt;P&gt;                                   augbl EQ space    AND&lt;/P&gt;&lt;P&gt;                                   bustw EQ 'WE01'.&lt;/P&gt;&lt;P&gt;    MOVE-CORRESPONDING wa_bdc TO t_bseg.&lt;/P&gt;&lt;P&gt;    APPEND t_bseg.&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;pls advise any problem with it ??&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2006 12:31:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162932#M120994</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-21T12:31:48Z</dc:date>
    </item>
    <item>
      <title>Re: Bseg data Reading slow</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162933#M120995</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;you &amp;lt;b&amp;gt;must&amp;lt;/b&amp;gt; fill  fields:&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt; bukrs, belnr, gjahr&amp;lt;/b&amp;gt; in where clause of bseg&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;othw. you get performance problem&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2nd tip: never use select * but select (fld) &lt;/P&gt;&lt;P&gt;or select f1 f2 f3..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;pls reward point for useful answers&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Andreas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2006 12:36:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162933#M120995</guid>
      <dc:creator>andreas_mann3</dc:creator>
      <dc:date>2006-02-21T12:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Bseg data Reading slow</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162934#M120996</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;Check with your basis if the stistics of those tables are updated, this cause peformance problems.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;&lt;P&gt;Gabriel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2006 12:40:01 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162934#M120996</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-21T12:40:01Z</dc:date>
    </item>
    <item>
      <title>Re: Bseg data Reading slow</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162935#M120997</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI prakash&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;you have to use key fields like burks,belnr etc for selecting rows from bseg becoz these are the fields which have indexes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;one more advice you can use tables like BSIS/BSAS-&amp;gt;customer data for open/close items&lt;/P&gt;&lt;P&gt;BSIK/BSAK --&amp;gt;vendor data for open/close items&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or try &lt;/P&gt;&lt;P&gt;BSID/BSAD-&amp;gt;secondary index for g/L account&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;kishore&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2006 12:40:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162935#M120997</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-21T12:40:38Z</dc:date>
    </item>
    <item>
      <title>Re: Bseg data Reading slow</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162936#M120998</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;Try to use the following VIEWS&lt;/P&gt;&lt;P&gt;V_VBSEGD&lt;/P&gt;&lt;P&gt;V_VBSEGK&lt;/P&gt;&lt;P&gt;V_VBSEGS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check for other views also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or otherwise create secondary index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Venkat Ramanan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2006 12:48:03 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162936#M120998</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-21T12:48:03Z</dc:date>
    </item>
    <item>
      <title>Re: Bseg data Reading slow</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162937#M120999</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Prakash&lt;/P&gt;&lt;P&gt;1. dont use nested selects.&lt;/P&gt;&lt;P&gt;2.dont use Select and Endselect. &lt;/P&gt;&lt;P&gt;3.Dont use  CORRESPONDING fields &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;my be this help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. try to use select single on the table bkpf by giving all the key fields in the where condition then have a "is not  initial" check then you can do a select on bseg.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;hope this will help you to improve your speed in getting data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards &lt;/P&gt;&lt;P&gt;Lakshmikanth.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2006 12:48:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162937#M120999</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-21T12:48:05Z</dc:date>
    </item>
    <item>
      <title>Re: Bseg data Reading slow</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162938#M121000</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;Try to use the following VIEWS&lt;/P&gt;&lt;P&gt;V_VBSEGD&lt;/P&gt;&lt;P&gt;V_VBSEGK&lt;/P&gt;&lt;P&gt;V_VBSEGS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check for other views also.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Or otherwise create secondary index.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Venkat Ramanan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2006 12:49:13 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162938#M121000</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-21T12:49:13Z</dc:date>
    </item>
    <item>
      <title>Re: Bseg data Reading slow</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162939#M121001</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;First - BSEG is a cluster table and I don't think you can create an index on it. Second - for the first two selects, you can:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT ztest MESSAGE-ID zc.

TABLES: bkpf, bseg.

******* new ********
TABLES: t001, bsis, bsas.
******* new ********

DATA: BEGIN OF t_bkpf OCCURS 0.
        INCLUDE STRUCTURE bkpf.
DATA: END   OF t_bkpf.

DATA: BEGIN OF t_bseg OCCURS 0.
        INCLUDE STRUCTURE bseg.
DATA: END   OF t_bseg.

DATA: BEGIN OF t_re OCCURS 0.
        INCLUDE STRUCTURE bseg.
DATA: END   OF t_re.

DATA: BEGIN OF wa_bdc OCCURS 0.
        INCLUDE STRUCTURE bseg.
DATA: END   OF wa_bdc.

******* new ********
DATA: BEGIN OF doc_key OCCURS 0,
        bukrs LIKE bseg-bukrs,
        belnr LIKE bseg-belnr,
        gjahr LIKE bseg-gjahr,
      END   OF doc_key.
******* new ********

DATA: p_hkont LIKE bseg-hkont.

RANGES: p_gjahr  FOR bkpf-gjahr,
        wa_gjahr FOR bkpf-gjahr,
        p_budat  FOR bkpf-budat,
        t_po     FOR bseg-ebeln,
        r_bukrs  FOR t001-bukrs.

******* new ********
r_bukrs-option = 'EQ'.
r_bukrs-sign   = 'I'.
SELECT bukrs FROM t001 INTO r_bukrs-low
  WHERE spras = sy-langu.
  APPEND r_bukrs.
ENDSELECT.
******* new ********

SELECT * FROM bkpf INTO CORRESPONDING FIELDS OF t_bkpf
******* new ********
WHERE bukrs IN r_bukrs AND
      bstat IN (' ', 'A', 'B', 'D', 'M', 'S', 'V', 'W', 'Z') AND
******* new ********
      gjahr IN (p_gjahr, wa_gjahr) AND
      budat IN p_budat AND
      blart EQ 'RE'.
  SELECT * FROM bseg INTO CORRESPONDING FIELDS OF t_bseg
******* new ********
   WHERE bukrs EQ t_bkpf-bukrs AND
******* new ********
         belnr EQ t_bkpf-belnr AND
         gjahr EQ t_bkpf-gjahr AND
         hkont EQ p_hkont AND
         ebeln NE space AND
         augbl EQ space AND
         bschl IN ('86','96','40','50') AND
         bustw EQ 'RE01'.
    t_po-low = t_bseg-ebeln .
    t_po-sign = 'I'.
    t_po-option = 'EQ'.
    APPEND t_po.
    APPEND t_bseg.
    MOVE-CORRESPONDING t_bseg TO t_re.
    APPEND t_re.
  ENDSELECT.
ENDSELECT.
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I haven't looked at how the last select can be speeded up.&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, 21 Feb 2006 15:12:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162939#M121001</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-21T15:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: Bseg data Reading slow</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162940#M121002</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Prakash n Rob,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Suggestion: It will be good to populate only required fields from BKPF and BSEG. This will help a lot in enhancing performance as BSEG is a cluster table.&lt;/P&gt;&lt;P&gt;Also we can create INDEX on cluster tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ashish&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Ashish Gundawar&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2006 16:22:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162940#M121002</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-21T16:22:29Z</dc:date>
    </item>
    <item>
      <title>Re: Bseg data Reading slow</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162941#M121003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is the final code I get. Try it out:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
REPORT ztest MESSAGE-ID zc.

TABLES: bkpf, bseg.

******* new ********
TABLES: t001, ekbe.
******* new ********

DATA: BEGIN OF t_bkpf OCCURS 0.
        INCLUDE STRUCTURE bkpf.
DATA: END   OF t_bkpf.

DATA: BEGIN OF t_bseg OCCURS 0.
        INCLUDE STRUCTURE bseg.
DATA: END   OF t_bseg.

DATA: BEGIN OF t_re OCCURS 0.
        INCLUDE STRUCTURE bseg.
DATA: END   OF t_re.

DATA: BEGIN OF wa_bdc OCCURS 0.
        INCLUDE STRUCTURE bseg.
DATA: END   OF wa_bdc.

******* new ********
DATA: BEGIN OF doc_key OCCURS 0,
        bukrs LIKE bseg-bukrs,
        belnr LIKE bseg-belnr,
        gjahr LIKE bseg-gjahr,
      END   OF doc_key.
DATA: BEGIN OF ir_key OCCURS 0,
        belnr LIKE bseg-belnr,
        gjahr LIKE bseg-gjahr,
      END   OF ir_key.
******* new ********

DATA: p_hkont        LIKE bseg-hkont,
      v_reference    LIKE bkpf-awtyp,                   "REFERENCE KEY
      v_objectkey    LIKE bkpf-awkey.                   "OBJECT KEY

RANGES: p_gjahr  FOR bkpf-gjahr,
        wa_gjahr FOR bkpf-gjahr,
        p_budat  FOR bkpf-budat,
        t_po     FOR bseg-ebeln,
        r_bukrs  FOR t001-bukrs.

******* new ********
r_bukrs-option = 'EQ'.
r_bukrs-sign   = 'I'.
SELECT bukrs FROM t001 INTO r_bukrs-low
  WHERE spras = sy-langu.
  APPEND r_bukrs.
ENDSELECT.
******* new ********

SELECT * FROM bkpf INTO CORRESPONDING FIELDS OF t_bkpf
******* new ********
WHERE bukrs IN r_bukrs AND
      bstat IN (' ', 'A', 'B', 'D', 'M', 'S', 'V', 'W', 'Z') AND
******* new ********
      gjahr IN (p_gjahr, wa_gjahr) AND
      budat IN p_budat AND
      blart EQ 'RE'.
  SELECT * FROM bseg INTO CORRESPONDING FIELDS OF t_bseg
******* new ********
   WHERE bukrs EQ t_bkpf-bukrs AND
******* new ********
         belnr EQ t_bkpf-belnr AND
         gjahr EQ t_bkpf-gjahr AND
         hkont EQ p_hkont AND
         ebeln NE space AND
         augbl EQ space AND
         bschl IN ('86','96','40','50') AND
         bustw EQ 'RE01'.
    t_po-low = t_bseg-ebeln .
    t_po-sign = 'I'.
    t_po-option = 'EQ'.
    APPEND t_po.
    APPEND t_bseg.
    MOVE-CORRESPONDING t_bseg TO t_re.
    APPEND t_re.
  ENDSELECT.
ENDSELECT.

CLEAR t_bseg.
SORT t_po BY low.
DELETE ADJACENT DUPLICATES FROM t_po.

******* new ********
* From the PO history, get the material document for the IR
SELECT belnr gjahr FROM  ekbe
  INTO CORRESPONDING FIELDS OF TABLE ir_key
       WHERE  ebeln  IN t_po
       AND    gjahr  IN p_gjahr
       AND    vgabe  = '2'.
* Now get the accounting document for the material document
LOOP AT ir_key.
  v_objectkey+00(10) = ir_key-belnr.
  v_objectkey+10(10) = ir_key-gjahr. "BELNR+YEAR
  v_reference        = 'MKPF'.
ENDLOOP.
SELECT bukrs belnr gjahr FROM  bkpf
  APPENDING CORRESPONDING FIELDS OF TABLE doc_key
  WHERE  awtyp  = v_reference
  AND    awkey  = v_reference.
******* new ********

SELECT * FROM bseg INTO CORRESPONDING FIELDS OF wa_bdc
  FOR ALL ENTRIES IN doc_key
  WHERE bukrs = doc_key-bukrs AND
        belnr = doc_key-belnr AND
        gjahr = doc_key-gjahr AND
        hkont NE p_hkont AND
        ebeln IN t_po AND
        bschl IN ('89','99','86','96','40','50') AND
        augbl EQ space AND
        bustw EQ 'WE01'.
  MOVE-CORRESPONDING wa_bdc TO t_bseg.
  APPEND t_bseg.
ENDSELECT.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The other suggestions about nested selects, select/endselect, into corresponding, and retrieving only the fields you need are all good. I haven't done this to simplify the coding. I don't think you can use scondary index tables (BSIS and BSAS) because you are checking a not equal condition on HKONT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are a lot of other conditions in the selects that I haven't looked at. Maybe they should be done outside of the selects. I don't know. I also haven't looked at the logic&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In 4.6C you cannot create an index on a cluster table. Since the database doesn't know the fields in the cluster, I don't see how it could be possible. (Maybe in other RDBMS??) In any event, it's a bad idea to create an index on an SAP table to speed up one report. There is overhead in updating the index each time the table is updated. With a little extra coding, you can almost always find a way to use existing indices.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I modified the code somewhat. The original code uses p_gjahr as both a select-option and a parameter. I changed it so that it is a select option.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Message was edited by: Rob Burbank&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Feb 2006 17:11:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162941#M121003</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-21T17:11:08Z</dc:date>
    </item>
    <item>
      <title>Re: Bseg data Reading slow</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162942#M121004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;better you use ldb (logical database) create ldb and insert the tables you need data from in the hierarchy how you want to fetch data .&lt;/P&gt;&lt;P&gt;if you need more detail you can send me mail at sap.manish@gmail.com i will send you all the details .this way you can solve the problem.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Feb 2006 04:36:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bseg-data-reading-slow/m-p/1162942#M121004</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-02-22T04:36:16Z</dc:date>
    </item>
  </channel>
</rss>

