2009 Sep 08 1:01 PM
Hi,
I want to calculate the service as on date.
Employee No Employee Name Date of joining Service as on date
1000 XXXXXXX 01.06.2004 5 Years 3 months
2000 yyyyyyyyyyyyy 01.08.2008 1 year 1 month
Is there any function module.
can you help me.
Regards,
K.Karthikeyan.
Edited by: Karthikeyan Krishnan on Sep 8, 2009 5:31 PM
2009 Sep 08 1:12 PM
In your case just pass the employee join date and current date.
I think this is what you want
data:wa_output type PSEN_DURATION_DEC.
CALL FUNCTION 'HR_SEN_CRULE_0100_DURATION'
EXPORTING
id_begda = dat1 "service join data
id_endda = sy-datum "current date
IMPORTING
ES_DURATION = wa_output
EXCEPTIONS
CONVERSION_NOT_SPECIFIED = 1
CONVERSION_NOT_POSSIBLE = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
write:/ 'Years', wa_output-CALYY DECIMALS 0,
/ 'Months',wa_output-CALMM DECIMALS 0,
/'Days', wa_output-CALDD DECIMALS 0.
ENDIF.
Edited by: Keshu Thekkillam on Sep 8, 2009 5:42 PM
2009 Sep 08 1:10 PM
Hi,
Use FM : FIMA_DAYS_AND_MONTHS_AND_YEARS
Example:
I_DATE_FROM 01.06.2004
I_DATE_TO 08.09.2009
I_FLG_SEPARATE X
Export parameters Value
E_DAYS 7
E_MONTHS 3
E_YEARS 5
Regds,
Anil
2009 Sep 08 1:12 PM
In your case just pass the employee join date and current date.
I think this is what you want
data:wa_output type PSEN_DURATION_DEC.
CALL FUNCTION 'HR_SEN_CRULE_0100_DURATION'
EXPORTING
id_begda = dat1 "service join data
id_endda = sy-datum "current date
IMPORTING
ES_DURATION = wa_output
EXCEPTIONS
CONVERSION_NOT_SPECIFIED = 1
CONVERSION_NOT_POSSIBLE = 2
OTHERS = 3
.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
else.
write:/ 'Years', wa_output-CALYY DECIMALS 0,
/ 'Months',wa_output-CALMM DECIMALS 0,
/'Days', wa_output-CALDD DECIMALS 0.
ENDIF.
Edited by: Keshu Thekkillam on Sep 8, 2009 5:42 PM
2009 Sep 08 1:20 PM
Hi Karthikayan,
use this FM.
HR_99S_INTERVAL_BETWEEN_DATES
I hope this will help you.
Regards,
Vijay
2009 Sep 08 1:27 PM
CALL FUNCTION 'HR_SGPBS_YRS_MTHS_DAYS'
EXPORTING
beg_da = wa_mara_month-mstde
end_da = wa_mara_month-ersda
IMPORTING
no_cal_day = l_days
EXCEPTIONS
dateint_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.