成本卷積報錯:CSTPSCEX.explode_sc_cost_flags():40:ORA-01476: 除數爲 0

成本卷積請求:供應鏈成本累計 - 打印報表sql

運行後報一下錯誤:oracle

MSG-00000: Rollup ID = 236403
MSG-00000: Before CSTPSCEX.supply_chain_rollup 2014/10/23 10:35:53
MSG-00000: After CSTPSCEX.supply_chain_rollup 2014/10/23 10:35:53
MSG-00000: No loop found
MSG-00000: CSTPSCEX.explode_sc_cost_flags():40:ORA-01476: 除數爲 0
REP-1825: 報表前觸發器返回 FALSE。
REP-0069: 內部錯誤
REP-57054: In-process job terminated:Terminated with error:
REP-1825: MSG-00000: Rollup ID = 236403
MSG-00000: Before CSTPSCEX.supply_chain_rollup 2014/10/23 10:35:53
MSG-00000: After CSTPSCEX.supply_chain_rollup 2014/10/23 10:35:53
MSG-00000: No loop found
MSG-00000: CSTPSCEX.explode_sc_cost_flags():40:ORA-01476: 除數爲 0
REP-1825: 報表前觸發器返回 FALSE。app

 

-----------oop

查找metalink 後分析,給出的解決方案:ui

-----------------spa

Supply Chain Indented Bills Of Material Cost Report Displays CSTPSCEX.explode_sc_cost_flags():40:ORA-01476 (文檔 ID 1904489.1)debug

 

To implement the solution, please execute the following steps:

1. Download and review the readme and pre-requisites for Patch 18632885:R12.BOM.C

2. Ensure that you have taken a backup of your system before applying the recommended patch.

3. Apply the patch in a test environment.

4. Confirm the following file versions:
CSTSCEXB.pls 120.12.12010000.14
CSTSCEXS.pls 120.0.12010000.4

You can use the commands like the following:
strings -a $BOM_TOP/patch/115/sql/CSTSCEXS.pls |grep '$Header'

5. Retest the issue.code

---------------------component

目前系統的版本爲:orm

 

[apptest@vis ZHS]$ strings -a $BOM_TOP/patch/115/sql/CSTSCEXS.pls |grep '$Header'
/* $Header: CSTSCEXS.pls 120.0.12010000.1 2008/07/24 17:25:17 appldev ship $ */
[apptest@vis ZHS]$ strings -a $BOM_TOP/patch/115/sql/CSTSCEXB.pls |grep '$Header'
/* $Header: CSTSCEXB.pls 120.12.12010000.6 2010/10/01 07:31:26 pbasrani ship $ */
[apptest@vis ZHS]$

 

顯然版本太低

想到現狀,打補丁麻煩,且。。。 言很少說

看看有沒有其餘辦法,再查 metalink,有一個給出數據修復的辦法:

Additional debug message in log for error: CSTPSCEX.explode_sc_cost_flags():40:ORA-01476: divisor is equal to zero (文檔 ID 1602932.1)

 

其中一段是這麼說的

@@The following datafix (Data_fix_script.sql) will address the existing phantom components that can't be manually adrressed in case the number is huge. The data fix script will only just uncheck the components having zero qty not included in cost roll up

@@ for phantom components.

 

下載了這個數據修復sql,內容以下:

/*
* Description :
*             This script is for 2 purpose
*             1. Check phantom item used in bom with quantity =0
*             2. Set such kind of bom component as NOT included in cost rollup.
*/

--step 1 CREATE back up table
DROP TABLE BOM_COMPONENTS_B_bak;
CREATE TABLE BOM_COMPONENTS_B_bak
AS
SELECT bic.*
  FROM bom_parameters bp, BOM_COMPONENTS_B bic , BOM_BILL_OF_MATERIALS bom, mtl_system_items msi
WHERE bp.organization_id = &p_org_id
 AND  bp.use_phantom_routings = 1
 AND  bp.organization_id = bom.organization_id
 AND  bom.common_bill_sequence_id = bic.bill_sequence_id
 AND  msi.organization_id = bom.organization_id
 AND  msi.inventory_item_id = bic.component_item_id
 AND  decode(nvl(BIC.wip_supply_type, nvl( MSI.wip_supply_type, 1)), 6, 1, 2) = 1
 AND  bic.component_quantity = 0
 AND  bic.include_in_cost_rollup = 1 ;


--below sql is used to find out each phantom item with 0 quantity 's assembly item and phantom item
SELECT bom.organization_id, msi1.inventory_item_id, msi1.segment1 assembly_item_name, msi.inventory_item_id, msi.segment1 phantom_item_name
  FROM bom_parameters bp, BOM_COMPONENTS_B bic , BOM_BILL_OF_MATERIALS bom, mtl_system_items msi, mtl_system_items msi1
WHERE bp.organization_id = &p_org_id
 AND  bp.use_phantom_routings = 1
 AND  bp.organization_id = bom.organization_id
 AND  bom.common_bill_sequence_id = bic.bill_sequence_id
 AND  msi.organization_id = bom.organization_id
 AND  msi.inventory_item_id = bic.component_item_id
 AND  msi1.organization_id = bom.organization_id
 AND  msi1.inventory_item_id = bom.assembly_item_id
 AND  decode(nvl(BIC.wip_supply_type, nvl( MSI.wip_supply_type, 1)), 6, 1, 2) = 1
 AND  bic.component_quantity = 0
 AND  bic.include_in_cost_rollup = 1 ;


--step 2, update include_in_cost_rollup = 2

UPDATE BOM_COMPONENTS_B
 SET include_in_cost_rollup = 2
WHERE (BILL_SEQUENCE_ID, COMPONENT_SEQUENCE_ID) IN (
   SELECT BILL_SEQUENCE_ID, COMPONENT_SEQUENCE_ID FROM  BOM_COMPONENTS_B_bak
) ;
COMMIT;

查看了以上代碼,分析了一下,無非就是修復清單中組件數量是0,且組件也是有清單的物料(子裝配件),須要把「包括在累計成本中」的勾去掉便可。這個也徹底能夠經過界面來操做完成,無需經過這段代碼也能夠完成。

 

再次提交卷積請求,成功!

相關文章
相關標籤/搜索