Skip to Content
Author's profile photo Former Member

Custom Hierarchies

Applies to: SAP ECC 6.0, SAP BI 7.3.

Author: Atul Vardhan Sarraf

Company: Accenture Services Pvt. Ltd.

Created on: 15th October 2013

Author Bio:  Atul is an Associate Software Engineer in Accenture Services Private Limited. He has been involved in SAP BW Implementation Projects.


As a standard, business content extractors support only main ECC hierarchies (e.g., cost center, general ledger [G/L] account, material, plant), but they do not support all hierarchies in the SAP ECC source system. Those hierarchies can be maintained via other methods as well, one of them is using “Set Name and Set Leaf” in ECC.

Configure the Extractor in ECC

The following steps illustrate how the above mentioned workaround can be utilized. These steps include creating a Hierarchy, generating the Datasource, and populating the Datasource with data from the table (In the current e.g. SKA1).

Step 1: Transaction GS01

While any set name can be entered, we need to provide the Table name along with the Field name based on which we want to create the Set hierarchies in source system. Set type as basic set, and then press enter.

In the pop-up window, select field name as SAKNR (as we are creating Set Hierarchy for GL account from table SKA1 (field/tables can be selected as per business requirement or for which you want to create a custom hierarchy)), press enter, and then click on the save icon.Initial Screen.jpg

Once the Setname is created, we can further create the Setnames under the Header Hierarchy (header setname) or directly assign the leafs to this setname. Here, we created another Setname under header Setname of (GCOA_*******)

Subordinate sets.png

Under the Second Setname, we created the Lead nodes (Set Line Items) as shown below:

Display set values.png

Here you can create further Set names or Set Line Items as required depending upon the business requirement. The final Hierarchy should look similar to one shown below.

Display set Hierarchy.png

Step 2: Transaction BW07 to generate the Datasource for Custom Set hierarchies

Enter SKA1 in the table for set field and SAKNR (key field) in the field name. Because the hierarchy is being loaded to the compounded Info Object 0GL_ACCOUNT in BW, the Datasource must be created by providing the data element for compounding which is KTOPL in this example. Enter the Datasource name or you can also allow the system to generate the Datasource name. In this example, a custom name Z****** is entered for the Datasource (refer the Figure below).  Then generate the Datasource by executing F8.

Generating dataSource.png

To ensure that a Datasource is generated correctly, use the Datasource browser (transaction code RSA6) to display it. As shown below, Z***** is found via menu path SAP-R/3>*.

file path.png

All the Datasources that will be created by the above mentioned method will be saved under the folder FI-SL-IO.

Step 3: ABAP code in the user exit EXIT_SAPLRSAP_004 for Compounding Values

Note:  If you don’t have any requirement for compounding InfoObject in BW, this step can be skipped. Please proceed to next Step in that case Else…

This coding allows the user to populate the Datasource created in step 2 with Compounding characteristic value. If this exit is not active, transaction CMOD can be used to make it active using standard Enhancement Process defined by SAP.

To access the user exit to enter the ABAP code, go into transaction SE38 and enter ZXRSAU04 in the Program field.

Or First Create a Project in CMOD transaction to activate the above program.

Click on the Create button to create Project and then click on Components and select SAPLRSAP_0004:

Project mgmt of SAP.png


In user exit ZXRSRU04 (we need to code as below)

IF i_datasource = <Datasource_name>   “<— Your DataSource
AND i_s_hiebashclass = ‘0000’.       “Hierarchy class of FI-SL-Sets

* Add compound value to hierarchy leaves
LOOP AT c_t_hienode WHERE iobjnm <> ‘0HIER_NODE’.
* Shift nodename right to get space for compound characteristic
SHIFT c_t_hienodenodename RIGHT BY 4 PLACES.
* Put chart of accounts into first 4 places
c_t_hienodenodename(4) = <COMPOUNDING_VALUE>.    “<– Your compound value
MODIFY c_t_hienode.

* Add compound value to intervals in the same fashion if there is an interval defined for Hierarchy in BW.
LOOP AT c_t_hieintv.
SHIFT c_t_hieintvleaffrom RIGHT BY 4 PLACES.
c_t_hieintvleaffrom(4) = <COMPOUNDING_VALUE>. “<– Your compound value
SHIFT c_t_hieintvleafto RIGHT BY 4 PLACES.
c_t_hieintvleafto(4) = <COMPOUNDING_VALUE>“<– Your compound value
MODIFY c_t_hieintv.


c_t_hienode3[] = c_t_hienode[].
c_t_hieintv3[] = c_t_hieintv[].


Configuring the Extractor in BW

Upon finishing the extractor on the ECC side, the BW portion will need to be configured to load the hierarchy into a BW Info Object. This section explains how to replicate the created Datasource in the BW7.3 and create transformation to map it to the Info Object where the hierarchy is assigned. The section then illustrates how to select the hierarchy, and load it into the BW, where the hierarchy will then be available for reporting.

Step 1: Prepare the Info Object to accept data from the Datasource

In BW, go to Administrator Workbench via RSA1 and find the desired Info Object; in this case, 0GL_ACCOUNT. On the Hierarchy tab, make sure the check box with hierarchies is selected. The Info Object 0GL_ACCOUNT is ready to hold the data coming from the Datasource.

Prepare infoobj.png

Step 2: Replicate the Datasource in SAP BI

Click on source systems in the RSA1 transaction. Find the desired source system in the pane on the right side, right-click on it, and select Datasource Overview from the pop-up menu.

All Datasources generated from the BW07 transaction in ECC fall under the Master Data Financial Accounting: Special Purpose Ledger node. Right-click on Master Data Financial Accounting: Special Purpose Ledger to perform Replicate Datasources. Z****** appears under Data Financial Accounting: Special Purpose Ledger after the replication is complete.

datasource for.png

Step 3: Selection of hierarchy and uploading data

The Datasource Z****** is now available under the ECC source system where the Datasource was created.

display datasource.png

After creating infopackage, in infopackage on Hierarchy Selection tab, select the hierarchy GCOA_*******.

hierarchy selection.png

Select the Schedule tab and click on the Start button to load the hierarchy from the source system. Like any other Datasource, the load with the monitor icon can be checked.


Right click on the G/L Account Hierarchy to create Transformations.

create tranformation.png

Once the Transformations are created, we can see the mappings between the source and target, via various Source Segments.

Hierarchy Header:

hierarchy header.png

By default, Hierarchy name and Object ID from source are mapped to the corresponding fields in the target.

If the hierarchy is version dependent, the source field VERSION has to be mapped.

If the hierarchy is time-dependent, DATEFROM and DATETO have to be mapped.

Header Texts:

header texts.png

All the Fields are mapped automatically between source and target.

Hierarchy Nodes:

hierarchy nodes.png

All the fields except OH_IOBJNM, 0CHRT_ACCOUNT and 0GL_ACCOUNT are mapped automatically.

The field OH_IOBJNM is mapped with IOBJNM via Routine.


The Routine is as follows:


The field 0CHRT_ACCOUNT is mapped with IOBJNM and NODENAME via Routine.


The Routine is as Follows:


The field 0GL_ACCOUNT is mapped with IOBJNM and NODENAME via Routine.


The Routine is as Follows:


Node Texts:

node texts.png

This mapping is also automatic, this ensures texts for the hierarchy nodes are filled.

Now, as we are done with the mappings, activate and save it and create a DTP.

node texts2.png

Once the load is successful, the GCOA hierarchy can be viewed from transaction RSH1 by double-clicking on it from the list. The icon depicting a tree can also be clicked in the toolbar of the monitor to display the hierarchy once the load is completed. The result is shown below:

hierarchy external.png

The hierarchy shown above depicts the ECC side. Now, the GCOA hierarchy can be included in any reports using the Info Object 0GL_ACCOUNT. The description of the nodes will not be present on the hierarchy. To load them, another text Datasource must be added and loaded into 0GL_ACCOUNT. This is because the texts are stored into a different table.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Hi Atul,

      This is well presented and step by step document. Appreciate your efforts on detailing it.



      Author's profile photo Former Member
      Former Member

      Nice stuff. thanks for sharing

      Author's profile photo Former Member
      Former Member

      Very nice document it was of great help .

      keep up the good work. 🙂

      Author's profile photo Former Member
      Former Member

      A helpful document indeed.Thanks.

      But I'm painfully missing one topic:

      Mapping within segment 'Intervals' with compounded characteristics.

      (or i there another document?)

      Author's profile photo abilash n
      abilash n

      Thanks Atul for neat presentation.

      Author's profile photo VISHAL RAINA

      I need help on hierarchy load.

      Since we have all custom tables and custom extractors, we have the requirement to go for hierarchy in BW side only. How do I do it?

      Lets say I have material number which comes under material group, material group comes under Subarea, subarea comes under area, and area is linked to Region. I have infoobjects like Region, area, subarea, material group, materialID. How do i go for transformation to map the hierarchy.

      Can anyone help me how do map the hierarchy in BW?

      Author's profile photo Former Member
      Former Member

      Very helpfull!!!

      Author's profile photo SAM K
      SAM K

      I have an Custom Hierarchy in R3 System

      its built on Custom Infoobject(RSH1)

      How to gt the SET name for particular hierarchy to generate data source