Skip to Content
Former Member
Apr 08, 2008 at 02:35 PM

Reading BSEG: performance problems



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.

   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.

    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.


Thanks in advance,