Professional Documents
Culture Documents
l_address_ref
l_customer_ref
hr_operating_units.organization_id%TYPE;
hr_operating_units.set_of_books_id%TYPE;
ra_cust_trx_types_all.cust_trx_type_id%TYPE;
ra_cust_trx_types_all.gl_id_rev%TYPE;
ra_cust_trx_types_all.NAME%TYPE;
fnd_currencies.currency_code%TYPE;
ra_terms_tl.term_id%TYPE;
ra_terms_tl.NAME%TYPE;
hz_cust_acct_sites_all.cust_acct_site_id%TYPE;
hz_cust_acct_sites_all.cust_acct_site_id%TYPE;
hz_cust_accounts.cust_account_id%TYPE;
hz_cust_accounts.cust_account_id%TYPE;
VARCHAR2(4000 BYTE);
VARCHAR2(4000 BYTE);
VARCHAR2(4000 BYTE);
VARCHAR2(15 BYTE);
VARCHAR2(4000 BYTE);
VARCHAR2 (50);
VARCHAR2 (50);
l_party_id
l_party_site_id
lx_address_ref
lx_customer_ref
lx_party_id
lx_party_site_id
l_customer_trx_id
VARCHAR2 (50);
VARCHAR2 (50);
VARCHAR2 (50);
VARCHAR2 (50);
VARCHAR2 (50);
VARCHAR2 (50);
Number;
CURSOR c1
IS
SELECT *
FROM XX_AR_INVOICES_UPLOAD_DATA
WHERE PROCESS_FLAG is null
AND SR_NO between 1 and 724 ;
BEGIN
MO_GLOBAL.SET_POLICY_CONTEXT('S',85);
fnd_global.apps_initialize(1110,50639,7000);
BEGIN
SELECT organization_id, set_of_books_id
INTO l_org_id, l_sob_id
FROM hr_operating_units
WHERE NAME = 'SaaS Operating Unit';
EXCEPTION
WHEN OTHERS
THEN
PROCESS_FLAG := 'E';
ERROR_MESSAGE := 'Invalide Operating Unit...';
END;
BEGIN
SELECT cust_trx_type_id, NAME, gl_id_rev
INTO l_cust_trx_type_id, l_cust_trx_type_name, l_gl_id_rev
FROM ra_cust_trx_types_all
WHERE set_of_books_id = l_sob_id
AND org_id = l_org_id
AND NAME = 'S_DOM_MYCS_INV';
dbms_output.put_line('cust_trx_type_id:='||l_cust_trx_type_id );
dbms_output.put_line('NAME:='||l_cust_trx_type_name );
dbms_output.put_line('gl_id_rev:='||l_gl_id_rev );
EXCEPTION
WHEN OTHERS
THEN
PROCESS_FLAG := 'E';
ERROR_MESSAGE := 'Invalide Invoice Type...';
END;
BEGIN
SELECT currency_code
INTO l_currency_code
FROM fnd_currencies
l_trx_header_tbl(1).trx_header_id
l_trx_header_tbl(1).trx_date
l_trx_header_tbl(1).gl_date
l_trx_header_tbl(1).trx_currency
:= '31-MAR-2014';
:= '31-MAR-2014';
:= l_currency_code; --'INR'
Source
uence
;
l_trx_header_tbl(1).cust_trx_type_id
62;--1007;
l_trx_header_tbl(1).bill_to_customer_id
l_trx_header_tbl(1).ship_to_customer_id
l_trx_header_tbl(1).term_id
l_trx_header_tbl(1).printing_option
:= l_cust_trx_type_id; --11
l_trx_lines_tbl(1).trx_header_id
l_trx_lines_tbl(1).trx_line_id
ded sequence
l_trx_lines_tbl(1).line_number
l_trx_lines_tbl(1).description
-Mar-2014'; --i.item_description;
l_trx_lines_tbl(1).quantity_invoiced
l_trx_lines_tbl(1).unit_selling_price
ce
l_trx_lines_tbl(1).uom_code
l_trx_lines_tbl(1).line_type
l_trx_lines_tbl(1).TAX_EXEMPT_FLAG
--l_trx_lines_tbl(1).inventory_item_id
--l_trx_lines_tbl(1).WAREHOUSE_ID
india localization
:= V_HDR_ID;
:= V_CUST_LINE_ID; --- see
l_trx_dist_tbl(1).trx_dist_id
ded sequence
l_trx_dist_tbl(1).trx_line_id
ded sequence
l_trx_dist_tbl(1).ACCOUNT_CLASS
l_trx_dist_tbl(1).percent
l_trx_dist_tbl(1).CODE_COMBINATION_ID
556966;--537959;--3054;
:=
:=
:=
:=
l_customer_id_bill_to;
l_customer_id_ship_to;
l_term_id; --5; --1000;
'PRI';
:= 1;
:= 'Opening Balance As on 31
:= 1; --i.Quantity;
:= i.AMOUNT;
:= '';
:= 'LINE';
:= 'S';
:= 1185;
:= 89; only if using for
AR_INVOICE_API_PUB.create_single_invoice(
p_api_version
=> 1.0,
p_batch_source_rec
=> l_batch_source_rec,
p_trx_header_tbl
=> l_trx_header_tbl,
p_trx_lines_tbl
=> l_trx_lines_tbl,
p_trx_dist_tbl
=> l_trx_dist_tbl,
p_trx_salescredits_tbl => l_trx_salescredits_tbl,
x_customer_trx_id
=> l_customer_trx_id,
x_return_status
=> l_return_status,
x_msg_count
=> l_msg_count,
x_msg_data
=> l_msg_data);
dbms_output.put_line('Created:'||l_msg_data||l_return_status);
Dbms_output.put_line('customer_trx_Id:=' || l_customer_trx_id );
IF l_return_status = 'S'
THEN
begin
SELECT count(*)
--Pri
Into
l_cnt
From ar_trx_errors_gt;
dbms_output.put_line('l_cnt:='|| l_cnt);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
dbms_output.put_line('l_cnt:='|| l_cnt);
dbms_output.put_line('no error count in ar_trx_errors_gt');
end;
begin
SELECT ERROR_MESSAGE
Into l_ERROR_MESSAGE
From ar_trx_errors_gt
where ROWNUM = 1;
dbms_output.put_line('l_ERROR_MESSAGE:='|| l_ERROR_MESSAGE);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
dbms_output.put_line('no error in ar_trx_errors_gt');
dbms_output.put_line('l_ERROR_MESSAGE:='|| l_ERROR_MESSAGE);
WHEN TOO_MANY_ROWS
THEN
dbms_output.put_line('TOO_MANY_ROWS in ar_trx_errors_gt');
/*SELECT ERROR_MESSAGE
Into lX_ERROR_MESSAGE
From ar_trx_errors_gt
where ROWNUM = 1;
*/
dbms_output.put_line('l_ERROR_MESSAGE:='|| l_ERROR_MESSAGE);
end;
dbms_output.put_line('l_return_status:='||l_return_status);
dbms_output.put_line ( 'Customer Trx id:='|| l_customer_trx_id);
begin
select trx_number
into v_trx_no
from ra_customer_trx_all
where customer_trx_id = l_customer_trx_id;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
dbms_output.put_line ('trx number not generated');
end;
dbms_output.put_line ( 'Customer trx number= '|| v_trx_no);
Dbms_output.put_line('Invoice(s) suceessfully created!') ;
Update XX_AR_INVOICES_UPLOAD_DATA
Set PROCESS_FLAG = 'Y',
ERROR_MESSAGE = 'SUCCESS',
TRX_NUMBER = v_trx_no,
customer_trx_id = l_customer_trx_id
Where SR_NO = i.SR_NO;
ELSE
dbms_output.put_line ( 'Transaction not Created, Please check ar_trx_errors_
gt table');
END IF;
IF l_return_status <> 'S' OR
l_return_status = fnd_api.g_ret_sts_unexp_error
THEN
dbms_output.put_line('l_msg_data:='|| l_msg_data);
ELSE
begin
SELECT count(*)
Into
lx_cnt
From ar_trx_errors_gt;
dbms_output.put_line('lx_cnt:='|| lx_cnt);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
dbms_output.put_line('lx_cnt:='|| lx_cnt);
dbms_output.put_line('no error count in ar_trx_errors_gt');
end;
begin
SELECT ERROR_MESSAGE
Into lxx_ERROR_MESSAGE
From ar_trx_errors_gt
where ROWNUM = 1;
dbms_output.put_line('lxx_ERROR_MESSAGE:='|| lxx_ERROR_MESSAGE);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
dbms_output.put_line('no error in ar_trx_errors_gt');
dbms_output.put_line('lxx_ERROR_MESSAGE:='|| lxx_ERROR_MESSAGE);
WHEN TOO_MANY_ROWS
THEN
dbms_output.put_line('TOO_MANY_ROWS in ar_trx_errors_gt');
SELECT ERROR_MESSAGE
Into lX_ERROR_MESSAGE
From ar_trx_errors_gt
where ROWNUM = 1;
dbms_output.put_line('lX_ERROR_MESSAGE:='|| lX_ERROR_MESSAGE);
end;
End If;
commit;
END LOOP;
End;