This is an archive of the Maximo Yahoo Community. The content of this pages may be a sometimes obsolete so please check post dates.
Thanks to the community owner Christopher Wanko for providing the content.
Hi Group,
[Maximo 6.2 on Oracle]
We have been manually generating all our pm workorders for the following month at the beginning of the last week of the current month. Due to staff changes, vacations etc the task sometimes gets overlooked, with a downside of having to figure out how to choose and print just the ones we want.
We are looking at using the 'pm options' available in the 'organization' application, but are having difficulty with getting the sql where clause to behave as expected.
In our test environment I have set the PMWoGenCronTask to run on the 21st day of the month, and have the following where clause:
(nextdate BETWEEN (ADD_MONTHS(TRUNC(SYSDATE, 'MM'),1 )) AND (ADD_MONTHS(TRUNC(SYSDATE, 'MM'),2 ) -1 ))
which resolves (in Oracle) to the date range between the first and last days of the next month.
However I have found that unless I put a number (say 40) in the 'Generate WOs Due on the Current Date Plus This Number of Days' box the process will only generate a workorder with a due date on the same day one month ahead, and not for all dates in the month.
The problem is that once I put say 40 in the ....days ahead box, on some months we will also pick up pm's from 2 months ahead. While this might not seem bad, it makes the printing of only next months work orders more complicated than it already is.
Is it possible to program what we are trying to achieve without having to change the number of days in the 'Generate WOs Due on the Current Date Plus This Number of Days' box each month (depending on the number of days in the calendar month)?
Nearly our pm's have no lead time.
Your experience and suggestions will be much appreciated.
Regards
Kim Prisk
The University of Auckland,
New Zealand.
Kim,
Would you kindly share any feedback on your "WoGen" issue with me.
Thanks
Steve Simpson
----- Original Message -----
From: "kimprisk" <k.prisk@auckland.ac.nz>
To: MAXIMO@yahoogroups.com
Sent: Tuesday, February 7, 2012 6:53:15 PM
Subject: [MAXIMO List] automatically generating all pm work orders for next month on one day
Hi Group,
[Maximo 6.2 on Oracle]
We have been manually generating all our pm workorders for the following month at the beginning of the last week of the current month. Due to staff changes, vacations etc the task sometimes gets overlooked, with a downside of having to figure out how to choose and print just the ones we want.
We are looking at using the 'pm options' available in the 'organization' application, but are having difficulty with getting the sql where clause to behave as expected.
In our test environment I have set the PMWoGenCronTask to run on the 21st day of the month, and have the following where clause:
(nextdate BETWEEN (ADD_MONTHS(TRUNC(SYSDATE, 'MM'),1 )) AND (ADD_MONTHS(TRUNC(SYSDATE, 'MM'),2 ) -1 ))
which resolves (in Oracle) to the date range between the first and last days of the next month.
However I have found that unless I put a number (say 40) in the 'Generate WOs Due on the Current Date Plus This Number of Days' box the process will only generate a workorder with a due date on the same day one month ahead, and not for all dates in the month.
The problem is that once I put say 40 in the ....days ahead box, on some months we will also pick up pm's from 2 months ahead. While this might not seem bad, it makes the printing of only next months work orders more complicated than it already is.
Is it possible to program what we are trying to achieve without having to change the number of days in the 'Generate WOs Due on the Current Date Plus This Number of Days' box each month (depending on the number of days in the calendar month)?
Nearly our pm's have no lead time.
Your experience and suggestions will be much appreciated.
Regards
Kim Prisk
The University of Auckland,
New Zealand.
Hi Kim: what ideally is the outcome of the automatic process? I gather you
only want the work orders to be created once a month .
Shannon
From: MAXIMO@yahoogroups.com [mailto:MAXIMO@yahoogroups.com] On Behalf Of
kimprisk
Sent: February-07-12 3:53 PM
To: MAXIMO@yahoogroups.com
Subject: [MAXIMO List] automatically generating all pm work orders for next
month on one day
Hi Group,
[Maximo 6.2 on Oracle]
We have been manually generating all our pm workorders for the following
month at the beginning of the last week of the current month. Due to staff
changes, vacations etc the task sometimes gets overlooked, with a downside
of having to figure out how to choose and print just the ones we want.
We are looking at using the 'pm options' available in the 'organization'
application, but are having difficulty with getting the sql where clause to
behave as expected.
In our test environment I have set the PMWoGenCronTask to run on the 21st
day of the month, and have the following where clause:
(nextdate BETWEEN (ADD_MONTHS(TRUNC(SYSDATE, 'MM'),1 )) AND
(ADD_MONTHS(TRUNC(SYSDATE, 'MM'),2 ) -1 ))
which resolves (in Oracle) to the date range between the first and last days
of the next month.
However I have found that unless I put a number (say 40) in the 'Generate
WOs Due on the Current Date Plus This Number of Days' box the process will
only generate a workorder with a due date on the same day one month ahead,
and not for all dates in the month.
The problem is that once I put say 40 in the ....days ahead box, on some
months we will also pick up pm's from 2 months ahead. While this might not
seem bad, it makes the printing of only next months work orders more
complicated than it already is.
Is it possible to program what we are trying to achieve without having to
change the number of days in the 'Generate WOs Due on the Current Date Plus
This Number of Days' box each month (depending on the number of days in the
calendar month)?
Nearly our pm's have no lead time.
Your experience and suggestions will be much appreciated.
Regards
Kim Prisk
The University of Auckland,
New Zealand.
The PM WoGen "Where" clause is not used to determine what records to process BUT when to run the process <smile>
That said, if you set the generate today + 31 days (the longest possible month) and set the "where clause" to run on the 1st of each month - # of days in the next month, you will get just today to the end of the next month each time.
Also allow it to run every 8 hours so that if it's down for a short period during any day, it will have a couple of additional times to run to be sure to pick up the need to process the cron (although that's not so important in v6 and up with the "more fully" functional taskscheduler table)
On any day except the 1st - Number of days in next month - it won't run, on that particular day once it's generated the Work Orders it will run, but not process anything since nothing is due.
R/
Will
From: MAXIMO@yahoogroups.com [mailto:MAXIMO@yahoogroups.com] On Behalf Of Shannon Rotz
Sent: Wednesday, February 08, 2012 10:31 AM
To: MAXIMO@yahoogroups.com
Subject: RE: [MAXIMO List] automatically generating all pm work orders for next month on one day
Hi Kim: what ideally is the outcome of the automatic process? I gather you
only want the work orders to be created once a month .
Shannon
From: MAXIMO@yahoogroups.com<mailto:MAXIMO%40yahoogroups.com> [mailto:MAXIMO@yahoogroups.com<mailto:MAXIMO%40yahoogroups.com>] On Behalf Of
kimprisk
Sent: February-07-12 3:53 PM
To: MAXIMO@yahoogroups.com<mailto:MAXIMO%40yahoogroups.com>
Subject: [MAXIMO List] automatically generating all pm work orders for next
month on one day
Hi Group,
[Maximo 6.2 on Oracle]
We have been manually generating all our pm workorders for the following
month at the beginning of the last week of the current month. Due to staff
changes, vacations etc the task sometimes gets overlooked, with a downside
of having to figure out how to choose and print just the ones we want.
We are looking at using the 'pm options' available in the 'organization'
application, but are having difficulty with getting the sql where clause to
behave as expected.
In our test environment I have set the PMWoGenCronTask to run on the 21st
day of the month, and have the following where clause:
(nextdate BETWEEN (ADD_MONTHS(TRUNC(SYSDATE, 'MM'),1 )) AND
(ADD_MONTHS(TRUNC(SYSDATE, 'MM'),2 ) -1 ))
which resolves (in Oracle) to the date range between the first and last days
of the next month.
However I have found that unless I put a number (say 40) in the 'Generate
WOs Due on the Current Date Plus This Number of Days' box the process will
only generate a workorder with a due date on the same day one month ahead,
and not for all dates in the month.
The problem is that once I put say 40 in the ....days ahead box, on some
months we will also pick up pm's from 2 months ahead. While this might not
seem bad, it makes the printing of only next months work orders more
complicated than it already is.
Is it possible to program what we are trying to achieve without having to
change the number of days in the 'Generate WOs Due on the Current Date Plus
This Number of Days' box each month (depending on the number of days in the
calendar month)?
Nearly our pm's have no lead time.
Your experience and suggestions will be much appreciated.
Regards
Kim Prisk
The University of Auckland,
New Zealand.
Hi,
We are on 7.1.1.6 and most of our sites generate the next 45 days of PMs. The PM cron task runs each Sunday night. So the sites on 45 days have between 38 to 45 days of PM work orders in the system.
We set the Generate WOs Due on the Current Date Plus This Number of Days to 45 and the WO Generation Where Clause to
status = 'ACTIVE' and siteid = 'HN'
and nextdate - IsNull(leadtime,0) - 45 <= getdate()
That way the PM cron task only looks at the PMs that fall within the where clause. That cuts down greatly on the time to process the PMs for a site.
Dave Bone
--- In MAXIMO@yahoogroups.com, Will Hampton <will.hampton@...> wrote:
>
> The PM WoGen "Where" clause is not used to determine what records to process BUT when to run the process <smile>
>
> That said, if you set the generate today + 31 days (the longest possible month) and set the "where clause" to run on the 1st of each month - # of days in the next month, you will get just today to the end of the next month each time.
>
> Also allow it to run every 8 hours so that if it's down for a short period during any day, it will have a couple of additional times to run to be sure to pick up the need to process the cron (although that's not so important in v6 and up with the "more fully" functional taskscheduler table)
>
> On any day except the 1st - Number of days in next month - it won't run, on that particular day once it's generated the Work Orders it will run, but not process anything since nothing is due.
>
> R/
> Will
>
> From: MAXIMO@yahoogroups.com [mailto:MAXIMO@yahoogroups.com] On Behalf Of Shannon Rotz
> Sent: Wednesday, February 08, 2012 10:31 AM
> To: MAXIMO@yahoogroups.com
> Subject: RE: [MAXIMO List] automatically generating all pm work orders for next month on one day
>
>
>
> Hi Kim: what ideally is the outcome of the automatic process? I gather you
> only want the work orders to be created once a month .
>
> Shannon
>
> From: MAXIMO@yahoogroups.com<mailto:MAXIMO%40yahoogroups.com> [mailto:MAXIMO@yahoogroups.com<mailto:MAXIMO%40yahoogroups.com>] On Behalf Of
> kimprisk
> Sent: February-07-12 3:53 PM
> To: MAXIMO@yahoogroups.com<mailto:MAXIMO%40yahoogroups.com>
> Subject: [MAXIMO List] automatically generating all pm work orders for next
> month on one day
>
> Hi Group,
> [Maximo 6.2 on Oracle]
>
> We have been manually generating all our pm workorders for the following
> month at the beginning of the last week of the current month. Due to staff
> changes, vacations etc the task sometimes gets overlooked, with a downside
> of having to figure out how to choose and print just the ones we want.
>
> We are looking at using the 'pm options' available in the 'organization'
> application, but are having difficulty with getting the sql where clause to
> behave as expected.
>
> In our test environment I have set the PMWoGenCronTask to run on the 21st
> day of the month, and have the following where clause:
>
> (nextdate BETWEEN (ADD_MONTHS(TRUNC(SYSDATE, 'MM'),1 )) AND
> (ADD_MONTHS(TRUNC(SYSDATE, 'MM'),2 ) -1 ))
>
> which resolves (in Oracle) to the date range between the first and last days
> of the next month.
>
> However I have found that unless I put a number (say 40) in the 'Generate
> WOs Due on the Current Date Plus This Number of Days' box the process will
> only generate a workorder with a due date on the same day one month ahead,
> and not for all dates in the month.
>
> The problem is that once I put say 40 in the ....days ahead box, on some
> months we will also pick up pm's from 2 months ahead. While this might not
> seem bad, it makes the printing of only next months work orders more
> complicated than it already is.
>
> Is it possible to program what we are trying to achieve without having to
> change the number of days in the 'Generate WOs Due on the Current Date Plus
> This Number of Days' box each month (depending on the number of days in the
> calendar month)?
>
> Nearly our pm's have no lead time.
>
> Your experience and suggestions will be much appreciated.
>
> Regards
> Kim Prisk
> The University of Auckland,
> New Zealand.
>
>
>
>
>
>
>
Hi Shannon,
Thanks for your interest.
Yes we want the pm generation process to run once a month say overnight on the 21st day of the month, and then run the wo print report the following business day.
Regards
KIM
--- In MAXIMO@yahoogroups.com, "Shannon Rotz" <shannonrotz@...> wrote:
>
> Hi Kim: what ideally is the outcome of the automatic process? I gather you
> only want the work orders to be created once a month .
>
>
>
>
>
> Shannon
>
>
>
> From: MAXIMO@yahoogroups.com [mailto:MAXIMO@yahoogroups.com] On Behalf Of
> kimprisk
> Sent: February-07-12 3:53 PM
> To: MAXIMO@yahoogroups.com
> Subject: [MAXIMO List] automatically generating all pm work orders for next
> month on one day
>
>
>
>
>
> Hi Group,
> [Maximo 6.2 on Oracle]
>
> We have been manually generating all our pm workorders for the following
> month at the beginning of the last week of the current month. Due to staff
> changes, vacations etc the task sometimes gets overlooked, with a downside
> of having to figure out how to choose and print just the ones we want.
>
> We are looking at using the 'pm options' available in the 'organization'
> application, but are having difficulty with getting the sql where clause to
> behave as expected.
>
> In our test environment I have set the PMWoGenCronTask to run on the 21st
> day of the month, and have the following where clause:
>
> (nextdate BETWEEN (ADD_MONTHS(TRUNC(SYSDATE, 'MM'),1 )) AND
> (ADD_MONTHS(TRUNC(SYSDATE, 'MM'),2 ) -1 ))
>
> which resolves (in Oracle) to the date range between the first and last days
> of the next month.
>
> However I have found that unless I put a number (say 40) in the 'Generate
> WOs Due on the Current Date Plus This Number of Days' box the process will
> only generate a workorder with a due date on the same day one month ahead,
> and not for all dates in the month.
>
> The problem is that once I put say 40 in the ....days ahead box, on some
> months we will also pick up pm's from 2 months ahead. While this might not
> seem bad, it makes the printing of only next months work orders more
> complicated than it already is.
>
> Is it possible to program what we are trying to achieve without having to
> change the number of days in the 'Generate WOs Due on the Current Date Plus
> This Number of Days' box each month (depending on the number of days in the
> calendar month)?
>
> Nearly our pm's have no lead time.
>
> Your experience and suggestions will be much appreciated.
>
> Regards
> Kim Prisk
> The University of Auckland,
> New Zealand.
>
>
>
>
>
>
>
Will do Steve,
KIM
--- In MAXIMO@yahoogroups.com, slsimpson@... wrote:
>
> Kim,
> Would you kindly share any feedback on your "WoGen" issue with me.
>
>
> Thanks
>
> Steve Simpson
>
> ----- Original Message -----
> From: "kimprisk" <k.prisk@...>
> To: MAXIMO@yahoogroups.com
> Sent: Tuesday, February 7, 2012 6:53:15 PM
> Subject: [MAXIMO List] automatically generating all pm work orders for next month on one day
Hi Will,
Thanks for this info. I was not aware that the "where" clause only affected the 'when' (a when clause maybe).
Are you saying all work orders will be generated in one 'hit' on the first of the month?
In our case following your suggested method as I understand it, should we put 38 ( = 31 + 7) in the 'Generate WOs Due on the Current Date Plus This Number of Days' box?
I get the 7 as we wish to generate 1 week before due month starts. This would have a potential downside for shorter than 31 days eg due month of February as we might also pick work orders due up to 4 ( 31 - 28) days in March.
We could work around this by ensuring no pm's are due in the say first week of the month but if we where late for some reason and the wo's are manually generated in the first week of the due month, the due dates will get set to that 'too early' date for the next month.
Is there a further refinement you or anyone can see? It seems to me that the 'Generate WOs Due on the Current Date Plus This Number of Days' box needs to have it's own where clause to create a varying number of days depending on the days in each month.
Cheers
KIM
--- In MAXIMO@yahoogroups.com, Will Hampton <will.hampton@...> wrote:
>
> The PM WoGen "Where" clause is not used to determine what records to process BUT when to run the process <smile>
>
> That said, if you set the generate today + 31 days (the longest possible month) and set the "where clause" to run on the 1st of each month - # of days in the next month, you will get just today to the end of the next month each time.
>
> Also allow it to run every 8 hours so that if it's down for a short period during any day, it will have a couple of additional times to run to be sure to pick up the need to process the cron (although that's not so important in v6 and up with the "more fully" functional taskscheduler table)
>
> On any day except the 1st - Number of days in next month - it won't run, on that particular day once it's generated the Work Orders it will run, but not process anything since nothing is due.
>
> R/
> Will
>
> From: MAXIMO@yahoogroups.com [mailto:MAXIMO@yahoogroups.com] On Behalf Of Shannon Rotz
> Sent: Wednesday, February 08, 2012 10:31 AM
> To: MAXIMO@yahoogroups.com
> Subject: RE: [MAXIMO List] automatically generating all pm work orders for next month on one day
>
>
>
> Hi Kim: what ideally is the outcome of the automatic process? I gather you
> only want the work orders to be created once a month .
>
> Shannon
>
> From: MAXIMO@yahoogroups.com<mailto:MAXIMO%40yahoogroups.com> [mailto:MAXIMO@yahoogroups.com<mailto:MAXIMO%40yahoogroups.com>] On Behalf Of
> kimprisk
> Sent: February-07-12 3:53 PM
> To: MAXIMO@yahoogroups.com<mailto:MAXIMO%40yahoogroups.com>
> Subject: [MAXIMO List] automatically generating all pm work orders for next
> month on one day
>
> Hi Group,
> [Maximo 6.2 on Oracle]
>
> We have been manually generating all our pm workorders for the following
> month at the beginning of the last week of the current month. Due to staff
> changes, vacations etc the task sometimes gets overlooked, with a downside
> of having to figure out how to choose and print just the ones we want.
>
> We are looking at using the 'pm options' available in the 'organization'
> application, but are having difficulty with getting the sql where clause to
> behave as expected.
>
> In our test environment I have set the PMWoGenCronTask to run on the 21st
> day of the month, and have the following where clause:
>
> (nextdate BETWEEN (ADD_MONTHS(TRUNC(SYSDATE, 'MM'),1 )) AND
> (ADD_MONTHS(TRUNC(SYSDATE, 'MM'),2 ) -1 ))
>
> which resolves (in Oracle) to the date range between the first and last days
> of the next month.
>
> However I have found that unless I put a number (say 40) in the 'Generate
> WOs Due on the Current Date Plus This Number of Days' box the process will
> only generate a workorder with a due date on the same day one month ahead,
> and not for all dates in the month.
>
> The problem is that once I put say 40 in the ....days ahead box, on some
> months we will also pick up pm's from 2 months ahead. While this might not
> seem bad, it makes the printing of only next months work orders more
> complicated than it already is.
>
> Is it possible to program what we are trying to achieve without having to
> change the number of days in the 'Generate WOs Due on the Current Date Plus
> This Number of Days' box each month (depending on the number of days in the
> calendar month)?
>
> Nearly our pm's have no lead time.
>
> Your experience and suggestions will be much appreciated.
>
> Regards
> Kim Prisk
> The University of Auckland,
> New Zealand.
>
>
>
>
>
>
>
Hello Dave,
Thanks for the contribution. I have amended our where clause to include NVL(leadtime,0)[as we are on Oracle] as per your example.
So our where clause (for just one crew in our test environment) now is:
(status = 'ACTIVE') AND (UPPER(crewid) = 'ELECTRICAL') AND (nextdate BETWEEN (SYSDATE) AND (ADD_MONTHS(TRUNC(SYSDATE, 'MM'),2 ) -1 + NVL(leadtime,0) ))
I am currently testing a method where the value in the 'Generate WOs Due on the Current Date Plus This Number of Days' box is changed each night by an Oracle procedure that sets this value (WOGENWHERECLAUSE in the Maxvars table) to the number of days from 'now' to the end of the following month. The procedure is run by the Oracle job scheduler just after midnight each day.
Regards
KIM
--- In MAXIMO@yahoogroups.com, "in2data" <in2data@...> wrote:
>
> Hi,
>
> We are on 7.1.1.6 and most of our sites generate the next 45 days of PMs. The PM cron task runs each Sunday night. So the sites on 45 days have between 38 to 45 days of PM work orders in the system.
>
> We set the Generate WOs Due on the Current Date Plus This Number of Days to 45 and the WO Generation Where Clause to
>
> status = 'ACTIVE' and siteid = 'HN'
> and nextdate - IsNull(leadtime,0) - 45 <= getdate()
>
> That way the PM cron task only looks at the PMs that fall within the where clause. That cuts down greatly on the time to process the PMs for a site.
>
> Dave Bone
>
> --- In MAXIMO@yahoogroups.com, Will Hampton <will.hampton@> wrote:
> >
> > The PM WoGen "Where" clause is not used to determine what records to process BUT when to run the process <smile>
> >
> > That said, if you set the generate today + 31 days (the longest possible month) and set the "where clause" to run on the 1st of each month - # of days in the next month, you will get just today to the end of the next month each time.
> >
> > Also allow it to run every 8 hours so that if it's down for a short period during any day, it will have a couple of additional times to run to be sure to pick up the need to process the cron (although that's not so important in v6 and up with the "more fully" functional taskscheduler table)
> >
> > On any day except the 1st - Number of days in next month - it won't run, on that particular day once it's generated the Work Orders it will run, but not process anything since nothing is due.
> >
> > R/
> > Will
> >
> > From: MAXIMO@yahoogroups.com [mailto:MAXIMO@yahoogroups.com] On Behalf Of Shannon Rotz
> > Sent: Wednesday, February 08, 2012 10:31 AM
> > To: MAXIMO@yahoogroups.com
> > Subject: RE: [MAXIMO List] automatically generating all pm work orders for next month on one day
> >
> >
> >
> > Hi Kim: what ideally is the outcome of the automatic process? I gather you
> > only want the work orders to be created once a month .
> >
> > Shannon
> >
> > From: MAXIMO@yahoogroups.com<mailto:MAXIMO%40yahoogroups.com> [mailto:MAXIMO@yahoogroups.com<mailto:MAXIMO%40yahoogroups.com>] On Behalf Of
> > kimprisk
> > Sent: February-07-12 3:53 PM
> > To: MAXIMO@yahoogroups.com<mailto:MAXIMO%40yahoogroups.com>
> > Subject: [MAXIMO List] automatically generating all pm work orders for next
> > month on one day
> >
> > Hi Group,
> > [Maximo 6.2 on Oracle]
> >
> > We have been manually generating all our pm workorders for the following
> > month at the beginning of the last week of the current month. Due to staff
> > changes, vacations etc the task sometimes gets overlooked, with a downside
> > of having to figure out how to choose and print just the ones we want.
> >
> > We are looking at using the 'pm options' available in the 'organization'
> > application, but are having difficulty with getting the sql where clause to
> > behave as expected.
> >
> > In our test environment I have set the PMWoGenCronTask to run on the 21st
> > day of the month, and have the following where clause:
> >
> > (nextdate BETWEEN (ADD_MONTHS(TRUNC(SYSDATE, 'MM'),1 )) AND
> > (ADD_MONTHS(TRUNC(SYSDATE, 'MM'),2 ) -1 ))
> >
> > which resolves (in Oracle) to the date range between the first and last days
> > of the next month.
> >
> > However I have found that unless I put a number (say 40) in the 'Generate
> > WOs Due on the Current Date Plus This Number of Days' box the process will
> > only generate a workorder with a due date on the same day one month ahead,
> > and not for all dates in the month.
> >
> > The problem is that once I put say 40 in the ....days ahead box, on some
> > months we will also pick up pm's from 2 months ahead. While this might not
> > seem bad, it makes the printing of only next months work orders more
> > complicated than it already is.
> >
> > Is it possible to program what we are trying to achieve without having to
> > change the number of days in the 'Generate WOs Due on the Current Date Plus
> > This Number of Days' box each month (depending on the number of days in the
> > calendar month)?
> >
> > Nearly our pm's have no lead time.
> >
> > Your experience and suggestions will be much appreciated.
> >
> > Regards
> > Kim Prisk
> > The University of Auckland,
> > New Zealand.
> >
> >
> >
> >
> >
> >
> >
>
Hi Group,
I now have a working solution. I have copied this rather wordy description from our procedure manual.
A. The number of days ahead: the parameter 'Generate WOs Due on the Current Date Plus This Number of Days' is set by assuming generation will be on the 21st day of the month. The 21st day is chosen to be one calendar week (7 days) before the end of the shortest month, February.
We wish to process all PM's up to the end of the last day in the following month. The last day of the longest month(s) is the 31st so we will be processing PM's for 31 days over the longest month.
The total interval required is found by subtracting 31 21 = 10 days for the longest month we might be running the process from, and adding for the longest following month when the PM's are due: 31 + 10 = 41. This gives the longest number of days (41) we need to 'look ahead' to pick up all PM's that might be due over a year.
It does not matter that 41 appears to be too long when it is February and we are generating PM's for March. In this case it would seem that all PM's from 21st of February through 28th of February (8 days), and the 33 days remaining up to the 2st of April (which is past March 31st ) will be generated. However this is not the case as the PM's that get chosen are also subject to the restrictions in the where clause.
B. Selection of PM's to process: The purpose of the 'WO Generation Where Clause' is to limit which PM's will processed within the time interval chosen above.
There are two types of PM's:
those that have no lead time (the majority)
and those that do have a lead time (only a few in our case).
For either PM's with no lead time or PM's with a lead time, the Where Clause must select either due dates or due date less their lead time, to the range between the 1st and last days of the following month.
The clause appropriate to this condition is (Oracle syntax):
(status = 'ACTIVE') AND (nextdate - nvl(leadtime,0) BETWEEN (ADD_MONTHS(TRUNC(SYSDATE, 'MM'),1 ) ) AND last_day(ADD_MONTHS(TRUNC(SYSDATE, 'MM'),1 )) )
The above clause also restricts PM's to only those that are active.
Regards
and thanks once again to those who contributed.
Kim (soon to retire) Prisk
--- In MAXIMO@yahoogroups.com, "kimprisk" <k.prisk@...> wrote:
>
> Hi Group,
> [Maximo 6.2 on Oracle]
>
> We have been manually generating all our pm workorders for the following month at the beginning of the last week of the current month. Due to staff changes, vacations etc the task sometimes gets overlooked, with a downside of having to figure out how to choose and print just the ones we want.
>
> We are looking at using the 'pm options' available in the 'organization' application, but are having difficulty with getting the sql where clause to behave as expected.
>
> In our test environment I have set the PMWoGenCronTask to run on the 21st day of the month, and have the following where clause:
>
> (nextdate BETWEEN (ADD_MONTHS(TRUNC(SYSDATE, 'MM'),1 )) AND (ADD_MONTHS(TRUNC(SYSDATE, 'MM'),2 ) -1 ))
>
> which resolves (in Oracle) to the date range between the first and last days of the next month.
>
> However I have found that unless I put a number (say 40) in the 'Generate WOs Due on the Current Date Plus This Number of Days' box the process will only generate a workorder with a due date on the same day one month ahead, and not for all dates in the month.
>
> The problem is that once I put say 40 in the ....days ahead box, on some months we will also pick up pm's from 2 months ahead. While this might not seem bad, it makes the printing of only next months work orders more complicated than it already is.
>
> Is it possible to program what we are trying to achieve without having to change the number of days in the 'Generate WOs Due on the Current Date Plus This Number of Days' box each month (depending on the number of days in the calendar month)?
>
> Nearly our pm's have no lead time.
>
> Your experience and suggestions will be much appreciated.
>
> Regards
> Kim Prisk
> The University of Auckland,
> New Zealand.
>