SUM.
Can be used only in LOOP - ENDLOOP block. A component of an internal table line may not be another table. In an AT - ENDAT block, calculates totals for the numeric fields (I, F, P) of all lines in the current line group and writes them to the corresponding fields in the work area. Outside an AT - ENDAT block - do it for lines of the internal table in each loop pass. Therefore, SUM should be used only in AT - ENDAT blocks.
Using Control Levels for Groups of Lines (AT ... ENDAT Events):
AT <line>.
...
ENDAT.
The <line> condition:
<line> Meaning
FIRST First line of the internal table
LAST Last line of the internal table
NEW <f> Beginning of a group of lines with the same contents in the field <f> and in the fields left of <f>
END OF <f>End of a group of lines with the same contents in the field <f> and in the fields left of <f>
<f> can be:
table field name;
table field name with Offset/Length specification;
field symbol. If it does not point to a valid component, a runtime error occurs;
(<name>) instead of <f> (See also). The <name> contains the name of the field <f>. If <name> is empty at runtime, the system ignores the control break criterion. If it contains an invalid component name, a runtime error occurs.
Cannot be used together with the WHERE restriction of a LOOP.
Read here: ABAP Performance Tuning with Select statements, Internal table usage, Database Index
Serkan AKKAVAK
Computer Engineer BSc
SAP Department Manager
Contact : serkurumsal@yandex.com
0 Comments