Time Window Shifting

You can use Time Windows to shift times or days, to take custom calendars or public holidays into account when scheduling repetitive Jobs.

Simple Calendar Day Shifting

Assume you have a Job Definition that always runs on Fridays at a given time, unless a Friday is a holiday, in which case you want the Job Definition to run a day earlier or later. You can accomplish this by creating a Calendar Time Window that uses simple Calendar Day Shifting. This is the simplest form of Time Window shifting because it does not use Time Window elements.

To use simple Calendar Day Shifting:

  1. Create a Time Window for the Job Definition to use. On the Time Window tab:

    1. Check Is Calendar.

    2. From the If an open day is closed during dropdown list, choose the Time Window that specifies the days you do NOT want the Job Definition to run (for example, System_US_PublicHolidays).

    3. From the then shift this day dropdown list, choose Forward or Reverse.

    4. In the to the field, enter the number of days you want the Time Window to shift the Job forward or backward.

    5. From the open day in dropdown list, choose a Time Window that contains days on which the Job may execute. For example, you could choose System_Week_WorkDays.

  2. Update the Job Definition to use the Time Window you just created.

Day Shifting with Time Window Elements

You can shift the execution of a Job Definition a certain number of days forward or backward by specifying a number of days in the and shift open periods field on a Time Window element.

The shift is relative to the range of days the Time Window element is open. For example, if a Time Window element is open from the 1st to the 3rd day of a month and the shift is 1, the element will be open from 3rd until the 6th day of the month.

Paced Day Shifting

Paced day shifting lets you compensate for public holidays, or (for example) when the last day of the month falls a Sunday. In such cases, you can shift a Job a few working days forward or backward.

Paced day shifting works by comparing Time Windows.

  • The main Time Window is the one associated with the Job or Workflow Definition.

  • The shift Time Window is used to shift the execution of the Job or Workflow Definition. If a given day is open in the main Time Window, but closed in the shift time window, the execution is shifted.

  • The stride Time Window determines how many days forward or back to shift the execution.

For example, assume you want a Job Definition to run on the last day of the month as long as that day is a weekday. However, if the last day of the month is a Saturday, Sunday or public holiday, assume that you want to shift the execution of the Job Definition to the preceding workday.

To accomplish this, you could create three Calendar Time Windows:

  • The main Time Window, (let's call it TW_Main) is open on the last day of the month.

  • The shift Time Window (let's call it TW_Closed) is closed on Public Holidays.

  • The stride Time Window (let's call it TW_Weekday) should be open Monday through Friday.

If an open day in TW_Main is closed in TW_Closed, the Job is shifted to the preceding open day in TW_Weekday.

Another example: assume you have a Job or Workflow Definition that runs on the 3rd work day of every month according to the FR factory calendar in your SAP system. Create three Calendar Time Windows:

  • A Time Window that is always closed, named PR5_NEVER.

  • A PR5_FR Time Window, which is defined by the Period Function SAP_FactoryCalendar. This Time Window should have the following Parameter: calendar = PR5 FR. RunMyJobs will use that Time Window to move forward according to the factory calendar.

  • A Time Window PR5_3RD_WORKDAY with a Time Window element "on the last day of the month" and the shift condition "If an open day is closed during PR5_NEVER, then shift this day forward to the 3rd following open day in PR5_FR".

Time Shifting

Time Windows also let you shift the time that a day starts. For example, if a company schedules a Job Definition for execution at midnight, and uses a Time Window that has OffsetTimeOfDay set to 6am, the Job will actually run the following day at 6am.

Note: The start time of Jobs will be modified only if OffsetTimeOfDay is greater than the scheduled start time.

Example

This example is for the third work day according to the FR factory calendar of SAP system PR5.

  1. Navigate to Configure > Automate > Job Definitions.
  2. Run SAP_ImportCalendars for SAP System PR5 and SAP Calendar Type factory.
  3. Click Run.
  4. Navigate to Configure > Automate > Calendar tools > Time Windows.
  5. Click New .
  6. Enter PR5_Never in the Name field.
  7. Click Is Calendar and then click Save & Close. Note that since we did not specify any details about when the Time Window opens, it is always closed.
  8. Click New .
  9. Enter PR5_FR in the Name field.
  10. Click Is Calendar.
  11. On the Elements tab, click Add, then select SAP_FactoryCalendar in the Period Function dropdown list. Enter calendar = PR5 FR in the with parameters field.
  12. Click Save & Close.
  13. Click New .
  14. Enter PR5_3RD_WorkDay in the Name field.
  15. Click is Calendar.
  16. Select PR5_Never in the If an open day is closed during field.
  17. Select Forward in the then shift this day field.
  18. Enter 3 in the to the field.
  19. Select PR5_FR in the open day in field.
  20. On the Elements tab, click Add, then select last in the and from the field. Leave day of the month.
  21. Click Save & Close.