SAP ABAP Data Element RSAN_WB_DST_HIERAGGR (Transformation "Hierarchical Aggregation")
Hierarchy
SAP_BW (Software Component) SAP Business Warehouse
   BW-EI-APD (Application Component) Analysis Process Designer
     RSAN_WB (Package) APD - Tool - User Interface
Basic Data
Data Element RSAN_WB_DST_HIERAGGR
Short Description Transformation "Hierarchical Aggregation"  
Data Type
Category of Dictionary Type     Direct Type Entry
Type of Object Referenced     No Information
Domain / Name of Reference Type      
Data Type STRG   Character String of Variable Length 
Length 0    
Decimal Places 0    
Output Length 0    
Value Table      
Further Characteristics
Search Help: Name    
Search Help: Parameters    
Parameter ID   
Default Component name    
Change document    
No Input History    
Basic direction is set to LTR    
No BIDI Filtering    
Field Label
  Length  Field Label  
Short 10 Text 
Medium 20 Description 
Long 40 Description 
Heading 60 Description 
Documentation

Use

Hierarchical aggregation is a special type of aggregation; it is the aggregation of hierarchical relationships. The input table contains the information for the hierarchical relationship as well as the aggregating key figures. In addition to aggregation, formulas can also be applied.

Activities

  1. Specify the hierarchical relationship by selecting Key Field and the field for the Reference to the Predecessor (see example below). Each data record in the input table is then interpreted as a hierarchy node.
  2. From the available fields, select the fields that are to be changed by the hierarchical aggregation.
  3. Specify the required aggregation behavior for each aggregation field. The following values are currently supported:
    • SUM: The values of the aggregation field are totaled for various levels, by adding all nodes with the same predecessor. The value of the predecessor node is overwritten by this total.
    • NOP: No aggregation. You can however change the value of the field using a formula.
  4. This allows you to perform formula calculations in addition to aggregating a field, if required. To do this, click in the row for the aggregation field, choose "Formula", and create the required formula in the formula builder. You can use all input fields in the formula.
    Important: The formula is evaluated after each aggregation step (see example below).

Example

Example 1: A hierarchical relationship exists between each employee and the employer:

Employee    Name    Superior    Overtime

710    Smith    922    2

859    Truman    922    23

922    Miller    212    -

744    Carlson    212    4

212    Wilson    -    -

Employees Smith and Truman both have Miller as superior. Employee Wilson does not have a superior. The "Employee" column is a key field for the input table and the "Superior" field specifies the relationship to the predecessor.

In this simple example, there is time recording for all employees that are not superiors. To calculate the number of overtime hours for each superior's area, the "Overtime" column is used for aggregation (summation). The results table is as follows:

Employee    Name    Superior    Overtime

710    Smith    922    2

859    Truman    922    23

922    Miller    212    25

744    Carlson    212    4

212    Wilson    -    29

Example 2: Assume that overtime is recorded for all employees. You want to calculate the average amount of overtime for each superior's area.
To do this, the input table requires the additional fields "Total Overtime", "Counter", and "Average". You can easily create and fill these auxiliary columns with a transformation of type formula.

Employee    Name    Superior    Overtime    Total    Average    Counter

710    Smith    922    2    2    -    1   

859    Truman    922    23    23    -    1

922    Miller    212    11    -    -    -

744    Carlson    212    4    4    -    1

212    Wilson    -    5    -    -    -

"Total" is required to accommodate the overtime for both the employees and their superior. "Total" is initialized with the overtime of the employees on the lowest level, and "Counter" is initialized with the value 1. The initial values of these fields do not affect the upper levels (superiors), because they are overwritten by the level-by-level aggregation.

For "Total" and "Counter", you set the aggregation behavior to "SUM"; for "Average", you set the aggregation behavior to "NOP".

For "Total", you specify the formula "Total" + "Overtime". During the aggregation for employee "Miller", the overtime for "Miller" and his employees "Smith" and "Truman" is added, that is, "Total" + "Overtime" = 25 + 11 = 36.

For "Average", you specify the formula ("Total" + "Overtime") / ("Counter" + 1). For employee "Miller", the average number of overtime hours is therefore calculated as (25 + 11) / (2 + 1) = 12.

For "Counter", you specify the corresponding formula "Counter" + 1.

The overall result is as follows:

Employee    Name    Superior    Overtime    Total    Average    Counter

710    Smith    922    2    2    -    1

859    Truman    922    23    23    -    1

922    Miller    212    11    36    12    3

744    Carlson    212    4    4    -    1

212    Wilson    -    5    45    9    5

History
Last changed by/on SAP  20130604 
SAP Release Created in 700