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: 

Work Schedule Time ( Planned work time ) problem HR ABAP

kapil_thuthuku
Explorer
0 Kudos

Hi Everyone,

         I want to get the Work Schedule and Work Schedule time of an employee for a particular date whose holiday type is 9 and day type is 1 i.e., even for the holidays I should pick up the data.  The following FM's HR_PERSONAL_WORK_SCHEDULEHR_WORK_SCHEDULE_TIMES are only fetching for non-holiday class. Is there any other way to fetch the Planned work time please suggest me.

1 ACCEPTED SOLUTION

kapil_thuthuku
Explorer
0 Kudos

Thanks Everyone got the solution...

Here is the solution

Need to check if there is any holiday using FM HOLIDAY_CHECK_AND_GET_INFO.


If there is holiday on a particular date pass that date to FM HR_DWS_RE550 and get the work schedule for that holiday date.


If there is no holiday then the work schedule time that is obtained through FM HR_WORK_SCHEDULE_TIMES is correct.

5 REPLIES 5

Former Member
0 Kudos

Hi Kapil,

Can I know how you are fetching the data from the above function modules? Can u specify the steps followed?

Thanks.

Seshadri.

0 Kudos

Hi Rajendra Nath,

           These are the steps I followed

I declared all the Infotypes and called below Function Modules:

call function 'HR_PERSONAL_WORK_SCHEDULE'

     exporting

       pernr             = pernr-pernr

       begda             = pn-begda

       endda             = pn-endda

*     KUG               =

*     REFRESH           = 'X'

*     WORKING_HOURS     = 'X'

       switch_activ      = switch_active

       i0001_i0007_error = '0'

*     read_cluster      = rdclust

*    IMPORTING

*     WARNING_OCCURED   =

     tables

       i0000             = p0000

       i0001             = p0001

       i0002             = p0002

       i0007             = p0007

*     I0049             =

       i2001             = p2001

       i2002             = p2002

       i2003             = p2003

       perws             = psp

     exceptions

       error_occured     = 1

       abort_occured     = 2

       others            = 3.

   if sy-subrc <> 0.

     call function 'HR_DISPLAY_ERROR_LIST'

       exporting

         no_popup         = ' '

         no_print         = 'X'

         no_img           = ' '

       exceptions

         invalid_linesize = 1

         others           = 2.

     if sy-subrc <> 0.

     endif.

     reject.

   endif.

   call function 'HR_WORK_SCHEDULE_TIMES'

     exporting

       pernr         = pernr-pernr

       begda         = pn-begda

       endda         = pn-endda

*     KUG           = ' '

*     BREAK_OVERTIME          = '1'

*     REFRESH_INFOTYPE_BUFFER = 'X'

*    IMPORTING

*     WARNING_OCCURED         =

     tables

       i0001         = p0001

       i0007         = p0007

       i2003         = p2003

*     I0049         =

       perws         = psp

       daygen        = daygen

       dayint        = dayint

     exceptions

       error_occured = 1

       perws_error   = 2

       others        = 3.

   if sy-subrc <> 0.

     call function 'HR_DISPLAY_ERROR_LIST'

       exporting

         no_popup         = ' '

         no_print         = 'X'

         no_img           = ' '

       exceptions

         invalid_linesize = 1

         others           = 2.

     if sy-subrc <> 0.

     endif.

     reject.

   endif.

DAYINT Function Module will give the Planned working times.

Also there is another FM HR_DWS_RE550 which will give the planned working times based on daily work schedule variant. But the problem is how to find link between PERNR and VARIANT for that particular day. There will be two work schedules for a day i.e., a normal working day is categorised as off-day with variants as space and '9'. Then which record should we consider.

In the above FM HR_PERSONAL_WORK_SCHEDULE the parameter PSP gives the Work Schedule. But for the above case mentioned it is just getting normal work schedule instead of Off-Day work Schedule.

Hope I am clear.

0 Kudos

Hi,

Hope you are providing the infotype data w.r.t pernr  0000,0001,0002,0007 for the above FM HR_PERSONAL_WORK_SCHEDULE

CALL FUNCTION 'HR_PERSONAL_WORK_SCHEDULE'  "Get Work Schedule

           EXPORTING

             pernr             = gs_upload-pernr

             begda             = date1

             endda             = date1

             refresh           = 'X'

             working_hours     = 'X'

             modify_entries    = 'X'

             i0001_i0007_error = '0'

           TABLES

             i0000             = t_p0000

             i0001             = t_p0001

             i0002             = t_p0002

             i0007             = t_p0007

             perws             = t_perws

           EXCEPTIONS

             error_occured     = 1

             abort_occured     = 2

             OTHERS            = 3.

         IF sy-subrc <> 0.

* Implement suitable error handling here

         ENDIF.

         READ TABLE t_perws INTO s_perws INDEX 1.

         SELECT SINGLE * FROM t550a INTO gs_t550a WHERE

         motpr = s_perws-motpr AND tprog = s_perws-tprog.


Where TPROG indicates the WDS and  gs_t550a-sobeg &  gs_t550a-soend indicates the Planned working times.


Try these and let me know if it is useful or not.


Thanks,

Seshadri.

Former Member
0 Kudos

Kapil,

Please go through following code

*& Declaration :

data :it_day           type table of pwsdaygen,  "Shift Details

      it_tim           type table of pwsdayint,  "Shift Timings

      it_ptpsp         type table of ptpsp    .

  refresh: it_day,it_tim,it_ptpsp.

*Function Module for Work Schedules

  call function 'HR_PERSONAL_WORK_SCHEDULE'

    exporting

      pernr         = pernr

      begda         = begda

      endda         = endda

    tables

      perws         = it_ptpsp

   exceptions

      error_occured = 1

      abort_occured = 2

      others        = 3.

*Function Module for Work Schedules Timings

  call function 'HR_WORK_SCHEDULE_TIMES'

    exporting

      pernr         = pernr

      begda         = begda

      endda         = endda

    tables

      perws         = it_ptpsp

      daygen        = it_day

      dayint        = it_tim

    exceptions

      error_occured = 1

      perws_error   = 2

      others        = 3.

kapil_thuthuku
Explorer
0 Kudos

Thanks Everyone got the solution...

Here is the solution

Need to check if there is any holiday using FM HOLIDAY_CHECK_AND_GET_INFO.


If there is holiday on a particular date pass that date to FM HR_DWS_RE550 and get the work schedule for that holiday date.


If there is no holiday then the work schedule time that is obtained through FM HR_WORK_SCHEDULE_TIMES is correct.