Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

HR Function Module for Working Days

Former Member
0 Kudos

Hi gurus,

Plz help me with a function module to calculate working days for an employee within a given date range.

4 REPLIES 4

milusai
Participant
0 Kudos

use FM hr_hk_diff_bt_2_dates ( date1 must be greater than date2)

Former Member
0 Kudos

HI,

Refer to the link.

Regards

Sumit Agarwal

Former Member
0 Kudos

Hi Sudipa,

Try the FM DATE_CHECK_WORKINGDAY.

Check this one for sample:

Regards,

Chandra Sekhar

saravanakumar_mac
Participant
0 Kudos

****Calender Days

     CALL FUNCTION 'HR_AUPBS_MONTH_DAY'

       EXPORTING

         BEG_DA     = PN-BEGDA

         END_DA     = PN-ENDDA

       IMPORTING

*       NO_DAY     =

*       NO_MONTH   =

*       NO_YEAR    =

         NO_CAL_DAY = LV_NO_DAYS.

******Calender Days

     LS_OUTPUT-KDAYS = LV_NO_DAYS.

******Payroll Days

     LV_COUNT = 0.

     DO LV_NO_DAYS TIMES.

       LV_DATE = PN-BEGDA + LV_COUNT.

       LV_COUNT = LV_COUNT + 1.

       CALL FUNCTION 'CATT_PERSONAL_WORKING_TIMES'

         EXPORTING

           PERNR         = PERNR-PERNR

           DATE          = LV_DATE

         IMPORTING

           R550A         = LS_R550A

         EXCEPTIONS

           ERROR_OCCURED = 1

           OTHERS        = 2.

       IF SY-SUBRC <> 0.

* Implement suitable error handling here

       ENDIF.

       IF LS_R550A-TPROG NE 'OFF'.

******Payroll Days

         LS_OUTPUT-PDAYS =   LS_OUTPUT-PDAYS + 1.

       ENDIF.

     ENDDO.