+ -

Pages

Saturday, July 26, 2014

Control Level Reporting

Overview

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:
  • at new xxxx
  • write detail line
  • at end of xxxx

Control levels

  • AT NEW xxx
  • AT END OF xxx
  • AT FIRST
  • AT LAST

Example

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.


5 ABAP Tips: Control Level Reporting Overview When using control levels with an internal table, remember to sort the internal table in accordance with the control levels, and...

No comments:

Post a Comment

< >