In RMS, normally, at the end of each period, the system should be reviewed for potential changes or additions to the calendar and half tables. Minor maintenance responsibilities involve adding rows to the calendar table for future periods. It is recommended that the calendar hold at least two years of history details and four years of future dates. The RMS system also bases the financial calendar on the half table. With each half year, the half table requires entries that correspond to the next four half year periods within the next two financial years.
4-5-4 Calendar
The 4-5-4 calendar determines the begin point of each financial month within the system, as well as how many weeks it runs for, but does not determine when the financial year ends. The 4-5-4 calendar is determined solely by the table CALENDAR. This table comes pre-populated by the RMS with an EXAMPLE 454 calendar that requires changes to match the required merchandise calendar for the business users.
If you are in doubt, add 15 days to first_day, look at what physical month the new date is in, and that is the month_454.
select substr(to_char(first_day,'DD-MON-YYYY'),1,11)
"First Day",
substr(to_char(first_day,'Day'),1,9)
"Day",
substr(year_454,1,4) y454,
substr(to_char(first_day + 15,'YYYY'),1,9)
"Should be",
substr(month_454,1,4) m454,
substr(to_number(to_char(first_day + 15,'MM')),1,9)
"Should be",
substr(no_of_weeks,1,5) weeks,
substr(to_char(first_day+(no_of_weeks*7),
'DD-MON-YYYY'),1,11)
"Next Month"
from CALENDAR
order by FIRST_DAY
/
First Day
|
Day
|
Y454
|
Should be
|
M454
|
Should be
|
WEEKS
|
Next Month
|
24-NOV-1997
|
Monday
|
1997
|
1997
|
12
|
12
|
5
|
29-DEC-1997
|
29-DEC-1997
|
Monday
|
1998
|
1998
|
1
|
1
|
4
|
26-JAN-1998
|
26-JAN-1998
|
Monday
|
1998
|
1998
|
2
|
2
|
4
|
23-FEB-1998
|
23-FEB-1998
|
Monday
|
1998
|
1998
|
3
|
3
|
5
|
30-MAR-1998
|
30-MAR-1998
|
Monday
|
1998
|
1998
|
4
|
4
|
4
|
27-APR-1998
|
27-APR-1998
|
Monday
|
1998
|
1998
|
5
|
5
|
4
|
25-MAY-1998
|
25-MAY-1998
|
Monday
|
1998
|
1998
|
6
|
6
|
5
|
29-JUN-1998
|
29-JUN-1998
|
Monday
|
1998
|
1998
|
7
|
7
|
4
|
27-JUL-1998
|
27-JUL-1998
|
Monday
|
1998
|
1998
|
8
|
8
|
4
|
24-AUG-1998
|
24-AUG-1998
|
Monday
|
1998
|
1998
|
9
|
9
|
5
|
28-SEP-1998
|
28-SEP-1998
|
Monday
|
1998
|
1998
|
10
|
10
|
4
|
26-OCT-1998
|
26-OCT-1998
|
Monday
|
1998
|
1998
|
11
|
11
|
4
|
23-NOV-1998
|
23-NOV-1998
|
Monday
|
1998
|
1998
|
12
|
12
|
5
|
28-DEC-1998
|
28-DEC-1998
|
Monday
|
1999
|
1999
|
1
|
1
|
4
|
25-JAN-1999
|
25-JAN-1999
|
Monday
|
1999
|
1999
|
2
|
2
|
4
|
22-FEB-1999
|
22-FEB-1999
|
Monday
|
1999
|
1999
|
3
|
3
|
5
|
29-MAR-1999
|
29-MAR-1999
|
Monday
|
1999
|
1999
|
4
|
4
|
4
|
26-APR-1999
|
26-APR-1999
|
Monday
|
1999
|
1999
|
5
|
5
|
4
|
24-MAY-1999
|
24-MAY-1999
|
Monday
|
1999
|
1999
|
6
|
6
|
5
|
28-JUN-1999
|
28-JUN-1999
|
Monday
|
1999
|
1999
|
7
|
7
|
4
|
26-JUL-1999
|
26-JUL-1999
|
Monday
|
1999
|
1999
|
8
|
8
|
4
|
23-AUG-1999
|
23-AUG-1999
|
Monday
|
1999
|
1999
|
9
|
9
|
5
|
27-SEP-1999
|
27-SEP-1999
|
Monday
|
1999
|
1999
|
10
|
10
|
4
|
25-OCT-1999
|
25-OCT-1999
|
Monday
|
1999
|
1999
|
11
|
11
|
4
|
22-NOV-1999
|
22-NOV-1999
|
Monday
|
1999
|
1999
|
12
|
12
|
5
|
27-DEC-1999
|
27-DEC-1999
|
Monday
|
2000
|
2000
|
1
|
1
|
4
|
24-JAN-2000
|
Day: Should always be the same day (regardless of whether your first day is a Sunday, Monday, Saturday or whatever), it should simply always be the one day.
If the financial year 1997 begins in July 1997, then the value of start_of_half_month = 7
The following script will correctly populate the SYSTEM_VARIABLES table. This script must only be run after the CALENDAR and PERIOD tables have been correctly populated.
update SYSTEM_VARIABLES set (
LAST_EOM_HALF_NO ,
LAST_EOM_MONTH_NO ,
LAST_EOM_DATE ,
NEXT_EOM_DATE ,
LAST_EOM_START_HALF ,
LAST_EOM_END_HALF ,
LAST_EOM_START_MONTH ,
LAST_EOM_MID_MONTH ,
LAST_EOM_NEXT_HALF_NO ,
LAST_EOM_DAY ,
LAST_EOM_WEEK ,
LAST_EOM_MONTH ,
LAST_EOM_YEAR ,
LAST_EOM_WEEK_IN_HALF ,
LAST_EOW_DATE ) = (
select p.half_no -
decode( p.curr_454_month_in_half, 1,
decode( mod(p.half_no,10), 1, 9, 1),
0 ) LAST_EOM_HALF_NO,
decode( p.curr_454_month_in_half, 1,
6,
p.curr_454_month_in_half - 1) LAST_EOM_MONTH_NO,
p.start_454_month - 1 LAST_EOM_DATE,
p.end_454_month NEXT_EOM_DATE,
add_months( p.start_454_half,
decode( p.curr_454_month_in_half, 1, -6, 0)) LAST_EOM_START_HALF,
add_months( p.end_454_half,
decode( p.curr_454_month_in_half, 1, -6, 0)) LAST_EOM_END_HALF,
add_months( p.start_454_month, -1) LAST_EOM_START_MONTH,
add_months( p.start_454_month, -1) + 14 LAST_EOM_MID_MONTH,
p.half_no +
decode( p.curr_454_month_in_half, 1,
0,
decode( mod(p.half_no,10), 1,1, 9)) LAST_EOM_NEXT_HALF_NO,
decode( to_char(p.start_454_month-1,'DD'),
'28', 7,
mod( to_char(p.start_454_month-1,'DD'),28) ) LAST_EOM_DAY,
decode( to_char(p.start_454_month-1,'DD'),
'28', 4, 5) LAST_EOM_WEEK,
to_char(p.start_454_month-1,'MM') LAST_EOM_MONTH,
to_char(p.start_454_month-1,'YYYY') LAST_EOM_YEAR,
ceil( ( p.start_454_month - 1 - add_months( p.start_454_half,
decode( p.curr_454_month, 1, -6, 0))
)/7 ) LAST_EOM_WEEK_IN_HALF,
p.start_454_month - 1 + trunc(to_char(p.vdate,'DD')/7)*7 LAST_EOW_DATE
from PERIOD p
)
/
update SYSTEM_VARIABLES set
LAST_EOM_DATE_UNIT = LAST_EOM_DATE,
NEXT_EOM_DATE_UNIT = NEXT_EOM_DATE,
LAST_EOW_DATE_UNIT = LAST_EOW_DATE,
NEXT_EOW_DATE_UNIT = LAST_EOW_DATE + 7
/
About Nagesh Mishra
Nagesh Mishra - A Passionate Oracle Retail Certified Professional with more than 17 years of overall experience in IT industry and more than 15 years of domain expertise in Oracle Retail Applications. Worked extensively in diversified fields of Product Implementation, Business Consulting, Pre-Sales, Application Software Development, Maintenance and Support and Re-Engineering Oracle Retail projects.
0 comments :
Post a Comment