Schedule SQR from App Engine

Global File &fileLog;
Local Record &Process_Rec;
Local ProcessRequest &RQST;

&fileLog.WriteLine("");

&fileLog.WriteLine("Generate Cashiering Entry for BU: " | RECORD_AET.BUSINESS_UNIT | ", CASHIER OFFICE: " | RECORD_AET.CASHIER_OFFICE);

/* Schedule the Generate Cashiering Entry Process */
&RQST = CreateProcessRequest();
&RQST.RunControlID = "DS";
&RQST.ProcessType = "SQR Report";
&RQST.ProcessName = "SFDPTREC";
&RQST.RunLocation = "PSNT";
&RQST.RunDateTime = %Datetime;
&RQST.Schedule();


/* Wait here for finished processing */
If &RQST.ProcessInstance <> 0 Then
&finished = False;

While Not &finished
/* Wait 10 seconds */
SQLExec("exec dbms_lock.sleep (10)");

&Process_Rec = CreateRecord(Record.PSPRCSRQST);
&Process_Rec.PRCSINSTANCE.Value = &RQST.ProcessInstance;
&Process_Rec.SelectByKey();

If &Process_Rec.RUNSTATUS.Value = "3" /* Error */ Or
&Process_Rec.RUNSTATUS.Value = "8" /* Cancelled */ Or
&Process_Rec.RUNSTATUS.Value = "9" /* Success */ Or
&Process_Rec.RUNSTATUS.Value = "10" Then /* Not Successful */
&finished = True;
End-If;
End-While;
End-If;

Comments