Skip to Content
0
Jun 29, 2007 at 05:16 AM

JOIN Between BSIS and SKB1 - Rewars will be awarded.

262 Views

Dear Guys

I am developing a query to join BSIS and SKB1 tables and wan to run it for the whole financial year.

But this query is taking 5 to 7 hours to run. Is there any alternative to increase the performance. Queris are given below.

*selection to get OPEN ITEM data in to FTAB.

SELECT * FROM BSIS

INNER JOIN SKB1 ON BSISHKONT = SKB1SAKNR

JOIN SKAT ON BSISHKONT = SKATSAKNR

INTO CORRESPONDING FIELDS OF TABLE FTAB

WHERE BSIS~HKONT IN GLACCT

AND BSIS~BUKRS = COMPY

AND BSIS~BUDAT IN DOCDT.

  • MOVE 'OPEN' TO FTAB-OPENCLR.

  • APPEND FTAB.

LOOP AT FTAB.

MOVE 'OPEN' TO FTAB-OPENCLR.

MODIFY FTAB.

ENDLOOP.

**selection to get CLEARED ITEM data in to FTAB.

SELECT * FROM BSAS

INNER JOIN SKB1 ON BSAS~HKONT = SKB1~SAKNR

JOIN SKAT ON BSAS~HKONT = SKAT~SAKNR

INTO CORRESPONDING FIELDS OF TABLE FTAB

WHERE BSAS~HKONT IN GLACCT

AND BSAS~BUKRS = COMPY

AND BSAS~BUDAT IN DOCDT.

  • MOVE 'CLEARED' TO FTAB-OPENCLR.

  • APPEND FTAB.

*

  • ENDSELECT.

LOOP AT FTAB WHERE OPENCLR EQ ' '.

MOVE 'CLEARED' TO FTAB-OPENCLR.

MODIFY FTAB.

ENDLOOP.

**end

**selection to get OPEN ITEM data in to ITAB0.

SELECT HKONT AUGBL BUDAT DMBTR SHKZG

  • UMSKZ

FROM BSIS

INTO CORRESPONDING FIELDS OF TABLE ITAB0

WHERE HKONT IN GLACCT

AND BUKRS = COMPY

AND BUDAT BETWEEN DAT1 AND DAT2.

**selection to get cleard ITEM data in to ITAB0.

SELECT HKONT AUGBL BUDAT DMBTR SHKZG

  • UMSKZ

FROM BSAS

INTO CORRESPONDING FIELDS OF TABLE ITAB0

WHERE HKONT IN GLACCT

AND BUKRS = COMPY

AND BUDAT BETWEEN DAT1 AND DAT2.