Calendars for January 1, 2, and 3 2016 are not working

Document ID : KB000084526
Last Modified Date : 14/04/2018
Show Technical Document Details
Issue:
Error Message :
N/A

A weekly calendar fails to select days either in the FIRST week of a year or in the LAST week of a year.  As a result conditions are evaluated incorrectly on references to those calendars. For example, a task does not run although it is scheduled weekly.
 

 
 
Cause:
Cause type:
Defect
Root Cause: The calendar definition allows to specify the week range for weekly calendar keywords. The full year only was taken if the range was set from 1 to 53.  For all other definitions (e.g. 1 to 54) days were considered according to the FIRST_WEEK_METHOD.
Resolution:
Update to a fix version listed below or a newer version if available.
 
However, applying the appropriate service pack does not initiate recalculation of calendars. Customers might have calendars being affected in their systems which need to be recalculated.  Usually on new year change all dynamic calendars are recalculated automatically. If customer would like to proactively recalculate weekly calendars they need to:
1) Apply the appropriate release (see above)
2) Find out all dynamic calendars with keyword type weekly use following SQL
select oh_client, oh_name, okb_name from oh, okb
where oh_idnr = okb_oh_idnr
and OKB_CType = 'W'
and oh_otype = 'CALE'
and oh_deleteflag = 0
order by oh_client
3) Edit the calendars set the week range in the weekly keyword definition to 154
4) Save calendar(s) – saving the calendar triggers new calculation.
 
 


Fix Status: Released

Fix Version(s):
Component(s): AE Server and Intialdata

Automation Engine 12.0.0 - Available
Automation Engine 11.2.1 - Available
Automation Engine 11.1.3 - Available
Automation Engine 10.0.8 - Available
Additional Information:
Workaround :
Here is the recommended workaround:
  1. For each calendar with a weekly keyword that has Friday, Saturday, or Sunday selected, edit the object.
  2. Right-click the affected weekly keyword(s) and go to "Calendar Definition".
  3. Change "starting with week" from 1 to 0. OR Change "ending with week" from 54 to 53
  4. Save the calendar.
You should immediately see the correct day(s) show up in the calendar.
 
These same steps need to be taken for all Weekly keywords.

The following SQL statement can be used to identify all keywords affected by this. This will return the client where a calendar resides that will have this issue as well as the calendar object name (calendar_name), and the keyword (calendar_keyword):

 
select OH_Client, OH_Name as "calendar_name", okb_name as "keyword_name" from OH, OKB
where OH_DeleteFlag = 0 and OH_Idnr = OKB_OH_Idnr and OKB_CType = 'W' and OKB_PeriodStart = 1 and OKB_PeriodEnd = 54

The following SQL statement can be used to identify all JOBP, JSCH, EVNT and C_PERIOD objects that could have been affected:

select distinct OH_Name, OH_client from OH
where (OH_Idnr in (select OH_Idnr from OH where OH_Idnr in (select JPPC_OH_Idnr from JPPC where JPPC_CaleName in (select OH_Name as "calendar_name" from OH, OKB where OH_DeleteFlag = 0 and OH_Idnr = OKB_OH_Idnr and OKB_CType = 'W' and OKB_PeriodStart = 1)))
OR OH_Idnr in (select OH_Idnr from oh where oh_idnr in (select OVP_OH_Idnr from OVP where OVP_CaleKeyName in (select okb_name as "keyword_name" from OH, OKB where OH_DeleteFlag = 0 and OH_Idnr = OKB_OH_Idnr and OKB_CType = 'W' and OKB_PeriodStart = 1)))
OR OH_Idnr in ( select OH_Idnr from OH where OH_Idnr in (select ah_oh_idnr from AH where AH_Idnr in (select epdc_ah_idnr from EPDC where EPDC_CaleKeyName in (select okb_name as "keyword_name" from OH, OKB where OH_DeleteFlag = 0 and OH_Idnr = OKB_OH_Idnr and OKB_CType = 'W' and OKB_PeriodStart = 1)))))
order by OH_Client asc;

 
This SQL can be used to find runs that were affected (please note: this may not be all inclusive depending on settings within your system):
 
select distinct AH_Name as 'Name', AH_client as 'Client', AH_Idnr as 'RunID'
from AH where AH_Timestamp1 > '2016-01-01 00:00:00.000'
and ( AH_OH_Idnr in
(select OH_Idnr from OH where OH_Idnr in
(select JPPC_OH_Idnr from JPPC where JPPC_CaleName in
(select OH_Name as "calendar_name" from OH, OKB where OH_DeleteFlag = 0 and OH_Idnr = OKB_OH_Idnr and OKB_CType = 'W' and OKB_PeriodStart = 1)))
OR AH_OH_Idnr in
(select OH_Idnr from oh where oh_idnr in
(select OVP_OH_Idnr from OVP where OVP_CaleKeyName in
(select okb_name as "keyword_name" from OH, OKB where OH_DeleteFlag = 0 and OH_Idnr = OKB_OH_Idnr and OKB_CType = 'W' and OKB_PeriodStart = 1)))
OR AH_OH_Idnr in
(select OH_Idnr from OH where OH_Idnr in
(select ah_oh_idnr from AH where AH_Idnr in
(select epdc_ah_idnr from EPDC where EPDC_CaleKeyName in
(select okb_name as "keyword_name" from OH, OKB where OH_DeleteFlag = 0 and OH_Idnr = OKB_OH_Idnr and OKB_CType = 'W' and OKB_PeriodStart = 1)))));