3/04/2010

問題記錄_CST_暫緩資源異動

事件:無法關閉分散式工單。
概述:原物料異動中有錯誤。
問題記錄:
1)「成本管理」職責下->檢視異動->暫緩資源異動。
2)彈出「搜尋暫緩的資源異動」視窗->依條件填入異動日期欄位->搜尋。
3)彈出「暫緩異動」視窗->內有暫緩狀態之資料(表示工單上有資源存在暫緩之狀態)
4)並且「重新提交」框無法勾選,工具->選取全部以重新提交,也無法執行。

5)以下為oracle support所提供的解決方案:

Comments
--------
Please perform the following action plan on TEST INSTANCE after taking appropriate back ups.

To implement the solution, please execute the following steps:
Run the following scripts to confirm that erred rows exist in the mtl_material_transactions (MMT) and mtl_cst_actual_cost_details (MCACD) tables.

Script 1. To check the erred transaction details :
Select Transaction_id , costed_flag , error_code , error_explanation , org_id ,acct_period_id ,
from mtl_material_transactions
where costed_flag='E'
-------> This script should return the erred transaction id with the error code mentioned above... The below mentioned fix is intended for this error only.


Script 2. To find out whether the erred transaction(s) have distributions created in the mtl_transaction_acconts table.:

Select * from mtl_transaction_accounts
where transaction_id in ( Select transaction_id from mtl_material_transactions where costed_flag='E')
-------> This query should not return any rows....


Script 3. To find out whether the erred transaction(s) have record(s) created in the mtl_cst_actual_cost_details
Select * from mtl_cst_actual_cost_details
where transaction_id in ( Select transaction_id from mtl_material_transactions where costed_flag='E')

------>This script will give the same transaction id which is erred out in the mtl_material_transactions.
It indicates that the erred transaction id's have reached this table.

Script 4. To find out whether the erred transaction(s) have record(s) created in the mtl_cst_txn_cost_details :
Select * from mtl_cst_txn_cost_details
where transaction_id in ( Select transaction_id from mtl_material_transactions where costed_flag='E')
-------------> This script should not return any rows, as the record will be either in the MCACD or MCTCD.

Script 5. To find out whether the erred transaction(s) have record(s) created in the mtl_actual_cost_subelement
Select * from mtl_actual_cost_subelement
where transaction_id in ( Select transaction_id from mtl_material_transactions where costed_flag='E')
------------------> This is checking in the subelement table.

After confirming the erred transaction in the above tables, the datafix will be as follows:

Create Back-tables.

Action 1. Backup mtl_cst_actual_cost_details table.
Sql : Create table MCACD as (Select * from mtl_cst_actual_cost_details
where transaction_id in (select transaction_id from mtl_material_transactions
where costed_flag in ('N','E')

Action 2. Backup mtl_material_transactions table.
Sql. : Create table MMT as (Select * from mtl_material_transactions
where costed_flag in ('N','E'));


Action 3. Delete the records from mtl_cst_actual_cost_details which have corresponding records
(same transaction_id with the same error_explanation ) in mtl_material_transactions table with costed_flag = ' E'
Sql : Delete from mtl_cst_actual_cost_details
Where transaction_id IN
(Select transaction_id from mtl_material_transactions where costed_flag IN ('E')
and organization_id = &org_id); << the organization_id which has the errors
---------> Please ensure that the transaction_id's which will be deleted by this script are the same as those returned by Script 3.

Action 4 : Cancel the Cost Manager:
System Administrator --> Requests --> View --> Go to Specific Request and in the Name enter 'Cost Manager'.
From here cancel the Cost Manager that is Pending Scheduled.

Action 5. Re-submitt the transactions:
Update mtl_material_transactions
Set costed_flag = 'N',
transaction_group_id = null,
error_code = null,
error_explanation = null
where costed_flag in ('N','E');
Commit ;

Action 6 . Launch the Cost Manager
Inventory --> Setup --> Transactions --> Interface Managers --> Tools (Menu Bar) --> Launch Manager-->Submit
(No scheduling for the Cost Manager should be done in the Request Form)
=============================================
This will resolve the erred transactions.

If the Script 2 returns any rows i.e. if the transaction(s) which is erred out in the mtl_material_transactions table, have reached in the mtl_transaction_accounts table, then, in this case, after proper scrutiny and analysis, update the costed_flag of these transactions to NULL.. This has to be done with the utmost care and it should be ensured that errred transactions have the distributions created for the same with base transaction value, which is matching with the transaction value coloumn of the mtl_material_transactions table.