Identify Modeling Scenarios for Hierarchies

Objective

After completing this lesson, you will be able to identify modeling scenarios for hierarchies

Use of Hierarchies

Advantages of Using Hierarchies

Hierarchies are used to navigate the entire set of members with more ease when analyzing the data. In a hierarchy, the characteristic values are arranged into groups. For example, the values for the Employee characteristic are grouped by geographical regions. These regions are grouped by country. Countries are grouped by continent. These groups are used to roll up transactional data.

Hierarchy from world to continent, to country, to region, to employee.

The main advantages of hierarchies are focused reports:

  • The report first displays an aggregated level, then a drilldown to details is possible.

  • Different levels are displayed in the same column.

  • Only interesting nodes need to be opened. Only interesting details need to be displayed.

  • In most reporting tools, filters on hierarchy nodes are possible.

  • Authorizations for hierarchies and hierarchy nodes can be implemented.

Note

At the design time of a model, you must define the drilldown sequence of a hierarchy. This definition helps users to investigate interesting values from one aggregated level to the next level. However, it reduces the flexibility when reporting tools don't allow a jump from level one directly to level three, or to use a different sequence.

Internal and External Hierarchy

Let's explain the differences between external and internal hierarchies.

  • Internal hierarchy: A hierarchical display of existing characteristics, for example, in reports. This hierarchy is also referred to as a Run Time or Display hierarchy. They are referred to as internal because the transactional data inside the InfoProvider is used to perform the grouping. In addition, navigation attributes can also be included.

  • External hierarchy: Parent-child data stored in SAP BW/4HANA-related master data tables for a specific characteristic. They are referred to as external because they are outside of the transactional data tables.

Both internal and external hierarchies are always defined on characteristics and attributes, not on key figures. They do not contain formulas. Standard aggregation is applied for the key figures of the Query.

The internal hierarchy is defined inside the Query by setting the Universal Display Hierarchy option to active in the rows or columns. For example, if you have country and customer in the rows, you can turn on the internal hierarchy feature, which will group customers by country. You can also turn on Compact Display in Rows, for example, in SAP Analysis for Office.

Hierarchical display of characteristics and navigation attributes.

Modeling External Hierarchies

A Characteristic can have more than one external hierarchy. As indicated in the following figure, different modeling options are available.

(External) hierarchy basics.

Characteristic hierarchies can be used in different hierarchy versions. Different hierarchy versions in the source system can be modeled in SAP BW/4HANA. However, you can also create different versions for the same hierarchy from the source system.

You can define that the entire hierarchy can be time-dependent. In other words, there are different versions for this hierarchy that are valid for a specific time interval only. The system automatically chooses the valid version based on settings in the Query.

You can also determine that the hierarchy structure (a hierarchy node) is to be time-dependent. The hierarchy is then constructed for the current key date or for the key date specified in the Query.

It is possible to position values of a Characteristic in the form of intervals under a hierarchy node. You can also create intervals for values of a Characteristic for which no master data currently exists. As a result, you do not need to extend the hierarchy for new master data (because new values of a Characteristic are allocated automatically). One limitation of the interval option in many areas is that the technical key of the values of a Characteristic must be meaningful. Most companies do not have smart numbering for their part numbers or customers. The interval option can, however, often be used in financial-related objects, such as general ledger account numbers.

(External) Hierarchy Elements from root to continent, to country, to region, to employee.

An external hierarchy comprises a series of groups (nodes) of the following types:

  • Root Node

    The uppermost node of the hierarchy and is always a text node. For text nodes, the technical characteristic 0HIER_NODE is used.

  • Text Node

    It belongs to a specific hierarchy without relation to another characteristic. Its text is defined in the hierarchy.

  • Postable Node

    It relates to the basic characteristic, but has subordinate nodes. You can extract transactional data from the data target only for postable nodes.

  • Nonpostable Node

    It does not relate to the basic characteristic. Other specific characteristics (External characteristics) can be allowed as characteristic node in the hierarchy settings of the basic characteristic. (They do not need to be attributes of the characteristic.) This node gets its text and value from the external characteristic.

  • Leave

    A node without subordinate nodes. It contains values for the hierarchy basic characteristic, display its texts, and can have entries in the fact table.

  • Hierarchy Level

    The level of a node denotes the distance of the node from the root. The root of a hierarchy forms the first level, its children, the second level, and so on.

  • Intervals

    Intervals contain several leaves that belong together, described by their upper and lower limits. You can create them for a node that has more than one leaf. By defining intervals, new characteristic values that are added to the master data are assigned automatically to the interval if the characteristic value is included in the interval range.

The key features of external hierarchies are as follows:

  • They can be loaded from predefined SAP BW/4HANA content data flows or the flat file interface.

  • They can be defined manually as SAP BW/4HANA master data tables.

  • They have no fixed number of levels and they can be in an unbalanced hierarchy.

  • The structure defines the fixed drilldown path.

  • Unassigned values can be displayed in reporting.

Hierarchy Tables

If external hierarchies are used for the characteristic, the hierarchy table (H table) is used to store the hierarchical relationships between characteristic values. Only one H table is ever generated, even if a characteristic contains several hierarchies. In other words, the H table contains all the hierarchies.

If the entire hierarchy is time-dependent, the DATETO and DATEFROM fields do not appear in the H table. They appear as global fields (meta information) in the RSHIEDIR table instead. This also applies to the VERSION field in version-dependent hierarchies. If the hierarchy structure is time-dependent, the two date fields appear in the H table.

External Hierarchy for 0COUNTRY Characteristic.

The preceding figure shows the contents of the H table after a hierarchy has been loaded into SAP BW/4HANA for the 0COUNTRY characteristic. This can also apply after a hierarchy has been created and activated (simplified display version) in SAP BW/4HANA. The second level of the example hierarchy helps you to better understand the structure of the table. You can see from the NODEID field that EUROPE is the second node of this hierarchy.

The PARENTID field shows that the higher-level node has NODEID 1. In this example, the higher-level node is the root node RAWO. The CHILDID field denotes the lower-level node and the NEXTID field denotes the adjacent (next) node. In this example, the lower-level node is Austria and the adjacent node is USA. If intervals are permitted in this hierarchy, an indicator in the INTERVL field indicates that this node represents an interval. An additional table /BIC/JCOUNTRY lists the FROM and TO key value for each interval node.

If you selected the With hierarchies checkbox in the maintenance screens for characteristics, the Surrogate ID (SID) tables are always generated in addition to the H table.

I and K tables with data.

The preceding figure shows the I and K tables of a hierarchy for characteristic COUNTRY after hierarchy data has been loaded.

The I table contains essentially the same information as the H table because it displays the relationships between nodes-to-nodes, and nodes-to-leaves. The leaves (characteristic values) are assigned positive SID values, and the nodes are assigned negative SID values (K table).

The following table describes the complete I and K table structure

Legend

The following table describes the complete I and K Table Structure:

FieldDescription
SIDSID for the node within the hierarchy.
OSIDSID for the node as an original value.
LINKNOLink number.
SVERVersion in the key of the inclusion table.
PREDMaster data ID (predecessor).
SUCCMaster data ID (successor).
LISTNOSequence of the inclusion relationships.
FACTORFactor that the inclusion relationship goes into the node with.
NTYPEIDInternal ID for node types.

Log in to track your progress & complete quizzes