Maximo | Scheduling, Generating & Posting a report to server | #Maximo #AutomationScript #Cron

Scenario : Schedule a report to be saved in the server for user access. As user does not want to run and download a report every time.

 Steps to achieve :

1. Create a path in server.

2. Create a script to create a report and post.

3. Associate the created script as a parameter to the cron.

 

Lets roll!

 

1. Create a folder under F drive in the server box:

 F:\REPORTS\WOREPORTS

 The report file that we are about to write will fall under the folder WOREPORTS that we have created under F drive, REPORTS folder.

 

2. Create a script:

Go To Automation script and Click on Create Script > Script. This being a cron script it would not need a launchpoint.

Script = CUSREPORTGEN

Description = To write a Report file

Script Language = Jython

 

----Sample code looks like below----

#Library

from  psdi.mbo import MboConstants

from  com.ibm.tivoli.maximo.report.birt.runtime import ReportParameterData

from  com.ibm.tivoli.maximo.report.birt.admin import ReportAdminServiceRemote

from  psdi.server import MXServer

from  java.io import File,FileOutputStream

from  java.text import SimpleDateFormat

from  java.util import Date

from  java.util import Calendar

 

# Defining services

userInfo = MXServer.getMXServer().getSystemUserInfo()

reportAdminService = MXServer.getMXServer().lookup("BIRTREPORT")

date=str(date.today())

 

# Report Parameter details

parameterData = ReportParameterData()

parameterData.addParameter("SITEID","TESTSITE")

#More parameters can be added as per requirement

 

# Report details

reportParam = File("F:\REPORTS\WOREPORTS","WOReportTestN_" + date + ".pdf")

reportOutput = reportAdminService.runReport(userInfo, "TestReport.rptdesign", "WOTRACK", parameterData, reportParam.getName(), "pdf")

fileOutput = FileOutputStream(reportParam.getAbsolutePath())

 

# Report Generation and adding in server folder

try:

   fileOutput.write(reportOutput)

   fileOutput.flush()

finally:

   fileOutput.close()

 

3. Script association to cron:

Go To --> System Configuration --> Platform Configuration -->Cron Task Setup

Click on New Cron Task Setup

Cron Task = REPORTGENCRON

Description = Cron for writing a Report

Class = com.ibm.tivoli.maximo.script.ScriptCrontask

Access Level = FULL

 

Cron Task Instance Name = REPORTGENCRONTASK

Description = Task for Cron

Schedule = 1d,0,30,12,*,*,*,*,*,*

Run as User = MAXADMIN

Active = 1

Keep History = 1

Max Number of History Records = 10000

 

 #Parameters, SCRIPTARG = None, SCRIPTNAME = Script Name

SCRIPTARG = None

SCRIPTNAME = CUSREPORTGEN

 

--Check after the cron runs in the folder path for the report pdf file.


###THANKYOUU###


***************************************************************************************************************************************


Comments

Post a Comment

Popular posts from this blog

BMXAA6445E - Cache INTOBJECT could not be initialized. Log out and then log in again to refresh your database connection #BMXAA6445E #BMXAA7733E

Launch a dialog and enable end user select assignee on workflow route