OracleFree generatorPDF, Excel, Word exportOracle E-Business SuiteDiscrete Manufacturing

Oracle EBS On-Hand vs Material Transactions Reconciliation SQL Generator

When an on-hand figure does not agree with the transaction history, consultants reach for SQL. This generator builds a reconciliation query between on-hand detail and material transactions, plus a drill-down you can run for one item.

Fill in

Generated code
Download:

Reconciliation query

-- On-hand quantity versus net material transactions
-- Verify table and column names in your release before running
SELECT msi.segment1 AS item,
       oh.subinventory_code,
       oh.onhand_qty,
       NVL(tx.net_txn_qty, 0) AS net_txn_qty,
       oh.onhand_qty - NVL(tx.net_txn_qty, 0) AS difference
  FROM (SELECT organization_id, inventory_item_id, subinventory_code,
               SUM(transaction_quantity) AS onhand_qty
          FROM mtl_onhand_quantities_detail
         WHERE organization_id = 207
           AND subinventory_code = 'STORES'
         GROUP BY organization_id, inventory_item_id, subinventory_code) oh
  JOIN mtl_system_items_b msi
    ON msi.inventory_item_id = oh.inventory_item_id
   AND msi.organization_id = oh.organization_id
  LEFT JOIN (SELECT organization_id, inventory_item_id, subinventory_code,
                    SUM(transaction_quantity) AS net_txn_qty
               FROM mtl_material_transactions
              WHERE organization_id = 207
                AND subinventory_code = 'STORES'
                AND transaction_date >= TO_DATE('2025-01-01', 'YYYY-MM-DD')
              GROUP BY organization_id, inventory_item_id, subinventory_code) tx
    ON tx.inventory_item_id = oh.inventory_item_id
   AND tx.organization_id = oh.organization_id
   AND tx.subinventory_code = oh.subinventory_code
 WHERE msi.segment1 LIKE 'AS-%'
 ORDER BY ABS(oh.onhand_qty - NVL(tx.net_txn_qty, 0)) DESC;

Drill-down for one item

-- Replace :item_id with the inventory_item_id from the query above
SELECT mmt.transaction_id,
       mmt.transaction_date,
       mmt.transaction_type_id,
       mmt.subinventory_code,
       mmt.transaction_quantity,
       mmt.transaction_uom
  FROM mtl_material_transactions mmt
 WHERE mmt.organization_id = 207
   AND mmt.subinventory_code = 'STORES'
   AND mmt.inventory_item_id = :item_id
 ORDER BY mmt.transaction_date, mmt.transaction_id;

The comparison is only meaningful if your date range starts at a point where the opening balance was zero, such as go-live, or if you add an opening balance. Test in a non-production instance, and check the table names and views against your EBS release. Read-only SELECT statements only.

Ask your EBS inventory data questions

Optional expert review of read-only natural-language access to your Oracle EBS inventory data.

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

How to use the generator

Enter the organization ID, subinventory, an item pattern and the date from which transactions should be summed. Copy the generated query into SQL Developer or your reporting tool and run it as a read-only user in a test or reporting instance first. Items with a non-zero difference need investigation. Use the second query to list the transactions for one item and spot duplicates, unit of measure issues or missing transactions.

  • Use organization ID, not organization code, in the filter
  • Run it against a reporting copy for large datasets
  • Start with a narrow item pattern to keep runtime short

The tables involved

MTL_ONHAND_QUANTITIES_DETAIL stores current on-hand by item, subinventory, locator, lot and revision. MTL_MATERIAL_TRANSACTIONS stores the transaction history, with quantity signed positive for receipts and negative for issues. MTL_SYSTEM_ITEMS_B is the item master and provides the item number in segment1. Summing signed transaction quantities from go-live should equal the current on-hand if every movement was transacted.

Reading the differences

A positive difference means on-hand exceeds the net of transactions in the range, which often reflects a conversion opening balance loaded outside the range or through an interface. A negative difference means the transactions net to more than on-hand, so check for pending or unprocessed transactions, subinventory transfers and cycle count adjustments. Oracle also keeps pending transactions in MTL_MATERIAL_TRANSACTIONS_TEMP, which this query does not include.

Common mistakes

Do not compare across different date ranges for each side. Be careful with transfers, because a transfer produces a negative transaction in the source subinventory and a positive one in the destination, so filtering to one subinventory shows only half. Remember mixed unit of measure and lot-controlled items, where detail is by lot. Keep the query read-only and avoid running it at month-end peak on production.

Frequently Asked Questions

Will this work in every EBS release?

The tables named exist across the 11i and R12 families, but columns and security can vary. Check them in your release and run in a non-production instance first.

Why is my difference never zero?

Typical causes are an opening balance outside the date range, pending transactions in the temp table, and transactions in transfers or intransit. Widen the range or add the opening balance to explain it.

Is it safe to run on production?

It is a SELECT only, but large unfiltered runs can load the database. Use a reporting copy or off-peak window, and narrow by item pattern.

Can I extend it to locators and lots?

Yes. Add locator_id and lot_number to the select and group by clauses on both sides, since the on-hand detail table holds them, and the transactions table has equivalents.

If your team wants to ask these reconciliation questions in plain English against EBS data, Netray can set up a private, read-only query layer.