After issuing the submission, you have to commit in order to get a returned value. Here is an example that I use to submit the seeded concurrent request REQIMPORT from PL/SQL:
BEGIN
-- Set System Options/Parameters to allow for successful concurrent request
-- submission of the Requisition Import
l_mode := APPS.FND_SUBMIT.SET_MODE(TRUE);
l_req_id := 0;
l_return_code := APPS.FND_REQUEST.SET_OPTIONS( 'N', 'N');
l_return_code := APPS.FND_REQUEST.SET_REPEAT_OPTIONS( '', '', '', '', '');
l_return_code := APPS.FND_REQUEST.SET_PRINT_OPTIONS( '', '', '', TRUE , '');
l_req_id := APPS.FND_REQUEST.SUBMIT_REQUEST('PO','REQIMPORT',NULL,NULL,FALSE,
'PO',NULL,'ALL',NULL,'Y','N',CHR(0),
'', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '', '', '',
'', '', '', '', '', '', '', '' );
COMMIT;
The empty values are for arguments that I am not passing to the submit request function. I believe these can be left out, but the documentation suggests that you should provide all 100 arguments in the call.
Once you have committed, you can then analyze the value of l_req_id to determine how to continue processing. The following is a continuation of the above code:
IF l_req_id > 0 THEN
l_conc_status := APPS.FND_CONCURRENT.WAIT_FOR_REQUEST
(request_id => l_req_id
,interval => 5 -- Sleep 5 seconds between checks.
,max_wait => 0 -- Wait indefinately.
,phase => l_phase
,status => l_status
,dev_phase => l_dev_phase
,dev_status => l_dev_status
,message => l_message
);
-- Test development status to determine how to proceed
IF l_dev_status = 'NORMAL' THEN
-- Set return code to "NORMAL":
retcode := 0;
ELSIF l_dev_status = 'WARNING' THEN
-- Store message and set return code to "WARNING":
errbuf := errbuf||'Request ID: '||l_req_id||' IMPORT_REQ_AND_AUTOCREATE_PO completed with WARNING status.';
errbuf := errbuf||CHR(10);
errbuf := errbuf||'Completion message from XXRI_PO_FY_EXPORT_PKG: ';
errbuf := errbuf||l_message;
errbuf := errbuf||CHR(10);
retcode := 1 ;
ELSIF l_dev_status IN ('ERROR','CANCELLED','TERMINATED') THEN
-- Store message and set return code to "ERROR":
errbuf := errbuf||'Request ID: '||l_req_id||' IMPORT_REQ_AND_AUTOCREATE_PO completed with '||l_dev_status||' status.';
errbuf := errbuf||CHR(10);
errbuf := errbuf||'Completion message from XXRI_PO_FY_EXPORT_PKG: ';
errbuf := errbuf||l_message;
errbuf := errbuf||CHR(10);
retcode := 2;
ELSE -- completed with unrecognized status:
-- Store message and set return code to "ERROR":
errbuf := errbuf||'Request ID: '||l_req_id||' IMPORT_REQ_AND_AUTOCREATE_PO completed with unrecognized status: '||l_dev_status;
errbuf := errbuf||CHR(10);
errbuf := errbuf||'Completion message from XXRI_PO_FY_EXPORT_PKG: ';
errbuf := errbuf||l_message;
errbuf := errbuf||CHR(10);
retcode := 2;
END IF;
ELSE
RAISE submission_error;
END IF;
I left out the declaration section, but I'm sure you can set yours appropriately.
Hope that helps,
Steve
|