01-13-2009 4:28 PM
I have to develop a custom report which will display cost center for a person along with his name. In our company the cost center is assigned to a position not to a person. Can some one send me a sample code how to get cost center related to a position. Also I wanted to display name of the person to whom that employee reports.
01-13-2009 5:13 PM
Hi,
you can try this ..
Use the FM RH_READ_INFTY_1001 , RH_GET_LEADER
Function module RH_READ_INFTY_1001
Import parameters Value
AUTHORITY DISP
PLVAR 01
OTYPE S
OBJID 50004867
ISTAT 1
BEGDA 01-01-1900
ENDDA 12-31-9999
Tables Value
I1001 0 Entries
Result: 4 Entries
OBJECTS 0 Entries
Result: 1 Entry
Next Delete the entriees from IT_1001 where sclas NE 'K' .
use the FM RH_GET_LEADER to read thel leader for correspomging Position
01-13-2009 4:53 PM
Hi,
IT1001 stores Cost Center value for position under relationship A-011. You can write query similar to below.
SELECT sobid
FROM hrp1001
INTO v_cost_ctr
WHERE otype = 'S' AND
objid = v_position AND
rsign = 'A' AND
relat = u2018'011' AND
begda <= sy-datum AND
endda >= sy-datum.
EXIT.
ENDSELECT.
IF lv_cost_ctr IS NOT INITIAL.
v_costctr = v_cost_ctr+0(10).
endif.
If you need Cost Center description, you can write select statement for DB table CSKT to get Cost Center text.
To look for supervisor, get the position of employee, than for this position get A-002 (Reports to Position) from IT1001 and for that position get A-008 (Holder) PERNR from IT1001. This PERNR is person to whom employee reports to.
Regards,
Nisarg
Edited by: Nisarg Joshi on Jan 13, 2009 6:02 PM
01-13-2009 5:13 PM
Hi,
you can try this ..
Use the FM RH_READ_INFTY_1001 , RH_GET_LEADER
Function module RH_READ_INFTY_1001
Import parameters Value
AUTHORITY DISP
PLVAR 01
OTYPE S
OBJID 50004867
ISTAT 1
BEGDA 01-01-1900
ENDDA 12-31-9999
Tables Value
I1001 0 Entries
Result: 4 Entries
OBJECTS 0 Entries
Result: 1 Entry
Next Delete the entriees from IT_1001 where sclas NE 'K' .
use the FM RH_GET_LEADER to read thel leader for correspomging Position