In my previous post I have explained about how can we make the parent concurrent program wait for all the child programs to complete. In this one I thought of giving an example of how to submit a concurrent program from the back-end and wait for the completion of that.
DECLARE v_request_id NUMBER; v_req_return_status BOOLEAN; v_phase VARCHAR2(100); v_status VARCHAR2(100); v_dev_phase VARCHAR2(100); v_dev_status VARCHAR2(100); v_message VARCHAR2(100); BEGIN --Initialize the session with appropirate values fnd_global.apps_initialize (user_id=>100 ,resp_id=>100 ,resp_appl_id=>100); --Submit the Request v_request_id := fnd_request.submit_request ( application => 'XXAJ' , program => 'XXAJ_CHILD' , start_time => SYSDATE , sub_request => FALSE); COMMIT; IF v_request_id = 0 THEN DBMS_OUTPUT.put_line('Request not submitted: '|| fnd_message.get); ELSE DBMS_OUTPUT.put_line('Request submitted successfully. Request id: ' || v_request_id); v_req_return_status := fnd_concurrent.wait_for_request (request_id => v_request_id ,INTERVAL => 2 --interval Number of seconds to wait between checks -- ,max_wait => 5 --Maximum number of seconds to wait for the request completion -- out arguments ,phase => v_phase ,status => v_status ,dev_phase => v_dev_phase ,dev_status => v_dev_status ,message => v_message ); DBMS_OUTPUT.put_line('Request status: ' || v_status); END IF; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.put_line('Exception: ' || SQLERRM); END;
Note:- If you want to wait only for x seconds, specify the value for the parameter max_wait.
Feel free to point out if anything is wrong/missing in this blog.
No comments:
Post a Comment