Did you read and apply suggestion of 185530 - Performance: Customer developments in SD?
c) Search for invoices with delivery number (preceding document, field VBRP-VGBEL):
Incorrect: SELECT FROM vbrp WHERE vgbel = ...
Correct: SELECT FROM vbfa WHERE vbtyp_n = 'M'
AND vbelv = ...
SELECT FROM vbrp WHERE vbeln = vbfa-vbeln
AND posnr = vbfa-posnn
Regards,
Raymond