AP_INVOICES_INTERFACE
-----------------------
1)INVOICE_ID not null Required, Primary key. This value is assigned in
the Invoice Gateway by the AP_INVOICES_INTERFACE_S sequence.
2) INVOICE_NUM Required if there is more than one invoice for the
supplier during import
3)VENDOR_ID or VENDOR_NAME or VENDOR_NUM is reqd if not matched to PO
4)VENDOR_SITE_ID or VENDOR_SITE_CODE is reqd if not matched to PO
5)INVOICE_AMOUNT
6)PO_NUMBER
6)INVOICE_CURRENCY_CODE:if not eneterd defaulted to functional currency
7)EXCHANGE_RATE_TYPE :User,Spot, Corporate, EMU Fixed, and user–defined.for Spot, Corporate, or any user–defined rate type, the value you enter here is validated against
the GL Daily Rates table.If you use EMU Fixed,Payables will provide the exchange rate during import. If you use User as the exchange rate type,you must enter a value for EXCHANGE_RATE orthe record will be rejected during import.
8)TERMS_NAME or TERMS_ID.:Payables searches1)invoice record header 2)purchase order terms if invoice is matched to PO 3)supplier site.
9)SOURCE
10)DOC_CATEGORY_CODE :
If you are using automatic sequential numbering, then Payables Open
Interface Import uses this column to assign a document category to the
invoice it creates.If the Sequential Numbering profile value is ”Always” and you do not
enter a value in this column, then during import Payables will use STANDARD as the category if the invoice amount is zero or positive,and CREDIT if the invoice amount is negative.
If you enable the Allow Document Category Override Payables option,you can enter the document category you want Open Interface Import to assign to the invoice created from this record
10)VOUCHER_NUM:If you use manual sequential numbering, then enter a unique value
11)PAYMENT_CURRENCY_CODE:Currency code for the payment. If you do not provide a value, then
during import PAYMENT_CURRENCY_CODE will be set to the same value as the INVOICE_CURRENCY_CODE,
12)PAYMENT_METHOD_LOOKUP_CODE:Method that will be used to pay the invoice.
The value must be a valid value for the PAYMENT_METHOD lookup code: Validation:
13)ACCTS_PAY_CODE_COMBINATION_ID:Liability account.
14)ORG_ID
AP_INVOICE_LINES_INTERFACE
Create Or Replace Procedure m_Ap_Invoices(Errbuf Out Varchar2,
Retcode Out Varchar2) Is
--starts the declaring variables for headers
v_Invoice_Id Ap_Invoices_Interface.Invoice_Id%Type;
v_Type Ap_Invoices_Interface.Invoice_Type_Lookup_Code %Type;
v_Supplier Ap_Invoices_Interface.Vendor_Name %Type;
v_Invoice_Date Ap_Invoices_Interface.Invoice_Date %Type;
v_Invoice_Num Ap_Invoices_Interface.Invoice_Num %Type;
v_Invoice_Curr Ap_Invoices_Interface.Invoice_Currency_Code%Type;
v_Invoice_Amount Ap_Invoices_Interface.Invoice_Amount %Type;
v_Payment_Cross_Rate Ap_Invoices_Interface.Payment_Cross_Rate%Type;
v_Cross_Payment_Curr Ap_Invoices_Interface.Payment_Currency_Code%Type;
v_Pay_Rate_Date Ap_Invoices_Interface.Payment_Cross_Rate_Date%Type;
v_Payment_Rate_Type Ap_Invoices_Interface.Payment_Cross_Rate_Type%Type;
v_Description Ap_Invoices_Interface.Description%Type;
v_Rate_Type Ap_Invoices_Interface.Exchange_Rate_Type%Type;
v_Exchange_Date Ap_Invoices_Interface.Exchange_Date%Type;
v_Exchange_Rate Ap_Invoices_Interface.Exchange_Rate%Type;
v_Terms_Date Ap_Invoices_Interface.Terms_Date%Type;
v_Terms Ap_Invoices_Interface.Terms_Id%Type;
v_Payment_Method Ap_Invoices_Interface.Payment_Method_Lookup_Code%Type;
v_Discountable_Amt Ap_Invoices_Interface.Amount_Applicable_To_Discount%Type;
v_Invoice_Recieved_Date Ap_Invoices_Interface.Invoice_Received_Date%Type;
v_Recieved_Goods_Date Ap_Invoices_Interface.Goods_Received_Date%Type;
v_Pay_Code_Combination_Id Ap_Invoices_Interface.Accts_Pay_Code_Combination_Id%Type;
v_Status Ap_Invoices_Interface.Status%Type;
v_Po_Number Ap_Invoices_Interface.Po_Number%Type := Null;
v_Attribute1 Ap_Invoices_Interface.Attribute1%Type;
v_Attribute2 Ap_Invoices_Interface.Attribute2%Type;
v_Attribute3 Ap_Invoices_Interface.Attribute3%Type;
v_Attribute4 Ap_Invoices_Interface.Attribute4%Type;
v_Attribute5 Ap_Invoices_Interface.Attribute5%Type;
v_Attribute6 Ap_Invoices_Interface.Attribute6%Type;
v_Attribute7 Ap_Invoices_Interface.Attribute7%Type;
v_Attribute8 Ap_Invoices_Interface.Attribute8%Type;
v_Attribute9 Ap_Invoices_Interface.Attribute9%Type;
v_Attribute10 Ap_Invoices_Interface.Attribute10%Type;
v_Vendor_Id Po_Vendors.Vendor_Id%Type;
v_Vendor_Site_Cd Po_Vendor_Sites.Vendor_Site_Code%Type;
v_Vendor_Site_Id Po_Vendor_Sites.Vendor_Site_Id%Type;
v_Currency_Code Fnd_Currencies.Currency_Code%Type;
v_Lookup_Code Ap_Lookup_Codes.Lookup_Code%Type;
v_Code_Comb Gl_Code_Combinations.Code_Combination_Id%Type;
v_Segment1 Po_Headers_All.Segment1%Type;
v_Term_Name Ap_Terms.Name%Type;
v_Term_Id Ap_Terms.Term_Id%Type;
v_Closed_Date Po_Headers_All.Closed_Date%Type;
v_Process_Flag Char(1) := Null;
v_Last_Date Date;
v_Count Number;
--ends the declaring variables for headers
--statrts the declaring variables for lines
--v_invoice_id ap_invoice_lines_interface.invoice_id%type;
v_Line_No Ap_Invoice_Lines_Interface.Line_Number%Type;
v_Amount Ap_Invoice_Lines_Interface.Amount%Type;
v_Expence_Account Ap_Invoice_Lines_Interface.Dist_Code_Combination_Id%Type;
v_Expence_Account1 Ap_Invoice_Lines_Interface.Dist_Code_Concatenated%Type;
v_Line_Type Ap_Invoice_Lines_Interface.Line_Type_Lookup_Code%Type;
v_Accounting_Date Ap_Invoice_Lines_Interface.Accounting_Date%Type;
v_Invoice_Line_Id Ap_Invoice_Lines_Interface.Invoice_Line_Id%Type;
v_Line_Attribute1 Ap_Invoice_Lines_Interface.Attribute1%Type;
v_Line_Attribute2 Ap_Invoice_Lines_Interface.Attribute2%Type;
v_Line_Attribute3 Ap_Invoice_Lines_Interface.Attribute3%Type;
v_Line_Attribute4 Ap_Invoice_Lines_Interface.Attribute4%Type;
v_Line_Attribute5 Ap_Invoice_Lines_Interface.Attribute5%Type;
v_Line_Attribute6 Ap_Invoice_Lines_Interface.Attribute6%Type;
v_Line_Attribute7 Ap_Invoice_Lines_Interface.Attribute7%Type;
v_Line_Attribute8 Ap_Invoice_Lines_Interface.Attribute8%Type;
v_Line_Attribute9 Ap_Invoice_Lines_Interface.Attribute9%Type;
v_Line_Attribute10 Ap_Invoice_Lines_Interface.Attribute10%Type;
v_Receipt_Number Ap_Invoice_Lines_Interface.Receipt_Number%Type;
/*following variables for PO related invoices*/
v_Found Char(1) := Null;
v_Po_Header_Id Ap_Invoice_Lines_Interface.Po_Header_Id%Type;
v_Po_Line_Id Ap_Invoice_Lines_Interface.Po_Line_Id%Type;
v_Po_Line_Num Ap_Invoice_Lines_Interface.Po_Line_Number%Type;
v_Po_Segment Ap_Invoice_Lines_Interface.Po_Number%Type;
v_Line_Location_Id Ap_Invoice_Lines_Interface.Po_Line_Location_Id%Type;
v_Shipment_Num Ap_Invoice_Lines_Interface.Po_Shipment_Num%Type;
v_Po_Distribution_Id Ap_Invoice_Lines_Interface.Po_Distribution_Id%Type;
v_Po_Distribution_Num Ap_Invoice_Lines_Interface.Po_Distribution_Num%Type;
--ends the declaring variables for lines
--declaring cursor for fetching header,Lines values from staging table.
Cursor Invoice_Cur Is
Select Invh.Rec_Id,
Invh.Type,
Invh.Supplier,
Invh.Site,
Invh.Invoice_Date,
Invh.Invoice_Num Invoice_Num,
Invh.Invoice_Curr,
Invh.Invoice_Amount,
Invh.Amount_Paid,
Invh.Payment_Cross_Rate,
Invh.Payment_Cross_Curr,
Invh.Pay_Rate_Date,
Invh.Payment_Rate_Type,
Invh.Payment_Rate,
Invh.Payment_Amt,
Invh.Description,
Invh.Tranction_Code,
Invh.Rate_Type,
Invh.Exchange_Date,
Invh.Exchange_Rate,
Invh.Functional_Amount,
Invh.Terms_Date,
Invh.Terms,
Invh.Payment_Method,
Invh.Discountable_Amt,
Invh.Invoice_Recieved_Date,
Invh.Recieved_Goods_Date,
Invh.Accts_Pay_Code_Combination_Id,
Invh.Status,
Invh.Po_Number,
Invh.Attribute1 Headattr1,
Invh.Attribute2 Headattr2,
Invh.Attribute3 Headattr3,
Invh.Attribute4 Headattr4,
Invh.Attribute5 Headattr5,
Invh.Attribute6 Headattr6,
Invh.Attribute7 Headattr7,
Invh.Attribute8 Headattr8,
Invh.Attribute9 Headattr9,
Invh.Attribute10 Headattr10,
Invh.Process_Flag,
Invl.Invoice_Num Line_Invoice_Num,
Invl.Line_No,
Invl.Amount,
Invl.Expence_Account,
Invl.Expence_Account1,
Invl.Accounting_Date,
Invl.Attribute1 Lineattr1,
Invl.Attribute2 Lineattr2,
Invl.Attribute3 Lineattr3,
Invl.Attribute4 Lineattr4,
Invl.Attribute5 Lineattr5,
Invl.Attribute6 Lineattr6,
Invl.Attribute7 Lineattr7,
Invl.Attribute8 Lineattr8,
Invl.Attribute9 Lineattr9,
Invl.Attribute10 Lineattr10
From m_Invoice_Headers_Int Invh, m_Invoice_Lines_Int Invl
Where Invh.Rec_Id = Invl.Rec_Id;
Begin
For Cur_Invoice In Invoice_Cur Loop
Begin
--Loop starts here to process invoice headers data
--fetching sequence value for invoice_id
Select Ap_Invoices_Interface_s.Nextval Into v_Invoice_Id From Dual;
v_Type := Cur_Invoice.Type;
v_Supplier := Cur_Invoice.Supplier;
v_Invoice_Date := Cur_Invoice.Invoice_Date;
v_Invoice_Num := Cur_Invoice.Invoice_Num;
v_Invoice_Curr := Cur_Invoice.Invoice_Curr;
v_Invoice_Amount := Cur_Invoice.Invoice_Amount;
v_Payment_Cross_Rate := Cur_Invoice.Payment_Cross_Rate;
v_Cross_Payment_Curr := Cur_Invoice.Payment_Cross_Curr;
v_Pay_Rate_Date := Cur_Invoice.Pay_Rate_Date;
v_Payment_Rate_Type := Cur_Invoice.Payment_Rate_Type;
v_Description := Cur_Invoice.Description;
v_Rate_Type := Cur_Invoice.Rate_Type;
v_Exchange_Date := Cur_Invoice.Exchange_Date;
v_Exchange_Rate := Cur_Invoice.Exchange_Rate;
v_Terms_Date := Cur_Invoice.Terms_Date;
v_Terms := Cur_Invoice.Terms;
v_Payment_Method := Cur_Invoice.Payment_Method;
v_Discountable_Amt := Cur_Invoice.Discountable_Amt;
v_Invoice_Recieved_Date := Cur_Invoice.Invoice_Recieved_Date;
v_Recieved_Goods_Date := Cur_Invoice.Recieved_Goods_Date;
v_Pay_Code_Combination_Id := Cur_Invoice.Accts_Pay_Code_Combination_Id;
v_Status := Cur_Invoice.Status;
v_Po_Number := Cur_Invoice.Po_Number;
v_Attribute1 := Cur_Invoice.Headattr1;
v_Attribute2 := Cur_Invoice.Headattr2;
v_Attribute3 := Cur_Invoice.Headattr3;
v_Attribute4 := Cur_Invoice.Headattr4;
v_Attribute5 := Cur_Invoice.Headattr5;
v_Attribute6 := Cur_Invoice.Headattr6;
v_Attribute7 := Cur_Invoice.Headattr7;
v_Attribute8 := Cur_Invoice.Headattr8;
v_Attribute9 := Cur_Invoice.Headattr9;
v_Attribute10 := Cur_Invoice.Headattr10;
v_Process_Flag := Cur_Invoice.Process_Flag;
/* Validate invoice number if null then assign invoice number equal to week_end_date.*/
If v_Invoice_Num Is Null Then
Select Next_Day(Sysdate, 'FRIDAY') Into v_Last_Date From Dual;
v_Invoice_Num := v_Last_Date;
End If;
/* validate invoice type*/
If v_Type <> 'STANDARD' Or v_Type <> 'CREDIT' Or v_Type <> 'DEBIT' Then
v_Type := Null;
End If;
/* validating vendor id */
Begin
Select Vendor_Id
Into v_Vendor_Id
From Po_Vendors
Where Vendor_Name = Ltrim(Rtrim(Upper(v_Supplier)))
And Sysdate >= Start_Date_Active
And Sysdate < End_Date_Active;
Exception
When No_Data_Found Then
Fnd_File.Put_Line(Fnd_File.Log,
'No vendor id found OR vendor status is not active = ');
When Others Then
Fnd_File.Put_Line(Fnd_File.Log, 'Exception' || Sqlerrm);
End;
/* Validation for VENDOR_SITE_CODE */
Begin
Select Vendor_Site_Code, Vendor_Site_Id
Into v_Vendor_Site_Cd, v_Vendor_Site_Id
From Po_Vendor_Sites
Where Vendor_Id = v_Vendor_Id;
Exception
When No_Data_Found Then
Fnd_File.Put_Line(Fnd_File.Log,
'No vendor site code found for this vendor - ' ||
v_Supplier);
When Others Then
Fnd_File.Put_Line(Fnd_File.Log, 'Exception' || Sqlerrm);
End;
/* Invoice currecy code */
Begin
Select Currency_Code
Into v_Currency_Code
From Fnd_Currencies
Where Currency_Code = Ltrim(Rtrim(Upper(v_Invoice_Curr)))
And Sysdate Between Nvl(Start_Date_Active, Sysdate) And
Nvl(End_Date_Active, Sysdate);
Exception
When No_Data_Found Then
Fnd_File.Put_Line(Fnd_File.Log,
'Currency Code Does not Exist for ' ||
v_Invoice_Curr);
When Others Then
Fnd_File.Put_Line(Fnd_File.Log, 'Exception' || Sqlerrm);
End;
/* validating term id */
Begin
Select Term_Id, Name
Into v_Term_Id, v_Term_Name
From Ap_Terms
Where Term_Id = v_Terms
And v_Terms_Date Between Nvl(Start_Date_Active, Sysdate) And
Nvl(End_Date_Active, Sysdate); -- v_term_date not in ver 11.5.0
Exception
When No_Data_Found Then
Fnd_File.Put_Line(Fnd_File.Log,
'Term id OR Term name Does not Exist for ' ||
v_Terms);
When Others Then
Fnd_File.Put_Line(Fnd_File.Log, 'Exception' || Sqlerrm);
End;
/*validating payment method */
Begin
Select Lookup_Code
Into v_Lookup_Code
From Ap_Lookup_Codes
Where Lookup_Code = Upper(v_Payment_Method);
Exception
When No_Data_Found Then
Fnd_File.Put_Line(Fnd_File.Log,
' Payment Method are not exist
in lookup table');
When Others Then
Fnd_File.Put_Line(Fnd_File.Log, 'Exception' || Sqlerrm);
End;
/* validating GL Code Combination validation */
Begin
Select Code_Combination_Id
Into v_Code_Comb
From Gl_Code_Combinations
Where Code_Combination_Id = v_Pay_Code_Combination_Id;
Exception
When No_Data_Found Then
Fnd_File.Put_Line(Fnd_File.Log,
' Code Combination id not exist in table');
When Others Then
Fnd_File.Put_Line(Fnd_File.Log, 'Exception' || Sqlerrm);
End;
/* validating po number */
Begin
If v_Po_Number Is Not Null Then
Select Segment1, Closed_Date
Into v_Segment1, v_Closed_Date
From Po_Headers_All
Where Segment1 = v_Po_Number;
If v_Closed_Date Is Not Null Then
Fnd_File.Put_Line(Fnd_File.Log, ' P O Staus is inactive');
End If;
End If;
Exception
When No_Data_Found Then
Fnd_File.Put_Line(Fnd_File.Log, ' P O number not found');
When Others Then
Fnd_File.Put_Line(Fnd_File.Log, 'Exception' || Sqlerrm);
End;
/*Validating Payment cross rate */
Begin
If v_Invoice_Curr = v_Cross_Payment_Curr Then
v_Payment_Cross_Rate := 1;
Else
Select Conversion_Rate
Into v_Payment_Cross_Rate --v_conversion_rate
From Gl_Daily_Rates
Where From_Currency = v_Invoice_Curr
And To_Currency = v_Cross_Payment_Curr
And Conversion_Date = v_Pay_Rate_Date
And Conversion_Type = v_Payment_Rate_Type;
End If;
Exception
When No_Data_Found Then
Fnd_File.Put_Line(Fnd_File.Log, ' Conversion rates not found');
When Others Then
Fnd_File.Put_Line(Fnd_File.Log, 'Exception' || Sqlerrm);
End;
/* validating exchange rate */
If v_Rate_Type = 'USER' And v_Exchange_Rate Is Not Null Then
Null;
Elsif v_Rate_Type = 'USER' And v_Exchange_Rate Is Null Then
Fnd_File.Put_Line(Fnd_File.Log,
' Exchange rate is null for the invoice number -' ||
v_Invoice_Num);
Elsif v_Rate_Type <> 'USER' And v_Exchange_Rate Is Not Null Then
v_Exchange_Rate := 0;
End If;
/* validating duplication of invoice */
Select Count(*)
Into v_Count
From Ap_Invoices_All
Where Invoice_Num = v_Invoice_Num
And Vendor_Id = v_Vendor_Id;
If v_Count > 0 Then
Fnd_File.Put_Line(Fnd_File.Log,
' Invocie already Exists - ' || v_Invoice_Num);
Update m_Invoice_Headers_Int
Set Process_Flag = 'N'
Where Invoice_Num = v_Invoice_Num
And Supplier = v_Supplier;
Else
--inserting validated values to interface table(headers)
Insert Into Ap_Invoices_Interface
(Invoice_Id,
Invoice_Num,
Invoice_Type_Lookup_Code,
Invoice_Date,
Po_Number,
Vendor_Id,
Vendor_Name,
Vendor_Site_Id,
Vendor_Site_Code,
Invoice_Amount,
Invoice_Currency_Code,
Exchange_Rate,
Exchange_Rate_Type,
Exchange_Date,
Terms_Id,
Terms_Name,
Terms_Date,
Description,
Status,
Source,
Payment_Cross_Rate_Type,
Payment_Cross_Rate_Date,
Payment_Cross_Rate,
Payment_Currency_Code,
Payment_Method_Lookup_Code,
Goods_Received_Date,
Invoice_Received_Date,
Gl_Date,
Accts_Pay_Code_Combination_Id,
Amount_Applicable_To_Discount,
Attribute1,
Attribute2,
Attribute3,
Attribute4,
Attribute5,
Attribute6,
Attribute7,
Attribute8,
Attribute9,
Attribute10,
Creation_Date,
Created_By,
Last_Update_Date,
Last_Updated_By)
Values
(v_Invoice_Id,
v_Invoice_Num,
v_Type,
v_Invoice_Date,
v_Po_Number,
v_Vendor_Id,
v_Supplier,
v_Vendor_Site_Id,
v_Vendor_Site_Cd,
Nvl(v_Invoice_Amount, 0),
v_Invoice_Curr,
v_Exchange_Rate,
v_Rate_Type,
v_Exchange_Date,
v_Terms,
v_Term_Name,
v_Terms_Date,
v_Description,
v_Status,
'InvoiceGateway',
v_Payment_Rate_Type,
v_Pay_Rate_Date,
v_Payment_Cross_Rate,
v_Cross_Payment_Curr,
v_Payment_Method,
v_Recieved_Goods_Date,
v_Invoice_Recieved_Date,
'30-NOV-2003',
v_Pay_Code_Combination_Id,
v_Discountable_Amt,
v_Attribute1,
v_Attribute2,
v_Attribute3,
v_Attribute4,
v_Attribute5,
v_Attribute6,
v_Attribute7,
v_Attribute8,
v_Attribute9,
v_Attribute10,
Sysdate,
Fnd_Global.User_Id,
Sysdate,
Fnd_Global.User_Id);
--starts here to process invoice lines data
--fetching sequence value for invoice_line_id
Select Ap_Invoice_Lines_Interface_s.Nextval
Into v_Invoice_Line_Id
From Dual;
--assigning values from staging table(lines)
--v_invoice_num :=cur_invoice.invoice_num;
v_Line_No := Cur_Invoice.Line_No;
v_Amount := Cur_Invoice.Amount;
v_Expence_Account := Cur_Invoice.Expence_Account;
v_Expence_Account1 := Cur_Invoice.Expence_Account1;
v_Accounting_Date := Cur_Invoice.Accounting_Date;
v_Line_Type := 'Item'; --(Item, Fright,Tax,Miscellaneous)
v_Line_Attribute1 := Cur_Invoice.Lineattr1;
v_Line_Attribute2 := Cur_Invoice.Lineattr2;
v_Line_Attribute3 := Cur_Invoice.Lineattr3;
v_Line_Attribute4 := Cur_Invoice.Lineattr4;
v_Line_Attribute5 := Cur_Invoice.Lineattr5;
v_Line_Attribute6 := Cur_Invoice.Lineattr6;
v_Line_Attribute7 := Cur_Invoice.Lineattr7;
v_Line_Attribute8 := Cur_Invoice.Lineattr8;
v_Line_Attribute9 := Cur_Invoice.Lineattr9;
v_Line_Attribute10 := Cur_Invoice.Lineattr10;
-- Validate Line Level Accounting Date
Begin
Select 'Y'
Into v_Found
From Gl_Period_Statuses
Where Application_Id = 200 --ASSUMTION
And Set_Of_Books_Id = 3 --ASSUMTION
And Sysdate Between Start_Date And End_Date
And Closing_Status In ('O', 'F')
And Nvl(Adjustment_Period_Flag, 'N') = 'N'
And Rownum = 1;
Exception
When No_Data_Found Then
Fnd_File.Put_Line(Fnd_File.Log,
'Accounting Date Is Not In Open');
End;
/*------start to Validate Line Level for po_number matching/validating----------*/
-- get the info of header (if invoice is related to po_number)
Begin
Select Po_Header_Id, Segment1
Into v_Po_Header_Id, v_Po_Segment
From Po_Headers_All
Where Vendor_Id = Vendor_Id;
Exception
When No_Data_Found Then
Fnd_File.Put_Line(Fnd_File.Log, 'PO not found in Headers');
End;
-- get the info line(if invoice is related to po_number)
Begin
Select Po_Line_Id, Line_Num
Into v_Po_Line_Id, v_Po_Line_Num
From Po_Lines_All
Where Po_Header_Id = v_Po_Header_Id;
Exception
When No_Data_Found Then
Fnd_File.Put_Line(Fnd_File.Log, 'PO not found in Lines');
End;
-- get the info location (if invoice is related to po_number)
Begin
Select Line_Location_Id, Shipment_Num
Into v_Line_Location_Id, v_Shipment_Num
From Po_Line_Locations_All
Where Po_Header_Id = v_Po_Header_Id
And Po_Line_Id = v_Po_Line_Id;
Exception
When No_Data_Found Then
Fnd_File.Put_Line(Fnd_File.Log, 'PO not found in Locations');
End;
-- get the info of distributions(if invoice is related to po_number)
Begin
Select Po_Distribution_Id, Distribution_Num
Into v_Po_Distribution_Id, v_Po_Distribution_Num
From Po_Distributions_All
Where Po_Header_Id = v_Po_Header_Id
And Po_Line_Id = v_Po_Line_Id
And Line_Location_Id = v_Line_Location_Id;
Exception
When No_Data_Found Then
Fnd_File.Put_Line(Fnd_File.Log,
'PO not found in distributionss');
End;
/*------end to Validate Line Level for po_number matching/validating----------*/
/*start to inserting invoice line*/
Insert Into Ap_Invoice_Lines_Interface
(Invoice_Id,
Invoice_Line_Id,
Line_Number,
Line_Type_Lookup_Code,
Amount,
Accounting_Date,
Dist_Code_Concatenated,
Dist_Code_Combination_Id,
Po_Header_Id,
Po_Number,
Po_Line_Id,
Po_Line_Number,
Po_Line_Location_Id,
Po_Shipment_Num,
Po_Distribution_Id,
Po_Distribution_Num,
Receipt_Number,
Attribute1,
Attribute2,
Attribute3,
Attribute4,
Attribute5,
Attribute6,
Attribute7,
Attribute8,
Attribute9,
Attribute10,
Creation_Date,
Created_By,
Last_Update_Date,
Last_Updated_By)
Values
(v_Invoice_Id,
v_Invoice_Line_Id,
v_Line_No,
v_Line_Type,
v_Amount,
v_Accounting_Date,
v_Expence_Account1,
v_Expence_Account,
v_Po_Header_Id,
v_Po_Segment,
v_Po_Line_Id,
v_Po_Line_Num,
v_Line_Location_Id,
v_Shipment_Num,
v_Po_Distribution_Id,
v_Po_Distribution_Num,
v_Receipt_Number,
v_Line_Attribute1,
v_Line_Attribute2,
v_Line_Attribute3,
v_Line_Attribute4,
v_Line_Attribute5,
v_Line_Attribute6,
v_Line_Attribute7,
v_Line_Attribute8,
v_Line_Attribute9,
v_Line_Attribute10,
Sysdate,
Fnd_Global.User_Id,
Sysdate,
Fnd_Global.User_Id);
/*end to inserting invoice line*/
-- ends here to process invoice lines data
End If;
Exception
When No_Data_Found Then
Commit;
Exit;
When Others Then
Fnd_File.Put_Line(Fnd_File.Log, 'Exception' || Sqlerrm);
Rollback;
Exit;
End;
End Loop; --Loop ends here to process invoice headers data
--FND_FILE.PUT_LINE(FND_FILE.log,'Data Transfer is Successfull');
End;
/
Subscribe to:
Post Comments (Atom)
Query to Find Receipt Class and its GL Combinition Query
SELECT ARC.NAME ReceiptClass, ARC.CREATION_METHOD_CODE Creation_Mehthod, DECODE (ARC.REMIT_METHOD_CODE, ...
-
GL AND AP GL_CODE_COMBINATIONS AP_INVOICES_ALL code_combination_id = acct_pay_code_combination_id G...
-
Accounts Receivables useful information ACCOUNTS RECEIVABLES: ==================== ACCOUNTING METHOD , ACCRUAL OR CASH : So do you...
-
SELECT hou.name Organization_name, ---------------------- --Customer Information ---------------------- ...
No comments:
Post a Comment