在提交并发请求的时候,有些情况需要调用其他的并发程序去处理相应的事务,此时父并发请求进入等待状态,当子程序完成之后接着去处理其他的业务,为了实现这种情况需要使用到FUNCTION FND_CONCURRENT.WAIT_FOR_REQUEST 这个功能。
log('begin call Import Standard Purchase Orders');
l_request_id := fnd_request.submit_request('PO',
'POXPOPDOI',
'',
to_char(SYSDATE, 'YYYY/MM/DD HH24:MI:SS'),
FALSE,
NULL,
'STANDARD',
NULL,
'N',
NULL,
'INCOMPLETE', --'APPROVED',
NULL,
NULL,
lt_org_id,
NULL,
chr(0));
log(l_request_name || ' Interface Request Submmit.l_request_id=' || l_request_id);
COMMIT;--注意这个commit需要写上,不然会有问题
l_wait_req := fnd_concurrent.wait_for_request(request_id => p_request_id,
INTERVAL => 1,
max_wait => 1000,
phase => l_child_phase,
status => l_child_status,
dev_phase => l_dev_phase,
dev_status => l_dev_status,
message => l_message);
x_wait_req := l_wait_req;
x_dev_phase := l_dev_phase;
x_dev_status := l_dev_status;
x_message := l_message;
fnd_concurrent.wait_for_request 参考
Problem Description:
The following describes how to submit concurrent requests using PL/SQL and
have the parent request ‘wait’ until each of the child processes have
completed before it completes.
Search Words: WAIT_FOR_REQUEST phase status arguments interval
Solution Description:
When submitting concurrent requests using PL/SQL, it is often desired to have
the parent process wait until all the child processes have completed before
completing itself. The following describes the function used to accomplish
this.
Use the FND_CONCURRENT.WAIT_FOR_REQUEST function documented in the Oracle
Applications Developer’s Guide, RELEASE 11i, Page 21-8 See the FND_CONCURRENT.WAIT_FOR_REQUEST
function description.
Summary
FUNCTION FND_CONCURRENT.WAIT_FOR_REQUEST
(request_id IN number default NULL,
interval IN number default 60,
max_wait IN number default 0,
phase OUT varchar2,
status OUT varchar2,
dev_phase OUT varchar2,
dev_status OUT varchar2,
message OUT varchar2) return boolean;
Description
Wait for the request completion, then return the request phase/status and
completion message to the caller. Also call sleep between database checks.
Arguments (input)
request_id
The request ID of the program to wait on.
interval
Time to wait between checks. This is the number of seconds to sleep.
The default is 60 seconds.
max_wait
The maximum time in seconds to wait for the requests completion.
Arguments (output)
phase
The user friendly request phase from FND_LOOKUPS.
status
The user friendly request status from FND_LOOKUPS.
dev_phase
The request phase as a constant string that can be used for program
logic comparisons.
dev_status
The request status as a constant string that can be used for program
logic comparisons.
message
The completion message supplied if the request has completed.