Skip to Content
0
Former Member
Oct 20, 2012 at 09:50 PM

Retrieving data from BSAK and BSIK

22 Views

Hi Friends,

Please help me.

Is there a better way to write the select statement to improve performance for the below code? I ran the SE30 and saw that these two select statements were the culprits taking almost 10 minutes.Please let me know if there is any better way.

SELECT BUKRS GJAHR BELNR BUDAT BLART FROM BSAK
CLIENT SPECIFIED INTO TABLE ITAB
FOR ALL ENTRIES IN ITAB1
WHERE MANDT = ITAB1-MANDT
AND BUKRS = ITAB1-BUKRS
AND UMSKS = ' '
AND UMSKZ = ' '
AND GJAHR = ITAB1-GJAHR
AND BELNR = ITAB1-BELNR
AND BUDAT IN SO_BUDAT
AND BLDAT IN SO_BLDAT
AND XBLNR IN SO_XBLNR
AND BLART IN SO_BLART
AND DMBTR IN SO_WRBTR
AND BSTAT = ' '.

IF SY-SUBRC = 0.


SELECT BUKRS GJAHR BELNR BUDAT BLART FROM BSIK
CLIENT SPECIFIED APPENDING TABLE ITAB
FOR ALL ENTRIES IN ITAB1
WHERE MANDT = ITAB1-MANDT
AND BUKRS = ITAB1-BUKRS
AND UMSKS = ' '
AND UMSKZ = ' '
AND GJAHR = ITAB1-GJAHR
AND BELNR = ITAB1-BELNR
AND BUDAT IN SO_BUDAT
AND BLDAT IN SO_BLDAT
AND XBLNR IN SO_XBLNR
AND BLART IN SO_BLART
AND DMBTR IN SO_WRBTR
AND BSTAT = ' '.

ENDIF.

Thanks,

Nani