Hi,
You can also try below to save time of execution:
select netwr vgtyp aufnr from vbrp into table itab
Where aufnr = aufk-aufnr
And vgtyp = 'K'.
clear creditamount.
loop at itab into wa_itab.
sum.
creditamount = wa_itab-netwr. "Sum up for all records
clear wa_itab.
exit.
endloop.