Skip to Content

Infoobject - Dynamic Hierarchy - populate entries


Is it possible to display the content of infoobject hierarchy with custom code where i will populate the content of hierarchy(or even hierarchy itself)? Currently we have manually maintained the hierarchy and it's entries, but this is static list. I am looking for something where i will be able to decide/code what/how it can be displayed via query. or may be can we overwrite the hierarchy table itself when populating?

Remote Hier. Class / Hier. Class Parameters, I thought this option will option will work.. but i didnt find any documentation.

I have read few blogs here, most of the blogs actually defines the hierarhy and it's entries.

any thougts from where I can start with?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Apr 25, 2017 at 09:30 AM


    Virtual hierarchy with remote class will definately work.

    The only point that you have to consider is that object can have either real heirarchy or virtual.

    So if you have a standard hierarchy loaded from ECC (lets say hierarchy of cost center) then you can't use a virtual approach in the same object.

    I will give you an example of what I used to do:

    There was an object with any existing hierarchy.

    The requirement was to show a sub hierarchy in F4 and report without showing a root of the main hierarchy.

    I created a shadow object (not reference) and implemented virtual hierarchy (took as example one of standard classes shown in F4, guess from CL_RSRTS_HIERARCHY_SFLIGHT).

    The main part in the code is IF_RRHI_VIRT_HIER-GET_HIER method.

    Here I have first to select sub-hierarchy (let's say only subordinate employees of the particular manager) from the existing physical hierarchy and then move it, with a slight modifications, to a virtual hierarchy.

    Please see a "rough" example of my implementation of IF_RRHI_VIRT_HIER-GET_HIER:

        SELECT *
          INTO TABLE lt_virt_hier
                nodename  = ANY_TABLE_WITH_RESTRICTED_VALUES-nodename.
        SORT lt_virt_hier BY tlevel ASCENDING.
        lv_min_level = lt_emp_hier[ 1 ]-tlevel.
        lv_min_level = lv_min_level - 2.
        e_th_hienode =  VALUE #( FOR <fs> IN lt_virt_hier
                                    hieid    = p_hieid
                                    objvers  = rs_c_objvers-active
                                    nodeid   = <fs>-nodeid
                                    iobjnm   = 'YOUR_VIRTUAL_HIERARCHY_IO_TECH_NAME'
                                    nodename = <fs>-nodename
                                    parentid = COND #( WHEN <fs>-tlevel - lv_min_level = 2 THEN '1' ELSE <fs>-parentid )
                                    tlevel   = <fs>-tlevel - lv_min_level
                                    childid  = <fs>-childid
                                    nextid   = <fs>-nextid
        l_s_hienode-hieid    = p_hieid.
        l_s_hienode-objvers  = rs_c_objvers-active.
        l_s_hienode-nodeid   = 1.
        l_s_hienode-iobjnm   = '0HIER_NODE'.
        l_s_hienode-nodename = 'ANY TITLE FOR VIRTUAL HIERARCHY ROOT'.
        l_s_hienode-tlevel   = 1.
        l_s_hienode-childid  = lt_virt_hier[ nodename = FIRST_MEMBER_OF_RESTRICTED_TABLE ]-nodeid.
        INSERT l_s_hienode INTO TABLE e_th_hienode.

    You can take it as a basis ...


    Add comment
    10|10000 characters needed characters exceeded

    • I'm not sure if you need GET_CAPABILITIES method.

      The following methods I left unchanged:






      the following methods I set empty:



      I only changed the following methods:



      Regarding GET_HIER the code is above.

      In _GET_HIEDIR I just corrected e_s_hiedir-hieid = 'NAME OF MY HIERARCHY'.