Show TOC

Creating a Transformation for a HierarchyLocate this document in the navigation structure


You can flexibly load hierarchies by using transformations. You can also make unlimited use of the transformation functions when working with hierarchies. Every field in the hierarchy structure can be transformed. This includes normal InfoObjects as well as special InfoObjects in the hierarchies (such as NODEID). Hierarchies can be loaded from any source. You can also load hierarchies from DataStore objects or InfoCubes. The data has to be converted to the required form (using a start, end or expert routine if necessary).

When flexible loading is used, the hierarchies are usually loaded in multiple segments. However, it may be necessary to load the hierarchy without segmenting it. This can be done by selecting the option Hierarchy (One Segment). This is necesary for updating hierarchies to an open hub destination, for example. In this case, the hierarchy has a format similar to a flat file and can be loaded into other systems using the open hub destination.

Special features for the transformation of hierarchies:

  • Target segment for level texts:

    A target segment is available for level texts. This allows you to create or change texts for hierarchy levels. No segment for level texts exists in hierarchy DataSources. Therefore normal mapping is not possible. The fields are not filled or have to be filled by a routine (start, end or expert routine).

  • When assigning the fields in the hierarchy header, we recommend that you set the InfoObject 0H_NORESTNO (Display Assigned Nodes Only) to 'X' using a constant. This means that non-assigned nodes (attribute values that occur in the attribute table of the InfoObject but not in the hierarchy) are not saved in the hierarchy SID table and do not have to be loaded into memory at runtime. This can lead to significantly improved performance.

  • Dependencies of transfer method:

    The appearance of the source structure in the transformation depends on whether the DataSource loads using the transfer method PSA or IDoc. In both cases, it is possible to load using the PSA and use transformation and DTP. However the following differences exist in the hierarchy structure:

    • IDoc format:

      This format is used for many SAP standard hierarchy DataSources from SAP systems. This format is also often used for files and BAPI DataSources.


      BW 3.x extractors must first be migrated to the new DataSource. A PSA in IDoc format is generated. Once the PSA has been created, you can load the 3.x hierarchies using the DTP with transformation.

      The node segment contains the fields IOBJNM and NODENAME. The name of the InfoObject, for example 0MATERIAL, is entered in the field IOBJNM. This field should be mapped to the InfoObject 0H_IOBJNM of the target hierarchy structure. You may have to adjust the name (for example, using a routine or formula) if no content InfoObjects are used (ZCOSTCENTER for example). The field NODENAME contains the value of the specified InfoObject. This value must be transferred to the target InfoObject in the hierarchy structure (for example, ZCOSTCENTER). Since NODENAME contains the values of all InfoObjects, it is usually possible to perform a simple 1:1 mapping to the target InfoObject. This does not work if the compound length in the source system is different to the length in the target system. In this case, you need to create a routine.

      If this not the case, choose the rule type Hierarchy Split. With non-compound characteristics, you can also use the rule type Direct Assignment.

      Intervals in IDOC format: The interval segment in IDoc format is not compatible with the interval segment of the target structure. Therefore you need to create a start routine that writes the From value of the interval to the node structure segment. The corresponding function call is created by default as a comment in a new start routine. You simply have to remove the comments and enter the correct source field of the hierarchy basis characteristic. In the interval segment you assign the LEAFTO field to the corresponding target InfoObjects. Note: The file LEAFFROM cannot be used.

    • PSA format:

      The hierarchy source structure contains the FIELDNM that specifies the field containing the value of the node for this row, for example MATNR. As a result, the hierarchy structure contains additional fields where the values are transferred to. The filed is assigned in the transformation to the corresponding InfoObject in the target structure. The field FIELDNM must be assigned to the InfoObject OH_IOBJNM in the target structure using the rule type Hierarchy Derivation.


      Unlike the IDoc format, the field NODENAME only contains the values of the text nodes and must be only assigned to the target InfoObject 0H_HIERNODE.

  • Derivation from InfoObject names:

    The InfoObject 0H_IOBJNM (characteristics for hierarchies) is used to derive node names from the InfoObject names. To do this, assign the InfoObject 0H_IOBJNM to the field FIELDM (field name). In the rule details, select the rule type Derive Hierarchy Characteristic. At runtime the InfoObject is automatically entered in the field 0H_IOBJNM. The InfoObject is assigned to the same field name that is contained in FIELDNM at runtime.

  • Splitting a node name (hierarchy split):

    The rule type Hierarchy Split is used if the field NODENAME from hierarchy structures in IDoc format is assigned to the target InfoObjects of the hierarchy. The field NODENAME has to be assigned to the basis characteristic and external characteristics of the hierarchy. The rule type Hierarchy Split is used dialog as the rule type in the rule detail. The value in the field 0H_IOBJNM must contain the name of the node InfoObject. At runtime, the hierarchy split takes the relevant part of the value from the field NODENAME and enters them in the corresponding compound components of the target InfoObject.


    In this example, let 0H_IOBJNM = 0COSTCENTER, NODENAME = 44442222222222. The characteristic 0COSTCENTER (length 10) is compounded to 0COSTAREA (length 4). Therefore both InfoObjects exist in the target structure and NODENAME is assigned to both InfoObjects using the rule type Hierarchy Split. At runtime, the hierarchy split takes the relevant compound components from NODENAME and updates them to the characteristics. This results in the following for the target structure: 0COSTCENTER = 2222222222 and 0COSTAREA = 4444.


    The hierarchy split is based on the compound information of the target InfoObject. Therefore the rule type cannot be used if the lengths of the target InfoObject do not correspond to the lengths of the composite values in NODENAME.

  • Object identification:

    The InfoObject 0OBJECTID (object identification in segments) is used if several hierarchies are loaded in one request. This is not relevant for normal DataSources as usually only one hierarchy is supplied per request.

  1. In the Data Warehousing Workbench under Modeling, select the InfoProvider tree.

  2. Navigate to your characteristic. In the context menu of the hierarchy of the characteristic, choose Create Transformation.

  3. Choose the relevant source for your transformation and choose Create Transformation. The system proposes a transformation. You can use this transformation as it is, or modify it to suit your requirements.

  4. In the transformation maintenance screen, you can use Select Source Segments Source Segments and Select Target Segments Target Segments to select the segment, for which you want to create the transformation. You must create at least one transformation for the hierarchy header and one for the hierarchy nodes. The segments are listed in the correct order for source and target in the drop-down lists of the segment selection switches.

  5. Proceed as described in the general procedure for creating transformations.

    More information: Creating Transformations