06-14-2013 6:56 PM
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.
06-14-2013 8:42 PM
06-15-2013 2:20 AM
Hi ,
Thanks for the response,
I am unable to find this , it says couldn't found/doesn't exist.
Thx,
06-15-2013 5:28 AM
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
06-15-2013 7:15 AM
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
06-15-2013 10:39 AM
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