Sunteți pe pagina 1din 7

9/8/2017 Oracle EBs Apps Blog of Mahfuz, OPM Consultant, Bangladesh : Reopen Closed Period

Lin kt khc Blog tip theo To Blog ng nhp

Oracle EBs Apps Blog of Mahfuz, OPM


Consultant, Bangladesh
Sunday, 20 November 2016 About Me

Md. Mahfuz
Reopen Closed Period
Follow 17
/* opm_undo_create_accounting_by_date_range_and_LE_R12.sql
View my complete profile
+=======================================================================+
* Undo/Reset OPM Costed Flags
*
+=======================================================================+
* Blog Archive
* IMPORTANT NOTE:
* =============== 2017 (6)
* 2016 (37)
* 1. This script should be used by authorised Oracle personnel only.
* Use of this script must be approved by:
December (1)
* OPM Financial Manager November (28)
* OPM Level 2 Support Manager Reopen Closed Period
* Customer Management
* Inter-Org Profit
* 2. Running this script without control/due care may severly damage the COGS
* customer's sub-ledger.
* a. Advice the customer to perform a complete backup and OU wise Orgs Lists
* create a test environement. OU wise Orgs
* b. Make sure that the customer understands that this script will
* only resets costed flags for transactions in process enabled Errors: Future-06
* organizations, so that these transactions can be considered Time stemp
* for processing by ACP/Preprocessor during next runs.
* c. Perform reversing/deleting of GL postings based on GL batches posted. RA Data Fix
* d. Run the script in the test environment first. URL From Toad
* e. Ask customer to run the process (ACP/Pre-processor) again.
* Verify the results.
Errors: Future-02
* f. IF THE RESULTS ARE ACCEPTABLE RUN THE SCRIPT IN PRODUCTION Errors: Future-01
* ENVIRONMENT.
Errors: EAM
*
* 3. This script must be immediately removed from the customer's machine Errors: Create Accounting
* as soon as possible. This is to prevent any accidental execution
Errors: Accounting
* by the customer's personnel.
Preprocessor
* 4. Please modify start date ,end date and legal entity id
* Errors: Actual Cost
* Process
* How to Use: Errors: XLA
* ===========
* - Make sure you backup all the related tables Errors: SLA
* mtl_material_transactions Errors: GL
* gmf_rcv_accounting_txns
* gmf_invoice_distributions
Errors: AR
* gmf_incoming_material_layers Errors: AP
* gme_resource_txns
Errors: OM
* gme_batch_header
* gmf_lot_cost_adjustments Errors: OPM
* gmf_period_balances
Errors : Landed Cost
* cm_adjs_dtl
Adjustments Import
* gl_aloc_dtl Process ...
* gmf_lc_actual_cost_adjs -- Applicable for OPM-LCM integration for R12.1 and later
* gmf_lc_lot_cost_adjs -- Applicable for OPM-LCM integration for R12.1 and later Supplier Opening Balance
* gmf_lc_adj_transactions -- Applicable for OPM-LCM integration for R12.1 and later Upload(
Invoice/Prepaymen...
* gmf_transaction_valuation
* xla_distribution_links

http://mahfuzgeml.blogspot.com/2016/11/reopen-closed-period.html 1/7
9/8/2017 Oracle EBs Apps Blog of Mahfuz, OPM Consultant, Bangladesh : Reopen Closed Period
* xla_ae_lines New Supplier Open to
* xla_ae_segment_values Opening Balance
* xla_ae_headers upload in EBS...
* xla_events
Existing Supplier with
* xla_transaction_entities_upg Pendings Transaction
* gmf_xla_extract_lines Cancel...
* gmf_xla_extract_headers
* AP Invoice Opening
* Balance Upload
* PRE-REQUISITE:
* September (1)
* - Perform reversing/deleting of GL postings based on GL batches posted.
June (1)
* After performing the reversals of batches make sure that the reversal/deleting
* of GL postings has happened correctly from GL side. Once that is made sure, only then May (2)
proceed
March (2)
* Please log a Service Request with Oracle General Ledger Support team For assistance with
reversing/deleting GL Batches February (1)
*
January (1)
* Use THIS script, for next step to reset OPM costed flags.
* 2015 (13)
* - Script does not commit. Commit or rollback needs to be explicitly issued
* based on the results from the above query.
*
* CHANGE HISTORY:
* Version Date Name Comments
* 2.00 01-JUL-2015 KGENIKAL Modified to add additional scripts needed
* to support LCM-OPM integration tables ( Reference bugs 21054001, 20503780)
*
*
+=======================================================================+
*/

--
-- Update mtl_material_transactions table
--

UPDATE mtl_material_transactions t
SET opm_costed_flag = 'D'
WHERE transaction_date >= TO_DATE('01/04/12 00:00:00','dd/mm/yy hh24:mi:ss')
AND transaction_date <= TO_DATE('30/04/12 23:59:59','dd/mm/yy hh24:mi:ss')
AND EXISTS
(
SELECT 1
FROM mtl_parameters p, hr_organization_information hoi
WHERE p.process_enabled_flag = 'Y'
AND hoi.org_information2 = '&LE_ID'
AND hoi.org_information_context = 'Accounting Information'
AND p.organization_id = hoi.organization_id
AND p.organization_id = t.organization_id
);

--
-- Update gmf_rcv_accounting_txns table
--

UPDATE gmf_rcv_accounting_txns grat


SET accounted_flag = 'D'
WHERE transaction_date >= TO_DATE('01/04/12 00:00:00','dd/mm/yy hh24:mi:ss')
AND transaction_date <= TO_DATE('30/04/12 23:59:59','dd/mm/yy hh24:mi:ss')
AND EXISTS
(
SELECT 1
FROM mtl_parameters p, hr_organization_information hoi
WHERE p.process_enabled_flag = 'Y'
AND hoi.org_information2 = '&LE_ID'
AND hoi.org_information_context = 'Accounting Information'
AND p.organization_id = hoi.organization_id
AND p.organization_id = grat.organization_id
);

http://mahfuzgeml.blogspot.com/2016/11/reopen-closed-period.html 2/7
9/8/2017 Oracle EBs Apps Blog of Mahfuz, OPM Consultant, Bangladesh : Reopen Closed Period

--
-- Update gmf_invoice_distributions table
--

UPDATE gmf_invoice_distributions
SET Accounted_flag = 'D', final_posting_date = NULL
WHERE accounted_date >= TO_DATE('01/04/12 00:00:00','dd/mm/yy hh24:mi:ss')
AND accounted_date <= TO_DATE('30/04/12 23:59:59','dd/mm/yy hh24:mi:ss')
AND legal_entity_id = '&LE_ID';

--
-- Update transaction valuation table to set shipment_costed flag
-- back to NULL for event clases FOB_RCPT_SENDER_RCPT and
FOB_SHIP_RECIPIENT_SHIP
--

UPDATE mtl_material_transactions t
SET shipment_costed = NULL
WHERE transaction_source_type_id IN (7, 8, 13)
AND transaction_action_id IN (12, 21)
AND transaction_date >= TO_DATE('01/04/12 00:00:00','dd/mm/yy hh24:mi:ss')
AND transaction_date <= TO_DATE('30/04/12 23:59:59','dd/mm/yy hh24:mi:ss')
AND EXISTS
(
SELECT 1
FROM mtl_parameters p, hr_organization_information hoi
WHERE p.process_enabled_flag = 'Y'
AND hoi.org_information2 = '&LE_ID'
AND hoi.org_information_context = 'Accounting Information'
AND p.organization_id = hoi.organization_id
AND p.organization_id = t.organization_id
);

--
-- Update incoming layers table (BatchesXperiods Enh.)
--

UPDATE gmf_incoming_material_layers giml


SET accounted_flag = 'D',
actual_posting_date = NULL
WHERE layer_date >= TO_DATE('01/04/12 00:00:00','dd/mm/yy hh24:mi:ss')
AND layer_date <= TO_DATE('30/04/12 23:59:59','dd/mm/yy hh24:mi:ss')
AND EXISTS
(
SELECT 1
FROM mtl_parameters p, hr_organization_information hoi
WHERE p.process_enabled_flag = 'Y'
AND hoi.org_information2 = '&LE_ID'
AND hoi.org_information_context = 'Accounting Information'
AND p.organization_id = hoi.organization_id
AND p.organization_id = giml.mmt_organization_id
);

--
-- Update resource transaction table
-- Decide what Flag to use when run in Draft Mode.
--

UPDATE gme_resource_txns
SET posted_ind = 0
WHERE trans_date >= TO_DATE('01/04/12 00:00:00','dd/mm/yy hh24:mi:ss')
AND trans_date <= TO_DATE('30/04/12 23:59:59','dd/mm/yy hh24:mi:ss')
AND organization_id in (
select hoi.organization_id
from hr_organization_information hoi
where hoi.org_information2 = '&LE_ID'
and hoi.org_information_context = 'Accounting Information'
);

http://mahfuzgeml.blogspot.com/2016/11/reopen-closed-period.html 3/7
9/8/2017 Oracle EBs Apps Blog of Mahfuz, OPM Consultant, Bangladesh : Reopen Closed Period

--
-- Update Batch Header table
--

UPDATE gme_batch_header
SET gl_posted_ind =0
WHERE batch_close_date >= TO_DATE('01/04/12 00:00:00','dd/mm/yy hh24:mi:ss')
AND batch_close_date <= TO_DATE('30/04/12 23:59:59','dd/mm/yy hh24:mi:ss')
AND organization_id in (
select hoi.organization_id
from hr_organization_information hoi
where hoi.org_information2 = '&LE_ID'
and hoi.org_information_context = 'Accounting Information'
);

--
-- Now for lot cost method, update gmf_lot_cost_adjustmets table
-- For Actual/Standard methods, update gmf_period_balances table.
--

UPDATE gmf_lot_cost_adjustments
SET gl_posted_ind =0
WHERE adjustment_date >= TO_DATE('01/04/12 00:00:00','dd/mm/yy hh24:mi:ss')
AND adjustment_date <= TO_DATE('30/04/12 23:59:59','dd/mm/yy hh24:mi:ss')
AND legal_entity_id = '&LE_ID';

--
-- Update transaction valuation table
--

UPDATE gmf_period_balances
SET costed_flag = 'D'
WHERE period_balance_id IN
(SELECT xte.SOURCE_ID_INT_1
FROM xla.xla_transaction_entities xte,
xla_events xe,
gmf_xla_extract_headers geh
WHERE xte.entity_id = xe.entity_id
AND xe.event_id = geh.event_id
AND xe.application_id = 555
AND geh.transaction_date >= TO_DATE('01/04/12 00:00:00','dd/mm/yy hh24:mi:ss')
AND geh.transaction_date <= TO_DATE('30/04/12 23:59:59','dd/mm/yy hh24:mi:ss')
AND geh.event_type_code = 'COSTREVAL'
AND geh.legal_entity_id = '&LE_ID'
);

--
-- Update Actual Cost Adjustments
--

UPDATE cm_adjs_dtl
SET gl_posted_ind =0
WHERE adjustment_date >= TO_DATE('01/04/12 00:00:00','dd/mm/yy hh24:mi:ss')
AND adjustment_date <= TO_DATE('30/04/12 23:59:59','dd/mm/yy hh24:mi:ss')
AND organization_id in (
select hoi.organization_id
from hr_organization_information hoi
where hoi.org_information2 = '&LE_ID'
and hoi.org_information_context = 'Accounting Information'
);

--
-- Update Cost Allocations
--

http://mahfuzgeml.blogspot.com/2016/11/reopen-closed-period.html 4/7
9/8/2017 Oracle EBs Apps Blog of Mahfuz, OPM Consultant, Bangladesh : Reopen Closed Period
UPDATE gl_aloc_dtl
SET gl_posted_ind =0
WHERE allocdtl_id IN
( SELECT xte.SOURCE_ID_INT_1
FROM xla.xla_transaction_entities xte,
xla_events xe,
gmf_xla_extract_headers geh
WHERE xte.entity_id = xe.entity_id
AND xe.event_id = geh.event_id
AND xe.application_id = 555
AND geh.transaction_date >= TO_DATE('01/04/12 00:00:00','dd/mm/yy hh24:mi:ss')
AND geh.transaction_date <= TO_DATE('30/04/12 23:59:59','dd/mm/yy hh24:mi:ss')
AND geh.event_type_code = 'GLCOSTALOC'
and geh.legal_entity_id = '&LE_ID'
);

/* Start changes V2 Dt. 01-Jul-2015 */


/* Applicable for OPM-LCM integration for release 12.1 and later */
/* Start Update OPM-LCM integration tables */

UPDATE gmf_lc_actual_cost_adjs
SET accounted_flag = 'N',
final_posting_date = NULL
WHERE adj_transaction_id IN
(
SELECT adj_transaction_id
FROM gmf_lc_adj_transactions
WHERE legal_entity_id = '&LE_ID'
AND transaction_date >= TO_DATE('05/07/09 00:00:00','dd/mm/yy hh24:mi:ss')
AND transaction_date <= TO_DATE('01/08/09 23:59:59','dd/mm/yy hh24:mi:ss')
);

UPDATE gmf_lc_lot_cost_adjs
SET accounted_flag = 'N',
final_posting_date = NULL
WHERE adj_transaction_id IN
(
SELECT adj_transaction_id
FROM gmf_lc_adj_transactions
WHERE legal_entity_id = '&LE_ID'
AND transaction_date >= TO_DATE('05/07/09 00:00:00','dd/mm/yy hh24:mi:ss')
AND transaction_date <= TO_DATE('01/08/09 23:59:59','dd/mm/yy hh24:mi:ss')
);

UPDATE gmf_lc_adj_transactions
SET accounted_flag = 'D'
WHERE legal_entity_id = '&LE_ID'
AND transaction_date >= TO_DATE('05/07/09 00:00:00','dd/mm/yy hh24:mi:ss')
AND transaction_date <= TO_DATE('01/08/09 23:59:59','dd/mm/yy hh24:mi:ss');

/* End Update OPM-LCM integration tables */

/* End changes V2 Dt. 01-Jul-2015 */

--
-- Delete transaction valuation rows
--

DELETE FROM gmf_transaction_valuation


WHERE transaction_date >= TO_DATE('01/04/12 00:00:00','dd/mm/yy hh24:mi:ss')
AND transaction_date <= TO_DATE('30/04/12 23:59:59','dd/mm/yy hh24:mi:ss')
AND legal_entity_id = '&LE_ID';

create table xla_events_bck as


select xe.*
from xla_events xe,
gmf_xla_extract_headers gmf
where xe.application_id = 555
and xe.event_id = gmf.event_id

http://mahfuzgeml.blogspot.com/2016/11/reopen-closed-period.html 5/7
9/8/2017 Oracle EBs Apps Blog of Mahfuz, OPM Consultant, Bangladesh : Reopen Closed Period
and gmf.transaction_date >= TO_DATE('01/04/12 00:00:00','dd/mm/yy hh24:mi:ss')
and gmf.transaction_date <= TO_DATE('30/04/12 23:59:59','dd/mm/yy hh24:mi:ss')
AND gmf.legal_entity_id = '&LE_ID';

create table xla_ae_headers_bck as


select *
from xla_ae_headers
where application_id = 555
and event_id in(select event_id
from xla_events_bck);

create table xla_ae_lines_bck as


select *
from xla_ae_lines
where application_id = 555
and ae_header_id in(select ae_header_id
from xla_ae_headers_bck);

create table xla_dist_link_bck as


select *
from xla_distribution_links
where application_id = 555
and ae_header_id in(select ae_header_id
from xla_ae_headers_bck);

create table xla_ae_seg_val_bck as


select *
from xla_ae_segment_values
where ae_header_id in(select ae_header_id
from xla_ae_headers_bck );

/* Start changes V2 Dt. 01-Jul-2015 */


CREATE TABLE xla_trans_enti_upg_bck AS
SELECT *
FROM XLA_TRANSACTION_ENTITIES_UPG
WHERE application_id = 555
AND LEGAL_ENTITY_ID = '&LE_ID'
AND ENTITY_ID IN
( SELECT ENTITY_ID FROM XLA_AE_HEADERS_BCK
);
/* End changes V2 Dt. 01-Jul-2015 */

-- delete data from xla tables


delete from xla_distribution_links
where application_id = 555
and ae_header_id in(select distinct ae_header_id
from xla_dist_link_bck);

delete from xla_ae_lines


where application_id = 555
and ae_header_id in(select distinct ae_header_id
from xla_ae_lines_bck);

--This one may take sometime.


delete from xla_ae_segment_values
where ae_header_id in(select distinct ae_header_id
from xla_ae_seg_val_bck);

delete from xla_ae_headers


where application_id = 555
and ae_header_id in (select ae_header_id
from xla_ae_headers_bck);

delete from xla_events


where application_id = 555

http://mahfuzgeml.blogspot.com/2016/11/reopen-closed-period.html 6/7
9/8/2017 Oracle EBs Apps Blog of Mahfuz, OPM Consultant, Bangladesh : Reopen Closed Period
and event_id in(select event_id
from xla_events_bck);

/* Start changes V2 Dt. 01-Jul-2015 */


DELETE
FROM XLA_TRANSACTION_ENTITIES_UPG
WHERE APPLICATION_ID=555
AND LEGAL_ENTITY_ID = '&LE_ID'
AND ENTITY_ID IN
( SELECT ENTITY_ID FROM XLA_AE_HEADERS_BCK
);
/* End changes V2 Dt. 01-Jul-2015 */

--
-- Delete extract lines
--
DELETE FROM gmf_xla_extract_lines
WHERE header_id IN (
SELECT header_id
FROM gmf_xla_extract_headers
WHERE transaction_date >= TO_DATE('01/04/12 00:00:00','dd/mm/yy hh24:mi:ss')
AND transaction_date <= TO_DATE('30/04/12 23:59:59','dd/mm/yy hh24:mi:ss')
AND legal_entity_id = '&LE_ID'
);

--
-- Delete extract headers
--

DELETE FROM gmf_xla_extract_headers


WHERE transaction_date >= TO_DATE('01/04/12 00:00:00','dd/mm/yy hh24:mi:ss')
AND transaction_date <= TO_DATE('30/04/12 23:59:59','dd/mm/yy hh24:mi:ss')
AND legal_entity_id = '&LE_ID';

Posted by Md. Mahfuz at 22:37

No comments:

Post a Comment

Enter your comment...

Comment as: Unknown (Google) Sign out

Publish Preview Notify me

Newer Post Home Older Post

Subscribe to: Post Comments (Atom)

Awesome Inc. theme. Powered by Blogger.

http://mahfuzgeml.blogspot.com/2016/11/reopen-closed-period.html 7/7

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