2006 May 30 12:39 PM
Hi Frenz..
Is there any FM for getting the leave details from infotypes 2001 and 2006. i.e., it should provide the details of leave taken, entitled, balance etc.?
Regards,
Rajeev
2006 May 30 12:40 PM
Hi rajeev,
1. <b>HR_DK_GET_LEAVE_ENTITLEMENT</b>
(This FM is simpler)
2. HR_GET_LEAVE_DATA
regards,
amit m.
2006 May 30 12:40 PM
Hi rajeev,
1. <b>HR_DK_GET_LEAVE_ENTITLEMENT</b>
(This FM is simpler)
2. HR_GET_LEAVE_DATA
regards,
amit m.
2006 May 30 12:44 PM
hi rajeev,
check the fm
HR_GET_LEAVE_DATA.
hope this helps,
do reward if it helps,
priya.
2006 May 30 12:46 PM
Hi,
to get the leave details,
use FM 'HR_GET_LEAVE_DATA'. It gets all leave information (includes leave entitlement, used holidays/paid out holidays)
Regards,
Aswin
2006 May 30 12:58 PM
HR_GET_LEAVE_DATA
HR_DK_GET_LEAVE_ENTITLEMENT
and my func mod:
FUNCTION Z_EMP_LEAVE_HISTORY.
*"----
""Local interface:
*" IMPORTING
*" VALUE(PERNR) LIKE PERNR-PERNR
*" VALUE(ST_DATE) LIKE SY-DATUM
*" VALUE(END_DATE) LIKE SY-DATUM
*" TABLES
*" TIME_DATA STRUCTURE ZHRTIMEHIST
*"----
DATA : INT_2001 LIKE P2001 OCCURS 0 WITH HEADER LINE,
INT_2002 LIKE P2002 OCCURS 0 WITH HEADER LINE.
DATA: WF_OT_HOURS TYPE ABRST.
DATA: WF_NEW_PERIOD(6) TYPE C, WF_LAST_PERIOD(6) TYPE C.
DATA: WC_ROW_COUNT TYPE I, WF_L_DAYS TYPE F.
DATA: WF_NUM_DAYS TYPE I.
DATA: WF_ST_DATE LIKE SY-DATUM, WF_E_DATE LIKE SY-DATUM.
DATA: WF_NO_YEARS TYPE P0000_AF-NOYRS,
WF_NO_MONTHS TYPE P0000_AF-NOMNS.
READ REGULAR WORKING HOURS AND OVERTIME DATA
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
TCLAS = 'A'
pernr = PERNR
infty = '2001'
BEGDA = ST_DATE
ENDDA = END_DATE
TABLES
infty_tab = INT_2001
EXCEPTIONS
INFTY_NOT_FOUND = 1
OTHERS = 2.
CALCULATE REGULAR AND LEAVE FIGURES
WF_L_DAYS = 0.
WC_ROW_COUNT = 1.
CLEAR TIME_DATA.
LOOP AT INT_2001 WHERE SUBTY = 'L'.
WF_NEW_PERIOD = INT_2001-BEGDA(6).
IF WF_NEW_PERIOD EQ WF_LAST_PERIOD OR WC_ROW_COUNT EQ 1.
ADD INT_2001-ABWTG TO WF_L_DAYS.
ELSE.
CONCATENATE WF_LAST_PERIOD '01' INTO WF_ST_DATE.
TIME_DATA-START_DATE = WF_ST_DATE.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = WF_ST_DATE
IMPORTING
LAST_DAY_OF_MONTH = WF_E_DATE
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2
.
WF_NUM_DAYS = WF_E_DATE+6(2).
TIME_DATA-REGULAR_TIME = ( WF_NUM_DAYS - WF_L_DAYS ) * 8.
TIME_DATA-LEAVE_DAYS = WF_L_DAYS.
APPEND TIME_DATA.
CLEAR TIME_DATA.
WF_L_DAYS = INT_2001-ABWTG.
ENDIF.
WF_LAST_PERIOD = WF_NEW_PERIOD.
ADD 1 TO WC_ROW_COUNT.
ENDLOOP.
IF WC_ROW_COUNT GT 1.
CONCATENATE WF_LAST_PERIOD '01' INTO WF_ST_DATE.
TIME_DATA-START_DATE = WF_ST_DATE.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = WF_ST_DATE
IMPORTING
LAST_DAY_OF_MONTH = WF_E_DATE
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2
.
WF_NUM_DAYS = WF_E_DATE+6(2).
TIME_DATA-REGULAR_TIME = ( WF_NUM_DAYS - WF_L_DAYS ) * 8.
TIME_DATA-LEAVE_DAYS = WF_L_DAYS.
APPEND TIME_DATA.
CLEAR TIME_DATA.
ENDIF.
READ LEAVE DATA
CALL FUNCTION 'HR_READ_INFOTYPE'
EXPORTING
TCLAS = 'A'
pernr = PERNR
infty = '2002'
BEGDA = ST_DATE
ENDDA = END_DATE
TABLES
infty_tab = INT_2002
EXCEPTIONS
INFTY_NOT_FOUND = 1
OTHERS = 2.
CALCULATE MONTHLY OVERTIME FIGURES
WF_OT_HOURS = 0.
WC_ROW_COUNT = 1.
CLEAR TIME_DATA.
LOOP AT INT_2002 WHERE SUBTY = 'OT'.
WF_NEW_PERIOD = INT_2002-BEGDA(6).
IF WF_NEW_PERIOD EQ WF_LAST_PERIOD OR WC_ROW_COUNT EQ 1.
WF_OT_HOURS = WF_OT_HOURS + INT_2002-STDAZ.
ELSE.
CONCATENATE WF_LAST_PERIOD '01' INTO WF_ST_DATE.
TIME_DATA-START_DATE = WF_ST_DATE.
TIME_DATA-OVER_TIME = WF_OT_HOURS.
READ TABLE TIME_DATA WITH KEY START_DATE = WF_ST_DATE.
IF SY-SUBRC EQ 0.
MODIFY TABLE TIME_DATA.
ELSE.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = WF_ST_DATE
IMPORTING
LAST_DAY_OF_MONTH = WF_E_DATE
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2
.
WF_NUM_DAYS = WF_E_DATE+6(2).
TIME_DATA-REGULAR_TIME = WF_NUM_DAYS * 8.
APPEND TIME_DATA.
ENDIF.
WF_OT_HOURS = INT_2002-STDAZ.
ENDIF.
WF_LAST_PERIOD = WF_NEW_PERIOD.
ADD 1 TO WC_ROW_COUNT.
ENDLOOP.
IF WC_ROW_COUNT GT 1.
CONCATENATE WF_LAST_PERIOD '01' INTO WF_ST_DATE.
TIME_DATA-START_DATE = WF_ST_DATE.
READ TABLE TIME_DATA WITH KEY START_DATE = WF_ST_DATE.
TIME_DATA-OVER_TIME = WF_OT_HOURS.
IF SY-SUBRC EQ 0.
MODIFY TABLE TIME_DATA .
ELSE.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = WF_ST_DATE
IMPORTING
LAST_DAY_OF_MONTH = WF_E_DATE
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2
.
WF_NUM_DAYS = WF_E_DATE+6(2).
TIME_DATA-REGULAR_TIME = WF_NUM_DAYS * 8.
APPEND TIME_DATA.
ENDIF.
ENDIF.
CLEAR INTERNAL TABLES
REFRESH INT_2001.
REFRESH INT_2002.
FIND NUMBER OF MONTHS BETWEEN THE START AND END DAYS
CALL FUNCTION 'HR_CALC_YEAR_MONTH_DAY'
EXPORTING
BEGDA = ST_DATE
ENDDA = END_DATE
IMPORTING
YEARS_OUT = WF_NO_YEARS
MONTHS_OUT = WF_NO_MONTHS
DAYS_OUT =
.
WF_NUM_DAYS = 12 * WF_NO_YEARS + WF_NO_MONTHS + 1.
FIND REGULAR HOURS FOR MONTHS WHERE NO OT OR LEAVE RECORS EXIST
CLEAR TIME_DATA.
DO WF_NUM_DAYS TIMES.
CONCATENATE ST_DATE(6) '01' INTO WF_ST_DATE.
READ TABLE TIME_DATA WITH KEY START_DATE = WF_ST_DATE.
IF SY-SUBRC NE 0.
CALL FUNCTION 'RP_LAST_DAY_OF_MONTHS'
EXPORTING
DAY_IN = WF_ST_DATE
IMPORTING
LAST_DAY_OF_MONTH = WF_E_DATE.
EXCEPTIONS
DAY_IN_NO_DATE = 1
OTHERS = 2.
WF_NUM_DAYS = WF_E_DATE+6(2).
TIME_DATA-REGULAR_TIME = WF_NUM_DAYS * 8.
TIME_DATA-START_DATE = WF_ST_DATE.
APPEND TIME_DATA.
ENDIF.
ADD WF_NUM_DAYS TO ST_DATE.
CLEAR TIME_DATA.
ENDDO.
SORT TIME_DATA.
ENDFUNCTION.
Plz reward points and close the thread..
gunjan
2006 May 30 1:12 PM
2006 May 30 1:34 PM
Hi Rajeev,
Use FM HR_GET_QUOTA_DATA in this function module table
ABWKO contains the data you require.
Regards,
Bharat Mistry.