Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8419

Improvement of join BSEG and BKPF

$
0
0

Hi Experts,

 

My goal is to select G/L account, Local currency and wbs element of a project by G/L account, posting period and a project name, which is as the same as the results in 'FBL3N' .

 

I read lots of threads for joining BSEG and BKPF.

 

I used a query as below:

"Find all wbs elements under a project
   CALL FUNCTION 'BAPI_PROJECT_GETINFO'
   EXPORTING
     PROJECT_DEFINITION = pj_n
   TABLES
     E_WBS_HIERARCHIE_TABLE = lt_hiera_return
   .

   "Put all wbs elements of a single project for seraching later
   LOOP AT lt_hiera_return INTO wa_hiera_return.
     IF wa_hiera_return-down IS INITIAL.
       CLEAR wa_wbs.
       wa_wbs-SIGN = 'I'.
       wa_wbs-OPTION = 'EQ'.
       wa_wbs-LOW = wa_hiera_return-WBS_ELEMENT.
       APPEND wa_wbs TO it_wbs.
     ENDIF.
   ENDLOOP.


SELECT BELNR BUDAT INTO TABLE it_ibkpf FROM BKPF WHERE BUDAT IN BUDAT.

   "For the above doc., select the related item data
   IF NOT it_ibkpf[] IS INITIAL.
     SELECT      BSEG~HKONT BSEG~DMBE2 BSEG~ZUONR BSEG~PROJK
     INTO TABLE  it_fidoc
     FROM        BSEG FOR ALL ENTRIES IN it_ibkpf
     WHERE       BSEG~BELNR = it_ibkpf-BELNR AND
                 ( BSEG~HKONT = '0000800104' OR BSEG~HKONT = '0000800113' OR BSEG~HKONT = '0000800040' OR BSEG~HKONT = '0000800115') AND
                 ( BSEG~ZUONR IN it_wbs OR BSEG~PROJK IN it_wbs  )
     .
   ENDIF.

When I was running the report, it takes too long and the report killed by timeout.

 

May I request some suggestions in the above query?

 

Thanks,

King


Viewing all articles
Browse latest Browse all 8419

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>