In my previous posts I have explained about how can we make the parent concurrent program wait for all the child programs to complete and how to submit a concurrent program from the backend periodically etc.... In this one I thought of giving an example of how to submit a concurrent program to run at a specific time.
Inorder to do that we just need to specify the 'start_date' parameter in the procedure fnd_request.submit_request. But the thing which we need to be careful is, this parameter is of type VARCHAR2. So if don't pass a date variable to this value, it will truncate the date and the time component will be removed. It will result in the program starting straight away if the date is on the same day or exactly 12:00 AM of the date (if the date is a future date). When you pass the parameter pass the date and time in the format 'DD-Mon-YYYY HH24:MI:SS'
A Sample can be like below. I have just added 3 hours to current date and converted into varchar using TO_CHAR function. You can also specify the time directly like '29-Jun-2021 10:00:00'
DECLARE v_request_id NUMBER; v_status BOOLEAN; 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_PROGRAM' , start_time => TO_CHAR(SYSDATE + 3/24,'DD-Mon-YYYY HH24:MI:SS') , 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); END IF; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.put_line('Exception: ' || SQLERRM); END;
Feel free to point out if anything is wrong/missing in this blog.
No comments:
Post a Comment