This blog is about Standard hierarchy ,Standard hierarchy is used to organize business processes of a controlling area. The highest node of a standard hierarchy is normally the first business process group. Here I am creating Profit Center Hierarchy in SAP HANA.When creating a Profit Center, you must assign it to a group (node) of the standard hierarchy.
Below is the sample ProfitCenter Hierarchy how it looks in SAP ECC.
There are two tables in SAP for groups in standard hierarchy.
To build a standard hierarchy, we have to read SETNODE for each level of the hierarchy and build the tree.
In SAP, there are many different groups such as Cost Center Group, Cost Element Group, and Profit Center Group etc. Each and every group is identified with unique code in field SETCLASS. For Profit Center it is ‘0106’.
To get the description texts, join the text tables SETHEADERT and CEPCT for Profit Center text to SETNODE and SETLEAF tables.
All the nodes, with subsets are included in SETNAME field in SETNODE table. SETNAME in SETNODE becomes the parent and SETNAME (joined to SUBSET in SETNODE) in SETLEAF is the child.
First create a base view to get Nodes, Sub Nodes and Profit Centers and there descriptions.
This is the overview of the Base View.
Join_1:Text join SETNODE table to SETHEADERT table with Language column as LANGU from which we will get Nodes and related Descriptions.
Join_2: Text join VALFROM to PRCTR with language column as SPRAS here we will get Profit Centers and related Descriptions.
Union Join_1 and Join_2, create a target column for SubSet and map SUBSETNAME from Join_1,this will be used in main view.
In SAP HANA there is no standard way to create this type of Hierarchy(In SAP HANA we have simple Level and Parent Child hierarchy)Create the Profit Center Hierarchy view and use the above created view as below,
In Projection_1 we have to select the following columns and apply the filters mentioned below.
There are different groups in SAP like Cost Center, to identify the Profit Center group we have to filter SetClass=’0106‘
Filters used in Projection_1 for Profit Center =’0106’,ControllingArea and Group Node.
Join1: Left Join SUBSET to SUBSETNAME and also SetClass to SetClass to get Level1,Level2 and Level3 with descriptions(Nodes and Leaves).
Join_2 :Inner Join SubSet to SetName to get Level4 and Level4 Description.
The leaf node will either be a group node or Profit Center; Profit Center will always be a leaf node.
Join_3 Left Join to get all the Level1,Level2,Level3 and Level4 with descriptions
Proceed further for more levels depending on the requirement.
Create a calculated column to get all Profit Centers into one column.This calculated column will contain leaf node of each field and can be used to join the hierarchy with the transaction data.
Final Semantics is
Save and Activate the view.
Hope this is Helpful.