API For Calling Layout :
1.fnd_request.add_layout
CREATE OR REPLACE procedure APPSLSPO_Calling_Templates1(ERRBUFF OUT VARCHAR,RETCODE OUT NUMBER,p_report_type in varchar2,
P_agent_id in number,
P_po_num_from in varchar2,
P_po_num_to in varchar2,
P_release_num_from in varchar2,
P_release_num_to in varchar2,
P_date_from in date,
P_date_to in date,
P_approved_flag in varchar2,
P_test_flag in varchar2,
P_print_releases varchar2,
P_sortby in varchar2,
P_user_id in number,
P_qty_precision in number,
--P_terms_conditions in varchar2,
p_currency in varchar2)
as
lc_boolean BOOLEAN;
l_responsibility_id pls_integer :=fnd_global.resp_id;
l_application_id pls_integer :=fnd_global.resp_appl_id;
l_user_id pls_integer :=fnd_global.user_id;
l_request_id NUMBER;
l_po_number varchar2(50):=P_po_num_from;
l_layout BOOLEAN;
l_currency_code varchar2(10);
l_org_id number;
L_PHASE VARCHAR2 (240);
L_STATUS VARCHAR2 (240);
L_REQUEST_PHASE VARCHAR2 (240);
L_REQUEST_STATUS VARCHAR2 (240);
L_FINISHED BOOLEAN;
L_MESSAGE VARCHAR2 (240);
begin
begin
select currency_code into l_currency_code from po_headers_all where segment1=l_po_number and org_id=fnd_profile.value('ORG_ID');
select org_id into l_org_id from po_headers_all where segment1=l_po_number and org_id=fnd_profile.value('ORG_ID');
--SELECT DISTINCT fr.responsibility_id,
-- frx.application_id
-- INTO l_responsibility_id,
-- l_application_id
-- FROM apps.fnd_responsibility frx,
-- apps.fnd_responsibility_tl fr
-- WHERE fr.responsibility_id = frx.responsibility_id
-- AND LOWER (fr.responsibility_name) LIKE LOWER('NG PO Superuser');
-- SELECT user_id INTO l_user_id FROM fnd_user WHERE user_name = '1232380819';
apps.fnd_global.apps_initialize (l_user_id,l_responsibility_id,l_application_id);
FND_FILE.PUT_LINE(FND_FILE.LOG,l_currency_code);
FND_FILE.PUT_LINE(FND_FILE.LOG,l_org_id);
if l_org_id=5605 then
FND_FILE.PUT_LINE(FND_FILE.LOG,'org_id:5605');
If p_currency='English' then
--dbms_output.put_line('calling application');
FND_FILE.PUT_LINE(FND_FILE.LOG,'Calling English Layout');
l_layout := fnd_request.add_layout(
template_appl_name => 'BTVL',
template_code => 'LSCUSPOXPRPOP',
template_language => 'en',
template_territory => 'US',
output_format => 'PDF');
else
FND_FILE.PUT_LINE(FND_FILE.LOG,'Calling French Layout');
l_layout := fnd_request.add_layout(
template_appl_name => 'BTVL',
template_code => 'LSCUSPOXPRPOP',
template_language => 'en',
template_territory => 'US',
output_format => 'PDF');
end if;
end if;
COMMIT;
If l_org_id !=5605 then
FND_FILE.PUT_LINE(FND_FILE.LOG,'org_id not in 54505');
------------------------------Working Fine----------------------------
If p_currency is null then
FND_FILE.PUT_LINE(FND_FILE.LOG,'calling Layout');
if l_currency_code in ('MGA','CDF','XAF') then
--dbms_output.put_line('calling application');
FND_FILE.PUT_LINE(FND_FILE.LOG,'Calling French Layout');
l_layout := fnd_request.add_layout(
template_appl_name => 'BTVL',
template_code => 'LSCUSPOXPRPOP',
template_language => 'en',
template_territory => 'US',
output_format => 'PDF');
else
FND_FILE.PUT_LINE(FND_FILE.LOG,'Calling English Layout');
l_layout := fnd_request.add_layout(
template_appl_name => 'BTVL',
template_code => 'LSXPRPOP11',
template_language => 'en',
template_territory => 'US',
output_format => 'PDF');
-- dbms_output.put_line('no template');
commit;
end if;
end if;
------------------------End IF -------------------------
-------- New If -------
If p_currency='English' then
FND_FILE.PUT_LINE(FND_FILE.LOG,'user selected language parameter');
--dbms_output.put_line('calling application');
FND_FILE.PUT_LINE(FND_FILE.LOG,'Calling English Layout parameter');
l_layout := fnd_request.add_layout(
template_appl_name => 'BTVL',
template_code => 'LSXPRPOP11',
template_language => 'en',
template_territory => 'US',
output_format => 'PDF');
else
FND_FILE.PUT_LINE(FND_FILE.LOG,'Calling French Layout Parameter');
l_layout := fnd_request.add_layout(
template_appl_name => 'BTVL',
template_code => 'LSCUSPOXPRPOP',
template_language => 'en',
template_territory => 'US',
output_format => 'PDF');
end if;
COMMIT;
end if;
----end if ------
FND_FILE.PUT_LINE(FND_FILE.LOG,'calling MAIN PROGRAM');
l_request_id := fnd_request.submit_request ('BTVL', -- application
'LSMGCUSPOXPRPOP',-- program short name
'', -- description
TO_CHAR (NULL), -- start time
FALSE, -- sub request
p_report_type, -- argument1
P_agent_id, -- argument2
l_po_number, -- argument3
l_po_number, -- argument4
P_release_num_from, -- argument5
P_release_num_to, -- argument6
P_date_from , -- argument7
P_date_to , -- argument8
P_approved_flag , -- argument9 --y
P_test_flag, -- argument10
P_print_releases, -- argument11 --y
P_sortby, -- argument12
P_user_id, -- argument13
P_qty_precision -- argument14
-- P_terms_conditions -- argument15
);
COMMIT;
-- IF L_REQUEST_ID > 0
-- THEN
-- L_FINISHED :=
-- FND_CONCURRENT.WAIT_FOR_REQUEST
-- (REQUEST_ID => L_REQUEST_ID,
-- INTERVAL => 30,
-- MAX_WAIT => 60,
-- PHASE => L_PHASE,
-- STATUS => L_STATUS,
-- DEV_PHASE => L_REQUEST_PHASE,
-- DEV_STATUS => L_REQUEST_STATUS,
-- MESSAGE => L_MESSAGE
-- );
-- IF (UPPER (L_REQUEST_STATUS) = 'NORMAL')
-- THEN
UPDATE apps.fnd_concurrent_requests set PARENT_REQUEST_ID=l_request_id
where request_id=l_request_id-1;
-- END IF;
-- END IF;
-- end if;
commit;
end;
end;
/
1.fnd_request.add_layout
CREATE OR REPLACE procedure APPSLSPO_Calling_Templates1(ERRBUFF OUT VARCHAR,RETCODE OUT NUMBER,p_report_type in varchar2,
P_agent_id in number,
P_po_num_from in varchar2,
P_po_num_to in varchar2,
P_release_num_from in varchar2,
P_release_num_to in varchar2,
P_date_from in date,
P_date_to in date,
P_approved_flag in varchar2,
P_test_flag in varchar2,
P_print_releases varchar2,
P_sortby in varchar2,
P_user_id in number,
P_qty_precision in number,
--P_terms_conditions in varchar2,
p_currency in varchar2)
as
lc_boolean BOOLEAN;
l_responsibility_id pls_integer :=fnd_global.resp_id;
l_application_id pls_integer :=fnd_global.resp_appl_id;
l_user_id pls_integer :=fnd_global.user_id;
l_request_id NUMBER;
l_po_number varchar2(50):=P_po_num_from;
l_layout BOOLEAN;
l_currency_code varchar2(10);
l_org_id number;
L_PHASE VARCHAR2 (240);
L_STATUS VARCHAR2 (240);
L_REQUEST_PHASE VARCHAR2 (240);
L_REQUEST_STATUS VARCHAR2 (240);
L_FINISHED BOOLEAN;
L_MESSAGE VARCHAR2 (240);
begin
begin
select currency_code into l_currency_code from po_headers_all where segment1=l_po_number and org_id=fnd_profile.value('ORG_ID');
select org_id into l_org_id from po_headers_all where segment1=l_po_number and org_id=fnd_profile.value('ORG_ID');
--SELECT DISTINCT fr.responsibility_id,
-- frx.application_id
-- INTO l_responsibility_id,
-- l_application_id
-- FROM apps.fnd_responsibility frx,
-- apps.fnd_responsibility_tl fr
-- WHERE fr.responsibility_id = frx.responsibility_id
-- AND LOWER (fr.responsibility_name) LIKE LOWER('NG PO Superuser');
-- SELECT user_id INTO l_user_id FROM fnd_user WHERE user_name = '1232380819';
apps.fnd_global.apps_initialize (l_user_id,l_responsibility_id,l_application_id);
FND_FILE.PUT_LINE(FND_FILE.LOG,l_currency_code);
FND_FILE.PUT_LINE(FND_FILE.LOG,l_org_id);
if l_org_id=5605 then
FND_FILE.PUT_LINE(FND_FILE.LOG,'org_id:5605');
If p_currency='English' then
--dbms_output.put_line('calling application');
FND_FILE.PUT_LINE(FND_FILE.LOG,'Calling English Layout');
l_layout := fnd_request.add_layout(
template_appl_name => 'BTVL',
template_code => 'LSCUSPOXPRPOP',
template_language => 'en',
template_territory => 'US',
output_format => 'PDF');
else
FND_FILE.PUT_LINE(FND_FILE.LOG,'Calling French Layout');
l_layout := fnd_request.add_layout(
template_appl_name => 'BTVL',
template_code => 'LSCUSPOXPRPOP',
template_language => 'en',
template_territory => 'US',
output_format => 'PDF');
end if;
end if;
COMMIT;
If l_org_id !=5605 then
FND_FILE.PUT_LINE(FND_FILE.LOG,'org_id not in 54505');
------------------------------Working Fine----------------------------
If p_currency is null then
FND_FILE.PUT_LINE(FND_FILE.LOG,'calling Layout');
if l_currency_code in ('MGA','CDF','XAF') then
--dbms_output.put_line('calling application');
FND_FILE.PUT_LINE(FND_FILE.LOG,'Calling French Layout');
l_layout := fnd_request.add_layout(
template_appl_name => 'BTVL',
template_code => 'LSCUSPOXPRPOP',
template_language => 'en',
template_territory => 'US',
output_format => 'PDF');
else
FND_FILE.PUT_LINE(FND_FILE.LOG,'Calling English Layout');
l_layout := fnd_request.add_layout(
template_appl_name => 'BTVL',
template_code => 'LSXPRPOP11',
template_language => 'en',
template_territory => 'US',
output_format => 'PDF');
-- dbms_output.put_line('no template');
commit;
end if;
end if;
------------------------End IF -------------------------
-------- New If -------
If p_currency='English' then
FND_FILE.PUT_LINE(FND_FILE.LOG,'user selected language parameter');
--dbms_output.put_line('calling application');
FND_FILE.PUT_LINE(FND_FILE.LOG,'Calling English Layout parameter');
l_layout := fnd_request.add_layout(
template_appl_name => 'BTVL',
template_code => 'LSXPRPOP11',
template_language => 'en',
template_territory => 'US',
output_format => 'PDF');
else
FND_FILE.PUT_LINE(FND_FILE.LOG,'Calling French Layout Parameter');
l_layout := fnd_request.add_layout(
template_appl_name => 'BTVL',
template_code => 'LSCUSPOXPRPOP',
template_language => 'en',
template_territory => 'US',
output_format => 'PDF');
end if;
COMMIT;
end if;
----end if ------
FND_FILE.PUT_LINE(FND_FILE.LOG,'calling MAIN PROGRAM');
l_request_id := fnd_request.submit_request ('BTVL', -- application
'LSMGCUSPOXPRPOP',-- program short name
'', -- description
TO_CHAR (NULL), -- start time
FALSE, -- sub request
p_report_type, -- argument1
P_agent_id, -- argument2
l_po_number, -- argument3
l_po_number, -- argument4
P_release_num_from, -- argument5
P_release_num_to, -- argument6
P_date_from , -- argument7
P_date_to , -- argument8
P_approved_flag , -- argument9 --y
P_test_flag, -- argument10
P_print_releases, -- argument11 --y
P_sortby, -- argument12
P_user_id, -- argument13
P_qty_precision -- argument14
-- P_terms_conditions -- argument15
);
COMMIT;
-- IF L_REQUEST_ID > 0
-- THEN
-- L_FINISHED :=
-- FND_CONCURRENT.WAIT_FOR_REQUEST
-- (REQUEST_ID => L_REQUEST_ID,
-- INTERVAL => 30,
-- MAX_WAIT => 60,
-- PHASE => L_PHASE,
-- STATUS => L_STATUS,
-- DEV_PHASE => L_REQUEST_PHASE,
-- DEV_STATUS => L_REQUEST_STATUS,
-- MESSAGE => L_MESSAGE
-- );
-- IF (UPPER (L_REQUEST_STATUS) = 'NORMAL')
-- THEN
UPDATE apps.fnd_concurrent_requests set PARENT_REQUEST_ID=l_request_id
where request_id=l_request_id-1;
-- END IF;
-- END IF;
-- end if;
commit;
end;
end;
/
No comments:
Post a Comment