This blog explains the benefits and process of loading hierarchies with transformations and DTP, using new framework in BW 7.30
In our example, we will take the below structure of hierarchy to load as shown in the below figure.
Structure of Hierarchy:
In the above figure, we can see the hierarchy levels.
Root Node: DCR (0HIER_NODE)
Level 1: Components (info object = ZCOMP)
Level 2: Parts (info object = ZPARTS)
Create Hierarchy file:
Create the following file in excel and save it as .CSV file.
Now we have to create info objects required for our hierarchy loading i.e. ZCOMP and ZPARTS
Creation of Info Objects:
You can see screenshots of different tabs I have maintained in the info object maintenance screens of ZCOMP & ZPARTS.
Adding ZCOMP as External Characteristic:
Since we are loading the hierarchy to info object ZPART, which involves the usage of ZCOMP in its hierarchy structure, we should add ZCOMP as a external characteristic to ZPARTS as shown below:
Creating Hierarchy Data source and Assigning Source System:
We will discuss about different tabs present in Hierarchy Data Source:
1) Extraction Tab:
- We can load the hierarchy using Adapter, where we specify the location of our file name.
- We choose Data Format as “Hierarchy Separated by Separator “as we are using CSV file.
- If we use “Hierarchy is Flexible” then data source is created using “New Structure” we have to mention Target Info Object name to which we load the Hierarchy, if we uncheck , the data source is created in “Old Structure”
We can now Create Header from this screen using “Create Header”. We create a Header named as “Custom Hierarchy”.
2) File Structure:
This shows the format of file which we are loading. We can use “Create Example File” if we want to change the format of the file.
3) Segment/ Fields:
Hierarchies are usually loaded in multiple segments. You can find the segments below:
- Hierarchy Header
- Hierarchy Description
- Hierarchy Structure
- Description for text
Here we can see the preview of our data load after activation of Data source.
Create an IP to load the data till PSA.
As we can use transformations, we can now use all the functionalities like Start Routine, End Routine, Expert Routine and all the in-built formulas when we load hierarchy. This helps us to load hierarchies not only info objects but also to data targets like DSOs and Info cubes.
Data source using PSA or Idoc as transfer method can use transformations to load. To load 3.x hierarchies, migrate data source from 3.x to 7.3 using migration tool, which creates a PSA table that can be used to load hierarchies using transformations.
We have to select Source Segments and Target Segments and do the necessary mappings.
We set the Info Object 0H_NORESTNO (Display Assigned Nodes Only) to ‘X’ using a constant. This ensures that non-assigned are not saved in the hierarchy SID table and do not have to be loaded into memory at runtime. We set it as shown in the below figure.
Using Rule Type: Derive Hierarchy Characteristic:
If we are using IDOC format and we have FIELDNM, to get Info object names at run time we use rule type “Derive Hierarchy Characteristic”. But in our case we need not use this rule as we are using “New Structure”.
Using Rule Type: Hierarchy Split:
If the target info object is compounded, then we have to use this rule type to split the information according to the info object.
In our Example:
We do 1:1 mapping for Node ID, Info Object Name and Parent Node. As this is new data source structure (PSA format) , we have to map Node Name to Link, Name of text Node, ZPARTS(target info object ) and ZCOMP(external characteristic).
Create a DTP and Load to the Target.
We use “FULL” mode and Check “Only retrieve last request”
We use “Full Update” and “Activate Hierarchy” to automatically activate the hierarchy loaded.
Hence we can see the hierarchy we loaded just now.