2012 Feb 10 4:35 PM
Hi All,
I need to find all the employees who report to a particular manager/Supervisor.
In my program I will have access to PERNR and based on this I need to :
1> Check if this PERNR is a Manager/Supervisor.
2> If yes, get all the employees who report to this Manager.
I tried searching the forum but did not get the exact answer hence the post.
As per some sdn posts I tried using RH_STRUC_GET but didnt go much ahead.
Appreciate your help.
Many thanks
SK
2012 Feb 13 5:44 AM
Hi
Take the Organization unit of the Manager and:
CALL FUNCTION 'RH_STRUC_GET'
EXPORTING
ACT_OTYPE = LC_ORG_OTYPE
ACT_OBJID = LV_ORG_UNIT
ACT_WEGID = 'O-S-P'
ACT_PLVAR = LC_PLVAR
TABLES
RESULT_TAB = T_RESULT
EXCEPTIONS
NO_PLVAR_FOUND = 0
NO_ENTRY_FOUND = 0
OTHERS = 0.
T_RESULT will hold all the employees reporting to that manager.
Regards
Raj
2012 Feb 10 6:57 PM
Hi,
1. To identify whether Manager or not.
Check whether A 012 relation is there in HRP1001 table for the manager's position.
SELECT SINGLE * FROM hrp1001 INTO wa_hrp1001
WHERE otype = 'S'
AND objid = manager-position
AND relat = 'A'
AND rsign = '012'
AND endda GE sy-datum.
IF sy-subrc EQ 0.
Manager
ENDIF.
2. To fetch the reportees of manager.
Use FM HRCM_ORGUNIT_EMPLOYEE_LIST_GET.
Pass manager Org unit and it will return all the employees of org unit.
Remove manager pernr from that list so that the remaining will be his reportees.
Cheers,
Raja.D
2012 Feb 10 11:54 PM
Hi,
function module RH_STRUC_GET is exactly the object to solve such tasks.You can find plenty of examples on how to use this function module via the where use list. Furthermore you should get familiar with the concept of evaluation paths and perhaps also w/ structural authorization.
Kind Regards
Roman
2012 Feb 13 5:21 AM
Hi,
In order to get the list of employees under a manager
1.Pass O-S-P to WEGID, 'O' to OTYPE and the pernr's organisation unit to OBJID in the FM RH_STRUC_GET.( Get the Org. Unit of the pernr from infotype 0001).
2.Delete all the entries from the RESULT_TAB where OTYPE is not equal to 'P'.
This will give you a list of all direct as well as indirect employees in that org unit.
The manager details will be maintained in the infotype '1010' and subty '1001'. Check if an entry has been maintained for the given pernr to find out if he's manager. Similarly, the supervisor details will be maintained in infotype '1001' and subty 'A012'.
Regards,
Supriya
2012 Feb 13 5:44 AM
Hi
Take the Organization unit of the Manager and:
CALL FUNCTION 'RH_STRUC_GET'
EXPORTING
ACT_OTYPE = LC_ORG_OTYPE
ACT_OBJID = LV_ORG_UNIT
ACT_WEGID = 'O-S-P'
ACT_PLVAR = LC_PLVAR
TABLES
RESULT_TAB = T_RESULT
EXCEPTIONS
NO_PLVAR_FOUND = 0
NO_ENTRY_FOUND = 0
OTHERS = 0.
T_RESULT will hold all the employees reporting to that manager.
Regards
Raj