Quantcast
Channel: SCN : Blog List - SAP Business Warehouse
Viewing all articles
Browse latest Browse all 333

Create hierarchy using any source

$
0
0

With the new 7.3 hierarchy framework, it is now possible to load a hierarchy from any datasource, be it a DSO, flat file or a non-hierarchy datasource.

 

In this post, I’ll walk through the process of loading a hierarchy from a master data attributes datasource. The hierarchy to be created consists of 5 levels and contains an external characteristic.

 

The Infoobject ZXCMDTYCD is enabled for hierarchy and an external characteristic (ZXCMDGRN) has been added for the hierarchy. The hierarchy will be a standard hierarchy and will not be time dependent.

 

The new BW framework consists of 5 target segments. More information can be found at –

Creating a Transformation for a Hierarchy - Modeling - SAP Library

Examples of a Hierarchy Transformation - Modeling - SAP Library

 

In the current example, there is no NODEID, PARENTID, CHILDID or NEXTID available. The data is a flat table with each CMDTY_CD assigned under up to 5 levels. This data needs to be converted into a proper format required for loading of hierarchy.

Source Data -
2-3-2014 8-47-56 AM.png

We start with creating a dummy hierarchy that we will use in the transformations.

2-3-2014 9-02-11 AM.png

Some of the parameters are hard coded within the transformations. In this example, the transformation is used to load only one hierarchy. Hence the hierarchy header information is constant. If you want to load multiple hierarchies, you can modify them through your source data or code it in your end routine.

2-3-2014 9-05-54 AM.png
2-3-2014 9-06-14 AM.png

The challenge is to populate the hierarchy structure with the proper node, parent, child and next ID’s.

 

We start by finding the parent nodes at each level and storing them in individual tables. The parent nodes for lowers levels will be children for upper nodes. We will take that into consideration when we populate the parent and child ID. In this example, all the ‘parent’ nodes are external characteristics. Their children might be CMDTY_CD or lower group level code.

2-3-2014 9-50-51 AM.png

The parent nodes for the top most level are populated.

2-3-2014 10-26-58 AM.png

We then add level 2 objects to the hierarchy. We make one pass for all the external characteristics and then another for all the CMDTY_CD that might be present. For finding the CMDTY_CD, we do a search within the entire table and not on the individual levels.

2-3-2014 10-40-04 AM.png
2-3-2014 10-40-34 AM.png

We repeat the process for all 5 levels. Since level 5 will not have any children from the external characteristic, we only look for CMDTY_CD for that level.

 

The code can be modified to fit a hierarchy with no external characteristic or with different number of levels. The link node would be needed if you have the same object used multiple times in the hierarchy.

 

The next step is to create a DTP for loading the hierarchy. We will use a full load info package to load data into PSA and then subsequently into the hierarchy.

2-3-2014 10-42-22 AM.png

2-3-2014 10-42-36 AM.png

 

You can see the hierarchy loaded once the DTP is run –

2-3-2014 10-47-10 AM.png


Viewing all articles
Browse latest Browse all 333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>