Product hierarchies with more than 1 million nodes
[201] [202] [cost hierarchies] [hierarchies] [nodes] [nodes.dat] [RH] [RH201] [RH202]
Symptom
Large product hierarchies cannot be loaded into BW.
Error messages RH 201 and RH 202 are issued.
Other terms
RH201, RH 201, RH202, RH 202
Reason and Prerequisites
In the VBIH_HIERARCHY_TRANSFER_LPRH extractor, the RS_TREE_CONTRUCT function module is used to determine the parent child relationship.
In this RS_TREE_CONTRUCT function module, the SNODETEXT and SNODE structures, whose PARENTID, CHILDID and NEXTID components are defined with a six-digit data element, are used.
With more than one million possible nodes, this leads to an overflow, the value of the ‘NEXTID’ is then duplicated and this results in the following errors in BW:
RH201Parent ID of node ID & is not the same as the ID of the higher level node
RH202The level of the node ID & does not suit the lev. of the higher lev. node
Solution
A possible solution can only be provided as part of a modification.
The following rows must be changed in the VBIH_HIERARCHY_TRANSFER_LPRH module.
function VBIH_HIERARCHY_TRANSFER_LPRH.
…
…
* Data for calling other Functions
data: l_t_hiers like rshiertrsf occurs 0 with header line.
data: l_big type c value ‘X’. <==INSERT
...
...
*
* Finally get parent / child / next -data of built tree.
*
if l_big eq 'X'. <==INSERT
perform tree_construct tables e_t_hienode. <==INSERT
else. <==INSERT
* Set tlevel of hierarchy table for next call
loop at e_t_hienode.
...
...
endloop.
endif. <==INSERT
endfunction.
*----------------------------------------------------------------------*
***INCLUDE LVBIHF01 .
*----------------------------------------------------------------------*
*&---------------------------------------------------------------------*
*& Form TREE_CONSTRUCT
*&---------------------------------------------------------------------*
* New routine for big producthierarchies
*----------------------------------------------------------------------*
* --> l_t_levnode
*———————————————————————-*
FORM TREE_CONSTRUCT
TABLES L_T_LEVNODE TYPE RSAP_T_HIENODE.
DATA:
L_S_LEVNODE TYPE RSAP_S_HIENODE,
L_S_NODE TYPE RSAP_S_HIENODE,
L_INDEX TYPE I VALUE 1,
L_EXIT TYPE SBIW_BOOL,
L_T_HTAB TYPE RSAP_T_HIENODE,
W_T_HTAB TYPE RSAP_S_HIENODE,
L_HLP_SY_TABIX LIKE SY-TABIX. .
* create hierarchy
READ TABLE L_T_LEVNODE INDEX 1 INTO L_S_LEVNODE.
MOVE-CORRESPONDING L_S_LEVNODE TO L_S_NODE.
L_S_NODE-NODEID = 1.
PERFORM RECURSE
TABLES L_T_LEVNODE
USING L_S_NODE
CHANGING
L_INDEX
L_T_HTAB
L_EXIT.
L_T_HTAB = L_T_HTAB.
SORT L_T_HTAB.
* Pass data to original table
LOOP AT L_T_HTAB INTO W_T_HTAB.
L_HLP_SY_TABIX = SY-TABIX.
READ TABLE L_T_LEVNODE INDEX L_HLP_SY_TABIX.
CHECK SY-SUBRC = 0.
L_T_LEVNODE-NODEID = W_T_HTAB-NODEID.
L_T_LEVNODE-PARENTID = W_T_HTAB-PARENTID .
L_T_LEVNODE-CHILDID = W_T_HTAB-CHILDID .
L_T_LEVNODE-NEXTID = W_T_HTAB-NEXTID .
MODIFY L_T_LEVNODE INDEX L_HLP_SY_TABIX.
ENDLOOP.
ENDFORM. ” TREE_CONSTRUCT
*———————————————————————*
* FORM recurse
*———————————————————————*
*
*———————————————————————*
* –> I_T_LEVNODE
* –> I_S_NODE
* –> C_INDEX
* –> C_T_HTAB
* –> C_EXIT
*———————————————————————*
FORM RECURSE
TABLES I_T_LEVNODE TYPE RSAP_T_HIENODE
USING I_S_NODE TYPE RSAP_S_HIENODE
CHANGING
C_INDEX TYPE I
C_T_HTAB TYPE RSAP_T_HIENODE
C_EXIT TYPE C.
DATA: E_T_HIENODE TYPE RSAP_T_HIENODE,
L_S_LEVNODE TYPE RSAP_S_HIENODE,
L_S_NODE TYPE RSAP_S_HIENODE,
L_S_NODE2 TYPE RSAP_S_HIENODE,
L_S_PARENT TYPE RSAP_S_HIENODE,
L_LEVDIF TYPE I.
L_S_NODE = I_S_NODE.
ADD 1 TO C_INDEX.
WHILE NOT L_LEVDIF < 0. "next node is not on a higher level
READ TABLE I_T_LEVNODE INDEX C_INDEX INTO L_S_LEVNODE.
IF SY-SUBRC <> 0.
* there is no further node, add last node and exit
APPEND L_S_NODE TO C_T_HTAB.
C_EXIT = SBIW_C_TRUE.
EXIT.
ENDIF.
MOVE-CORRESPONDING L_S_LEVNODE TO L_S_NODE2.
L_S_NODE2-NODEID = C_INDEX.
L_LEVDIF = L_S_NODE2-TLEVEL – L_S_NODE-TLEVEL.
CASE L_LEVDIF.
WHEN 0.
* both nodes on the same level: add prenode to htab, go on with next
* node
L_S_NODE2-PARENTID = L_S_NODE-PARENTID.
L_S_NODE-NEXTID = L_S_NODE2-NODEID.
APPEND L_S_NODE TO C_T_HTAB.
L_S_NODE = L_S_NODE2.
C_INDEX = C_INDEX + 1.
WHEN 1.
* new node is child of actual node: recurse to get nodes on same level
* of the child
L_S_NODE-CHILDID = L_S_NODE2-NODEID.
L_S_NODE2-PARENTID = L_S_NODE-NODEID.
PERFORM RECURSE
TABLES I_T_LEVNODE
USING L_S_NODE2
CHANGING
C_INDEX
C_T_HTAB
C_EXIT.
IF C_EXIT = SBIW_C_TRUE.
* add actual node to htab, because it is the last one in this
* level on the way home ![]()
APPEND L_S_NODE TO C_T_HTAB.
EXIT.
ENDIF..
WHEN OTHERS.
* new node is one level higher than actual node, add actual node to
* htab and exit, to get the next nodes one level higher
APPEND L_S_NODE TO C_T_HTAB.
* exit while
ENDCASE.
ENDWHILE.
ENDFORM. “recurse