Running an SQR from within your PeopleCode program

Your rating: None Average: 4 (3 votes)

Therefore, the best and safest way to launch an SQR program is to use the People Code functions CreateProcessRequest() and Schedule(). The CreateProcessRequest function allows you to create a Process Request object. Remember, you should be coding your People Code 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 CreateProcessRequest 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 /* The process was Schedule successfully.
*/Else /*
Process was not scheduled, do to an 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.

Please try to help out with unanswered topics on the forum. Chances are you have had the same issue/question some time in your IT career!