Translate

Tuesday, 21 January 2014

To run an sqr from application engine

You could use the ProcessRequest Class PeopleCode to call an SQR program from 
an application engine. You would add the PeopleCode step to the application 
engine. Below is some sample code to accomplish this task: 

Local ProcessRequest &RQST; 
/********************************************* ************************** 
* Construct a ProcessRequest Object. * 
********************************************** *************************/ 
&RQST = CreateProcessRequest(); 
/********************************************* ************************** 
* RunControlID and ProcessType, ProcessName or JobName * 
* are required properties. * 
********************************************** *************************/ 
&RQST.ProcessType = "SQR Report"; 
&RQST.ProcessName = "XRFWIN"; 
&RQST.RunControlID = RUN_CNTL_ID; 
/********************************************* ************************** 
* RunLocation can be Client, Server or a Process Scheduler Server * 
* Name. If the Run Location is Server, the Process Request would be * 
* scheduled on Process Scheduler server for the default Operating * 
* System. * 
* A default Operating System is defined on the System Settings page * 
* of Process Scheduler Manager. * 
********************************************** *************************/ 
&RQST.RunLocation = "PSNT"; 
/********************************************* ************************** 
* OutDestTypes are None, File, Printer, Window, Email and Web. Window is 
Supported for Run Location Client only. In this example, letting Process 
Scheduler resolve the output directory at runtime. * 
********************************************** *************************/ 
&RQST.OutDestType = "%OutputDirectory%"; 
&RQST.OutDestFormat = "SPF"; 
&RQST.OutDest = "C:\TEMP\"; 
/********************************************* ************************** 
* DateTime when the Process Request will be scheduled to Run 
Also TimeZone 

********************************************** *************************/ 
&RQST.RunDateTime = %Datetime; 
&RQST.TimeZone = %ServerTimeZone; 
/********************************************* ************************** 
* Schedules the process based on the object properties, setting the * 
* ProcessInstance and Status properties. * 
* Status of zero means Success. * 
********************************************** *************************/ 
&RQST.Schedule(); 
&PRCSSTATUS = &RQST.Status; 
If &RQST.Status = 0 then 
/* Schedule succeeded. */ 
&PRCSINSTANCE = &RQST.ProcessInstance; 
Else 
/* Process (job) not scheduled, do error processing */ 
End-If; 

No comments:

Post a Comment