BOM Query
BOM Query
segment1, '^') sequence_id, LPAD (' ', LEVEL * 2) || LEVEL order_Level, msib2.inventory_item_id child_inv_id, msib2.segment1 CHILD, bic.item_num level1, msib2.list_price_per_unit "Per Cost", (bic.component_quantity * msib2.list_price_per_unit) "ExtCost", msib2.description "PartDescription", bic.attribute2 ECO, msib.inventory_item_id ***_item_id, msib2.INVENTORY_ITEM_STATUS_CODE status, MSIB2.ITEM_TYPE, msib2.inventory_item_id part_item_id, bic.component_sequence_id comp_seq_id, cic.material_cost, cic.resource_cost, cic.overhead_cost, (cic.overhead_cost * bic.component_quantity) ovrhd_ext_cost, cic.item_cost, cic.material_cost material_cost_ly, (cic.material_cost * bic.component_quantity) material_ext_cost, cic.resource_cost resource_cost_ly, cic.overhead_cost overhead_cost_ly, cic.item_cost item_cost_ly, bic.attribute1 deliver_to, bic.attribute2 eco_num, bic.attribute3 eng_comments, bic.component_item_id child_item_id, bic.component_sequence_id child_component_id, msib2.segment1 CHILD, msib2.description child_item_desc, msib2.item_type child_item_type, TO_CHAR (bic.component_quantity) quantity, bic.effectivity_date start_date, bic.disable_date end_date, msib2.inventory_item_status_code item_status_code, msib2.primary_unit_of_measure child_uom_code FROM bom_inventory_components bic, bom_bill_of_materials bom, mtl_system_items_b msib, mtl_system_items_b msib2, BOM_REFERENCE_DESIGNATORS BRD, cst_item_costs cic, CST_COST_TYPES cct WHERE bic.bill_sequence_id = bom.bill_sequence_id AND bom.assembly_item_id = msib.inventory_item_id AND bom.organization_id = msib.organization_id AND bic.component_item_id = msib2.inventory_item_id AND bom.organization_id = msib2.organization_id AND bom.organization_id = :orgt_id
AND bom.alternate_bom_designator IS NULL AND bic.component_sequence_id = brd.component_sequence_id(+) AND cic.inventory_item_id = BIC.COMPONENT_ITEM_ID AND cic.INVENTORY_ITEM_ID = msib2.INVENTORY_ITEM_ID AND cic.organization_id = bom.organization_id AND cic.cost_type_id = 1 AND cic.COST_TYPE_ID = cct.COST_TYPE_ID AND cct.cost_type = 'Frozen' START WITH msib.SEGMENT1 = :item CONNECT BY NOCYCLE PRIOR bic.component_item_id = msib.inventory_item_id ORDER BY sequence_id ------------------------------------Correct Query -------------select CONNECT_BY_ROOT msi.PLANNER_CODE FG_PLANNER, CONNECT_BY_ROOT bill_item_name FG_ITEM, CONNECT_BY_ROOT msi.DESCRIPTION FG_DESCRIPTION, BILL_SEQUENCE_ID, CONNECT_BY_ROOT COMPONENT_SEQUENCE_ID, component_item_name, msi2.DESCRIPTION, msi2.ITEM_TYPE CMP_TYPE, msi2.PLANNER_CODE COMPONENT_PLANNER, QUANTITY_PER_ASSEMBLY, bfg.WIP_SUPPLY_TYPE, supply_locator_name, end_effective_date from apps.bomfg_bom_components bfg, apps.mtl_system_items msi, apps.mtl_system_items msi2 where msi.ORGANIZATION_ID = 477 and msi.ORGANIZATION_ID = msi2.ORGANIZATION_ID and msi.ORGANIZATION_ID = bfg.ORGANIZATION_ID and msi.inventory_item_id = bfg.ASSEMBLY_ITEM_ID and msi2.inventory_item_id = bfg.COMPONENT_ITEM_ID AND(end_effective_date IS NULL OR end_effective_date >= SYSDATE - 1) start with bill_item_name = '0250070500' --- use a sub select to get it for all the Fg's connect by prior component_item_name = bill_item_name ORDER BY BILL_SEQUENCE_ID ;