Entering content frame

Function documentation get_subtotals Locate the document in its SAP Library structure

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   =  
<reference variable of type REF TO DATA >
      EP_COLLECT01   =  
<reference variable of type REF TO DATA >
      EP_COLLECT02   =  
<reference variable of type REF TO DATA >
      EP_COLLECT03   =  
<reference variable of type REF TO DATA >
      EP_COLLECT04   =  
<reference variable of type REF TO DATA >
      EP_COLLECT05   =  
<reference variable of type REF TO DATA >
      EP_COLLECT06   =  
<reference variable of type REF TO DATA >
      EP_COLLECT07   =  
<reference variable of type REF TO DATA >
      EP_COLLECT08   =  
<reference variable of type REF TO DATA >
      EP_COLLECT09   =  
<reference variable of type REF TO DATA >
      ET_GROUPLEVELS =  
<ínternal table of type LVC_T_GRPL > .

Note

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:

  • INDEX_FROM , INDEX_TO : Rows of the output table for which the subtotal was created
  • LEVEL: Subtotals level (see above)
  • COUNTER : Number of rows for which the subtotal was created
  • COMPRESS : For this subtotals line, the user has hidden the associated rows.
  • COLLECT : Indicates the subtotals table ( 01 - 09 ) in which the values are stored

 

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>.

 

 

 

 

 

Leaving content frame