Monday, 25 May 2015

Oracle Apps BOM Extraction

BOM extraction query:

By using below query we can get BOM extraction i.e underlying components of the BOM parent.

SELECT DISTINCT msia.segment1 assembly_item
               ,msia.item_type assembly_item_type
      ,msia.bom_item_type assembly_item_bom_item_type
               ,msia.inventory_item_status_code assembly_item_status
               ,msic.segment1 compoennt_item
               ,msic.item_type compoennt_item_type
               ,msic.inventory_item_status_code compoennt_item_status
               ,LEVEL
               ,bbm.organization_id
  FROM   apps.bom_bill_of_materials  bbm
       , apps.bom_inventory_components bic
       , apps.mtl_system_items_b   msia
       , apps.mtl_system_items_b   msic
WHERE 1=1
  AND  BBM.ORGANIZATION_ID           =  <<BOM-SOURCE-ORGANIZATION>>  
  AND  MSIA.INVENTORY_ITEM_ID         = BBM.ASSEMBLY_ITEM_ID
  AND  msia.organization_id           = bbm.organization_id
  AND  BBM.COMMON_BILL_SEQUENCE_ID    = BIC.BILL_SEQUENCE_ID
  AND  BIC.COMPONENT_ITEM_ID          = MSIC.INVENTORY_ITEM_ID
  AND  MSIA.ORGANIZATION_ID           = MSIC.ORGANIZATION_ID
  AND  BIC.DISABLE_DATE IS NULL
START WITH  MSIA.segment1             = <<BOM >>                    
CONNECT BY NOCYCLE PRIOR   MSIC.INVENTORY_ITEM_ID =MSIA.INVENTORY_ITEM_ID;