When you perform a calculation, the system uses all values of a numeric column. You can also display intermediate results for this calculation.
If you perform a calculation in a sorted list, by default, the system shows intermediate results wherever data was changed in the sorted column or columns.
To display intermediate results in a column in which you make a calculation using all values, you must first specify where you want to place the intermediate result: you put all the data records that contain the values for an intermediate result into one group.
The criterion for grouping data records is not in the same column as the calculations.
A list contains an Airline column containing the names of airlines, a Flight Number column containing the flights for each airline, and an Occupancy column containing the number of seats occupied for each flight.
To determine the seat occupancy for each airline, you first sort the list by airline and group the rows that contain the relevant seating information.
To group data records that are to provide an intermediate result, you sort the list according to the required criteria.
You can specify multiple columns as criteria for grouping the corresponding data records. This allows you to generate a hierarchical structure of intermediate results. For more information, see Showing and Hiding Data Rows for Calculations.
You can display intermediate results in any numeric column. To specify in which of the columns you want to display intermediate results, you simply perform a calculation in one. You can use all calculation types provided by SAP List View (ALV) (see Making Calculations).
In the example above, you make a calculation in the Occupancy column. You choose Total as the calculation type.
Some columns that you can use to sort the list cannot be used as criteria for intermediate results. Only columns that contain alphanumeric values such as text, and date, are permitted.
In the example above, you could have also used the Flight Number column as criterion. This is because even when a column contains mostly numbers, it can still be defined as an alphanumeric column. This means that special characters and alphanumeric characters can also be included.
With intermediate results, you can:
● Display intermediate result for all criteria
● Define exceptions
● Show and hide data rows for the calculation (see Showing and Hiding Data Rows for Calculations)
● Your application permits the creation of intermediate results.
● The columns that form the criteria for the intermediate results contain alphanumeric values.
1. To generate intermediate results, open the Settings dialog box (see Using the Dialog Box with Settings for the List).
2. To group the data records that form an intermediate result, choose the Sorting tab page. Move all columns that are to form the criteria for the intermediate result to the right list.
3. To specify the columns for the intermediate results, choose the Calculation tab page and specify the required calculation type for each column in which you want to display intermediate results.
4. Set the Display Intermediate Results for Sorted Columns indicator, if required.
5. Apply your settings to the list.
If you do not want all sorted columns to be used as criterion for intermediate results, you can explicitly specify which columns you want to use as criteria and which ones you do not want to use; you do this by defining exceptions.
1. To define exceptions, open the dialog box and choose the Calculation tab page.
2. Choose Exception.
In the Only Generate Intermediate Results for Some Sorted Columns dialog box, a list of all the columns you can use as criteria is displayed.
3. For any columns that you do not want to use as criteria, deselect the indicator under Subtotal.
4. Close the dialog box by choosing OK and apply the settings to the list.
● The list is sorted.
● A results row is inserted wherever the value changes in columns that contain the criteria for generating intermediate results. In the columns in which you make a calculation, the intermediate result is displayed in the results rows.
For information about showing and hiding rows that contain single values for intermediate results, see Showing and Hiding Data Rows for Calculations.