Skip to Content
5
Former Member
Jul 04, 2007 at 12:13 AM

bad Performance in a query into table BKPF

59 Views

Hi forum i have a really problem in the second query under the table

BKPF.. some body cans help me, please

*THIS IS THE QUERY UNDER MSEG

SELECT tmsegmblnr tmkpfbudat tmsegbelnr tmsegbukrs tmseg~matnr

tmsegebelp tmsegdmbtr tmsegwaers tmsegwerks tmseg~lgort

tmsegmenge tmsegkostl

FROM mseg AS tmseg JOIN mkpf AS tmkpf ON tmsegmblnr = tmkpfmblnr

INTO CORRESPONDING FIELDS OF TABLE it_docs

WHERE

tmseg~bukrs IN se_bukrs AND

tmkpf~budat IN se_budat AND

tmseg~mjahr = d_gjahr AND

( tmsegbwart IN se_bwart AND tmsegbwart IN (201,261) ).

IF sy-dbcnt > 0.

      • I CREATE AWKEY FOR CONSULTING BKPF

      LOOP AT it_docs.

      CONCATENATE it_docs-mblnr d_gjahr INTO it_docs-d_awkey.

      MODIFY it_docs.

      ENDLOOP.

      • THIS IS THE QUERY WITH BAD BAD PERFOMANCE

      • I NEED KNOW "BELNR" FOR GO TO THE BSEG TABLE

      SELECT belnr awkey

      FROM bkpf

      INTO CORRESPONDING FIELDS OF TABLE it_tmp

      FOR ALL ENTRIES IN it_docs

      WHERE

      bukrs = it_docs-bukrs AND

      awkey = it_docs-d_awkey AND

      gjahr = d_gjahr AND

      bstat = space .

      THNKS