Pulling the tax request and response from Oracle EBS
Every tax problem gets easier once you can see exactly what Oracle sent to the tax engine and what came back. This lesson shows how to find that pair of XML documents in the adapter log with SQL, and what to read first.
By Herb Park, Clarent Technologies
A screen shows you the tax result. The request shows what the engine was told and the response shows what it decided and why. With both in hand, most "wrong tax" questions can be triaged in minutes. The examples use the ONESOURCE (Sabrix) Oracle adapter, which logs to a table called SABRIX_LOG; other engines’ adapters keep similar logs under different names.
What you need
- A SQL client (SQL Developer or similar) connected to the instance where the issue happened. Production logs only exist in production, test logs only in test.
- Read access to the
APPSschema. - The transaction you are investigating: invoice number and operating unit, or the order or transaction number.
alter session set current_schema=apps;Method 1: find the logs for a transaction that already ran
Use this when an invoice is already on hold or already shows the wrong tax. The log stores Oracle’s internal document ID, not the number users see, so look that up first. For an AP invoice:
SELECT invoice_id, invoice_num, org_id, creation_date
FROM ap_invoices_all
WHERE invoice_num = :invoice_num;If several rows come back, pick the one with the right operating unit (org_id). Then pull the XML rows:
SELECT log_date, batch_id, log_id, document_num, procedure_name,
location, message, extended_message
FROM sabrix_log
WHERE document_num = :document_num
AND location LIKE '%DATA%XML%'
ORDER BY log_id DESC;| Row | Location | What it is |
|---|---|---|
| Request | INDATA XML | What Oracle sent to the engine |
| Response | OUTDATA XML | What the engine returned |
Take the most recent pair unless you are investigating a specific earlier attempt.
- LOG_DATE: 15-OCT 09:05; BATCH_ID: 77120; LOG_ID: 9034418; DOCUMENT_NUM: 284511; LOCATION: OUTDATA XML; EXTENDED_MESSAGE: <OUTDATA>...
- LOG_DATE: 15-OCT 09:05; BATCH_ID: 77120; LOG_ID: 9034412; DOCUMENT_NUM: 284511; LOCATION: INDATA XML; EXTENDED_MESSAGE: <INDATA>...
- LOG_DATE: 14-OCT 16:22; BATCH_ID: 76893; LOG_ID: 9029977; DOCUMENT_NUM: 284511; LOCATION: OUTDATA XML; EXTENDED_MESSAGE: <OUTDATA>...
- LOG_DATE: 14-OCT 16:22; BATCH_ID: 76893; LOG_ID: 9029970; DOCUMENT_NUM: 284511; LOCATION: INDATA XML; EXTENDED_MESSAGE: <INDATA>...
- 4 rows fetched. DOCUMENT_NUM holds the internal invoice ID.
- (1) The most recent pair: same batch ID, one request and one response. Take this one.
- (2) An earlier attempt. Use it only if that attempt is the one you are investigating.
Method 2: capture a fresh log by re-running the transaction
- Note the current highest log ID. Run
SELECT MAX(log_id) FROM sabrix_log;and write the number down. - Run the transaction. Validate the invoice or recalculate tax in Oracle. Only do this in production when the business owner agrees.
- Pull everything logged since then. Query
sabrix_logforlog_id > :max_log_idandlocation LIKE '%DATA%XML%', newest first. - Check it is yours. Confirm
DOCUMENT_NUMandLOG_DATE. On a busy system someone else’s transaction can land in the same window.
- 1. You, in SQL: Note the highest log ID
- 2. Oracle EBS: Validate the invoice
- 3. Adapter log: Call logged as two rows
- 4. You, in SQL: Query the newer rows
- 5. You, in SQL: Check it is yours
Copying the XML out
The full XML is in EXTENDED_MESSAGE; the results grid only shows the start of it. Open the cell’s full-value editor, select all, copy, and save it as a file. Save the request and the response, and name them so they stay paired, for example request-<log_id>.xml and response-<log_id>.xml.
What to read first
- Any rows in the log?: Was the engine called at all
- Look upstream: Call point, adapter or E-Business Tax
- Request facts right?: Ship-to, ship-from, dates, product codes, tax code
- Fix what Oracle sent: Master data or the integration
- Read the response: Jurisdiction, rate, rule fired, tax code, error flags
- Was the engine called at all? No rows means the problem is upstream: the call point, the adapter, or Oracle E-Business Tax itself. See When it isn’t the tax engine.
- Are the facts in the request right? Ship-to, ship-from, dates, product codes, the tax code passed in. See Anatomy of a tax calculation request.
- What did the engine decide? In the response: jurisdiction, rate, the rule that fired, the tax code returned, and any error or partial-success flags.
Then work through Diagnosing an unexpected tax result.