Submitting a concurrent request from a FORM module through button click....
Required:
FNDCONC.pll attached to custom form
with
when-button-pressed trigger, attach the following code (Please remove what is
not applicable in your case)
Declare
l_ord_num
NUMBER := 0;
l_ord_type_name VARCHAR2 (240);
l_req_id_Rep
NUMBER;
l_request_completed BOOLEAN := FALSE;
l_req_phase
VARCHAR2 (20);
l_req_status
VARCHAR2 (1000);
l_req_dev_phase VARCHAR2
(1000);
l_req_dev_status VARCHAR2 (1000);
l_req_message
VARCHAR2 (1000);
l_conc_mgr_status NUMBER;
p_call_stat
NUMBER;
p_activep_stat NUMBER;
l_order_category_code NUMBER;
l_inv_report_name VARCHAR2 (40);
l_ret_report_name VARCHAR2 (40);
l_req_id
NUMBER;
l_order_type_name
VARCHAR2(30);
Begin
l_req_id :=
fnd_request.submit_request (‘ONT’,—Actual application short name
l_inv_report_name,—Short name of concurrent program, please note this is not
the executable name
NULL,—Description not required
SYSDATE,—start time, not required
FALSE,—subsequent report name, not required
/*You
can pass a total of 100 parameters, just make sure to pass them in the same
order you have defined them in the parameter session for the concurrent
program*/
:ORDERS.OE_ORDER_NUMBER,
l_order_type_name,
NULL,
NULL,
apps.fnd_profile.VALUE (‘ORG_ID’));
:SYSTEM.Message_Level
:= ’25′;
COMMIT;
l_request_completed :=
fnd_concurrent.wait_for_request (request_id => l_req_id,
INTERVAL => 1,
phase => l_req_phase,
status => l_req_status,
dev_phase => l_req_dev_phase,
dev_status => l_req_dev_status,
MESSAGE => l_req_message);
–
:SYSTEM.Message_Level := ’25′;
COMMIT;
:SYSTEM.Message_Level
:= ’0’;
editor_pkg.report (l_req_id, ‘Y’);
/*for
displaying the pdf automatically with a new window or tab after the concurrent
request completes successfully*/
END;
Submit
concurrent program FND_REQUEST.SUBMIT_REQUEST along with XML Publisher layout
and printer options
FND_REQUEST.SUBMIT_REQUEST
submits concurrent request to be processed by a concurrent manager.
Using submit_request will only submits the program and will
not attach any layout or print option. Code below will help to set XMLpublisher template/layout along with print option.
*****Add_layout
and Add_printer procedures are optional in calling submit_request. Use only if
you need to set them.
Layout is
submitted to a concurrent request using below procedure
fnd_request.add_layout
(
template_appl_name => 'Template Application',
template_code => 'Template Code',
template_language => 'en', --Use language from template
definition
template_territory => 'US', --Use territory from template
definition
output_format => 'PDF' --Use
output format from template definition
);
Setting
printer while submitting concurrent program
fnd_submit.set_print_options
(printer => lc_printer_name
,style => 'PDF Publisher'
,copies => 1
);
fnd_request.add_printer
(
printer => printer_name,
copies => 1);
DECLARE
lc_boolean BOOLEAN;
ln_request_id NUMBER;
lc_printer_name VARCHAR2 (100);
lc_boolean1 BOOLEAN;
lc_boolean2 BOOLEAN;
BEGIN
-- Initialize Apps
fnd_global.apps_initialize (>USER_ID<
,>RESP_ID<
,>RESP_APPL_ID<
);
-- Set printer options
lc_boolean :=
fnd_submit.set_print_options (printer =>
lc_printer_name
,style => 'PDF Publisher'
,copies => 1
);
--Add printer
lc_boolean1 :=
fnd_request.add_printer (printer =>
lc_printer_name
,copies => 1);
--Set Layout
lc_boolean2 :=
fnd_request.add_layout (
template_appl_name => 'Template Application',
template_code => 'Template Code',
template_language => 'en', --Use language from template
definition
template_territory => 'US', --Use territory from template
definition
output_format => 'PDF' --Use
output format from template definition
);
ln_request_id :=
fnd_request.submit_request ('FND',
-- application
'COCN_PGM_SHORT_NAME',-- program short name
'',
-- description
'',
-- start time
FALSE,
-- sub request
'Argument1', -- argument1
'Argument2', -- argument2
'N',
-- argument3
NULL,
-- argument4
NULL,
-- argument5
'Argument6', -- argument6
CHR (0)
-- represents end of arguments
);
COMMIT;
IF ln_request_id = 0
THEN
dbms.output.put_line ('Concurrent request failed to submit');
END IF;
END;
No comments:
Post a Comment