... SUM(g) ....
SUM(g) is not a statement, but a field which is automatically
created and filled when g is a sub-field of an extract
dataset.
SUM(g) can only be addressed from
within a LOOP on a
sort extract dataset.
If g is a numeric field
in an extract dataset (see also
ABAP/4 number types), SUM(g) contains the appropriate
control total at the end of a control level (AT END OF, AT LAST).
Determine Numbers and Sums