DECLARE
v_request_id NUMBER;
l_user_id apps.fnd_user.user_id%TYPE;
l_resp_id apps.fnd_responsibility.responsibility_id%TYPE;
l_appl_id apps.fnd_responsibility.application_id%TYPE;
l_user_name VARCHAR2 := 'MFG';
-- replace with valid username
l_resp_name VARCHAR2 := 'Purchasing';
-- replace with responsibility key/name
BEGIN
SELECT user_id
INTO l_user_id
FROM apps.fnd_user
WHERE user_name = l_user_name;
SELECT application_id, responsibility_id
INTO l_appl_id, l_resp_id
FROM apps.fnd_responsibility
WHERE responsibility_key = l_resp_name;
-- Initialize Context
FND_GLOBAL.APPS_INITIALIZE(l_user_id, l_resp_id, l_application_id, 0);
-- Initialize Multi-Org
MO_GLOBAL.SET_POLICY_CONTEXT('S','&ORG_ID');
-- Call API
-- v_request_id will be 0 if the API call fails, otherwise contains the
request_id
v_request_id := fnd_request.submit_request (
application => 'PO'
program => 'RVCTP',
description => 'Receiving Transaction Processor', --
OPTIONAL
start_time => NULL, --
OPTIONAL
sub_request => FALSE,
argument1 => 'BATCH', --
RVCTP Argument 1
argument2 => '', --
RVCTP Argument 2
argument3 => '', --
RVCTP Argument 3
argument4 => chr(0) --
after last non null argument, pass chr(0)
);
DBMS_OUTPUT.put_line ('Request submission returns request_id: ' || v_request_id);
-- Commit
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line ('Request submission failed: ' || SQLERRM);
END;
From file: AFCPREQS.pls
-- Name
-- submit_request
-- Purpose
-- Submits concurrent request to be processed by a concurrent manager
--
-- Arguments
-- application - Short name of application under which the program
-- - is registered
-- program - concurrent program name for which the request has
-- - to be submitted
-- description - Optional. Will be displayed along with user
-- - concurrent program name
-- start_time - Optional. Time at which the request has to start
-- - running
-- sub_request - Optional. Set to TRUE if the request is submitted
-- - from another running request and has to be treated
-- - as a sub request. Default is FALSE
-- argument1..100 - Optional. Arguments for the concurrent request
select application_short_name, application_name
from fnd_application_vl
where application_name = 'Purchasing';