Oracle has provided the feasibility to submit a concurrent
request from backend using "fnd_request.submit_request" API.
Before submitting the API we need to set the environment and
this can be done using "fnd_global.apps_initialize"
Here is a sample code to submit a concurrent program from PL/SQL
Note:- This code is to
submit a Concurrent Program, not the Request Set. To Submit the Request Set
from the backend, We have a different API.
/*********************************************************
*PURPOSE: To Submit a
Concurrent Request from backend *
*AUTHOR: Ragul Halan *
**********************************************************/
--
DECLARE
l_responsibility_id NUMBER;
l_resp_application_id NUMBER;
l_security_group_id NUMBER;
l_user_id NUMBER;
l_request_id NUMBER;
BEGIN
--
-- Get the apps environment
variables --
--
SELECT user_id, responsibility_id,
responsibility_application_id,
security_group_id
INTO l_user_id, l_responsibility_id, l_resp_application_id,
l_security_group_id
FROM fnd_user_resp_groups
WHERE user_id = (SELECT user_id
FROM fnd_user
WHERE user_name = '&USER_NAME')
AND
responsibility_id =
(SELECT responsibility_id
FROM fnd_responsibility_vl
WHERE responsibility_name = '&RESP_NAME');
--
--To set environment context.
--
apps.fnd_global.apps_initialize (l_user_id,
l_responsibility_id,
l_resp_application_id
);
--
--Submitting Concurrent
Request
--
l_request_id :=
fnd_request.submit_request (application => 'XXCUST', -- Application Short Name
program => 'XX_DEPT_DTLS', -- Program Short Name
description => 'XX_DESCRIPTION', -- Any Meaningful Description
start_time => SYSDATE, -- Start Time
sub_request => FALSE, -- Subrequest Default False
argument1 => 'Accounting' -- Parameters Starting
);
--
COMMIT;
--
IF l_request_id = 0
THEN
DBMS_OUTPUT.put_line
('Concurrent request failed to
submit');
ELSE
DBMS_OUTPUT.put_line
('Successfully Submitted the
Concurrent Request: '||l_request_id);
END IF;
--
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line
( 'Error While Submitting Concurrent Request '
|| TO_CHAR (SQLCODE)
|| '-'
|| SQLERRM
);
END;
/
For any suggestion or issues with the above code, please
leave your comments. I will try to reply back as soon as possible.
Hi Jennifer,
ReplyDeleteCan't we pass different parameters let's sat for argument 1 I have to pass 100 records and argument 2 as well..do you have any scripts