09-06-2006 2:29 PM
Hi together,
I've got a profit center hierarchy in BW and I need to develop a function module to check, whether a profit center exists under a certain hierarchy node.
Does anyone has an approach how to do that?
Kind regards
Stefan
09-06-2006 2:49 PM
HI Stefan,
You can do it in 2 ways:-
<b>1)</b> Use the Function Module <b>'G_SET_TREE_IMPORT'</b>
<b> CALL FUNCTION 'G_SET_TREE_IMPORT'
EXPORTING
no_descriptions = ' '
no_rw_info = 'X'
setid = p_setid
TABLES
set_hierarchy = lt_hier
set_values = lt_val.</b>
here, in lt_hier table you will get all the Nodes and in lt_val talbe you will get all the values under that nodes, so loop the lt_val Internal talbe and see whether the value is existed or not.
<b>2)</b> you can use SETNODE and SETLEAF tables to get the value and the Hierarchy Node.
i will show the way how to do this
By using the Fm you will get all the nodes and the values, so loop that internal tales and get waht you want and if you want to check a profit center then use the table SETLEAF, you will get the child node, then use the SETNODE to get the next node for that node. do like this up to get the parent node.
Hope you understand my point
Regards
Sudheer
09-06-2006 2:56 PM
Use function module K_HIERARCHY_TABLES_READ to read the BW Hierarchy.
The structures T_NODES and T_VALUES retuen the hierarchy nodes.
You could then read these tables to determine if a PC exists in the hierarchy nodes.
09-06-2006 3:03 PM
Thanks for the awnsers,
but unfortunately I cannot find neither the one nor the other fm in BW....
Any suggestions?
09-06-2006 3:04 PM