Introduction:
Certain reporting scenarios in SAP BW require hierarchical representation of master data. To enable these master data in BW there has to be maintained as hierarchies. Examples of few hierarchies are Material, GL Account, Cost Center, Organization structure etc.
In BW, the characteristic hierarchies are enabled in the tab ‘Hierarchy’. Depending on the requirement, the properties could be selected. This document describes loading/maintaining of a non-time dependent hierarchy with intervals. We are considering flat file loading scenario in the version of SAP BW 7.3.
Step 1: Create the Info object bearing hierarchy and choose the desired properties
If we need external characteristics in the hierarchy tree, we can include them by clicking on the tab button
Step 2: Create the Flat file data source
While creating the Data source, if we select “hierarchy is flexible”, the Data Source will be created with the new structure, if we leave it blank the Data Source will be created with the old structure.
Select the check box -”Hierarchy is Flexible”, if we have compounding Attributes.
The checkbox ‘Intervals permitted in hierarchy’ is enabled when we click on ’Read Info Object properties’, as we have already selected this option in info object definition.
File structure:
We can also create an example file to check the file structure by clicking on the tab button
Hierarchies are loaded as multiple segments. The different segments of this hierarchy are seen in the ‘Segments/Fields’ tab.
Segments are created based on the hierarchy properties. For example, we got the 5th segment ‘Node Intervals’, as we are creating a hierarchy with intervals,
Preview of different segments is possible in the ‘Preview’ tab.
If we select the segment – Node Intervals, it will show the “To values” in the intervals.
The structure of the file is as below –
|
Field Name |
Data Type |
Length |
Description |
Comments |
1 |
NODEID |
NUMC |
8 |
Node ID |
|
2 |
IOBJNM |
CHAR |
30 |
Info Object Name |
|
3 |
NODENAME |
CHAR |
32 |
Node Name |
|
4 |
LINK |
CHAR |
1 |
Link name |
|
5 |
PARENTID |
NUMC |
8 |
Parent Node |
|
6 |
LANGU |
LANG |
1 |
Language Key |
|
7 |
TXTSH |
CHAR |
20 |
Description – Short |
|
8 |
TXTMD |
CHAR |
40 |
Description – Medium |
|
9 |
TXTLG |
CHAR |
60 |
Description – Long |
|
10 |
INTERVL |
CHAR |
1 |
Interval |
|
11 |
/BIC/Z_PLANT |
CHAR |
8 |
Plant |
From plant |
12 |
TO_Z_PLANT |
CHAR |
8 |
Interval – Plant |
To Plant |
Sample File to load plant hierarchy is as below:
Note: The sample file above has texts as well in row no. 16 , these are loaded only till PSA and will not be reflected in the hierarchy. But the texts maintained for the master
data Z_PLANT will be reflected in the hierarchy.
Step 3: Create Info package and Click on Create Header (To maintain the Hierarchy technical name and Description).
You will find the Hierarchy name in the ” Hierarchy Selection ” Tab:
Step 4: Select the appropriate Hierarchy ( In our case it is INDIA)
Step 5: Create transformation for the hierarchy info object
All the segments have the corresponding mappings done in transformations. For this scenario of hierarchy with intervals, we need to do the mapping from TO_Z_PLANT to Z_PLANT as it is not auto-generated
Step 6: Create DTP for hierarchy load
The setting for DTP error handling has to be ‘Deactivated’. If we set it as ‘No update, No reporting’ we cannot see the exact error when hierarchy data load fails.
If we select DTP error handling ‘Deactivated’, it will show the appropriate error message:
As seen in the screen below, the appropriate error message is shown in the case of duplicate nodes.
Based on the error displayed, we have to ask the business to correct the data in the Flat File and we have to reload it.
After loading the data hierarchy we can see single nodes and intervals as shown below:
You can also refer to the below helpful links:
Very Useful Information.
Thanks Ravi Kypa.
Nice presentation and useful stuff .
Thanks for sharing Ravi.
Thanks Ravi,
Very nice posting, great detailed information on how to create and load Hierarchies information from flat file.
Thanks, this is really useful information. Now, I can see that the values (nodes) for intervals are not there. How do you add them? Do you add them manually or there is a better way to automatically add them (if there are many)?