When a credit memo or debit memo is matched to an invoice in Oracle Payables, the memo’s distributions point back to the original invoice. In AP_INVOICE_DISTRIBUTIONS_ALL this link is the PARENT_INVOICE_ID column, and in R12 the invoice line also stores it in AP_INVOICE_LINES_ALL.CORRECTED_INV_ID. Joining AP_INVOICES_ALL to itself through that column shows which memos belong to which invoice.
Query: number of invoices each memo is matched to
This query returns each memo number (ai1) and the count of distinct invoices (ai2) that it is matched to:
SELECT COUNT (DISTINCT ai2.invoice_num), ai1.invoice_num
FROM ap.ap_invoices_all ai1,
ap.ap_invoice_distributions_all aid1,
ap.ap_invoices_all ai2
WHERE ai1.invoice_id = aid1.invoice_id
AND aid1.parent_invoice_id = ai2.invoice_id
AND ai1.org_id = ai2.org_id
GROUP BY ai1.invoice_num
Query: list all credit and debit memos for one invoice
To start from the invoice instead and see every memo applied to it, with the amount, use the R12 line-level link:
SELECT inv.invoice_num parent_invoice,
inv.invoice_amount invoice_amount,
cm.invoice_num memo_number,
cm.invoice_type_lookup_code memo_type,
cm.invoice_date memo_date,
SUM (cml.amount) memo_amount
FROM ap_invoices_all inv,
ap_invoice_lines_all cml,
ap_invoices_all cm
WHERE cml.corrected_inv_id = inv.invoice_id
AND cm.invoice_id = cml.invoice_id
AND cm.invoice_type_lookup_code IN ('CREDIT', 'DEBIT')
AND inv.invoice_num = :p_invoice_num
AND inv.org_id = :p_org_id
GROUP BY inv.invoice_num,
inv.invoice_amount,
cm.invoice_num,
cm.invoice_type_lookup_code,
cm.invoice_date
ORDER BY cm.invoice_date;
Notes
- Memo amounts are negative for credit memos, so
invoice_amount + SUM(memo_amount)gives the net invoice value. - Pass
:p_org_id(operating unit) because invoice numbers are unique only per supplier and operating unit. - Cancelled memos still appear; add
AND cm.cancelled_date IS NULLto exclude them.
How is a credit memo linked to an invoice in Oracle Payables?
When the memo is matched to an invoice, its lines store the invoice ID in AP_INVOICE_LINES_ALL.CORRECTED_INV_ID and its distributions store it in AP_INVOICE_DISTRIBUTIONS_ALL.PARENT_INVOICE_ID.
What is the difference between a credit memo and a debit memo in AP?
A credit memo is a negative amount document sent by the supplier. A debit memo is a negative amount document you create to notify the supplier of a credit you are taking. Both reduce the amount you owe.
Which column identifies the invoice type in AP_INVOICES_ALL?
INVOICE_TYPE_LOOKUP_CODE, with values such as STANDARD, CREDIT, DEBIT, PREPAYMENT and MIXED.
Related queries
- Query to find the AP invoices that are applied to multiple Purchase Orders
- Query to find Purchase Order and Invoice Details
- Query to find AP Invoices matched with receipts
- Oracle EBS query to get AP Invoice SLA Details
- Query to find AP invoice workflow item key in oracle apps
- PTD and YTD Balance Query for a GL Account in Oracle R12
- Supervisor Hierarchy and Approval Limits Query in Oracle EBS R12
- Query to Find All Expense Report Entry Delegations in Oracle iExpenses
- Query to Find Vacation Rules (Workflow Delegations) in Oracle R12
- Purchase Order Receipt Details Query in Oracle Apps R12
- Oracle Apps Query to Find Purchasing Approval Limits (R12)
- View Accounting Query in Oracle Apps R12 (SLA / XLA Tables)
- Query to Get AR Invoice SLA and GL Journal Details in Oracle R12
- Accounting Entries Not Transferred to the General Ledger (SLA to GL Query)
- Query to Find All Public APIs of Oracle Apps Modules
- R12 AR Cash Receipt SLA and GL Details Query
- Oracle Apps AR Receipt Applications and SLA Details Query
- Oracle EBS Query to Get AP Invoice SLA (Subledger Accounting) Details
- Oracle EBS Query to Get AR Invoice SLA (Subledger Accounting) Details
- Oracle AR Remit-To Address Query
- Oracle iExpenses Credit Card Details Query (Cards, Programs and Transactions)
- Query to Get Customer Tax Registration Details in Oracle R12
- Purchase Requisition Vertex Debug XML Query in Oracle EBS
- Purchase Order Vertex Debug XML Query in Oracle EBS
- AP Invoice Vertex Debug XML Query in Oracle EBS
- AR Invoice Vertex Debug XML Query in Oracle EBS
- Query to Find the AP Invoice Approval Workflow Item Key in Oracle Apps
- Query to Find Serial Number Material Transaction Details in Oracle Inventory
- Query to Find Period Status for Inventory, GL, Purchasing, Payables, Receivables and Fixed Assets
- Oracle Fixed Assets Query: Asset Details with Cost, Depreciation and Net Book Value (NBV)
- Query to Find Sales Orders That Are Shipped but Not Invoiced
- Query to Get Customer Bank Account Details in Oracle R12 (Oracle Payments)
- Query to Get the Description of a GL Code Combination
- Query to Find Purchase Order and AP Invoice Details
- Query to Find AP Invoices Matched to Receipts
- Query to Find Supplier Bank Account Details in Oracle R12
- Query to Find Credit Memos Matched to an AP Invoice
- Query to Find AP Invoices Matched to Multiple Purchase Orders
- AutoInvoice Grouping Columns in RA_INTERFACE_LINES_ALL (OM to AR)
- Query to Find Ship Sets and Fulfillment Sets in Oracle Order Management
