Organizational Unit useful function module

234 阅读1分钟

you can use the function module RH_STRUC_GET to read information from the org model:

Created by Wang, Jerry on Jul 04, 2015

* read all org units a specific user is assigned to
   call function 'RH_STRUC_GET'
     exporting
        act_otype  = 'US'
        act_objid  = lv_username "e.g. sy-uname
        act_wegid  = 'US_CP_O'
     tables
        result_tab = lt_result "all org units the user is assigned to
     exceptions
       others      = 3.
   delete lt_result where otype <> 'O'.
* get all employees who are assigned to an org unit
   call function 'RH_STRUC_GET'
     exporting
        act_otype  = 'O'
        act_objid  = lv_org
        act_wegid  = 'OO-S-BP'
        act_plvar  = lv_plvar
     tables
        result_tab = lt_result " all employees that are assigned to an org unit
     exceptions
       others      = 0.
   delete lt_result where otype ne 'BP' .

There are a lot of other combinations possible. But please keep in mind this FM is not really fast.