CREATE OR REPLACE PACKAGE XX_CONC_REQ_SUBMIT_PKG
IS
v_request_id fnd_concurrent_requests.request_id%type;
PROCEDURE XX_SUBMIT_INV_VOUCHER
(
p_org_id IN NUMBER,
--p_resp_name IN VARCHAR2,
p_inv_no IN VARCHAR2,
--p_invoice_date IN DATE,
p_doc_seq_value NUMBER,
p_created_by IN NUMBER
)
;
PROCEDURE XX_SUBMIT_PAYMENT_VOUCHER
(
p_org_id IN number,
p_created_by IN NUMBER,
p_vouch_no_v IN number,
p_check_no IN number
)
;
FUNCTION XX_RET_REQUEST_ID
RETURN NUMBER;
END XX_CONC_REQ_SUBMIT_PKG;
--------------------------------------------------------------------------------------------------------------------------
CREATE OR REPLACE PACKAGE BODY XX_CONC_REQ_SUBMIT_PKG
IS
----*****************-- Procedure for calling Invoice Voucher
PROCEDURE XX_SUBMIT_INV_VOUCHER
(
p_org_id IN NUMBER,
p_inv_no IN VARCHAR2,
p_doc_seq_value IN NUMBER,
p_created_by IN NUMBER
)
IS
x_user_id NUMBER;
x_appl_id NUMBER;
x_resp_id NUMBER;
X_LEDGER_ID NUMBER;
x_pos varchar2(50):='XXX';
V_LAYOUT BOOLEAN;
v_print_option boolean;
V_RDF_FILE VARCHAR2(200); -- ADDED ON 11-DEC-15
BEGIN
x_pos:='BEFORE USER';
SELECT user_id
INTO x_user_id
FROM FND_USER
WHERE user_id = p_created_by ;
x_pos:='AFTER USER';
select OU.set_of_books_id
into X_LEDGER_ID
from hr_operating_units OU
where OU.organization_id = p_org_id ;
SELECT application_id
INTO x_appl_id
FROM FND_APPLICATION
WHERE application_short_name = 'SQLAP';
x_pos:='AFTER APPLICATION';
FND_GLOBAL.APPS_INITIALIZE(x_user_id, x_resp_id, x_appl_id);
x_pos:= 'BEFORE API';
V_LAYOUT:= FND_SUBMIT.add_layout(template_appl_name => 'SQLAP'
,template_code => 'COAPN2'
,template_language => 'en'
,template_territory => 'US'
,output_format => 'PDF');
--commit;
IF V_LAYOUT = TRUE THEN
IF p_org_id=8 THEN
V_RDF_FILE:='APAPNB';
ELSIF p_org_id=85 THEN
V_RDF_FILE:='APAPNB';
ELSIF p_org_id=36 THEN
V_RDF_FILE:='APAPNB';
ELSIF p_org_id=29 THEN
V_RDF_FILE:='APAPNB';
ELSIF p_org_id=47 THEN
V_RDF_FILE:='APAPNB';
END IF;
v_print_option := fnd_request.set_print_options(printer => 'cheque'
--,style => 'A4'
,copies => 1
,save_output => TRUE
,print_together => 'N');
v_request_id := fnd_request.submit_request(application => 'SQLAP'
, program => V_RDF_FILE --'APAPNB'
, description => NULL
,start_time => SYSDATE
,sub_request => FALSE
, argument1 => p_org_id
, argument2 => NULL--p_invoice_date
, argument3 => NULL--p_invoice_date
, argument4 => p_doc_seq_value
, argument5 => p_doc_seq_value
, argument6 => NULL --p_inv_no
, argument7 => NULL --p_inv_no
, argument8 => NULL
, argument9 => NULL --
, argument10 => NULL --
, argument11 => NULL
, argument12 => X_LEDGER_ID --Ledger ID
);
--FND_REQUEST.add_layout(template_appl_name => 'SQLAP');
END IF;
x_pos:='AFTER API';
commit;
EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line(x_pos);
dbms_output.put_line(SQLERRM);
END;
---*****************-- Procedure for calling Payment Register
PROCEDURE XX_SUBMIT_PAYMENT_VOUCHER(
p_org_id IN number,
p_created_by IN number,
p_vouch_no_v IN number,
p_check_no IN number
)
IS
x_user_id NUMBER;
x_appl_id NUMBER;
x_resp_id NUMBER;
x_pos varchar2(50):='XXX';
--req_id NUMBER;
v_print_option boolean;
V_RDF_FILE VARCHAR2(200); -- ADDED ON 11-DEC-15
BEGIN
x_pos:='BEFORE USER';
SELECT user_id
INTO x_user_id
FROM FND_USER
WHERE user_id = p_created_by;
x_pos:='AFTER USER';
SELECT application_id
INTO x_appl_id
FROM FND_APPLICATION
WHERE application_short_name = 'SQLAP';
x_pos:='AFTER APPLICATION';
SELECT responsibility_id
INTO x_resp_id
FROM FND_APPLICATION fa, FND_RESPONSIBILITY_TL fr
WHERE fa.application_short_name = 'SQLAP' AND
fa.application_id = fr.application_id AND
fr.responsibility_name = 'AP Super User';
x_pos:='AFTER RESPONSIBILITY';
FND_GLOBAL.APPS_INITIALIZE(x_user_id, x_resp_id, x_appl_id);
x_pos:= 'BEFORE API';
IF p_org_id=82 THEN
V_RDF_FILE:='APAPV';
ELSIF p_org_id=185 THEN
V_RDF_FILE:='APAPV';
END IF;
v_print_option := fnd_request.set_print_options(printer => 'cheque'
,style => 'A4'
,copies => 1
,save_output => TRUE
,print_together => 'N');
v_request_id := fnd_request.submit_request(application => 'SQLAP'
, program => V_RDF_FILE -- 'PAPV'
, description => NULL
,start_time => NULL
,sub_request => FALSE
--
, argument1 => null
, argument2 => NULL
, argument3 => NULL
, argument4 => NULL
--
, argument5 => p_vouch_no_v
, argument6 => p_vouch_no_v
, argument7 => p_check_no
, argument8 => p_check_no
);
x_pos:='AFTER API';
commit;
EXCEPTION
WHEN OTHERS THEN
NULL;
END;
FUNCTION XX_RET_REQUEST_ID
RETURN NUMBER AS
BEGIN
RETURN v_request_id;
END XX_RET_REQUEST_ID;
END XX_CONC_REQ_SUBMIT_PKG;
----------------------------------------------------------------------------------------------------------------------
='
begin
XX_CONC_REQ_SUBMIT_PKG.XX_SUBMIT_INV_VOUCHER('''||:INV_SUM_FOLDER.ORG_ID||''', '''||:INV_SUM_FOLDER.INVOICE_NUM||''','''||:INV_SUM_FOLDER.DOC_SEQUENCE_VALUE||''','''||:PARAMETER.USER_ID||'''
);
end'
----------------------------------------------------------------------------------------------------------------------
='
begin
XX_CONC_REQ_SUBMIT_PKG.XX_SUBMIT_INV_VOUCHER('''||:INV_SUM_FOLDER.ORG_ID||''', '''||:INV_SUM_FOLDER.INVOICE_NUM||''','''||:INV_SUM_FOLDER.DOC_SEQUENCE_VALUE||''','''||:PARAMETER.USER_ID||'''
);
end'