submit request output eamil to user
declare
l_conc_id number;
l_boolean boolean := TRUE;
e_add_del exception;
e_add_layout exception;
e_set_option exception;
e_set_repeat exception;
begin
-- intialize the apps.
-- fnd_global.apps_initialize (10275, 52373, 222);
fnd_global.apps_initialize (10275, 51953, 222);
-- Adding delivery option to send the request output as email
l_boolean := fnd_request.add_delivery_option
(type => 'E' -- this one to speciy the delivery option as email
,p_argument1 => 'Delivery Option Test' -- subject for the mail
,p_argument2 => '100385@senao.com' -- from address
,p_argument3 => 'vicky.wu@senao.com' -- to address
,p_argument4 => '' -- cc address to be specified here.
,nls_language => ''); -- Optional
/* -- Adding delivery option to FTP the request output
l_boolean := fnd_request.add_delivery_option
(type => 'T' -- this one to specify the delivery option as FTP
,p_argument1 => 'uatdev.6auconsulting.com' – Server Name/IP address
,p_argument2 => 'oradev' – Unix Box User
,p_argument3 => 'oradevpass' -- Password
,p_argument4 => '/appl/UAT/apps/apps_st/comn/admin/XXAK/data/Test/' – Directory Path
,nls_language => ''); -- Optional */
-- Adding Template to the request
if l_boolean then
l_boolean := fnd_request.add_layout
(template_appl_name => 'AR'
,template_code => 'AR_R_5005_XML'
,template_language => 'en' -- English
,template_territory => null
,output_format => 'PDF'
);
else
raise e_add_del;
end if;
if l_boolean then
l_boolean := fnd_request.set_options ('YES');
else
raise e_add_layout;
end if;
/*
-- Scheduling the request
if l_boolean then
l_boolean :=fnd_request.set_repeat_options
(repeat_time => null--to_char(sysdate,'hh24:mi:ss'),
,repeat_interval => 2 --Applies only when releat_time is null
,repeat_unit => 'MINUTES'--Applies only when releat_time is null
,repeat_type => 'START' --Applies only when releat_time is null
--,repeat_end_time =>
--,increment_dates => 'Y'-- Increment the date parameters for next run
);
else
raise e_set_option;
end if;
*/
if l_boolean then
l_conc_id := fnd_request.submit_request
(application => 'AR'--'XXAK'
,program => 'AR_R_5005' -- short name
,start_time => null
,sub_request => null
,argument1 => '204',--'224' -- P_ORG_ID
,argument2 => '205',--'223' -- P_ORGANIZATION_ID
,argument3 => '446906'--'207180' -- P_DELIVERY_ID
);
else
raise e_set_repeat;
end if;
if l_conc_id > 0 then
dbms_output.put_line('Concurrent Program Id: '||l_conc_id);
else
dbms_output.put_line('Error: submit_request');
end if;
commit;
exception
when e_add_del then
dbms_output.put_line('Error: add_delivery_option');
when e_add_layout then
dbms_output.put_line('Error: add_layout');
when e_set_option then
dbms_output.put_line('Error: set_options');
when e_set_repeat then
dbms_output.put_line('Error: set_repeat_options' );
when others then
dbms_output.put_line('Error: '||sqlerrm);
end;
l_conc_id number;
l_boolean boolean := TRUE;
e_add_del exception;
e_add_layout exception;
e_set_option exception;
e_set_repeat exception;
begin
-- intialize the apps.
-- fnd_global.apps_initialize (10275, 52373, 222);
fnd_global.apps_initialize (10275, 51953, 222);
-- Adding delivery option to send the request output as email
l_boolean := fnd_request.add_delivery_option
(type => 'E' -- this one to speciy the delivery option as email
,p_argument1 => 'Delivery Option Test' -- subject for the mail
,p_argument2 => '100385@senao.com' -- from address
,p_argument3 => 'vicky.wu@senao.com' -- to address
,p_argument4 => '' -- cc address to be specified here.
,nls_language => ''); -- Optional
/* -- Adding delivery option to FTP the request output
l_boolean := fnd_request.add_delivery_option
(type => 'T' -- this one to specify the delivery option as FTP
,p_argument1 => 'uatdev.6auconsulting.com' – Server Name/IP address
,p_argument2 => 'oradev' – Unix Box User
,p_argument3 => 'oradevpass' -- Password
,p_argument4 => '/appl/UAT/apps/apps_st/comn/admin/XXAK/data/Test/' – Directory Path
,nls_language => ''); -- Optional */
-- Adding Template to the request
if l_boolean then
l_boolean := fnd_request.add_layout
(template_appl_name => 'AR'
,template_code => 'AR_R_5005_XML'
,template_language => 'en' -- English
,template_territory => null
,output_format => 'PDF'
);
else
raise e_add_del;
end if;
if l_boolean then
l_boolean := fnd_request.set_options ('YES');
else
raise e_add_layout;
end if;
/*
-- Scheduling the request
if l_boolean then
l_boolean :=fnd_request.set_repeat_options
(repeat_time => null--to_char(sysdate,'hh24:mi:ss'),
,repeat_interval => 2 --Applies only when releat_time is null
,repeat_unit => 'MINUTES'--Applies only when releat_time is null
,repeat_type => 'START' --Applies only when releat_time is null
--,repeat_end_time =>
--,increment_dates => 'Y'-- Increment the date parameters for next run
);
else
raise e_set_option;
end if;
*/
if l_boolean then
l_conc_id := fnd_request.submit_request
(application => 'AR'--'XXAK'
,program => 'AR_R_5005' -- short name
,start_time => null
,sub_request => null
,argument1 => '204',--'224' -- P_ORG_ID
,argument2 => '205',--'223' -- P_ORGANIZATION_ID
,argument3 => '446906'--'207180' -- P_DELIVERY_ID
);
else
raise e_set_repeat;
end if;
if l_conc_id > 0 then
dbms_output.put_line('Concurrent Program Id: '||l_conc_id);
else
dbms_output.put_line('Error: submit_request');
end if;
commit;
exception
when e_add_del then
dbms_output.put_line('Error: add_delivery_option');
when e_add_layout then
dbms_output.put_line('Error: add_layout');
when e_set_option then
dbms_output.put_line('Error: set_options');
when e_set_repeat then
dbms_output.put_line('Error: set_repeat_options' );
when others then
dbms_output.put_line('Error: '||sqlerrm);
end;
留言
張貼留言