Let us take a concurrent program "Subinventory quantities report" and run it in the front end. Check whether its executing successfully from the front end.
Login into the vision instance. (Username : OPERATIONS , Password : welcome )
Choose the "Inventory, Vision Operations (USA)" responsibility
Go to View -> Requests
Press "Submit a New Request"
Select "Single Request" and then press "OK"
Give the Request name as "Subinventory quantities report" and press TAB key
Give the parameters
Subinventory From : DropShip
Subinventory To : DropShip
Items From :
To :
Press OK and view the output for the report
Till now you successfully exectued a concurrent program from the front end.
Now we are going to see how this concurrent program can be executed in the back end
"fnd_request.submit_request" is used to execute the concurrent program from back end
before calling this function we need to initialize the Application from the back end.
"fnd_global.apps_initialize" is used to initialize the application from the back end.
procedure APPS_INITIALIZE(user_id in number,
resp_id in number,
resp_appl_id in number,
security_group_id in number default 0,
server_id in number default -1)
Argument : User_id
Its nothing but ID of the User in which the apps was logged in. Here we logged in as "OPERATIONS" as the user. To know
the user id of "OPERATIONS" we use the following query.
SELECT user_id FROM fnd_user WHERE user_name = 'OPERATIONS';
Arguemnt : resp_id
Its nothing but ID of the responsiblity which we selected. Here we are in "Inventory, Vision Operations (USA)" reponsibility.
select responsibility_id from fnd_responsibility_tl
where responsibility_name ='Inventory, Vision Operations (USA)'
If we know the resposbility short name, we can use the following query to get the responsiblity id.
select responsibility_id from fnd_responsibility
where responsibility_key='INVENTORY_VISION_OPERATIONS'
Argument : resp_appl_id
Its the ID for the application for which the responsibility was registered.
select application_id from fnd_responsibility_tl
where responsibility_name ='Inventory, Vision Operations (USA)'
select application_id from fnd_responsibility
where responsibility_key='INVENTORY_VISION_OPERATIONS'
function submit_request ( application IN varchar2 default NULL,
program IN varchar2 default NULL,
description IN varchar2 default NULL,
start_time IN varchar2 default NULL,
sub_request IN boolean default FALSE,
argument1 IN varchar2 default CHR(0),
argument2 IN varchar2 default CHR(0),
argument3 IN varchar2 default CHR(0),
.
.
argument100 IN varchar2 default CHR(0)) return number ;
Argument : application
Its the application to which the concurrent program was registered.
select fa.application_short_name
from fnd_application fa,fnd_concurrent_programs_tl fcp
where fa.application_id=fcp.application_id
and fcp.user_concurrent_program_name='Subinventory quantities report'
Argument : program
Its the short name of the concurrent program.
select fcp.concurrent_program_name
from fnd_concurrent_programs fcp,fnd_concurrent_programs_tl fcpt
where fcp.concurrent_program_id=fcpt.concurrent_program_id
and fcpt.user_concurrent_program_name='Subinventory quantities report'
Argument : description
Its the discription of the concurrent program. Its a optional parameter
select description from fnd_concurrent_programs_tl
where user_concurrent_program_name='Subinventory quantities report'
Argument : start_time
Its used for scheduled concurrent program. Its also a optional parameter
Argument : sub_request
Mostly FALSE
Argument : Argument1,Argument2,Argument3,.....Argument100
These are the parameters passed to the concurrent program. Some of the parameters were hiddend from the user as it
takes the value from profile.
To know the exact parameter values, check the previous concurrent program submission and check the parameter passed.
Otherwise open the Concurrent program from the application developer and see the parameter passed. Otherwise see the log file of the previously executed concurrent program
---log----
Arguments
------------
P_ORGANIZATION_ID='207'
P_QTY_PRECISION='2'
P_SUBINV_LO='DropShip'
P_SUBINV_HI='DropShip'
------------
---log----
In this case the arguments are
(tokens in the parameter window)
P_ORGANIZATION_ID (hidden)
P_QTY_PRECISION (hidden)
P_SUBINV_LO (optional)
P_SUBINV_HI (optional)
P_ITEM_LO (optional)
P_ITEM_HI (optional)
-------------------------------------------------------------------------------------------
Procedure to run the concurrent program from the back end
SET serveroutput on;
DECLARE
v_user_id NUMBER;
v_app_id NUMBER;
v_resp_id NUMBER;
v_req_id NUMBER;
v_exec_mode VARCHAR2 (1) := 'S';
BEGIN
SELECT user_id
INTO v_user_id
FROM fnd_user
WHERE user_name = 'OPERATIONS';
SELECT application_id
INTO v_app_id
FROM fnd_application
WHERE application_short_name = 'INV';
SELECT responsibility_id
INTO v_resp_id
FROM fnd_responsibility
WHERE application_id = v_app_id
AND responsibility_key = 'INVENTORY_VISION_OPERATIONS';
fnd_global.apps_initialize (v_user_id, v_resp_id, v_app_id);
v_req_id :=
fnd_request.submit_request (application => 'INV',
program => 'INVIRSIQ',
sub_request => FALSE,
argument1 => 207,
argument2 => 2,
argument3 => 'DropShip',
argument4 => 'DropShip',
argument5 => NULL,
argument6 => NULL
);
DBMS_OUTPUT.put_line ('Request_ID = ' || v_req_id);
COMMIT;
END;
-------------------------------------------------------------------------------------------