Hello Brill,
you can use control break statement , At End and sum.
loop at itab into wa.
AT LAST." last statement
DESCRIBE TABLE itab.
sum .
DIVIDE WA-sal BY sy-tfill. " u can use sy-tabix instead of sy-tfill
WRITE:/23 'avrage :', WA-sal.
ENDAT.
endloop.