Introduction


The idea of this knowledge artifact came from a question posted by another consultant in SAP Community Network (SCN). She wanted the system to dynamically determine 2nd Saturday of every month and make it half day working. Rest of the Saturdays will remain full day working.

Solution Design


Let me first show you the DWS, PWS and WSR of the normal WSR to which the employee will be assigned to.


V_T550A


DWS


/wp-content/uploads/2014/07/1_506604.jpg

As you can see from the above DWS, the working hours for the day are 8.75 hours.


Below is the DWS created for half day shift.

/wp-content/uploads/2014/07/2_506605.jpg

We also need a DWS called OFF for the off day.

/wp-content/uploads/2014/07/3_506609.jpg

V_T551A


Let me show you the PWS created for the given WSR.


/wp-content/uploads/2014/07/4_506610.jpg

You can see from above screenshot that Saturday is full day working.

V_T508A


/wp-content/uploads/2014/07/5_506611.jpg

The above WSR is getting generated from 02-Aug-2010 which is a Monday.


Let us define a PCR to achieve this solution. 2nd Saturday is always going to occur between 08th and 14th of the month. Below is the PCR configured for this solution.



TCODE PE02

/wp-content/uploads/2014/07/5_506611.jpg

PCR ZT01 checks using VARSTREDAY if the date is 08, 09, 10, 11, 12, 13, 14 or any other date. If it is any other date, it gets processed under **. If the date is 08, 09, 10, 11, 12, 13 or 14, PCR checks for 2nd Saturday using VARSTWEDAY. If the weekday is anything other Saturday, it gets processed under *. If the weekday is Saturday, it replaces the existing DWS D001 with DWS D002 using DAYPGD002.


Let us place this PCR in custom positive time schema ZT01 before function P2011. The custom time schema is a copy of standard positive time schema TM00.



TCode PE01

/wp-content/uploads/2014/07/9_507090.jpg

I would recommend to replace the full day DWS with half day DWS before function P2011 so that function P2011 processes as per the half day DWS.


Let us now proceed to solution testing.

Solution Design


Let us first go through IT0007 and the generated DWS. The employee has been assigned to WSR D0001-01 from 01-Aug-2013.

IT0007

/wp-content/uploads/2014/07/10_506616.jpg

Work Schedule

/wp-content/uploads/2014/07/11_506617.jpg

The work schedule shows that on 2nd Saturday, 10-Aug-13, the DWS is D001. This should get replaced by DWS D002 dynamically in time evaluation on 10-Aug-13.

Let us run time evaluation using PT60 till 10-Aug-13.

PT60

/wp-content/uploads/2014/07/12_506618.jpg

The time evaluation gets successfully processed for 10 days.


/wp-content/uploads/2014/07/13_506619.jpg


Let us go through the processing of PCR ZT01 for 10-Aug-13 which is 2nd Saturday of the month.


/wp-content/uploads/2014/07/18_507091.jpg


As per the above PCR processing, the DWS D001 is getting replaced by DWS D002 on 2nd Saturday, 10-Aug-13.

Let us now see the processing of function P2011.


P2011

/wp-content/uploads/2014/07/19_506625.jpg



As you can see in the screenshot above, DWS D002 has replaced DWS D001 and the employee has to work only 4 hours on 10-Aug-2013, 2nd Saturday of the month. Also, the Table TZP has got created as per DWS D002.


So here is the solution of Second Saturday as Half Day Working configured dynamically and I come to the end of this knowledge artifact. Thank you for your patience to go through this document. I hope this has been useful for you.


Thanks and regards,

Vivek Barnwal.


If you are interested in other knowledge artifacts by me, please refer the below link:


One Stop Shop of my Knowledge Artifacts in SAP HCM



To report this post you need to login first.

27 Comments

You must be Logged on to comment or reply to a post.

  1. rakesh k m

    Hi Vivek,

    Very Nice document on the Second Saturday as the Half day.

    Could you please let me know how it works if the employee joins in the middle of the month.

    Ex: Suppose the employee joins on July 8th 2014. As per the PCR ZT01 the Time type ZT01 value will become 2 on 18th july. so the PCR ZT02 will default half day DWS for July 19th which is incorrect as it is 3rd saturday of the month.

    Please advice if my understanding is correct.

    Regards

    Rakesh KM

    (0) 
    1. Vivek Barnwal Post author

      Thanks Rakesh for pointing this out.

      I never thought of this scenario. This is a defect in my logic. I will rework on this to include the hiring logic too.

      Regards,

      Vivek

      (0) 
    2. Vivek Barnwal Post author

      Hi Rakesh,

      I have completely modified the solution design for this requirement and has made the logic simpler. Now, this solution will work for all scenarios even for your hiring scenario.

      Thanks once again for your valuable feedback which helped me to plug this defect.

      Regards,

      Vivek Barnwal

      (0) 
  2. Rajasekhar Reddy

    Hi,

    Good document 🙂 .

    Time Evaluation can run upto current day -1 as per SAP standard. Work schedule will update only after running the time evaluation.

    What if employee wants apply leave for second Saturday of Sepetember month 13-09-2014  on Aug 4th that is today.

    Unless we run the time evaluation for the future period i,e 13-09-2014.half day work schedule will not be generated for that day.

    How the SAP standard will work in this scenario?

    Regards,

    Raja Sekhar

    (0) 
    1. Vivek Barnwal Post author

      Hi Rajasekhar,

      Operation DAYPG doesn’t replace the DWS in Table T552A where the generated DWS are stored.

      It only invokes the replacement DWS in run time for the given date.

      Regarding application of leave on 2nd saturday in advance or at any time, employee should be asked to apply for half day leave on 2nd saturday.

      Thanks and regards,

      Vivek

      (0) 
      1. Rajasekhar Reddy

        Hi,

        Suppose employee wants to take leave from 10-09-2014 to 15-09-2014. Now he should apply leave from 10-09-2014 to 12-09-2014 and again separate leave 13-09-2014(Which is second Saturday) and again from 14 to 15-09-2014. Total three times employee have to create a leave record. Wouldnt it be a time consuming process ???

        Regards,

        Raja Sekhar

        (0) 
        1. Vivek Barnwal Post author

          Yes, it will be a time consuming process. A better option is to do a customization to enable system to determine 2nd Saturday while applying leave and for that day, the counting rule should count 50% for leave.

          Such things happen when client wants automation in standard for every possible scenario but there will be some or other limitations.

          Regards,

          Vivek Barnwal

          (0) 
        2. Vivek Barnwal Post author

          We can do one more thing.

          For every 2nd Saturday, if leave is applied for full day, we give 0.5 days quota back to employee for the extra quota that gets deducted. This can be achieved in PCRs.

          Thanks and regards,

          Vivek Barnwal

          (0) 
            1. Harish Krishnan

              A user exit EXIT_SAPLPTWS_001 can also be used to perform the necessary calculations and generate the Work Schedule accordingly. This will ensure that it will work not only for Time Evaluation but also for Leave Processing.

              It is Programming vs Configuration, but I would say the programming effort is not huge to achieve the desired outcome.

              (0) 
  3. Jagan Gunja

    Vivek,

    This solution would work for time eval. However you may need to verify the output from  payroll functions GENPS & PARTT for TSOLL, etc. which depend on IT 7 & 2003.

    (0) 
    1. Vivek Barnwal Post author

      Yes…it will work from time evaluation perspective. And I agree with you about checking the output with regards to payroll functions.

      Regards,

      Vivek Barnwal

      (0) 
        1. Vivek Barnwal Post author

          You can do the following:

          Create public holidays with public holiday class 3 for such dates. Write a variant for the DWS that whenever public holiday class 3 occurs, it should called the variant DWS. And you can define this variant DWS as you wish it to be.

          Regards,

          Vivek

          (0) 
  4. Rajasekhar Reddy

    T-code PT_SHF00  is used for Work schedule generation . There is SAP Standard user exit available to override the workschedule

    User Exit :- PTIM2007 (Generate Monthly Work Schedule)”

    FM:- EXIT_SAPLPTWS_001

    Include:- ZXP01U03


    This helps you to generate the work schedule for whole year .


    Regards,

    Raja Sekhar


    (0) 
      1. Bhagyashree Naik

        Once again a nice Document by you Vivek Sir….I really admire your simplicity in writing…the explanation is very easy to understand in all your documents.

        Regards,

        Bhagyashree

        (0) 
    1. Vivek Barnwal Post author

      Hi Shiva,

      1st Saturday can fall only between 1st of the month and 7th of the month because there are 7 days in a week. Hence, 2nd Saturday can fall only between 8th of the month and 14th of the month.

      Regards,

      Vivek

      (0) 

Leave a Reply