2007 Dec 19 11:41 AM
hi
Iam very new to abap hr and om module in hr.
I have a query.My requirement is that i need to get the manager for the employees in the organisation.
Also i need to get the manager last name,first name from pa0002 through nachn,vorna .There is a relationship mentioned for this field in the mapping. Relationship A012 to employee's organisation unit.Using the above information how can i get the manager information for a person in the organisation?Can anyone help me out in this regard?
hi
Iam very new to abap hr and om module in hr.
I have a query.My requirement is that i need to get the manager for the employees in the organisation.
Also i need to get the manager last name,first name from pa0002 through nachn,vorna .There is a relationship mentioned for this field in the mapping. Relationship A012 to employee's organisation unit.Using the above information how can i get the manager information for a person in the organisation?Can anyone help me out in this regard?
2007 Dec 19 12:40 PM
>FUNCTION zhr_get_manager.
>*"----
>""Local Interface:
>*" IMPORTING
>*" VALUE(FI_PLANS) TYPE PLANS OPTIONAL
>*" EXPORTING
>*" VALUE(FE_NACHN) TYPE NACHN
>*" VALUE(FE_VORNA) TYPE VORNA
>*" VALUE(FE_PERNR) TYPE PERSNO
>*" EXCEPTIONS
>*" NO_REPORT_TO
>*" NO_POSITION_HOLDER
>*" NO_NAME_FOUND
>*"----
> DATA : lv_sobid LIKE hrp1001-sobid,
> lv_pernr LIKE hrp1001-sobid.
>
>
> 1) Get report-to position.
> SELECT SINGLE sobid FROM hrp1001 INTO lv_sobid WHERE
> otype EQ 'S' AND
> objid EQ fi_plans AND
> plvar EQ '01' AND
> relat EQ '002' AND
> rsign EQ 'A' AND
> sclas EQ 'S' AND
> begda LE sy-datum AND
> endda GE sy-datum.
> IF sy-subrc NE 0.
> RAISE no_report_to.
> ENDIF.
>
>* 2) Get position holder (Manager ID)
> SELECT SINGLE sobid FROM hrp1001 INTO lv_pernr WHERE
> otype EQ 'S' AND
> objid EQ lv_sobid AND
> plvar EQ '01' AND
> relat EQ '008' AND
> rsign EQ 'A' AND
> sclas EQ 'P' AND
> begda LE sy-datum AND
> endda GE sy-datum.
> IF sy-subrc NE 0.
> RAISE no_position_holder.
> ENDIF.
>
>fe_pernr = lv_pernr.
>
>* 3) Get Manager First Name and Last Name.
> SELECT SINGLE vorna nachn FROM pa0002 INTO (fe_vorna, fe_nachn) WHERE
> pernr EQ fe_pernr AND
> begda LE sy-datum AND
> endda GE sy-datum.
> IF sy-subrc NE 0.
> RAISE no_name_found.
> ENDIF.
>
>ENDFUNCTION.
There are other standard functions which you can use as well.
>RH_GET_MANAGER_ASSIGNMENT
2007 Dec 19 1:15 PM
Thanks a lot.But i have a doubt. why is the relationship A-012 is mentioned? Any ways we are getting the manager by position to position(002) and position to person relationship.
2007 Dec 19 2:02 PM
Here are the steps to get the manager.
1. First step is to get the Reports to Relationship via A0002. This will give you the position number of the Manager whom the employee reports to.
2. After you have the position of the manager you need to get the holder of the position with realtionship type A0008. Which will give you the personnel number of the manager.
3. After you have personnel number of the manager you need to get his name from the IT0002.
If you still have doubts let me know.
Never used A012 relationship type. ? Better would be to ask your functional expert about this,
Aman
2007 Dec 19 2:29 PM
Thanks a lot. I understood your program and the steps you explained clarified the doubts I have.I need to get the number of successors for each position in the organization. It is to be retrieved from the table HRP5139 with object_status=5. How do i do it?
2007 Dec 19 2:33 PM
2007 Dec 19 2:36 PM
Yes i think you will be able to view this table in ECC 6.0
We are working with ECC 6.0.Any ways thanks a lot.