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: 

Looking for a FM or Class which gets children below a hierarchy node value in a hierarchy?

Former Member
0 Kudos

Hi All,

I had a task in which I need to bring all the children of a hierarchy node in a hierarchy. I tried using FM RSNDI_SHIE_STRUCTURE_GET3 but it didn't help, when I am giving node name in import parameters I_S_SUBTREESEL it is coming out with error.If you think there are any other FM or class/Methods Please let me know.

Please give me some inputs in getting the children based on a hierarchy node value in a hierarchy.

Thanks,

venkat.

5 REPLIES 5

former_member188827
Active Contributor
0 Kudos

Check if 'EAM_TASKLIST_GET_DETAIL' helps

0 Kudos

Hi ,

Thanks for the response,

I am unable to find this , it says couldn't found/doesn't exist.

Thx,

UmaArjunan
Active Participant
0 Kudos

Is the requirement needed for BW or BPC ABAP ?

If it is for BW or BPC then please use the following piece of code .

Code Snippet # 2

The below code reads child members of a parent node from the hierarchy of dimension's master data

DATA:   lo_dim TYPE REF TO cl_uja_dim,
        lr_dim_data
TYPE REF TO if_uja_dim_data,
        lt_base_en
TYPE uja_t_dim_member.
TRY.
   
CREATE OBJECT lo_dim
     
EXPORTING
        i_appset_id
= i_appset_id
        i_dimension
= 'ENTITY'.  "Hierarchy Name

 
CATCH cx_uja_admin_error.

ENDTRY.

lr_dim_data
= lo_dim.


"GET THE CHILD NODES
CALL METHOD lr_dim_data->get_children_mbr
 
EXPORTING
    i_parent_mbr    
= 'ENT_PAR01'   "Node Name
    if_only_base_mbr
= 'X'
 
IMPORTING
    et_member       
= lt_base_en.

Points to note:

If if_only_base_mbr parameter is left blank then all the intermediate hierarchy level nodes are fetched in lt_base_en.

The above code is from SDN code snippets , Also please refer the following link

http://scn.sap.com/docs/DOC-28777

0 Kudos

Hi uma, does it work for BW?The reason is we will not have application set I'd and dimension correct . please let me know. Thanks

0 Kudos

Yes. the above code is for BPC.

For BW hierarchy info object, please use the following ..

* Constants declaration

  CONSTANTS: lc_iobj_hier TYPE rsiobjnm   VALUE 'IOBJ_HIER', ---> change this to your Hier Info object name

             lc_hier_node   TYPE rshienm    VALUE 'HIER_NODEID', ---> change to the hierarchy node value you want to select data

             lc_a         TYPE rsobjvers  VALUE 'A',

             lc_e         TYPE sy-langu   VALUE 'E',

             lc_02        TYPE rstlevel   VALUE '02',

             lc_03        TYPE rstlevel   VALUE '03',

             lc_i         TYPE char1      VALUE 'I',

             lc_eq        TYPE char2      VALUE 'EQ'.

*internal tables declaration

  DATA: lt_hier_name      TYPE           rssh_t_hiedir,

              lt_hier       TYPE TABLE OF  /bic/hhier_iobj.

*work area declaration

DATA: lw_hier_name      TYPE rshiedir,

            lw_hier            TYPE /bic/hhierobj.

1.First get the heirarchy ID's of the Info object IOBJ_HIER are fetched

  CALL FUNCTION 'RSSH_HIER_OF_IOBJ_GET'

    EXPORTING

      i_objvers    = lc_a                  " Active version

      i_iobjnm     = lc_iobj_hier      " Info object Name

      i_langu      = lc_e

    IMPORTING

      e_t_rshiedir = lt_hier_name.

  CLEAR lw_hier_name.

*

  READ TABLE lt_hier_name INTO lw_hier_name

                          WITH KEY hienm = <pass hierarch node ID >    "lc_hier_node

*

2. *The hierarchy table values for the Infoobject HIER_IOBJ

*for which the hierarchy version is Active is fetched.

*

  IF sy-subrc IS INITIAL

    AND lt_hier[] IS INITIAL.

*

    SELECT * FROM /bic/hhier_iobj

          INTO TABLE lt_hier

               WHERE hieid   EQ lw_hier_name-hieid

                 AND objvers EQ lc_a.

    IF sy-subrc IS INITIAL.

      SORT ltl_hier

        BY iobjnm

           nodename

           tlevel.

    ENDIF.  "" SELECT subrc initial ?

  ENDIF.  ""  READ subrc initial  ?

Use the above code and modify according to your requirement. Change HIER_OBJ to the hierachy info object technical name where in you want to retreive the data

Thanks,

Uma