← Back to Cases
AP/PO Accrual Reconciliation 1-Cent Variance Fix — Currency Rate Correction and Write-Off Creation
Case Number00059272
Oracle ModuleAccounts Payable (AP) / Purchasing (PO)
EBS Version11i (11.5.10.2)
Functional AreaPO Accrual Reconciliation / Receipt Currency Rates / Accrual Write-Offs
Related PatchesNone

Symptoms

Root Cause

In Oracle 11i, the PO accrual reconciliation matches receipt transactions to AP invoice distributions using functional currency amounts computed from the receipt's currency_conversion_rate on RCV_TRANSACTIONS. When the rate on the receipt was stored with slightly less precision than the rate implied by the AP invoice (computed as AP_TRANSACTION_AMOUNT / (AP_TRANSACTION_QUANTITY × AP_TRANSACTION_UNIT_PRICE)), a 1-cent rounding difference appears in NET_PO_LINE_AMOUNT on the reconciliation temp table. Two alternative resolution approaches are provided:


Resolution — Script 01: Create Work and Error Tables

Pre-requisite — Create backup and error tables

Run 01_setup_driver_tables.sql first. Creates:

Note: Script 02 (Phase A) uses a separate backup table RSI_RCV_TRX_59272 (created inline with CREATE TABLE AS SELECT on first use, protected by a DUP_VAL_ON_INDEX handler for subsequent runs).


Resolution — Script 02: Currency Rate Correction (Phase A)

Recalculate and correct RCV_TRANSACTIONS currency_conversion_rate

Selects pairs of matching PO and AP accrual reconciliation rows from PO_ACCRUAL_RECONCILE_TEMP_ALL where both sides have net_po_line_amount = 0.01 and org_id = 119. Joins PO rows (transaction_source_code = 'PO') to AP rows (transaction_source_code = 'AP') on matching PO_HEADER_ID, PO_LINE_ID, LINE_LOCATION_ID, and INVENTORY_ITEM_ID.

For each matched pair:

  1. Calculates the corrected rate: v_new_rate := AP_TRANSACTION_AMOUNT / (AP_TRANSACTION_QUANTITY × AP_TRANSACTION_UNIT_PRICE).
  2. Backs up matching rows from RCV_TRANSACTIONS (receipt transaction_id and its parent_transaction_id chain) into RSI_RCV_TRX_59272. Skips backup if already present (DUP_VAL_ON_INDEX).
  3. Updates RCV_TRANSACTIONS.currency_conversion_rate to the new calculated rate for the PO transaction ID and its parent transaction.
  4. Commits per record. Logs errors to RSI_AP_PO_ERRORS_59272 and proceeds to the next record on failure.

Resolution — Script 03: Write-Off Creation (Phase B — Hardcoded Parameters)

Create write-off records for 1-cent PO accrual variances (fixed org_id = 119)

Selects PO accrual records from PO_ACCRUAL_RECONCILE_TEMP_ALL where abs(net_po_line_amount) = 0.01, org_id = 119, transaction_source_code = 'PO', and write_off_id IS NULL (not yet written off).

For each PO record:

  1. Backs up the PO and matching AP rows from PO_ACCRUAL_RECONCILE_TEMP_ALL into RSI_PO_ACCR_59272 (protected by DUP_VAL_ON_INDEX).
  2. Creates a PO write-off record: inserts into PO_ACCRUAL_WRITE_OFFS_ALL using PO_ACCRUAL_WRITE_OFFS_S.NEXTVAL, copying all relevant columns from the PO accrual row, with WRITE_OFF_CODE = 'WRITE OFF' and REASON_ID = 232.
  3. Updates the PO row in PO_ACCRUAL_RECONCILE_TEMP_ALL: sets write_off_id, write_off_flag = 'Y', net_po_line_amount = 0.
  4. Finds the matching AP accrual row: queries PO_ACCRUAL_RECONCILE_TEMP_ALL for transaction_source_code = 'AP' matching on PO_HEADER_ID, PO_LINE_ID, LINE_LOCATION_ID, INVENTORY_ITEM_ID, and round(abs(transaction_amount)). Requires exactly one AP match — rolls back if zero or more than one AP row found.
  5. Creates an AP write-off record: inserts into PO_ACCRUAL_WRITE_OFFS_ALL for the AP accrual row with a new sequence ID.
  6. Updates the AP row in PO_ACCRUAL_RECONCILE_TEMP_ALL: sets write_off_id, write_off_flag = 'Y', net_po_line_amount = 0.
  7. Commits per PO/AP pair. Logs errors per transaction type (PO or AP) to RSI_AP_PO_ERRORS_59272.

Resolution — Script 04: Write-Off Creation (Phase C — Parametric)

Parametric write-off creation for any org_id and variance amount

Same logic as Phase B (Script 03), but accepts two user-supplied parameters at runtime:

Phase C adds an additional filter on PO_DISTRIBUTION_ID when locating the matching AP accrual row, improving accuracy when multiple AP lines exist for the same PO/line/location combination. Otherwise identical to Phase B in its write-off insertion and update logic. Use Phase C as the preferred general-purpose version when the org or variance amount differs from the hardcoded Phase B values.

Note: Phases B and C require exactly one matching AP accrual row for each PO row — the script rolls back the PO write-off and logs an error if zero or more than one AP match is found. Phase A (rate correction) and Phases B/C (write-offs) are alternative approaches to the same underlying 1-cent variance problem; typically only one approach is applied per set of transactions. Phase A is preferred when the root cause (incorrect conversion rate on the receipt) can still be corrected; Phases B/C are used when write-off is the approved business resolution. Always run Script 01 to create the work tables before executing any fix script. Run Phase C in preference to Phase B for new engagements — it is more flexible and adds the po_distribution_id filter for better AP record matching.

Script Inventory

FileDescription
01_setup_driver_tables.sqlCreates backup table RSI_PO_ACCR_59272 (mirrors PO_ACCRUAL_RECONCILE_TEMP_ALL with unique index) and error table RSI_AP_PO_ERRORS_59272. Must be run before any fix script.
02_data_fix_phase_a.sqlPhase A: Recalculates currency_conversion_rate on RCV_TRANSACTIONS for PO/AP accrual pairs with 1-cent variance (net_po_line_amount=0.01, org_id=119). New rate = AP_TRANSACTION_AMOUNT / (AP_TRANSACTION_QUANTITY × AP_TRANSACTION_UNIT_PRICE). Backs up to RSI_RCV_TRX_59272.
03_data_fix_phase_b.sqlPhase B: Creates write-off records in PO_ACCRUAL_WRITE_OFFS_ALL for PO and AP accrual rows with abs(net_po_line_amount)=0.01 in org_id=119. Updates PO_ACCRUAL_RECONCILE_TEMP_ALL (write_off_id, write_off_flag='Y', net_po_line_amount=0). Requires exactly one AP match per PO row; rolls back pair if mismatch.
04_data_fix_phase_c.sqlPhase C (parametric): Same write-off logic as Phase B but accepts runtime parameters for org_id (&p_variable1) and variance amount (&p_variable2). Adds po_distribution_id to AP matching criteria. Preferred general-purpose version.

Key Tables Affected

TableAction
RCV_TRANSACTIONSUpdate currency_conversion_rate to corrected rate for affected receipt and parent transactions (Phase A)
PO_ACCRUAL_WRITE_OFFS_ALLInsert write-off records for both PO and AP sides of each 1-cent variance (Phases B and C)
PO_ACCRUAL_RECONCILE_TEMP_ALLUpdate write_off_id, write_off_flag='Y', net_po_line_amount=0 for written-off PO and AP rows (Phases B and C)
RSI_RCV_TRX_59272Backup of RCV_TRANSACTIONS rows before rate update (Phase A — created inline)
RSI_PO_ACCR_59272Backup of PO_ACCRUAL_RECONCILE_TEMP_ALL rows before write-off (Phases B and C)
RSI_AP_PO_ERRORS_59272Error log for per-transaction processing failures (Phases B and C)