When using control levels with an internal table, remember to
sort the internal table in accordance with the control levels, and
the fields in the table must occur in the same order as you sort
the table.
In the example below, carrid must be the first field in the
table
When you use control levels the SUM statement can be used to
generate totals.
Every control level statement end with ENDAT
Important: The fields in the internal table must
be in the same order as the sort order.
Remember to place the control levels in the following
order:
sort itab by bukrs.
loop at itab.
* Heading for every bukrs
at new bukrs.
write: / itab-bukrs.
endat.
* Detail line
write: / itab-bukrs.
* Totals per bukrs
at end of bukrs
* Sum all variables of type P and I
sum.
uline.
write: / 'Total bukrs', itab-bukrs.
uline.
endat.
* Grand totals
at last.
sum.
write: / 'Grand total', itab-bukrs.
endat.
endloop.
| Converted from CHM to HTML with chm2web Standard 2.7 (unicode) |