Sunday, 22 April 2012

bom bill query



SELECT
MSIB.SEGMENT1,
MSIB.DESCRIPTION,
DECODE(MSIB.REVISION_QTY_CONTROL_CODE,1,'A',2,'B',MSIB.REVISION_QTY_CONTROL_CODE)REVISION,
bom.creation_date,
MSIB.PRIMARY_UOM_CODE UOM,
---------LINES DETAILS
bic.item_num,
bic.operation_seq_num,
MSI.CONCATENATED_SEGMENTS,
 msit.description,
 MSI.PRIMARY_UOM_CODE,
 DECODE(NVL (bic.basis_type, 1),1,'ITEM',2,'LOT',NVL (bic.basis_type, 1))BASIS,
 MIRB.REVISION,
 bic.component_quantity,
 ---COMPONENT DETAILS
 fcl.meaning item_type,
  msi.inventory_item_status_code,
  ----MATERIAL CONTROL
  ml.meaning supply_type
FROM
bom_bill_of_materials bom,
MTL_SYSTEM_ITEMS_B MSIB,
-----------------------
bom_inventory_components bic,
 mtl_system_items_b_kfv msi,
 mtl_system_items_tl msit,
 ------------------------
 MTL_ITEM_REVISIONS_B MIRB,
 fnd_common_lookups fcl,
 -------------------
   mfg_lookups ml
WHERE
ASSEMBLY_ITEM_ID='222955'
AND BOM.ASSEMBLY_ITEM_ID=MSIB.INVENTORY_ITEM_ID
AND BOM.ORGANIZATION_ID=MSIB.ORGANIZATION_ID
--------------------------------------------
AND bic.bill_sequence_id = bom.bill_sequence_id
AND bic.component_item_id = msi.inventory_item_id
------------------------------------------------------
AND bic.component_item_id = msi.inventory_item_id
AND bom.organization_id = msi.organization_id
AND msi.inventory_item_id = msit.inventory_item_id
AND msi.organization_id = msit.organization_id
AND msit.LANGUAGE = USERENV ('LANG')
-----------------------------------------
AND bic.component_item_id = miRB.inventory_item_id
AND bom.organization_id = miRB.organization_id
AND msi.inventory_item_id = msit.inventory_item_id
-----------------------------------------------
AND fcl.lookup_type(+) = 'ITEM_TYPE'
AND fcl.lookup_code(+) = msi.item_type
------------------------------------------
AND ml.lookup_code(+) = bic.wip_supply_type
AND ml.lookup_type(+) = 'WIP_SUPPLY'



No comments:

Post a Comment