Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

check whether element exists in hierarchy

Former Member
0 Kudos

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

4 REPLIES 4

Former Member
0 Kudos

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

Former Member
0 Kudos

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.

Former Member
0 Kudos

Thanks for the awnsers,

but unfortunately I cannot find neither the one nor the other fm in BW....

Any suggestions?

andreas_mann3
Active Contributor
0 Kudos

hi,

or use table setleaf and setheader

A.