REQUIREMENT : To submit a concurrent program from back-end(database client)
CASE STUDY : Oracle EBS, is a powerful enterprise business suite and it uses a concurrent manager to execute multiple concurrent programs at the same time. While testing for one of my modules today, I realized that it becomes a tedious job when you have to raise a concurrent program again and again just to test a small change in your code.
However it is very easy to raise a concurrent program from back-end, with one time setup. And all you have to do to raise a concurrent program, is compile the PL/SQL code.
APPROACH :
We use the Oracle standard API fnd_request.submit_request to submit a concurrent request. But before using the above API, we need to setup the environment selective to our concurrent program (like Responsibility, User ID, etc) using fnd_global.apps_initialize.
You can use the following PL/SQL code to submit a concurrent program from back-end, after changing the values of the variables as per your requirement.
/********************************************************* * PURPOSE: Submitting a Concurrent Request from backend * * AUTHOR: Anirudh Sethi * **********************************************************/ SET SERVEROUTPUT ON; DECLARE ln_responsibility_id NUMBER; ln_application_id NUMBER; ln_user_id NUMBER; ln_request_id NUMBER; BEGIN SELECT DISTINCT fr.responsibility_id, frx.application_id INTO ln_responsibility_id, ln_application_id FROM apps.fnd_responsibility frx, apps.fnd_responsibility_tl fr WHERE fr.responsibility_id = frx.responsibility_id AND UPPER (fr.responsibility_name) LIKE UPPER('RESPONSIBILITY NAME'); SELECT user_id INTO ln_user_id FROM fnd_user WHERE user_name = 'USER_NAME'; --To setup environment. apps.fnd_global.apps_initialize (ln_user_id,ln_responsibility_id,ln_application_id); --Submitting Concurrent Request ln_request_id := fnd_request.submit_request ( application => 'APPLICATION_SHORT_NAME', program => 'PROGRAM_SHORT_NAME', description => 'Concurrent Program Name', start_time => sysdate, sub_request => FALSE, argument1 => 'PARAMETER_VALUE' --(if applicable) ); COMMIT; IF ln_request_id = 0 THEN dbms_output.put_line ('Concurrent request failed to submit'); ELSE dbms_output.put_line('Successfully Submitted the Concurrent Request'); END IF; EXCEPTION WHEN OTHERS THEN dbms_output.put_line('Error While Submitting Concurrent Request ' ||TO_CHAR(SQLCODE)||'-'||sqlerrm); END; / |