Sunteți pe pagina 1din 2

REM

+================================================================================+
REM |
|
REM | File Name : sweep_transactions_Fix.txt
REM |
|
REM | Desc : Datafix finds all transactions accounted in a closed period for an
|
REM | application and sweeps them to next period as input provided by user.
|
REM | Related Subledger teams like AP/AR should first update their
tables ,then|
REM | only Xla tables can be modified.Else there would be serious
reconciliation issues
|
REM | CodeFix: |
REM | USAGE :
|
REM | Supply the following when prompted:
|
REM | 1) new_accounting_date
|
REM | 2) ledger_id
|
REM | 3) application_id
REM | |
REM
*================================================================================*/

/* $Header: sweep_transactions_Fix.txt 120.0 2008/09/15 15:53:01 nksurana noship $


*/

--The script can be used when Transfer to GL fails because transactions are in
closed/permanently closed periods.
--After applying datafix when Transfer to GL is run again ,it should go fine.
--The script can be hardcoded for specific transaction also if subledgers like
AP/AR want to sweep a draft/final accounted
--transaction Or if they are having an issue sweeping a transaction.

--1)
Drop table xla_ae_headers_7234498;

--2) Find transactions which are in closed period


create table xla_ae_headers_7234498
as select xah.event_id,xah.ae_header_id,glp.period_name
from xla_ae_headers xah,gl_period_statuses glp
where xah.ledger_id=&ledger_id
and xah.application_id=&application_id
and xah.accounting_entry_status_code='F'
and xah.gl_transfer_status_code ='N'
and xah.upg_batch_id is NULL
and xah.period_name = glp.period_name
and glp.application_id = 101
and glp.set_of_books_id= xah.ledger_id
and glp.closing_status IN ('C','P');
--3) Update transactions period and gl date in xla ae headers which are in closed
period

update xla_ae_headers xah


set xah.accounting_date = to_date('&new_accounting_date','DD-MON-YYYY'),
xah.period_name = (select period_name
from gl_period_statuses
where ledger_id = &&ledger_id
and application_id = 101
and adjustment_period_flag <> 'Y'
and to_date('&new_accounting_date', 'DD-MON-YYYY')
between start_date and end_date),
xah.last_updated_by=-169
where exists
(select 1 from xla_ae_headers_7234498 xah1
where xah1.ae_header_id = xah.ae_header_id)
and xah.ledger_id=&ledger_id
and xah.application_id=&application_id
and xah.accounting_entry_status_code='F'
and xah.gl_transfer_status_code ='N'
and xah.upg_batch_id is NULL;

--4) Update transactions event date in xla event which are in closed period

Update xla_events xe
set xe.event_date = to_date('&new_accounting_date','DD-MON-YYYY'),
xe.last_updated_by = -169
where exists
( select 1 from xla_ae_headers_7234498 xah1
where xah1.event_id = xe.event_id)
and xe.application_id=&application_id
and xe.event_status_code='P'
and xe.process_status_code ='P'
and xe.upg_batch_id is NULL;

--5) Update transactions gl date in xla ae lines which are in closed period

update xla_ae_lines xal


set xal.accounting_date = to_date('&new_accounting_date','DD-MON-YYYY'),
xal.last_updated_by=-169
where exists
(select 1 from xla_ae_headers_7234498 xah1
where xah1.ae_header_id = xal.ae_header_id)
and xal.ledger_id=&ledger_id
and xal.application_id=&application_id
and xal.upg_batch_id is NULL;

S-ar putea să vă placă și