1、 在Form和包中
应当使用系统标准API来展开:apps.bompexpl.exploder_userexit,可以展开任意级的多级清单,含指定类型的成本。我们不需要自己写展开BOM的函数,也不需要用SQL直接取,这样可以保证最大的代码健壮性和兼容性。
2、 在日常的SQL中,也要参考该标准API来书写,下面是取当前时点(Sysdate)单层BOM的例子,尚缺考虑Revision:
SELECT mst.segment1 assembly_item,
boms.alternate_bom_designator alternate,
bics.item_num,
msic.segment1 component_item,
bics.component_quantity,
bics.effectivity_date,
bics.disable_date
FROM inv.mtl_system_items_b mst,
apps.bom_bill_of_materials boms,
apps.bom_inventory_components bics,
inv.mtl_system_items_b msic
WHERE mst.organization_id = boms.organization_id
AND mst.inventory_item_id = boms.assembly_item_id
AND boms.bill_sequence_id = bics.bill_sequence_id
AND boms.organization_id = msic.organization_id
AND bics.component_item_id = msic.inventory_item_id
--Item
AND mst.bom_enabled_flag = 'Y'
AND mst.bom_item_type IN (1, 2, 3, 4) --Dependent
--BOM Header
AND boms.assembly_type = 1 --1 Manufature,2 ENG
AND nvl(boms.effectivity_control, 1) <= 3
--BOM Line
AND nvl(bics.disable_date, SYSDATE) >= SYSDATE
AND bics.effectivity_date <= SYSDATE
AND bics.implementation_date IS NOT NULL
AND nvl(bics.eco_for_production, 2) = 2
--Filters
AND mst.organization_id = 82
AND mst.segment1 LIKE '96%'
ORDER BY 1, 2 NULLS FIRST, 3