SELECT H1.ORGANIZATION_ID,
H1.ROOT_INVENTORY_ITEM_ID,
H1.PRIMARY_ITEM_ID,
H1.INVENTORY_ITEM_ID,
H1.QUANTITY_PER_ASSEMBLY,
H1.LEVEL_PATH,
H1.WIP_ENTITY_ID,
H1.JOB_QUANTITY,
H1.JOB_QUANTITY_COMPLETED,
H1.REQUIRED_QUANTITY,
H1.H_LEVEL,
H1.H_PATH,
MSI.SEGMENT1||'-'||MSI.SEGMENT2||'-'||MSI.SEGMENT3 Item_code,
MSI.DESCRIPTION,
MSI.PRIMARY_UOM_CODE,QUANTITY_ISSUED,cit.item_cost , ROUND(QUANTITY_ISSUED*cit.item_cost)iTEMCost
FROM
------END INLINE HIRARCHY
(SELECT ORGANIZATION_ID, CONNECT_BY_ROOT PRIMARY_ITEM_ID ROOT_INVENTORY_ITEM_ID ,
PRIMARY_ITEM_ID,
INVENTORY_ITEM_ID,
QUANTITY_PER_ASSEMBLY,
SYS_CONNECT_BY_PATH(LEVEL, '.')LEVEL_PATH,
WIP_ENTITY_ID,
START_QUANTITY JOB_QUANTITY,
QUANTITY_COMPLETED JOB_QUANTITY_COMPLETED ,
REQUIRED_QUANTITY, QUANTITY_ISSUED,LEVEL H_LEVEL
,SYS_CONNECT_BY_PATH(PRIMARY_ITEM_ID, '/') H_PATH
FROM (SELECT WDJ.WIP_ENTITY_ID, WDJ.ORGANIZATION_ID,
WDJ.PRIMARY_ITEM_ID, WRO.INVENTORY_ITEM_ID,
WRO.REQUIRED_QUANTITY, WRO.QUANTITY_ISSUED,
WRO.QUANTITY_PER_ASSEMBLY , WDJ.QUANTITY_COMPLETED , WDJ.START_QUANTITY
FROM WIP_DISCRETE_JOBS WDJ, WIP_REQUIREMENT_OPERATIONS WRO
WHERE 1 = 1
AND WRO.WIP_ENTITY_ID = WDJ.WIP_ENTITY_ID
AND WRO.ORGANIZATION_ID = WDJ.ORGANIZATION_ID)
START WITH PRIMARY_ITEM_ID in (&PrimaryItemId)
CONNECT BY NOCYCLE PRIOR INVENTORY_ITEM_ID = PRIMARY_ITEM_ID
AND ORGANIZATION_ID = &pOrg)H1 ,
---END INLINE HIRARCHY
APPS.CST_ITEM_COST_TYPE_V CIT,
Mtl_system_items msi
WHERE H1.INVENTORY_ITEM_ID = CIT.INVENTORY_ITEM_ID
AND H1.ORGANIZATION_ID = CIT.ORGANIZATION_ID
AND MSI.ORGANIZATION_ID = CIT.ORGANIZATION_ID
AND MSI.INVENTORY_ITEM_ID = H1.INVENTORY_ITEM_ID