cancel
Showing results for 
Search instead for 
Did you mean: 

Read day's before or day's after daily work schedule in time evaluation of current day

Former Member
0 Kudos

Dear SAP Gurus,

My factory owner has a special requirement for OFF days, which doesn't have planned working hours and planned working time.

They want to take reference from a day before or a day after's daily work schedule, which has planned working hours and planned working time to consider employee's late coming and early going. Or say, it doesn't have to be a day before or a day after, just "nearest" daily work schedule with planned working hours and planned working time.

What should I do in PCR to fulfill such requirement?

The factory uses IT2003 since every employee has individual personnel work schedule. It has over 200 DWS to support 6000+ employees. So it's not a good idea to create every "OFF" daily work schedule with planned working hours and planned working time. 

And it's impossible to use  V_T552W dynamic daily work schedule since the factory is neither judging according to first clock-in entry nor actual working time.

Thank you very much for your kindly advice.

Best Regards,

Alina

Accepted Solutions (1)

Accepted Solutions (1)

jagan_gunja
Active Contributor
0 Kudos

This needs a functionality to loop through backward & forward through PSP or work schedule including any substitutions.  This can be done with custom operation, which can use a function (e.g., FUNCTION 'HR_PERSON_READ_WORK_SCHEDULE') in RPTIME00 to read the work schedule with option to include IT 2003).

see links below

.

http://www.sapdev.co.uk/hr/hr_workschedule.htm

Former Member
0 Kudos

Dear Jagan,

Thank you very much. I will ask my ABAP to check.

However is there any standard solution to figure this out?

Best Regards,

Alina

Answers (4)

Answers (4)

venkateshorusu
Active Contributor
0 Kudos

Use this below logic it may works.

Regards

Venkatesh

venkateshorusu
Active Contributor
0 Kudos

PCR &PDT with ACTIO function and PCR &PD1 with RTIP function.

Regards

Venkatesh

Former Member
0 Kudos

Hi Alina ,

Consider January 1st is having a shift timings  from 09:00 to 17:00

and On Jan 2nd there is a OFF day ..

Now employee does OT on Jan 2nd and also he is late on Jan 2nd .

Now do you want to calculate late coming on 2nd Jan comparing the Jan 1st shift timings ??.

Please let me know if I am correct

And also please let me know how are you maintaining the OFF days in the system .

With Regards

Aditya.T.M


Former Member
0 Kudos

Dear Aditya,

Yes, you are right. That's our case.

We use IT2003 to maintain all employee's monthly work schedule, so the OFF day is maintained under IT2003 as well.

Best Regards,

Alina

Former Member
0 Kudos

Ok Alina ,

I got your query thank you could you please confirm me one more thing

As you said all the daily work schedules are being created in IT2003 .

Please let me know what kind of custom reports are you using to fetch these details .

ABAP Reports.

Any enhancements which are being coded on  "OFF " daily workschedule .

Any PCR are written on this daily work schedule etc..

Also if you could let me know the counting rules configuration of leaves .

Kindly let me know,

With Regards

Aditya.T.M

Former Member
0 Kudos

Dear Aditya,

To answer your query one by one:

1) we have many reports to fetch these data, but all follow similar logic. I post the codes below if you are interested:

FORM frm_get_tprog USING lv_tmp-zhr_date TYPE sy-datum  CHANGING lv_tprog1 TYPE zhr_shift_num-tprog .

   DATA: lv_datbe LIKE sy-datum.

   DATA: lv_dataf LIKE sy-datum.

   DATA: lv_date LIKE sy-datum.      " current day

   DATA: lv_date1 LIKE sy-datum.     " following day

   DATA: lv_date_5 LIKE sy-datum.    " following 5 consecutive days

   DATA: lv_date_6 LIKE sy-datum.    " in advance 5 consecutive days

   DATA: gv_pernr LIKE p0001-pernr.

   DATA: gv_first_5 LIKE sy-datum,

         gv_last_1 LIKE sy-datum,

         gv_last_5 LIKE sy-datum.

   DATA: lv_tprog LIKE ptpsp-tprog,                  " daily work schedule

         lv_tprog_tmp LIKE ptpsp-tprog,              " previous day DWS

         lv_ttext LIKE zhr_time_issue-ttext,         " period work schedule

         lv_times LIKE zhr_shift_num-zhr_times,      " minimum clock-in & clock-out times

         lv_yb_flag LIKE zhr_shift_num-zhr_ybflag,   " night shift or not

         real_times(2) TYPE c,

         lv_index(2) TYPE c.

   DATA: lv_tprog_text TYPE c LENGTH 20.

   DATA: lt_2001 LIKE TABLE OF p2001 WITH HEADER LINE,

         lt_2002 LIKE TABLE OF p2002 WITH HEADER LINE,

         lt_2003 LIKE TABLE OF p2003 WITH HEADER LINE,

         lt_2007 LIKE TABLE OF p2007 WITH HEADER LINE,

         lt_0007 LIKE TABLE OF p0007 WITH HEADER LINE.

   gv_first_5 = gv_first - 5.

   gv_last_1 = gv_last + 1.

   gv_last_5 = gv_last + 5.

   lv_date_6 = lv_tmp-zhr_date - 5.

   lv_date_5 = lv_tmp-zhr_date + 5.


2) We don't have any PCRs to support this requirement, so this is what I am trying to do now.


3) employee can't take any leave on OFF day OT.If that's the case, our HR will switch daily work schedule, or cancel his or her OT.


Time evaluation in this company is very flexible.


Best Regards,

Alina

Former Member
0 Kudos

Hi Alina,

Possible option is creating DWS for OFF with shift timings and planned working hours to "0"

I have checked with DAYPG operation where you can change  the current DWS to a new one in time evaluation but as you have mentioned 200 DWS's are there then to arrive at the correct DWS will be complicated .

You have mentioned as below:

"And it's impossible to use  V_T552W dynamic daily work schedule since the factory is neither judging according to first clock-in entry nor actual working time."

But in case of OFF days you can also try dynamic assignment and calculate late coming and early going and revert the DWS to OFF and continue the OT calculation.

Or else a custom operation as suggested above

With Regards
Aditya.T.M

Sanky
Active Contributor
0 Kudos

Hi Alina,

Can you elaborate on the below paragraph.

"They want to take reference from a day before or a day after's daily work schedule, which has planned working hours and planned working time to consider employee's late coming and early going. Or say, it doesn't have to be a day before or a day after, just "nearest" daily work schedule with planned working hours and planned working time."

If employee is late or early going for current day on that time you would like to see what was previous day dws and next day dws. But after that what you want. You did not mention that.

You can explore the operation VARST.

Regards,

Sankarsan

Former Member
0 Kudos

Dear Sankarsan,

Our HR will use the reference DWS to check if the employee is late or not.

Best Regards,

Alina

Sanky
Active Contributor
0 Kudos

Late coming or Early going would be evaluating based on that day's DWS start time & End time and it's easy to compare through HRS=P or HRS=S operation. But still could not understand previous day and next day dws for this case.

Colud you please share the example on this then would be easy to understand.

Regards,

Sankarsan

Former Member
0 Kudos

Dear Sankarsan,

Aditya gives a good example so I will elaborate based on that.

Consider Jan 10th is a working day, DWS 192, planned working hours from 8:00~19:00. Jan 11th is an OFF day.

The employee is expected to OT on Jan 11th, so HR would like to take Jan 10th DWS 192 as a reference to check if the employee is late or not.

For case like Jan 2nd to Jan 4th are OFF days, and employee is expected to OT on Jan 4th, HR would like to take Jan 5th DWS 192 as a reference to check if the employee is late or not.

We have use IT2003 to overwrite IT0007's work schedule.

Since we have over 200 daily work schedule, it's impossible to create another 200+ OFF day with planned working hours schedule 😞

Best Regards,

Alina

vianshu
Active Contributor
0 Kudos

Hi Alina,

Sorry, I got lost in your query.

Can you please specify your requirement by giving an example in terms of numbers?

Regards,
Vivek Barnwal

Former Member
0 Kudos

Dear Vivek,

Sorry I forgot to mention the employee suppose to overtime on OFF days.

The detailed example in our factory goes below:

The employee should take over time on OFF days, and HR will maintain IT2007 for overtime attendance quota. If employee works longer than IT2007 quota, system will pay employee according to IT2007 quota; however if employee works less than IT2007 quota, system will pay employee according to actual time.

Somehow the management needs to know the late coming and early going of the employee. So they would like to use nearest DWS which with planned working time/hours as reference.

It's not possible to take IT2007's BEG/END as reference, since it's floating quite often, and may be separated into different slots.

Thank you again for your kindly help.

Best Regards,

Alina

vianshu
Active Contributor
0 Kudos

Hi Alina,

Late coming and early going will be for previous days. How does the client want to use that as reference?

Kindly explain with a numeric example. I am still not clear about your requirement.

Regards,
Vivek

Former Member
0 Kudos

Dear Vivek,

Because it is OFF day OT, which doesn't include late coming and early going.

However business would like to check if the employee is late or take early leave according to some standard, so they take previous day's work schedule as a reference.

The root cause is bizzar business requirement which we can't reject....

Best Regards,

Alina

vianshu
Active Contributor
0 Kudos

Hi Alina,

I have handled this requirement in the below document.

We do this by creating a constant and specifying the start time and end time for OFF days in the constant.

You may use a similar approach for your solution.

Regards,
Vivek Barnwal

vianshu
Active Contributor
0 Kudos

Hi Alina,

You can attempt to do this.

You can write a PCR Z123 to read the start time and end time for a given day if it is working day and pass it to 2 time types - ZAAA and ZABC. These are daily time types. Ensure that this PCR gets executed for working days only.

Next day, if it is not an OFF day, the same PCR gets executed. If it is an OFF, write a PCR Z124 which will read time types using HRS=LZAAA and HRS=LZABC to determine the shift start and end time of the previous day and pass it to time types ZAAA and ZABC. This PCR gets executed only for OFF days.

Now for determining late in and early out, you use the start time and end time of shift from time types HRS=LZAAA and HRS=LZABC.

I hope this helps to define your solution and will resolve your issue.

Regards,

Vivek Barnwal