The Stock Ledger: Core of RMS Accounting
Every time an item is received, transferred, adjusted, or sold in RMS, money changes hands—at least on paper. The Stock Ledger is the bridge between physical supply chain operations and corporate finance. Learn how TRAN_DATA captures millions of daily events and rolls them up into the General Ledger.
While store managers care about how many units are on a shelf, the CFO only cares about what those units are worth. Oracle RMS bridges this gap using the Stock Ledger.
The Stock Ledger is a sub-ledger system within RMS that records the financial value of all inventory movements. Every time physical stock is altered, an immutable financial record is written. At the end of the day, week, and month, these records are rolled up and fed into the corporate financial system (like Oracle Financials or SAP).
1. The Immutable Journal: TRAN_DATA
The most important table in all of Oracle RMS is TRAN_DATA.
Whenever an action occurs that impacts inventory—a receipt against a PO, a customer sale at the POS, an inventory adjustment due to damage, or a price change that affects the retail value of the stock—RMS writes a record to TRAN_DATA.
Immutability
Records in TRAN_DATA are immutable. Once written, they can never be updated or deleted. If an error was made (e.g., receiving 10 units instead of 1), a reversal transaction must be posted (e.g., an adjustment of -9 units). This ensures strict financial compliance and auditability.
The Structure of a Tran Data Record
Every record in TRAN_DATA contains:
- The
ITEMandLOCATION. - The
TRAN_CODE(what happened). - The
UNITS(how many). - The
TOTAL_COST(the financial impact to the balance sheet). - The
TOTAL_RETAIL(the impact to the potential revenue).
2. Key Transaction Codes
TRAN_DATA categorizes every event using a two-digit TRAN_CODE. There are dozens of codes, but these are the most critical:
- Tran Code 20 (Receipt): Written when goods arrive from a supplier. Increases inventory valuation.
- Tran Code 1 (Sale): Written when the POS integration reports a customer purchase. Decreases inventory valuation and books revenue/COGS.
- Tran Code 4 (Customer Return): Written when a customer returns a product. Reverses Tran Code 1.
- Tran Code 22 (Inventory Adjustment): Written when a user manually adjusts SOH up or down (e.g., due to shrinkage, damage, or stock counts).
- Tran Code 30/32 (Transfers): Written when goods move between locations. Tran 30 represents the shipment out, Tran 32 represents the receipt in.
- Tran Code 11 (Markup) / Tran Code 15 (Markdown): Written when the retail price of an item changes. This doesn't change the physical units, but it changes the
TOTAL_RETAILvalue of the inventory sitting on the shelf.
3. Cost vs. Retail Accounting
RMS supports two primary methods of inventory valuation. The method you choose dictates how the Stock Ledger behaves.
Cost Accounting
In cost accounting, the value of inventory is strictly what you paid for it.
- Every receipt is valued at the PO cost (or Actual Landed Cost).
- The
UNIT_COSTonITEM_LOC_SOHis maintained via Weighted Average Cost (WAC) or Standard Cost. - When an item is sold, the Cost of Goods Sold (COGS) is exactly the WAC of the item.
Retail Accounting
In retail accounting, inventory is managed at its Retail Selling Price.
- The ledger tracks the total retail value of all stock in a department.
- To determine the actual cost valuation at month-end, the ledger applies a "Cost-to-Retail Ratio" (the historical markup percentage for that department) to the total retail value.
- Because it's managed at Retail, every price change (Markdowns/Markups) directly impacts the stock ledger valuation and requires a
TRAN_DATArecord (Tran Codes 11/15) to account for the lost/gained margin.
4. The Rollup Process
Generating financial reports by summing hundreds of millions of TRAN_DATA rows would crash the database. Instead, RMS uses batch programs to roll up transactions into summary tables.
- Daily Rollup (
saldly): At the end of the day, RMS sums all transactions by department/class/subclass and location, writing the totals toMONTH_DATA. - Monthly Rollup (
salmth): At the end of the fiscal month (following the 4-5-4 calendar), RMS finalizes theMONTH_DATArecords, closes the fiscal period, and passes the summarized financial data to the corporate General Ledger (GL) via cross-reference mapping (FIF_GL_CROSS_REF).
5. Core Tables Reference
Transaction Journal (TRAN_DATA)
| Column | Type | Description |
|---|---|---|
ITEM | VARCHAR2(25) | The item involved in the transaction. |
LOCATION | NUMBER(10) | The location where it occurred. |
TRAN_DATE | DATE | When the transaction was processed. |
TRAN_CODE | NUMBER(2) | The event type (1=Sale, 20=Receipt, 22=Adjustment). |
UNITS | NUMBER(12,4) | The quantity of items. |
TOTAL_COST | NUMBER(20,4) | The total cost value of the transaction. |
TOTAL_RETAIL | NUMBER(20,4) | The total retail value of the transaction. |
6. SQL Deep Dives
Auditing Daily Sales vs. Receipts
This query summarizes the total units received (Tran Code 20) versus total units sold (Tran Code 1) for a specific store on a specific day.
Reconciling Stock on Hand (SOH) with TRAN_DATA
Because TRAN_DATA is the complete historical journal, the sum of all transactions for an item/location should theoretically equal its current STOCK_ON_HAND. (Assuming an opening balance of 0).
7. Common Gotchas
Important Gotchas
- !
Directly updating SOH without TRAN_DATA. If you manually
UPDATE item_loc_soh SET stock_on_hand = 10via a backend SQL script, you have instantly corrupted the stock ledger. The physical count says 10, but the financial ledger is missing the cost valuation for those 10 units. At month-end, the physical asset value will not match the GL balance. - !
Missing GL Cross-References. If a new department is created, but the GL mappings in
FIF_GL_CROSS_REFare not set up, the month-endsalmthbatch will fail or write to suspense accounts, causing a massive headache for the finance team during month-end close. - !
TRAN_DATA partitioning.
TRAN_DATAgrows by millions of rows daily. It must be strictly partitioned byTRAN_DATEorPOST_DATE, and old partitions must be dropped or archived. A failure in partition management will crash the database within weeks.
8. Official Oracle Resources
For further reading, consult the official Oracle documentation:


