SAP OO OBS SUMMING 1

Get Example source ABAP code based on a different SAP table
  


ABAP Code Snippet
ARTICLE

Cannot Perform Automatic Calculations While Using the WRITE Statement
In ABAP Objects, you cannot use MAXIMUM, MINIMUM, or SUMMING to calculate values automatically when creating basic lists using the WRITE statement. .

In ABAP Objects, the following statements cause an error message:

MAXIMUM f.
MINIMUM f.
SUMMING f.

...
WRITE f.
...

WRITE: / max_f, min_f, sum_f.
Correct syntax:

DATA: max_f like f,
min_f like f,
sum_f like f.

...
WRITE f.
IF max_f < f.
max_f = f.
ENDIF.
IF min_f > f.
min_f = f.
ENDIF.
sum_f = sum_f + f.
...

WRITE: / max_f, min_f, sum_f.
Cause:

These statements create the internal global variables max_f, min_f and sum_f. To make programs more readable, you should stopy using these statements and write explicit code instead.