!--a11y-->
Use
Returns the current subtotals of the ALV Grid Control. Having created totals for at least one column, users can calculate at most nine subtotals. The list is sorted by the values of one or several columns (called the subtotals column). If a value is changed in the subtotals column, the subtotal is displayed (this is also referred to as control level change).
Integration
Before you access the subtotals value, you use the method
get_sort_criteria to get the sort table. One row of this table describes properties of a column in the output table.Based on this information, you specifically access the values of the tables passed (using reference variables
COLLECT01 to COLLECT09 ).Features
CALL METHOD
<ref. var. to CL_GUI_ALV_GRID > ->get_subtotals IMPORTING
EP_COLLECT00 =

In order to access the values of
EP_COLLECT00 to EP_COLLECT09 , you use ASSIGN to dereference the relevant reference variable in a field symbol of your output table type (see below).Parameters |
Meaning |
EP_COLLECT00 |
Points to the totals line. Since there is only one totals line which, in addition, has a unique totalling area, no further information is available for this table in table ET_GROUPLEVELS . |
EP_COLLECT01 to EP_COLLECT09 |
Point to the subtotals line. For each subtotals level, there is one reference variable. Each of these variables points to an internal table that has the type of the output table. EP_COLLECT01 points to the subtotal at the hightest level, while EP_COLLECT02 points to the subtotal at the second highest level, and so on. The levels are derived from the sort priority (field SPOS in the sort table). The column by which the data was sorted first, is the highest subtotals level. |
ET_GROUPLEVELS |
Manages all indexes for the individual control levels. The fields of the table have the following meaning: |
For an overview, see
Methods of Class CL_GUI_ALV_GRID
Activities
Access the subtotals tables (in our example, only the totals and the first subtotals level) using field symbols:
data: total type ref to data,
subtotal1 type ref to data.
field-symbols <total> like gt_sflight.
field-symbols <subtotal1> like gt_sflight.
call method grid1->get_subtotals
importing
ep_collect00 = total
ep_collect01 = subtotal1.
assign total->* to <total>.
assign subtotal1->* to <subtotal1>.