SQR's are already setup and defined as a Process Definition inside of your PeopleSoft application, so we will deal with how to launch an SQR. There are two ways of launching a program from within your PeopleCode programs. The first way is to make a system call to launch the SQRW.exe if you are on windows or the equivalent binary program if you are running on a UNIX operating system. However, this is not the best method.
Using the method to make a call to the system does not give you the control and integration that you desire with your PeopleSoft environment. Therefore, the best and safest way to launch an SQR program is to use the PeopleCode functions CreateProcessRequest() and Schedule().
The CreateProcessRequest function allows you to create a ProcessRequest object. Remember, you should be coding your PeopleCode programs using the Object Oriented methods. Once you've created your object, you can assign values to its properties and use the Schedule method to submit the process request for scheduling. The CreateProccessRequest function takes 2 arguments. The Process Type and the Process Name.
REM Declare your Variables;
Local ProcessRequest &MYRQST;
Local String &MySQR;
&MySQR = "DDDAUDIT"
REM Create My Process Request Object;
&MYRQST = CreateProcessRequest("SQR Process", &MySQR);
REM Set Properties of My Process Request Object;
&MYRQST.RunControlID = "MYRUNCNTRL_ID"
REM Set Properties of My Process Request Object;
&MYRQST.SetOutputOption("Web", "PDF", "", &MySQR);
The above example creates a ProcessRequest object for the DDDAUDIT SQR named &MYRQST. You will notice that I also specified Run Control ID and the output options. I can now take this Object and use the Schedule() method agains it to Schedule the SQR. Here is an example.
&MYRQST.Schedule();
If &MYRQST.Status = 0 then
/* Schedule succeeded. */
Else
/* Process (job) not scheduled, do error processing */
End-If;
That's how you run an SQR program from within your PeopleCode program
Search This Blog
Monday, September 14, 2009
Running an SQR from within your PeopleCode program
Subscribe to:
Post Comments (Atom)
cool and useful one ;)
ReplyDeletehow to pass customised run control parameter for sqr in Peoplecode?
ReplyDelete