PeopleSoft NA Payroll or HCM Functional Training:

PeopleSoft NA Payroll or HCM Functional Training:

Please send email to nandu.peoplesoft@gmail.com for enrolling the course or call me @8897575066. Please see below HCM Functional training AGENDA.

Payroll for North America training AGENDA.

This is an online Functional Training. Training goes through webex and explain you with real time execution of processes with examples. Recordings and documentation will be given once the training is done.

Wednesday, October 17, 2012

Running an SQR from within your PeopleCode program



I am often asked a common question on launching other applications from within PeopleCode. Most of the time I am asked.. "How do I launch an SQR from within my PeopleCode program?"

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. Now, if you want to run any other type of program that is not an SQR, AppEngine, or Crystal I would highly suggest that you first setup a Process Definition for the type of application you are running and run it through the process scheduler. We'll table this discussion for another time