Submit the Concurrent Program from Backend :-
We can submit a concurrent request from backend using fnd_request.submit_request API. Before submitting the API we need to set the environment context using fnd_global.apps_initialize.
The following is the Sample Code to Submit the Concurrent Program from the backend.
DECLARE
L_USER_ID NUMBER;
L_RESP_ID NUMBER;
L_RESP_APPL_ID NUMBER;
L_REQUEST NUMBER;
BEGIN
SELECT USER_ID,
RESPONSIBILITY_ID,
RESPONSIBILITY_APPLICATION_ID
INTO L_USER_ID,
L_RESP_ID,
L_RESP_APPL_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
WHERE RESPONSIBILITY_KEY = '&RESP_NAME'
);
FND_GLOBAL.APPS_INITIALIZE(
user_id => L_USER_ID, -- User ID
resp_id => L_RESP_ID, -- Responsibility Id
resp_appl_id => L_RESP_APPL_ID -- Responsibility Application Id
);
L_REQUEST :=
resp_id => L_RESP_ID, -- Responsibility Id
resp_appl_id => L_RESP_APPL_ID -- Responsibility Application Id
);
L_REQUEST :=
FND_REQUEST.SUBMIT_REQUEST(
APPLICATION => '&appl_short_name', -- Application Short Name
PROGRAM => '&cp_name',--Concurrent Program Short Name
DESCRIPTION => NULL -- Program Description
);
COMMIT;
IF L_REQUEST = 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;
PROGRAM => '&cp_name',--Concurrent Program Short Name
DESCRIPTION => NULL -- Program Description
);
COMMIT;
IF L_REQUEST = 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;
No comments:
Post a Comment