Merchandising /Material Group Hierarchy is an hierarchy available for categorizing articles from
a purchase/procurement business process point of view. Merchandising Category/Material group is the last level of the hierarchy.
For understanding this Hierarchy concept below resources are of big help.
From a functional point of view while trying to figure out /understand the tables responsible for holding the hierarchy levels / assignments between levels/assignment of Material group to hierarchy level data, found very limited blogs/materials available in the internet explicitly explaining the same.
Through this blog I am sharing my findings on how Retail Merchandising/ Material Group Hierarchy content are stored within the back end standard tables and later on how it can be moved by triggering Idocs in S/4 HANA Fashion.
Note:To figure out the back end tables I debugged the FM‘MERCHANDISE_GROUP_HIER_ART_SEL’ by using some dummy hierarchy data setup.I would really appreciate if experts from the community would express their thoughts on any other easier methods for achieving the same.
1.How Retail Merchandising /Material Group Hierarchy stored in SAP S/4 HANA Fashion ?
The last level of the Hierarchy is always the Material group field (MARA-MATKL).The two main tables holding this information is KLAH & KSSK. Having said that I have created a sample Hierarchy data along with some levels assigned to a Material group which is called the Merchandising category (MC- being the last level). On each hierarchy level we can also have characteristics, or we can have them inherited from superior hierarchy levels.
All the characteristics are differentiated by class types for ex. Material class by 001, Batch by 023 etc.
Similarly In Fashion / Retail we also have variant creating characteristics which is of class type 300(Article- Size variants created via configuration class), and then there is this Material group/ Merchandising Category created with class type 026.
We create retail material group from T code – ‘WG21’. This would generate a record in table ‘KLAH’.
For simplicity creating material group ‘TESTMATGR‘ , MARA-MATKL being 9 characters, hierarchies can be built accordingly.(for eg: 1,11,111,1111,1111…till the last level which is the material group/merchandising category ).
Hierarchy levels can be assigned to the material group once they are already created and same goes also for Material group Reference articles which can also be created from T code – ‘WG22’ as shown below.
On creation of Material group, a record gets generated every time in table KLAH with an Internal Class Number (KLAH-CLINT)
Later on we will be using the same KLAH-CLINT for fetching the relevant hierarchy level assignments for the Material group.
All the superior levels above Material Group (Merch. Category) can be created from tcode CLWM
Create superior levels and also assign one level to the next level.
This is a Hierarchy level which itself can also hold characteristics, which can also be inherited down the hierarchy tree in that case those characteristics would be flagged in the Inherited Char column.
The assignment checkbox flagged which means the hierarchy levels are assigned to another hierarchy level or a Material Group (Merch. Category). To change anything within the hierarchy, the hierarchy level needs to be unassigned from the Material group first otherwise it holds on to the assignment record created in KSSK table will get to this in a bit. On unassigning it automatically deletes the assignment records from backend std. tables. In contrast Article hierarchy is more flexible/robust in this regard.
Assignment of one Hierarchy level to another.
Assigning hierarchy level to Material Group at the end.
FM ‘MERCHANDISE_GROUP_HIER_ART_SEL’ gives the list of hierarchy levels connected with relevant Hierarchy levels.
As mentioned earlier debugging the FM would help us understand how the RMH content is stored in SAP tables including the hierarchy levels and all its assignments till the last level (Material Group / Merch. Category).
As already discussed for our material group – ‘TESTMATGR’ we have a record in KLAH.
Based on KLAH-CLINT in KSSK-OBJEK we retrieve KSSK-CLINT
Based on KSSK-CLINT in KLAH-CLINT we get the next hierarchy level connected to the Material group
In this case it is KLAH-CLASS = ‘1111’
Similarly, we continue the search for the other hierarchy level assignments based on the
KSSK-OBJEK = KLAH-CLINT , till there is no record to be found in KSSK.
We now understand if there is any assignment between two hierarchy levels or assignment between Material group and hierarchy level there will be a record generated for the same in KSSK.
Similarly, to find out the level itself we retrieve KLAH-CLASS based on KLAH-CLINT = KSSK-CLINT
which is ‘111’.
We continue the same until there is no assignments found in table KSSK and we get the highest level in KLAH.
2.How we can transfer RMH (Retail Merchandising/Material Group Hierarchy) ?
If the data transfer is between SAP systems, we can setup distribution models.
If any legacy system sending this information to a S4 Hana Fashion/Retail system then similar idocs can be triggered through middleware with relevant mapping.
Distribute the Distribution model to receiver system and generate partner profiles accordingly.
Execute Tcode ‘WGSE’ to transfer the Material groups along with the Hierarchy levels.
Note if any characteristics are also included within the hierarchy levels, then the CHRMAS Idocs would also get triggered but going by my example following outbound idocs triggered.
In WE02 following outbound Idocs triggered.
Hope this blog brings some more clarity and understanding on how the Retail Merchandising / Material Group Hierarchy content is stored in the back end SAP tables and how it can be transferred across systems by triggering Idocs in S/4 HANA Fashion.
Some useful resources