<?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: Reading BSEG: performance problems in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/reading-bseg-performance-problems/m-p/3693952#M889482</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;In cluster tables like bseg is not good select data using not key fields in "Where" conditions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it's better to use only key fields "BUKRS", "BELNR" in the select statement and then you can use DELELE statement to others fields.&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;Fernando&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 10 Apr 2008 14:16:04 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-04-10T14:16:04Z</dc:date>
    <item>
      <title>Reading BSEG: performance problems</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reading-bseg-performance-problems/m-p/3693948#M889478</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 wrote an function module where I access the table BSEG. It works fine so far, but I have a big performance problem. Has anybody an idea how I can improve the performance? I'm quite new to ABAP, so I would really appreciate your help.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
   select * from bseg
      into table itab_bseg
      where bukrs = perdat-bukrs
*nur Belege deren Nummer mit 5 beginnt
      and   belnr like '0005%'
*das Sachkonto selektieren
      and   hkont = '0000474800'
*Zuordnungsnummer ist mit Reisenummer gefüllt
      and zuonr like search_zuonr.

    clear itab_bseg_kum.
*Falls zu einer Reise mehrere FI Belege
*diese addieren (kommt vor bei mehreren PSP-Elementen)
    loop at itab_bseg into wa_bseg.
      move-corresponding wa_bseg to wa_bseg_kum.
      collect wa_bseg_kum into itab_bseg_kum.
    endloop.

    loop at itab_bseg_kum into wa_bseg_kum.
      wa_perdiems_head-mandt = wa_ptrv_perio-mandt.
      wa_perdiems_head-pernr = wa_ptrv_perio-pernr.
      wa_perdiems_head-reinr = wa_ptrv_perio-reinr.
      wa_perdiems_head-zuonr = wa_bseg_kum-zuonr.
      wa_perdiems_head-belnr = wa_bseg_kum-belnr.
      wa_perdiems_head-sgtxt = wa_bseg_kum-sgtxt.
      wa_perdiems_head-dmbtr = wa_bseg_kum-wrbtr.
      wa_perdiems_head-ename = perdat-ename.

*Währungsschlüssel holen
      select waers from bkpf
        into wa_perdiems_head-waers
        where belnr   = wa_bseg_kum-belnr
        and   gjahr   = wa_bseg_kum-gjahr
        and   bukrs   = wa_bseg_kum-bukrs.

      endselect.

&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;Martin&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Apr 2008 14:35:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reading-bseg-performance-problems/m-p/3693948#M889478</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-08T14:35:46Z</dc:date>
    </item>
    <item>
      <title>Re: Reading BSEG: performance problems</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reading-bseg-performance-problems/m-p/3693949#M889479</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try using the standard index tables of BSEG. They are indexed by a few criteria.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cleared items:&lt;/P&gt;&lt;P&gt;BSAD Accounting: Secondary Index for Customers (Cleared Items)&lt;/P&gt;&lt;P&gt;BSAK Accounting: Secondary Index for Vendors (Cleared Items)&lt;/P&gt;&lt;P&gt;BSAS Accounting: Secondary Index for G/L Accounts (Cleared Items)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Non-cleared items:&lt;/P&gt;&lt;P&gt;BSID Accounting: Secondary Index for Customers&lt;/P&gt;&lt;P&gt;BSIK Accounting: Secondary Index for Vendors&lt;/P&gt;&lt;P&gt;BSIM Secondary Index, Documents for Material&lt;/P&gt;&lt;P&gt;BSIP Index for Vendor Validation of Double Documents&lt;/P&gt;&lt;P&gt;BSIS Accounting: Secondary Index for G/L Accounts &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>Tue, 08 Apr 2008 14:40:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reading-bseg-performance-problems/m-p/3693949#M889479</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-08T14:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: Reading BSEG: performance problems</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reading-bseg-performance-problems/m-p/3693950#M889480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Martin,&lt;/P&gt;&lt;P&gt;if you look around you will find lots of posts here that deal with similar problems on selecting BKPF and BSEG.&lt;/P&gt;&lt;P&gt;Since you're selecting only one G/L account I suggest you read BSIS and BSAS instead of BSEG.&lt;/P&gt;&lt;P&gt;By the way, hardcoding literals is never a good idea...&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Apr 2008 14:43:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reading-bseg-performance-problems/m-p/3693950#M889480</guid>
      <dc:creator>ThomasZloch</dc:creator>
      <dc:date>2008-04-08T14:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: Reading BSEG: performance problems</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reading-bseg-performance-problems/m-p/3693951#M889481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One point where you can increase performance is, after the Select Query on BSEG,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;for fetching the currency from BKPF,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;write a single query,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Data: Begin of itab_bkpf occurs 0,&lt;/P&gt;&lt;P&gt;          belnr..,&lt;/P&gt;&lt;P&gt;          gjahr..,&lt;/P&gt;&lt;P&gt;          bukrs..,&lt;/P&gt;&lt;P&gt;          waers..,&lt;/P&gt;&lt;P&gt;         Endof itab_bkpf.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If itab_bseg[] is not initial.&lt;/P&gt;&lt;P&gt;       Select belnr gjahr bukrs waers from bkpf&lt;/P&gt;&lt;P&gt;        into table itab_bkpf&lt;/P&gt;&lt;P&gt;        for all entries in itab_bseg_kum&lt;/P&gt;&lt;P&gt;        where belnr   = itab_bseg_kum-belnr&lt;/P&gt;&lt;P&gt;        and    gjahr    = itab_bseg_kum-gjahr&lt;/P&gt;&lt;P&gt;        and    bukrs   = itab_bseg_kum-bukrs.&lt;/P&gt;&lt;P&gt;Endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sort itab_bseg by BELNR GJAHR BUKRS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the Loop if you want to fetch the currency of BKPF,you can try &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Loop at itab_bseg_kum into wa_bseg_kum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;code&amp;gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read table itab_bkpf into wa_bkpf with key belnr  = wa_bseg_kum-belnr&lt;/P&gt;&lt;P&gt;                                                              gjahr  = wa_bseg_kum-gjahr&lt;/P&gt;&lt;P&gt;                                                              bukrs = wa_bseg_kum-bukrs&lt;/P&gt;&lt;P&gt;                                                              Binary Search.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;code&amp;gt;...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here you will be hitting the database only once to fetch all the records of itab_bseg_kum unlike the Select EndSelect statement where you will have to hit the database as many times as the no. of records in the table itab_bseg_kum.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Apr 2008 14:56:18 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reading-bseg-performance-problems/m-p/3693951#M889481</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-08T14:56:18Z</dc:date>
    </item>
    <item>
      <title>Re: Reading BSEG: performance problems</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/reading-bseg-performance-problems/m-p/3693952#M889482</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;In cluster tables like bseg is not good select data using not key fields in "Where" conditions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So it's better to use only key fields "BUKRS", "BELNR" in the select statement and then you can use DELELE statement to others fields.&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;Fernando&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Apr 2008 14:16:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/reading-bseg-performance-problems/m-p/3693952#M889482</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-04-10T14:16:04Z</dc:date>
    </item>
  </channel>
</rss>

