Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

BOM traversal: Find child nodes for a parent node or vice versa


I am trying to find the longest path for a particular BOM material. I am using the FM CS_BOM_EXPL_MAT_V2 to explode the BOM to get the materials (including children nodes etc.). I think, in this scenario, a recursive function would be the best way to go. The problem is to find the children nodes for a node in a particular level. Looking at the structure STPOX and the fields STUFE (Level), WGEXX (path) , TTIDX (index) and VWGEX (path, multi-level), I cannot find a logical way to link the children nodes to a parent node although visually I can see how things are connected when the FM returns the STB table..

For example: TBL_STB returns from FM:


1 1 M 1 0 MATXX1

2 1 M 2 1 MATXX2

3(a) 1 M 3 1 MATXX3

4(c) 1 M 4 1 MATXX4

4(d) 2 M 4 1 MATXX5

3(b) 2 M 3 1 MATXX6

4(e) 3 M 5 2 MATXX7

4(f) 4 M 5 2 MATXX8

Visually, we can tell that Level 2 has one item 2, level 3 has 2 items, 3(a) and 3(b), Level 4 has 4 items where 4c and 4d are connected to 3a and 4e and 4f are connected to 3b.

Going through STPOX structure itself, how can we find out that 4c and 4d belongs to assembly 3a but 4e and 4f belong to 3b?? If someone can explain the uses of the differnet indicators in STPOX (or other) where I can find out the children from the parent, it would be greatly helpful to write the recursive function..

Thanks in advance..

Former Member
Not what you were looking for? View more on this topic or Ask a question