Function Module to get subordinates of a manager
Unfortunately, I have seen generally that there is no proper standard FM provided by SAP where you can get the subordinates of a manager to directly. So, I got curious enough to explore more on this one & started debugging & troubleshooting different set of services like Team Calendar, Team Viewer etc. in backend. And I indeed found one which could be used more realistically for getting subordinates related data.
Although there are other FM’s like RH_STRUC_GET which can also be used, but they are more complicated to use by way of passing input & changing parameters to them. So, one FM that can be queried very easily & get the required set of data is ‘HRWPC_RFC_OADP_GET_OBJECTS‘. This FM has been primarily been used as a wrapper FM for most of the services in MSS viz., Team Calendar , Team Viewer to name a few.
Parameters that needs to be passed to this FM are :-
OBJSEL -> Either of the two values can be passed depending on the business needs.
1. MSS_TMV_EE_DIR -> This will only give DIRECT REPORTS to the manager , as per the evaluation path of O-S-P.
2. MSS_TMV_EE_ALL-> This will give ALL EMPLOYEES coming under the manager , as per the evaluation path of O-S-P
(Both the above parameter values are based on OADP- Object and Data Provider structures used in MSS)
BEGDA -> SY-DATUM
ENDDA -> SY-DATUM
USER-> Username of the manager stored in info type 0105.
An example to depict the working of this FM is shown from the below Organization Structure .
Passing object selection “MSS_TMV_EE_DIR”
Passing object selection “MSS_TMV_EE_ALL”
As you can see, in the last result an additional employee is outputted as “Bryan Adams” , as he not being the direct employee of the manager.
Hope this blog was helpful for those who usually gets baffled for getting subordinates data of a manager through various discussion forums.