DBA Data[Home] [Help]

VIEW: APPS.EAM_WO_DIRECT_ITEMS_LITE_V

Source

View Text - Preformatted

SELECT wed.wip_entity_id AS wip_entity_id, wed.operation_seq_num, wed.organization_id, to_number(null) AS Item_id, wed.direct_item_sequence_id, to_char(null) item_name, wed.description, wed.uom AS UOM_CODE, wed.unit_price, wed.auto_request_material, wed.need_by_date, wed.purchasing_category_id, wed.required_quantity quantity_required, sum(rql.quantity), pd.quantity, sum(pd.quantity_delivered), sum(pd.quantity_ordered), sum(pd.quantity_cancelled), wed.suggested_vendor_name, ml.meaning, 1, wed.department_id, to_number(null) AS effectivity_control, to_number(null) AS eam_item_type, nvl(nvl(rql.order_type_lookup_code, wed.order_type_lookup_code), pd.order_type_lookup_code), nvl(nvl(rql.amount, wed.amount), pd.amount_ordered), pd.amount_delivered, rql.amount as rql_amount_ordered, pd.amount_ordered FROM wip_eam_direct_items wed , po_requisition_lines_all rql, po_requisition_headers_all rqh , ( select pol.quantity, pd1.quantity_delivered, pd1.quantity_ordered, pd1.quantity_cancelled, pol.order_type_lookup_code, pd1.amount_ordered, pd1.amount_delivered, pd1.wip_entity_id, pd1.destination_organization_id, pd1.wip_operation_seq_num, pol.cancel_flag, pol.item_id, pd1.wip_resource_seq_num, pol.item_description from po_lines_all pol, po_distributions_all pd1 where pd1.po_line_id = pol.po_line_id ) pd , mfg_lookups ml where wed.wip_entity_id = rql.wip_entity_id (+) AND wed.organization_id = rql.destination_organization_id (+) AND wed.operation_seq_num = rql.wip_operation_seq_num (+) AND rql.requisition_header_id = rqh.requisition_header_id(+) AND upper(NVL(rqh.authorization_status, 'APPROVED') ) not in ('CANCELLED', 'REJECTED','SYSTEM_SAVED') AND rql.item_id is null AND ( wed.direct_item_sequence_id = rql.wip_resource_seq_num OR rql.wip_resource_seq_num is null ) AND wed.description = rql.item_description(+) AND wed.wip_entity_id = pd.wip_entity_id(+) AND wed.organization_id = pd.destination_organization_id(+) AND wed.operation_seq_num = pd.wip_operation_seq_num(+) AND upper(nvl(pd.cancel_flag,'N')) <> 'Y' AND pd.item_id is null AND ( wed.direct_item_sequence_id = pd.wip_resource_seq_num OR pd.wip_resource_seq_num is null ) AND wed.description = pd.item_description(+) and ml.lookup_type='EAM_DIRECT_ITEM_TYPE' AND ml.lookup_code=1 GROUP BY wed.wip_entity_id, wed.operation_seq_num, wed.organization_id, ml.meaning, wed.direct_item_sequence_id, wed.description, wed.uom, wed.order_type_lookup_code, rql.order_type_lookup_code, pd.order_type_lookup_code, wed.unit_price, wed.amount, rql.amount, pd.amount_ordered, pd.amount_delivered, wed.auto_request_material, wed.need_by_date, wed.purchasing_category_id, wed.required_quantity, pd.quantity, wed.suggested_vendor_name, wed.department_id, pd.amount_delivered UNION ALL SELECT wro.wip_entity_id, wro.operation_seq_num, wro.organization_id, wro.inventory_item_id, to_number(null) AS direct_item_sequence_id, msi.CONCATENATED_SEGMENTS as item_name, msi.description, msi.PRIMARY_UOM_CODE AS UOM_CODE, wro.unit_price, wro.auto_request_material, wro.date_required, mic.category_id , wro.required_quantity quantity_required, sum(rql.quantity), pd.quantity, sum(pd.quantity_delivered), sum(pd.quantity_ordered), sum(pd.quantity_cancelled), wro.suggested_vendor_name, ml.meaning, 2, wro.department_id, msi.effectivity_control, msi.eam_item_type, nvl(pd.order_type_lookup_code, rql.order_type_lookup_code) AS order_type_lookup_code, nvl(pd.amount_ordered, rql.amount) AS amount, pd.amount_delivered, rql.amount, pd.amount_ordered FROM wip_requirement_operations wro, mtl_system_items_kfv msi, mtl_item_categories mic , mtl_default_category_sets mdcs , po_requisition_lines_all rql, po_requisition_headers_all rqh , ( select pol.quantity, pd1.quantity_delivered, pd1.quantity_ordered, pd1.quantity_cancelled, pol.order_type_lookup_code, pd1.amount_ordered, pd1.amount_delivered, pd1.wip_entity_id, pd1.destination_organization_id, pd1.wip_operation_seq_num, pol.cancel_flag, pol.item_id, pd1.wip_resource_seq_num, pol.item_description from po_lines_all pol, po_distributions_all pd1 where pd1.po_line_id = pol.po_line_id ) pd , mfg_lookups ml WHERE msi.inventory_item_id = wro.inventory_item_id AND msi.organization_id = wro.organization_id AND nvl(msi.stock_enabled_flag, 'N') = 'N' AND wro.inventory_item_id = mic.inventory_item_id AND wro.organization_id = mic.organization_id AND mic.category_set_id = mdcs.category_set_id AND mdcs.functional_area_id = 2 AND wro.wip_entity_id = rql.wip_entity_id (+) AND wro.organization_id = rql.destination_organization_id (+) AND wro.operation_seq_num = rql.wip_operation_seq_num (+) AND rql.requisition_header_id = rqh.requisition_header_id(+) AND upper(NVL(rqh.authorization_status, 'APPROVED') ) not in ('CANCELLED', 'REJECTED','SYSTEM_SAVED') AND rql.wip_resource_seq_num is null AND wro.inventory_item_id = rql.item_id (+) AND wro.wip_entity_id = pd.wip_entity_id(+) AND wro.organization_id = pd.destination_organization_id(+) AND wro.operation_seq_num = pd.wip_operation_seq_num(+) AND upper(nvl(pd.cancel_flag, 'N')) <> 'Y' AND pd.wip_resource_seq_num is null AND wro.inventory_item_id = pd.item_id (+) AND ml.lookup_type='EAM_DIRECT_ITEM_TYPE' AND ml.lookup_code=2 GROUP BY wro.wip_entity_id, wro.operation_seq_num, wro.organization_id, ml.meaning, wro.inventory_item_id, msi.CONCATENATED_SEGMENTS, msi.description, msi.primary_uom_code, pd.order_type_lookup_code, rql.order_type_lookup_code, wro.unit_price, pd.amount_ordered, rql.amount, wro.auto_request_material, wro.date_required, mic.category_id, wro.required_quantity, pd.quantity, wro.suggested_vendor_name, wro.department_id, msi.effectivity_control, msi.eam_item_type, pd.amount_delivered
View Text - HTML Formatted

SELECT WED.WIP_ENTITY_ID AS WIP_ENTITY_ID
, WED.OPERATION_SEQ_NUM
, WED.ORGANIZATION_ID
, TO_NUMBER(NULL) AS ITEM_ID
, WED.DIRECT_ITEM_SEQUENCE_ID
, TO_CHAR(NULL) ITEM_NAME
, WED.DESCRIPTION
, WED.UOM AS UOM_CODE
, WED.UNIT_PRICE
, WED.AUTO_REQUEST_MATERIAL
, WED.NEED_BY_DATE
, WED.PURCHASING_CATEGORY_ID
, WED.REQUIRED_QUANTITY QUANTITY_REQUIRED
, SUM(RQL.QUANTITY)
, PD.QUANTITY
, SUM(PD.QUANTITY_DELIVERED)
, SUM(PD.QUANTITY_ORDERED)
, SUM(PD.QUANTITY_CANCELLED)
, WED.SUGGESTED_VENDOR_NAME
, ML.MEANING
, 1
, WED.DEPARTMENT_ID
, TO_NUMBER(NULL) AS EFFECTIVITY_CONTROL
, TO_NUMBER(NULL) AS EAM_ITEM_TYPE
, NVL(NVL(RQL.ORDER_TYPE_LOOKUP_CODE
, WED.ORDER_TYPE_LOOKUP_CODE)
, PD.ORDER_TYPE_LOOKUP_CODE)
, NVL(NVL(RQL.AMOUNT
, WED.AMOUNT)
, PD.AMOUNT_ORDERED)
, PD.AMOUNT_DELIVERED
, RQL.AMOUNT AS RQL_AMOUNT_ORDERED
, PD.AMOUNT_ORDERED
FROM WIP_EAM_DIRECT_ITEMS WED
, PO_REQUISITION_LINES_ALL RQL
, PO_REQUISITION_HEADERS_ALL RQH
, ( SELECT POL.QUANTITY
, PD1.QUANTITY_DELIVERED
, PD1.QUANTITY_ORDERED
, PD1.QUANTITY_CANCELLED
, POL.ORDER_TYPE_LOOKUP_CODE
, PD1.AMOUNT_ORDERED
, PD1.AMOUNT_DELIVERED
, PD1.WIP_ENTITY_ID
, PD1.DESTINATION_ORGANIZATION_ID
, PD1.WIP_OPERATION_SEQ_NUM
, POL.CANCEL_FLAG
, POL.ITEM_ID
, PD1.WIP_RESOURCE_SEQ_NUM
, POL.ITEM_DESCRIPTION
FROM PO_LINES_ALL POL
, PO_DISTRIBUTIONS_ALL PD1
WHERE PD1.PO_LINE_ID = POL.PO_LINE_ID ) PD
, MFG_LOOKUPS ML
WHERE WED.WIP_ENTITY_ID = RQL.WIP_ENTITY_ID (+)
AND WED.ORGANIZATION_ID = RQL.DESTINATION_ORGANIZATION_ID (+)
AND WED.OPERATION_SEQ_NUM = RQL.WIP_OPERATION_SEQ_NUM (+)
AND RQL.REQUISITION_HEADER_ID = RQH.REQUISITION_HEADER_ID(+)
AND UPPER(NVL(RQH.AUTHORIZATION_STATUS
, 'APPROVED') ) NOT IN ('CANCELLED'
, 'REJECTED'
, 'SYSTEM_SAVED')
AND RQL.ITEM_ID IS NULL
AND ( WED.DIRECT_ITEM_SEQUENCE_ID = RQL.WIP_RESOURCE_SEQ_NUM OR RQL.WIP_RESOURCE_SEQ_NUM IS NULL )
AND WED.DESCRIPTION = RQL.ITEM_DESCRIPTION(+)
AND WED.WIP_ENTITY_ID = PD.WIP_ENTITY_ID(+)
AND WED.ORGANIZATION_ID = PD.DESTINATION_ORGANIZATION_ID(+)
AND WED.OPERATION_SEQ_NUM = PD.WIP_OPERATION_SEQ_NUM(+)
AND UPPER(NVL(PD.CANCEL_FLAG
, 'N')) <> 'Y'
AND PD.ITEM_ID IS NULL
AND ( WED.DIRECT_ITEM_SEQUENCE_ID = PD.WIP_RESOURCE_SEQ_NUM OR PD.WIP_RESOURCE_SEQ_NUM IS NULL )
AND WED.DESCRIPTION = PD.ITEM_DESCRIPTION(+)
AND ML.LOOKUP_TYPE='EAM_DIRECT_ITEM_TYPE'
AND ML.LOOKUP_CODE=1 GROUP BY WED.WIP_ENTITY_ID
, WED.OPERATION_SEQ_NUM
, WED.ORGANIZATION_ID
, ML.MEANING
, WED.DIRECT_ITEM_SEQUENCE_ID
, WED.DESCRIPTION
, WED.UOM
, WED.ORDER_TYPE_LOOKUP_CODE
, RQL.ORDER_TYPE_LOOKUP_CODE
, PD.ORDER_TYPE_LOOKUP_CODE
, WED.UNIT_PRICE
, WED.AMOUNT
, RQL.AMOUNT
, PD.AMOUNT_ORDERED
, PD.AMOUNT_DELIVERED
, WED.AUTO_REQUEST_MATERIAL
, WED.NEED_BY_DATE
, WED.PURCHASING_CATEGORY_ID
, WED.REQUIRED_QUANTITY
, PD.QUANTITY
, WED.SUGGESTED_VENDOR_NAME
, WED.DEPARTMENT_ID
, PD.AMOUNT_DELIVERED UNION ALL SELECT WRO.WIP_ENTITY_ID
, WRO.OPERATION_SEQ_NUM
, WRO.ORGANIZATION_ID
, WRO.INVENTORY_ITEM_ID
, TO_NUMBER(NULL) AS DIRECT_ITEM_SEQUENCE_ID
, MSI.CONCATENATED_SEGMENTS AS ITEM_NAME
, MSI.DESCRIPTION
, MSI.PRIMARY_UOM_CODE AS UOM_CODE
, WRO.UNIT_PRICE
, WRO.AUTO_REQUEST_MATERIAL
, WRO.DATE_REQUIRED
, MIC.CATEGORY_ID
, WRO.REQUIRED_QUANTITY QUANTITY_REQUIRED
, SUM(RQL.QUANTITY)
, PD.QUANTITY
, SUM(PD.QUANTITY_DELIVERED)
, SUM(PD.QUANTITY_ORDERED)
, SUM(PD.QUANTITY_CANCELLED)
, WRO.SUGGESTED_VENDOR_NAME
, ML.MEANING
, 2
, WRO.DEPARTMENT_ID
, MSI.EFFECTIVITY_CONTROL
, MSI.EAM_ITEM_TYPE
, NVL(PD.ORDER_TYPE_LOOKUP_CODE
, RQL.ORDER_TYPE_LOOKUP_CODE) AS ORDER_TYPE_LOOKUP_CODE
, NVL(PD.AMOUNT_ORDERED
, RQL.AMOUNT) AS AMOUNT
, PD.AMOUNT_DELIVERED
, RQL.AMOUNT
, PD.AMOUNT_ORDERED
FROM WIP_REQUIREMENT_OPERATIONS WRO
, MTL_SYSTEM_ITEMS_KFV MSI
, MTL_ITEM_CATEGORIES MIC
, MTL_DEFAULT_CATEGORY_SETS MDCS
, PO_REQUISITION_LINES_ALL RQL
, PO_REQUISITION_HEADERS_ALL RQH
, ( SELECT POL.QUANTITY
, PD1.QUANTITY_DELIVERED
, PD1.QUANTITY_ORDERED
, PD1.QUANTITY_CANCELLED
, POL.ORDER_TYPE_LOOKUP_CODE
, PD1.AMOUNT_ORDERED
, PD1.AMOUNT_DELIVERED
, PD1.WIP_ENTITY_ID
, PD1.DESTINATION_ORGANIZATION_ID
, PD1.WIP_OPERATION_SEQ_NUM
, POL.CANCEL_FLAG
, POL.ITEM_ID
, PD1.WIP_RESOURCE_SEQ_NUM
, POL.ITEM_DESCRIPTION
FROM PO_LINES_ALL POL
, PO_DISTRIBUTIONS_ALL PD1
WHERE PD1.PO_LINE_ID = POL.PO_LINE_ID ) PD
, MFG_LOOKUPS ML
WHERE MSI.INVENTORY_ITEM_ID = WRO.INVENTORY_ITEM_ID
AND MSI.ORGANIZATION_ID = WRO.ORGANIZATION_ID
AND NVL(MSI.STOCK_ENABLED_FLAG
, 'N') = 'N'
AND WRO.INVENTORY_ITEM_ID = MIC.INVENTORY_ITEM_ID
AND WRO.ORGANIZATION_ID = MIC.ORGANIZATION_ID
AND MIC.CATEGORY_SET_ID = MDCS.CATEGORY_SET_ID
AND MDCS.FUNCTIONAL_AREA_ID = 2
AND WRO.WIP_ENTITY_ID = RQL.WIP_ENTITY_ID (+)
AND WRO.ORGANIZATION_ID = RQL.DESTINATION_ORGANIZATION_ID (+)
AND WRO.OPERATION_SEQ_NUM = RQL.WIP_OPERATION_SEQ_NUM (+)
AND RQL.REQUISITION_HEADER_ID = RQH.REQUISITION_HEADER_ID(+)
AND UPPER(NVL(RQH.AUTHORIZATION_STATUS
, 'APPROVED') ) NOT IN ('CANCELLED'
, 'REJECTED'
, 'SYSTEM_SAVED')
AND RQL.WIP_RESOURCE_SEQ_NUM IS NULL
AND WRO.INVENTORY_ITEM_ID = RQL.ITEM_ID (+)
AND WRO.WIP_ENTITY_ID = PD.WIP_ENTITY_ID(+)
AND WRO.ORGANIZATION_ID = PD.DESTINATION_ORGANIZATION_ID(+)
AND WRO.OPERATION_SEQ_NUM = PD.WIP_OPERATION_SEQ_NUM(+)
AND UPPER(NVL(PD.CANCEL_FLAG
, 'N')) <> 'Y'
AND PD.WIP_RESOURCE_SEQ_NUM IS NULL
AND WRO.INVENTORY_ITEM_ID = PD.ITEM_ID (+)
AND ML.LOOKUP_TYPE='EAM_DIRECT_ITEM_TYPE'
AND ML.LOOKUP_CODE=2 GROUP BY WRO.WIP_ENTITY_ID
, WRO.OPERATION_SEQ_NUM
, WRO.ORGANIZATION_ID
, ML.MEANING
, WRO.INVENTORY_ITEM_ID
, MSI.CONCATENATED_SEGMENTS
, MSI.DESCRIPTION
, MSI.PRIMARY_UOM_CODE
, PD.ORDER_TYPE_LOOKUP_CODE
, RQL.ORDER_TYPE_LOOKUP_CODE
, WRO.UNIT_PRICE
, PD.AMOUNT_ORDERED
, RQL.AMOUNT
, WRO.AUTO_REQUEST_MATERIAL
, WRO.DATE_REQUIRED
, MIC.CATEGORY_ID
, WRO.REQUIRED_QUANTITY
, PD.QUANTITY
, WRO.SUGGESTED_VENDOR_NAME
, WRO.DEPARTMENT_ID
, MSI.EFFECTIVITY_CONTROL
, MSI.EAM_ITEM_TYPE
, PD.AMOUNT_DELIVERED