May 28, 2008

Submitting Concurrrent Request through Procedure

Hi All,

This article will help you to understand how to submit a Concurrent Request through a stored procedure.

Few important points to analyze before proceeding are:

  • What parameters we need to pass to the Concurrent Request?
  • The User or Session information that we will pass
  • We will use FND_REQUEST.SUBMIT_REQUEST Standard API for submitting the requests through the Procedure
  • We need to initialize the Global Session Variables using FND_GLOBAL.APPS_INITIALIZE Standard API
  • Remember that Submit_request is a function and returns a value. Value is the Concurrent Request ID
The Work:

CREATE OR REPLACE PROCEDURE jith_test AS
--Define 3 Variables for holding User Id, Program Application ID, Responsibility ID
v_user NUMBER := fnd_profile.VALUE ('USER_ID');
v_appl VARCHAR2 (20);
v_resp VARCHAR2 (40);

v_user_name FND_USER.USER_NAME%TYPE;
v_req_id FND_CONCURRENT_REQUESTS.REQUEST_ID%TYPE;

UNKNOWN EXCEPTION;

BEGIN

--Get the Program Application ID
SELECT application_id
INTO v_appl
FROM fnd_application
WHERE application_short_name = 'PO';

--Get the Program Responsibility Application ID
SELECT responsibility_id
INTO v_resp
FROM fnd_application fa, fnd_responsibility_vl fr
WHERE fa.application_short_name = 'PO'
AND fa.application_id = fr.application_id
AND fr.responsibility_key = 'PURCHASING_OPERATIONS';

SELECT user_name
INTO v_user_name
FROM fnd_user
WHERE user_id = v_user;

FND_GLOBAL.APPS_INITIALIZE(v_user, v_resp, v_appl);

v_req_id :=
FND_REQUEST.SUBMIT_REQUEST (application => 'PO',
program => 'POXPOSTD',
description => 'Purchase Order Detail Report',
argument1 => '',
argument2 => '',
argument3 => '',
argument4 => '',
argument5 => 201,
argument6 => '',
argument7 => '',
argument8 => '',
argument9 => '',
argument10 => '',
argument11 => '',
argument12 => '',
argument13 => 2
);
COMMIT;

IF(v_req_id=0) THEN
DBMS_OUTPUT.PUT_LINE('Request not submitted, raising exception');
RAISE UNKNOWN;
ELSE
DBMS_OUTPUT.PUT_LINE('Request ID: '||v_req_id||' was submitted');
END IF;

EXCEPTION
WHEN UNKNOWN THEN
ROLLBACK;
END;

The Screens:






By for now! Will be back with more articles!

Yours,
Jithendra

No comments:

Post a Comment

Comments or feed backs please