Page tree
Skip to end of metadata
Go to start of metadata

Sorting of Characteristic Values

Important Points

  1. By default, the values are sorted as defined in the query definition (QueryDesigner: Sort Characteristic='As in the Query'). This means that the values in the query output are displayed in the same order as the filter values in the Query Designer. If you have not specified filter values in the query definition, the system sorts the values according to the key.
  2. In case there are more characteristics in the drilldown, the sorting of characteristic values is always carried out in relation to the characteristic 'left' of the affected one.


These samples are transferred from KBA: 2128583  Sorting Query Results 

Sorting and Filter Values

Sample Query I contains several filter values regarding the characteristic which is in the drilldown

If you use the default setting for 'Sorting', the values in the query result are sorted the same way:

Sorting and multiple characteristics in drilldown I

Sample Query II has two characteristics in the drilldown: 'Quarter' and 'Product'. Both characteristics are sorted by their key (ascending):

The products are sorted in relation to the quarter, so for each quarter independently. If you need all products to be sorted (independent of the quarter) then you need to swap the characteristics:


Sorting and multiple characteristics in drilldown II

Sample Query III  has the characteristics 'Customer and 'Sales Personnel' in the drilldown:

In this case there is always just one sales staff member assigned to a customer. Hence, whatever sorting you define for the characteristic 'Sales Personnel', it does not have any effect. You need to swap 'Sales Personnel' with 'Customer' in case such a sorting is required.

E.g. if you want to sort 'Sales Personnel' by the text (ascending), you need to have it on the left side in the drilldown:

SAP Consulting Notes
  • 2128583  Sorting Query Results 
  • 1030678  Table is not sorted according to TopN condition
  • 1489967  BExAnalyzer: Sorting Options
  • 1527041 BExAnalyzer: Enable Sorting for Structures
  • 989872  # Entries when sorting in descending order by key or text
SAP Online Documentation

Sorting of Key Figure Values

In contrast to the sorting of characteristic values, it is not possible to define some kind of sorting regarding key figures in the QueryDesigner. However, in many BW frontends like AO or SAC it is possible to activate a sorting(ascending or descending) for a key figure during query runtime. Note that the sorting of key figure values heavily depends on the exact navigation state. E.g. in case two characteristics are in the rows, the key figure values are sorted 'from left to right', so in blocks regarding the sorted characteristics values of the InfoObject 'on the left side'. See the following example:

Transaction RSRT 

When the first key figure is sorted in ascending order 

the query result changes to:

Note that the order of the countries AUS and DE has changed and that the customer are sorted in blocks per country.

In Analysis for Office it looks as follows:

Note that it can happen that key figure values are equal and that for such a subset there is no defined order(from a logical point of view). It is not possible to control the order inside such a subset.

E.g. in our example the customers 'Becker Berlin' and 'Karpov SR' have the same key figure value regarding the country Australia. Hence, the order of these two customers in the result set is undefined.

  • No labels