How do you undo accounting in R12? [ID 753695.

1] Modified 02-JUN-2011 D
In this Document

Type HOWTO

Status PUBLISHE

Goal Solution

Applies to:
Oracle Payables - Version: 12.0.0 to 12.1.2 - Release: 12.0 to 12.1 Information in this document applies to any platform.

Goal
How do you undo accounting in R12?

Solution
R12 does not have any standard functionality to undo accounting. If you find accounting that is incorrect due to a bug, a datafix bug will need to be logged to provide you a script to undo accounting. If development determines that the accounting is incorrect and needs to be reversed/undone, they will provide you the appropriate instructions and corresponding scripts/patches. The ap_undo_acctg.sql is a centralized script for Undo Accounting to be used in AP. If the accounting is transferred, this script will create a manual entry with a NEW event id that reverses the original entry, change the original entry to a manual entry with a NEW event id, reset the status of the original event to unprocessed and also reset the posted flags for transactions assigned the original event id. The original event id, the reversed event id and the new event id are stored in the backup table created , namely AP_undo_event_log. If the accounting is NOT transferred, the script will delete the accounting and reset the original event to be accounted again, but it will not create a reversing entry. Example of undo for transferred accounting: Before Undo ========= 1 Event: Event_id = 123456, Event Type = Invoice Validated, Event Status = P After Undo ========= 3 Events: Event_id = 123456, Event Type = Invoice Validated, Event Status = U -- The original event id remains associated with the transaction data and the accounting status is reset to allow the new/corrected accounting to be created. Event_id = 234567, Event Type = Manual, Event Status = P -- New event id created for the reversal of the original accounting header and lines. Event_id = 234568, Event Type = Manual, Event Status = P -- New event id assigned to the original accounting header and lines. IMPORTANT: If the event_date corresponding to a transferred event is in a closed period, the reversed event and new event event_date will be set based on the script GL Date parameter. If the GL Date parameter is not populated, the event_date will be set to the latest open period. Make sure the corresponding period is open for both AP and GL.

IMPORTANT: Undo accounting can affect the Trial Balance report and reconciling Payables to GL. Please see Note 605707.1"UNDERSTANDING HOW UNDO ACCOUNTING CAN IMPACT RECONCILIATION" for more information on how manual entries created by the undo fix can affect reconciliation. The script utilizes a new package to undo/reverse accounting. The package name is AP_ACCTG_DATA_FIX_PKG and it should be created/compiled before running the ap_undo_acctg.sql script. If development provides you the undo script for a datafix, it should include the files for the new package and instructions to compile the package before running the script e.g. 1. Please download and compile apgdfals.pls and apgdfalb.pls Or For R12.0: Please download and apply patch 8471406 and Pre-Req/Co-Req patch 9177085 to get the latest Generic Datafix Package with the latest undo accounting code. For R12.1: Please download and apply patch 8471406 to get the latest Generic Datafix Package with the latest undo accounting code. Note: The instance does not need to be brought down to apply this patch, you can apply it in hotpatch mode e.g. adpatch option=hotpatch 2. Run ap_undo_acctg.sql with the following parameters: • • • P_EVENT_ID -- This can be null if all of the events related to an invoice or payment are to be unaccounted. P_SOURCE_TABLE -- AP_INVOICES or AP_PAYMENTS P_SOURCE_ID -- The invoice id or check id to be unaccounted. P_BUG_ID -- The bug number under which the fix was provided. This is logged in the AP_undo_event_log table so we can keep track of which bugs are responsible for the undo of which events. GL_DATE -- If transaction is in closed period, then enter GL date to which it has to be swept. Format like 01-APR-2009. If left blank the GL Date will default to the latest Open Period. L_USER_NAME*** -- Your user name (case insensitive) L_RESP_NAME ***-- Responsibility Name(Case Sensitive)


• • •

sum(xel.ledger_id. xla_ae_headers xeh.ledger_id. sum(xel. check_id.event_id and undo..ae_header_id||xel.application_id = 200 and xel. You MUST run the Transfer Journal Entries to GL program after you run any data fix that uses the undo fix. count(distinct xel.ledger_id.ae_header_id and undo. invoice_id. e3 event_id_related_to_orig_acctg.* from xla_ae_lines xel. 'U'. xeh.accounted_dr).ae_header_id||xel.accounted_dr).bug_id = &bug_number group by xeh.ae_header_id = xeh.e2 = xeh.ae_header_id and undo. Note: This is just one example of how the instructions for the undo script may be presented in a datafix bug.e2 = xeh. If the undo included transferred accounting.event_id. 4. etc.ledger_id.e3 = xeh. count(*) from xla_ae_lines xel. 1. ap_undo_event_log undo where xeh.event_id. sum(xel. xeh.event_id = xeh.e3 = xeh. The reversing entries created by the undo are not automatically transferred.ae_header_id). count(distinct xeh.ae_line_num).* from xla_ae_lines xel. ap_undo_event_log undo where xeh. e2 reversal_event_id.ledger_id. If the undo script ran did not pass a bug number or you want to see the related entries for a specific check_id. 'unhandled exception'.event_id and undo.ae_line_num).ledger_id. xla_ae_headers xeh.application_id = 200 and xel.event_id . where event_id = &event_id.accounted_dr).event_id and undo.ae_header_id and undo. ap_undo_event_log undo where xeh.application_id = 200 and xel. 2.accounted_cr).ae_header_id||xel.bug_id = &bug_number group by xeh. Query for original/incorrect reversal accounting select distinct xeh. ap_undo_event_log undo where xeh. select xeh. and corrected entries: (If the ap_undo_event_log table is populated) Note: The scripts provided below use the bug number the undo was ran for to return results.event_id = xeh.1 to rebuild the Trial Balance. select xeh.. xla_ae_headers xeh. Query for New/correct accounting select distinct xeh. sum(xel. xeh.event_id.ae_header_id).***Make sure you are using a responsibility name and user name for a payables responsibility and associated user that have access to run accounting for the subject transaction.bug_id = &bug_number order by xeh. invoice_id. ap_undo_event_log undo where xeh.ae_header_id = xeh.bug_id = &bug_number order by xeh. xeh. the original event_id. count(distinct xeh.application_id = 200 and xel. 3. 3. xla_ae_headers xeh. 'success'. count(distinct xel. This step will remove the old/undone accounting from the xla_trial_balances table and from the Trial Balance report.accounted_cr).ledger_id.* from xla_ae_lines xel.event_id.ledger_id.application_id = 200 and xel.ledger_id. bug_id from AP_undo_event_log where bug_id = &bug_number.ae_header_id). xel. count(distinct xel. xeh.accounted_cr). count(*) from xla_ae_lines xel. xel. change the where bug_id = &bug_number condition to where invoice_id = &invoice. count(distinct xeh.ae_header_id and undo. ap_undo_event_log undo where xeh.event_id. count(*) from xla_ae_lines xel. sum(xel. xla_ae_headers xeh. 'S'. status) status.ledger_id. xeh.ae_header_id and undo.event_id and undo. select xeh. 4. xla_ae_headers xeh.ae_header_id and undo.event_id. where check_id = &check_id. sum(xel. And you must run with Process Category parameter = Blank or 'Manual' to pick up the reversing entries.ae_header_id = xeh.bug_id = &bug_number order by xeh. Query the events updated/created by the undo script select event_id original_event_id .ae_header_id = xeh. Run the Transfer Journal Entries to GL process to transfer the reversing entries. please follow the instructions in Note 553484.ae_header_id = xeh.ledger_id. Queries to review and compare the incorrect.ae_line_num).ae_header_id = xeh. xel. Please make sure you follow the instruction from the bug/SR and only use this note as a reference. decode(status. Query for original/incorrect accounting select distinct xeh.event_id and undo. reversal.application_id = 200 and xel.

application_id = 200 and ( (xte.entity_id-1) ) UNION select distinct xte2.entity_id = xte. select * from xla_ae_lines where application_id = 200 and ae_header_id in ( select xeh.bug_id = &bug_number group by xeh.application_id = 200 and ( (xte.application_id = 200 and ( (xte2.source_id_int_1 = &&invoice_id) OR (xte2.xla_transaction_entities xte2 where xte2.application_id = 200 and ( (xte.entity_code = 'AP_INVOICES' and xte2.entity_code = 'MANUAL' and xte.xla_transaction_entities xte2 where xte2.entity_id in ( select distinct xte2.application_id = 200 and ( (xte2.xla_transaction_entities xte.entity_code = 'AP_INVOICES' and xte2.* from xla.entity_code = 'MANUAL' and xte2.entity_id-1) ) UNION select distinct xte2.xla_transaction_entities xte. xla.source_id_int_1 = &&invoice_id and xte2.entity_id from xla.event_id in ( select xe.entity_id = xte.application_id = 200 and xe.application_id = 200 and ( (xte2.entity_code = 'MANUAL' and xte2.xla_transaction_entities xte2 where xte.entity_code = 'MANUAL' and xte2.and undo.application_id = 200 and xte2.entity_id in ( select distinct xte2.entity_code = 'MANUAL' and xte2.xla_transaction_entities xte2 where xte.source_id_int_1 = &&invoice_id and xte2.entity_code = 'MANUAL' and xte.ae_header_id from xla_ae_headers xeh where xeh.event_id from xla_events xe where xe.entity_code = 'AP_INVOICES' and xte2.entity_id from xla.source_id_int_1 = &&invoice_id) )) order by event_id.application_id = 200 and xte2.source_id_int_1 = &&invoice_id and xte2.* from xla.xla_transaction_entities xte2 where xte2.ledger_id.source_id_int_1 = &&invoice_id) ))) order by ae_header_id. select * from xla_events where application_id = 200 and entity_id in ( select distinct xte2.entity_code = 'MANUAL' and xte. (If the ap_undo_event_log table is NOT populated) Invoices select distinct xte2.xla_transaction_entities xte.application_id = 200 and xeh.source_id_int_1 = &&invoice_id) OR (xte2. xla.entity_code = 'MANUAL' and xte.entity_id-1) ) UNION select distinct xte2.entity_id from xla. xla.xla_transaction_entities xte2 where xte. select * from xla_ae_headers where application_id = 200 and event_id in ( select xe.xla_transaction_entities xte2 where xte.source_id_int_1 = &&invoice_id and xte2.entity_code = 'MANUAL' and xte2.entity_id-1) ) UNION .entity_code = 'MANUAL' and xte2.xla_transaction_entities xte.application_id = 200 and xte2.entity_id from xla.source_id_int_1 = &&invoice_id) ) order by 1.entity_id = xte.entity_id = xte.application_id = 200 and xte2.entity_id from xla.source_id_int_1 = &&invoice_id) OR (xte2.event_id from xla_events xe where xe.entity_code = 'MANUAL' and xte2. xla.application_id = 200 and ( (xte.application_id = 200 and xe.

entity_code = 'MANUAL' and xte2.source_id_int_1 = &&check_id and xte2. xla.select distinct xte2.entity_id from xla.xla_transaction_entities xte2 where xte2.source_id_int_1 = &&check_id and xte2.application_id = 200 and xte2. xla.xla_transaction_entities xte2 where xte2.entity_id in ( select distinct xte2.entity_code = 'AP_INVOICES' and xte2.application_id = 200 and (xte.entity_id-1) UNION select distinct xte2.xla_transaction_entities xte2 .entity_code = 'AP_PAYMENTS' and xte2.entity_code = 'MANUAL' and xte.entity_id-1) UNION select distinct xte2.entity_code = 'MANUAL' and xte2.xla_transaction_entities xte2 where xte2.entity_id from xla.entity_code = 'MANUAL' and xte2.event_id from xla_events xe where xe.entity_id from xla.xla_transaction_entities xte2 where xte.xla_transaction_entities xte2 where xte.application_id = 200 and ( (xte2.entity_code = 'AP_PAYMENTS' and xte2.application_id = 200 and xe.xla_transaction_entities xte.entity_id from xla.xla_transaction_entities xte.source_id_int_1 = &&check_id) )) order by event_id.application_id = 200 and xe.xla_transaction_entities xte.xla_transaction_entities xte2 where xte.ae_header_id from xla_ae_headers xeh where xeh.entity_code = 'MANUAL' and xte2. xla.entity_code = 'AP_PAYMENTS' and xte2.source_id_int_1 = &&check_id) ))) order by ae_header_id.entity_id = xte.entity_code = 'MANUAL' and xte.entity_id from xla.source_id_int_1 = &&check_id) OR (xte2.application_id = 200 and xte2.* from xla.application_id = 200 and (xte.entity_id-1) UNION select distinct xte2.entity_id from xla.application_id = 200 and ( (xte2. Payments select distinct xte2.application_id = 200 and ( (xte2.application_id = 200 and ( (xte2.application_id = 200 and (xte.entity_id in ( select distinct xte2.source_id_int_1 = &&check_id and xte2. select * from xla_ae_lines where application_id = 200 and ae_header_id in ( select xeh.entity_id = xte.application_id = 200 and (xte.xla_transaction_entities xte.entity_id from xla.* from xla. xla.event_id from xla_events xe where xe.source_id_int_1 = &&check_id) ) order by 1.application_id = 200 and xeh.entity_code = 'MANUAL' and xte2.source_id_int_1 = &&check_id and xte2.source_id_int_1 = &&invoice_id) )))) order by ae_header_id.entity_code = 'MANUAL' and xte2.entity_id = xte.entity_code = 'MANUAL' and xte.entity_code = 'MANUAL' and xte2.xla_transaction_entities xte2 where xte2.application_id = 200 and xte2.source_id_int_1 = &&check_id) OR (xte2.application_id = 200 and xte2. select * from xla_ae_headers where application_id = 200 and event_id in ( select xe.entity_code = 'MANUAL' and xte2.entity_code = 'MANUAL' and xte.entity_id-1) UNION select distinct xte2. select * from xla_events where application_id = 200 and entity_id in ( select distinct xte2.entity_id = xte.source_id_int_1 = &&invoice_id) OR (xte2.event_id in ( select xe.xla_transaction_entities xte2 where xte.source_id_int_1 = &&check_id) OR (xte2.

sql 5. gl_sets_of_books gsob where gsob.'. 5. Navigate Responsibility: System Administrator > Profile > System > Query User: Enter the username the script will be ran for (L_USER_NAME) Profile: FND:%Debug% Set the following Profile values at the user level FND: Debug Log Enabled = Yes FND: Debug Log Level = Statement FND: Debug Log Module = % 5. Get the FND Debug log for the ap_undo_acctg. Spool this into an xls file. summary_flag. gsob. 3.end 5.sql 1. Get the FND Debug log data for the undo script.source_id_int_1 = &&check_id) )))) order by ae_header_id.code_combination_id.1)) FROM v$parameter WHERE name = 'utl_file_dir'.chart_of_accounts_id.2. substr(fnd_flex_ext. Then run the following to verify the ccids are valid: select gcc. gcc.4.'. Troubleshooting ap_undo_acctg.sql script. Use the following script to determine the location of the log file: SELECT decode(instr(value. detail_posting_allowed_flag.start 5. Please run the following query to get the ccid for the accounts: SELECT code_combination_id CCID FROM gl_code_combinations WHERE segment1 = '&segment1' AND segment2 = '&segment2' AND segment3 = '&segment3' AND segment4 = '&segment4' AND segment5 = '&segment5' .'). Check the Undo package version select * from dba_source where line = 2 and name = 'AP_ACCTG_DATA_FIX_PKG'.where xte2.entity_code = 'MANUAL' and xte2. account_type. select max(log_sequence) from fnd_log_messages . Get the current log sequence in the FND table.chart_of_accounts_id and gcc. Get the log sequence in the FND table after the undo script completes. 6. If the event undone is in a closed period. -.3. gcc. enabled_flag. Review the log file created by the ap_undo_acctg. Related Products • Oracle E-Business Suite > Financial Management > Procure to Pay > Oracle Payables .set_of_books_id = 1 and gsob. Make sure you are using a responsibility name and user name for a payables responsibility and associated user that have access to run accounting for the subject transaction.1. 4. -.value.entity_code = 'AP_PAYMENTS' and xte2.code_combination_id in (&ccid). end_date_active. make sure the GL Date entered or the default date corresponds with an open period in AP and GL.application_id = 200 and ( (xte2. Make sure the account numbers corresponding to the event to be undone are valid account numbers.chart_of_accounts_id = gcc.') .source_id_int_1 = &&check_id) OR (xte2.6.5. select * from fnd_log_messages where log_sequence between <start> and <end>.1.sql script.0. SUBSTR (value.get_segs('SQLGL'. 5. 5.chart_of_accounts_id.1. start_date_active. detail_budgeting_allowed_flag.instr(value.'GL#'. Run ap_undo_acctg.35) account from gl_code_combinations gcc.code_combination_id). select max(log_sequence) from fnd_log_messages . 2.

Back to top .

Sign up to vote on this title
UsefulNot useful