Scheduling/Running a SQR from Peoplecode
A PeopleSoft Application Engine(AE) can be called from peoplecode using CALLAPPENGINE function(except within the AE, to call AE within an AE we use Call Section). But how about running a SQR by peoplecode without taking the user to Process request page. The best way to do it is to create a process request and schedule it.
Below is the sample code to run a sqr through peoplecode by creating a process and scheduling it.
/* Declare a ProcessRequest object */
Local ProcessRequest &PRCSRQST;
/* Declare name of the sqr JAN_PRCS to be processed */
Local String &SQR_TO_PROCESS;
&SQR_TO_PROCESS = "JAN_PRCS"
/* Create a Process Request Object; */
&PRCSRQST = CreateProcessRequest("SQR Process", &SQR_TO_PROCESS);
/* Set Properties of the Process Request Object; */
REM CreateProccessRequest function takes these 2 arguments - Process Type and the Process Name;
&PRCSRQST.RunControlID = "JAN07";
&PRCSRQST.SetOutputOption("Web", "PDF", "", &SQR_TO_PROCESS);
/* Schedule the SQR */
&PRCSRQST.Schedule();
If &PRCSRQST.Status = 0 then
/* Schedule successful. */
Else
/* Process (job) not scheduled, do error processing */
End-If;
Similarly, Crystal Reports can be run via peoplecode but what has to be made sure is a PROCESS DEFINITION must be added as Crystal Reports.
Below is the sample code to run a sqr through peoplecode by creating a process and scheduling it.
/* Declare a ProcessRequest object */
Local ProcessRequest &PRCSRQST;
/* Declare name of the sqr JAN_PRCS to be processed */
Local String &SQR_TO_PROCESS;
&SQR_TO_PROCESS = "JAN_PRCS"
/* Create a Process Request Object; */
&PRCSRQST = CreateProcessRequest("SQR Process", &SQR_TO_PROCESS);
/* Set Properties of the Process Request Object; */
REM CreateProccessRequest function takes these 2 arguments - Process Type and the Process Name;
&PRCSRQST.RunControlID = "JAN07";
&PRCSRQST.SetOutputOption("Web", "PDF", "", &SQR_TO_PROCESS);
/* Schedule the SQR */
&PRCSRQST.Schedule();
If &PRCSRQST.Status = 0 then
/* Schedule successful. */
Else
/* Process (job) not scheduled, do error processing */
End-If;
Similarly, Crystal Reports can be run via peoplecode but what has to be made sure is a PROCESS DEFINITION must be added as Crystal Reports.
No comments
Please refrain for marketing messages and unnecessary back links.