I have a performance issue in one report.I ran the report and find in ST05 that average time / record is more for BSID and BSID.
The respective code is as follow for this :
Is this the right approcah to improve the performance ? and can I use select single * instead of COUNT ( * ) and check sy-subrc <> 0 ,for that purpose?
LOOP AT it_with_item.
write:/ it_with_item-belnr,
' ',
it_with_item-buzei.
SELECT COUNT( * )
FROM bsid
WHERE belnr = it_with_item-belnr
AND buzei = it_with_item-buzei
AND budat IN p_budat
AND blart IN p_blart.
IF sy-dbcnt > 0.
ELSE.
SELECT COUNT( * )
FROM bsad
WHERE belnr = it_with_item-belnr
AND buzei = it_with_item-buzei
AND budat IN p_budat
AND blart IN p_blart.
IF sy-dbcnt = 0.
DELETE it_with_item.
ENDIF.
ENDIF.
ENDLOOP.