OracleFree generatorPDF, Excel, Word exportOracle E-Business SuiteAll Oracle E-Business Suite tools

Oracle EBS AR Aging Report Query with Configurable Buckets

This generator writes a receivables aging query for Oracle E-Business Suite R12 with seven buckets you define, by customer account in functional currency, plus an open-item detail query in entered currency. It reads AR_PAYMENT_SCHEDULES_ALL, the table the standard aging reports start from.

Fill in

Generated code
Download:

Query 1: aging by customer account (functional currency)

-- bucket_1: days past due <= 0 (current)
-- bucket_2: 0 < days <= 30   bucket_3: 30 < days <= 60
-- bucket_4: 60 < days <= 90   bucket_5: 90 < days <= 120
-- bucket_6: 120 < days <= 180   bucket_7: days > 180
WITH open_items AS (
  SELECT ps.customer_id,
         ps.class,
         ps.acctd_amount_due_remaining AS amt,
         TRUNC(TO_DATE('2026-10-22', 'YYYY-MM-DD')) - TRUNC(ps.due_date) AS days_past_due
  FROM   ar_payment_schedules_all ps
  WHERE  ps.org_id = 204
  AND    ps.status = 'OP'
  AND    ps.amount_due_remaining <> 0
  AND    ps.gl_date <= TO_DATE('2026-10-22', 'YYYY-MM-DD')
  AND    ps.customer_id IS NOT NULL
)
SELECT p.party_name,
       ca.account_number,
       SUM(o.amt) AS total_due,
       SUM(CASE WHEN o.days_past_due <= 0 THEN o.amt ELSE 0 END) AS bucket_1,
       SUM(CASE WHEN o.days_past_due >  0 AND o.days_past_due <= 30 THEN o.amt ELSE 0 END) AS bucket_2,
       SUM(CASE WHEN o.days_past_due >  30 AND o.days_past_due <= 60 THEN o.amt ELSE 0 END) AS bucket_3,
       SUM(CASE WHEN o.days_past_due >  60 AND o.days_past_due <= 90 THEN o.amt ELSE 0 END) AS bucket_4,
       SUM(CASE WHEN o.days_past_due >  90 AND o.days_past_due <= 120 THEN o.amt ELSE 0 END) AS bucket_5,
       SUM(CASE WHEN o.days_past_due >  120 AND o.days_past_due <= 180 THEN o.amt ELSE 0 END) AS bucket_6,
       SUM(CASE WHEN o.days_past_due >  180 THEN o.amt ELSE 0 END) AS bucket_7,
       SUM(CASE WHEN o.class = 'PMT' THEN o.amt ELSE 0 END) AS unapplied_receipts
FROM   open_items o
JOIN   hz_cust_accounts ca
       ON ca.cust_account_id = o.customer_id
JOIN   hz_parties p
       ON p.party_id = ca.party_id
WHERE  p.party_name LIKE '%'
GROUP  BY p.party_name, ca.account_number
ORDER  BY total_due DESC;

Query 2: open-item detail in entered currency

SELECT p.party_name,
       ca.account_number,
       ps.class,                       -- INV, DM, CM, CB, DEP, GUAR, PMT, BR
       ps.trx_number,
       t.purchase_order,
       ps.trx_date,
       ps.due_date,
       TRUNC(TO_DATE('2026-10-22', 'YYYY-MM-DD')) - TRUNC(ps.due_date) AS days_past_due,
       ps.invoice_currency_code,
       ps.amount_due_original,
       ps.amount_due_remaining,
       ps.exchange_rate,
       ps.acctd_amount_due_remaining
FROM   ar_payment_schedules_all ps
JOIN   hz_cust_accounts ca
       ON ca.cust_account_id = ps.customer_id
JOIN   hz_parties p
       ON p.party_id = ca.party_id
LEFT JOIN ra_customer_trx_all t
       ON t.customer_trx_id = ps.customer_trx_id
WHERE  ps.org_id = 204
AND    ps.status = 'OP'
AND    ps.amount_due_remaining <> 0
AND    ps.gl_date <= TO_DATE('2026-10-22', 'YYYY-MM-DD')
AND    p.party_name LIKE '%'
ORDER  BY p.party_name, ps.due_date;

This is an open-item aging from current balances. For an as-of date in the past it overstates or understates items that were open then but have since been applied or adjusted: a true historical aging must add back AR_RECEIVABLE_APPLICATIONS_ALL and AR_ADJUSTMENTS_ALL activity dated after the as-of date. Reconcile against the standard Aging - 7 Buckets - By Account Report for the same date.

Get a true as-of aging query

Need historical aging that ties to the standard report for past month-ends? Send your operating units and we scope the rollback query for your instance.

Optional. The tool and every export work without this. No spam.

Was this tool useful?

How to use it

Enter the operating unit ORG_ID, the as-of date and six bucket boundaries. The defaults 0, 30, 60, 90, 120 and 180 give current, 1-30, 31-60, 61-90, 91-120, 121-180 and over 180 days past due, the same layout as the standard 7-bucket report. Restrict to a customer with a LIKE pattern or leave %. Run Query 1 for the summary a controller reviews, and Query 2 when a collector needs the transactions behind a bucket. Both run in SQL Developer as APPS; no multi-org context is needed because the _ALL table is filtered by ORG_ID directly.

  • Days past due = as-of date minus due date, both truncated
  • Negative days (not yet due) fall in bucket 1
  • Functional amounts use ACCTD_AMOUNT_DUE_REMAINING

Where the numbers come from

Every invoice, debit memo, credit memo, chargeback, deposit and receipt has one or more payment schedule rows in AR_PAYMENT_SCHEDULES_ALL, one per installment. STATUS is OP while AMOUNT_DUE_REMAINING is not zero and CL once fully applied. CLASS tells you the document type: INV, DM, CM, CB, DEP, GUAR, PMT and BR. AMOUNT_DUE_REMAINING is in the transaction currency; ACCTD_AMOUNT_DUE_REMAINING is the stored functional amount, which avoids recalculating with EXCHANGE_RATE and handles rounding the way Receivables did. Customer comes from CUSTOMER_ID, which is HZ_CUST_ACCOUNTS.CUST_ACCOUNT_ID, with the name on HZ_PARTIES.

Worked example and reconciliation

An invoice due 15 August 2026 aged as of 22 October 2026 is 68 days past due and lands in bucket 4 (61-90). An open credit memo shows as a negative amount in the bucket of its due date, and an unapplied receipt shows as a negative PMT row in the bucket of its due date and in total_due, and is also broken out in the unapplied_receipts column so you can see how much cash is waiting to be applied. To reconcile, run the Aging - 7 Buckets - By Account Report for the same operating unit and date and compare totals by customer. Differences usually come from as-of dates in the past, on-account credits treated differently in the report options, or receipts in other operating units.

Limits and common mistakes

The query is exact for today and an approximation for a past date, because applications and adjustments posted after that date have already reduced AMOUNT_DUE_REMAINING. For month-end aging, run it on the first day of the next month before cash application, or build the rollback with AR_RECEIVABLE_APPLICATIONS_ALL and AR_ADJUSTMENTS_ALL. Do not join to RA_CUSTOMER_TRX_LINES_ALL in an aging: lines multiply rows and inflate totals. Bill-to site level aging needs CUSTOMER_SITE_USE_ID joined to HZ_CUST_SITE_USES_ALL. Disputed amounts sit in AMOUNT_IN_DISPUTE if you want a separate column.

Frequently Asked Questions

What is the AR aging query in Oracle Apps R12?

Select open rows from AR_PAYMENT_SCHEDULES_ALL (status OP, amount_due_remaining not zero) for the operating unit, compute as-of date minus due date, and sum the remaining amount into buckets with CASE expressions, grouped by customer account from HZ_CUST_ACCOUNTS and HZ_PARTIES. Query 1 above does this with seven configurable buckets.

Which standard report should my query match?

Aging - 7 Buckets - By Account Report in Receivables, run for the same operating unit, as-of date and bucket set. Use the same treatment of on-account credits and receipts as your report parameters. Differences on today's date usually point to filters; differences on past dates point to later applications.

What are the main AR tables in Oracle EBS?

RA_CUSTOMER_TRX_ALL and RA_CUSTOMER_TRX_LINES_ALL for transactions, RA_CUST_TRX_LINE_GL_DIST_ALL for accounting distributions, AR_PAYMENT_SCHEDULES_ALL for balances due, AR_CASH_RECEIPTS_ALL for receipts, AR_RECEIVABLE_APPLICATIONS_ALL for applications, AR_ADJUSTMENTS_ALL for adjustments, and HZ_CUST_ACCOUNTS with HZ_PARTIES for customers.

Why do unapplied receipts show as negative amounts?

A receipt has its own payment schedule row with class PMT, and its unapplied amount is stored as a negative AMOUNT_DUE_REMAINING. It reduces the customer's total due. Query 1 shows it separately so you can tell real overdue balances apart from cash that is simply not applied yet.

If you want collectors to ask which customers moved into the 61-90 bucket this week and get the answer from your own EBS instance on your servers, we can set that up.

ArchRay builder
Design the on-prem AI stack for Oracle E-Business Suite: model, GPUs, RAG pipeline, guardrails
See memory, speed and cost as you swap parts, then export the diagram. Free, in your browser.
Open the builder

Keep exploring

Free tools

ERP fixes and how-tos

Runs with your ERP

AI on your ERP

Integrations

Software