Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to get list of All Employees reporting to a Manger/Position

Former Member
0 Kudos
3,119

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

1 ACCEPTED SOLUTION

Former Member
590

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

4 REPLIES 4

Former Member
0 Kudos
590

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

romanweise
Active Contributor
0 Kudos
590

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

Former Member
590

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

Former Member
591

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