這個月,有一筆 Uncosted Material Pending Transaction,怪得是,並沒有 Error Message
Period Pending數量是 1,但 Open Detail,卻有 4 筆交易,原來他是 InterCompany Transaction,所以除了 Sales Order Issue 之外,還有三筆 Logical Transaction。
仔細看這筆 Transaction,發現其實分錄已經產生,而且,Transaction Distribution 的 Transaction Type 是 Sales order issue,也就是說,Oracle 把他當成一般出貨 (非 InterCompany ) 在切分錄。
正常的 InterCompany 應該有三組分錄,Distribution 的 Transaction Type 應該分別是 Logical Sales Order Issue, Logical Intercompany Shipment Receipt 和 Logical Intercompany Sales Issue。
所以,蠢的是
1. InterCompany 交易,卻把他當成一般交易再切分錄
2. 分錄都切了,卻還把他判定是 Pending。(不過好在還有判定 Pending,否則分錄錯了都不知道)
想起來,這個之前其實也發生過,原因是,如果 Sales Order Issue 交易發生了,但 Logical Transaction 還沒有產生之前,如果 Cost Manager 處理到此交易,就會當做一般出貨在切分錄。
我不知道有沒有更好的解法,我的解法是,在 Logical Transactions 產生之後,將原本的分錄刪除,讓 Oracle 重切分錄。同時,如果原本的分錄已經拋到總帳去了,就要請財務進行調帳。
1. 首先,我會把錯誤的分錄 Dump 出來,讓財務調帳有個依據
select msi.segment1 item
, mmt.transaction_date
, sha.order_number||'-'||sla.line_number||'.'||sla.shipment_number so
, fa_rx_flex_pkg.get_value(101,'GL#',50534,'ALL', mta.reference_account) account
, mta.base_transaction_value
from mtl_material_transactions mmt
, mtl_transaction_accounts mta
, mtl_system_items msi
, oe_order_lines_all sla
, oe_order_headers_all sha
where mmt.organization_id = 278
and mmt.transaction_id = mta.transaction_id
and mmt.organization_id = msi.organization_id
and mmt.inventory_item_id = msi.inventory_item_id
and mmt.trx_source_line_id = sla.line_id
and sla.header_id = sha.header_id
and mmt.transaction_id in (40225418, 40225421, 40225422, 40225423, 40225424, 40225425);
2. 先備份,再刪除,預防萬一
insert into zyapps.bk_mtl_transaction_accounts
select *
from mtl_transaction_accounts mta
where mta.transaction_id in (40225418, 40225421, 40225422, 40225423, 40225424, 40225425);
insert into zyapps.bk_mtl_cst_actual_cost_details
select *
from mtl_cst_actual_cost_details cacd
where cacd.transaction_id in (40225418, 40225421, 40225422, 40225423, 40225424, 40225425);
delete from mtl_cst_actual_cost_details cacd
where cacd.transaction_id in (40225418, 40225421, 40225422, 40225423, 40225424, 40225425);
delete from mtl_transaction_accounts mta
where mta.transaction_id in (40225418, 40225421, 40225422, 40225423, 40225424, 40225425);
3. 把交易改成未產生分錄
update mtl_material_transactions mmt
set costed_flag = 'N'
, request_id = NULL
, transaction_group_id = NULL
, error_code = NULL
, error_explanation = NULL
where mmt.transaction_id in (40225418, 40225421, 40225422, 40225423, 40225424, 40225425);
沒有留言:
張貼留言