cancel
Showing results for 
Search instead for 
Did you mean: 

How to get the Organizational Unit One level up

Former Member
0 Kudos

Hi

Does any one know any function module to get the org unit one level up by giving the current Organizational unit as input. Please reply very urgent.

Accepted Solutions (1)

Accepted Solutions (1)

suresh_datti
Active Contributor
0 Kudos

You can use RH_STRUC_GET or use the following piece of code..

data w_sobid type sobid.
parameters:p_objid like hrp1001-objid
select sobid into w_sobid
             up to 1 rows
             from HRP1001
             where otype = 'O'
               and objid = p_objid
               and plvar = '01'
               and istat = 1
               and rsign = 'A'
               and relat = '002'
               and begda le sy-datum
               and endda ge sy-datum.
endselect.
if sy-subrc ne 0.
write: / w_sobid.
endif.

~Suresh

Answers (2)

Answers (2)

uwe_schieferstein
Active Contributor

Hello Nirmal

I am usually using the following function module to read to OM:

*   SAP_SORG
* OrgStructure with assigned orgunits)
    REFRESH: lt_struc.
    CALL FUNCTION 'RHPH_STRUCTURE_READ'
      EXPORTING
        plvar             = '01'            " active Planvar.
        otype             = 'O'             " OrgUnit
        objid             = l_wa_cb1-objid  " Toplevel-Node
        wegid             = 'SAP_SORG'
        begda             = iw_begda
        endda             = iw_endda
        pup_info          = 'X'
        with_stext        = 'X'
        tdepth            = 0               " alle Sub-Levels
      TABLES
        stru_tab          = lt_struc
      EXCEPTIONS
        catalogue_problem = 1
        root_not_found    = 2
        wegid_not_found   = 3.

The parameter <b>WEGID</b> is the crucial on which determines the objects that are read from the OM. In your case you will need <b>WEGID = 'A002'</b> (reports (line) to).

To understand the <i>evaluation path</i> (WEGID) better have a look at transaction <b>PPST</b>.

Regards

Uwe

Former Member
0 Kudos

Hi Nirmal,

Go through the sample code,

http://www.sapdevelopment.co.uk/fmodules/fms_orgstruc.htm

Regards,

Azaz Ali.