ECC Project Manufacturing, Exceptions and Overdues, SQL8

Description
Categories: Enterprise Command Center
Imported from Enterprise Command Center
Description: Project Manufacturing Exceptions and Overdues
Dataset Key: pjm-exceptions-overdues
Query Procedure: PJM_ECC_UTIL_PVT.GET_ECC_DATA_LOAD_INFO
Security Procedure: PJM_ECC_DATASECURITY_PKG_PUB.GetFilterAttributeValues
select
x.*
from
(
select * from ( SELECT /* s54 */  /*+ leading(p3 pp) index(pp PA_PROJECTS_U1) */    'PROJ_PA_SCHEDULE' || '-' || PP.PROJECT_ID || '-' || NVL( TO_CHAR(PT.TASK_ID), 'NO_TASK' ) || '-RFQ-' ||  pl.po_header_id || '-' || pl.po_line_id AS ECC_SPEC_ID , 'PROJ_EXC' AS RECORD_TYPE,  GREATEST( NVL( PL.last_update_date, to_date('01-01-1990', 'DD-MM-YYYY')) , NVL( PH.last_update_date, to_date('01-01-1990', 'DD-MM-YYYY')) ,  NVL( HL.last_update_date, to_date('01-01-1990', 'DD-MM-YYYY')) ,  NVL( MIF.last_update_date, to_date('01-01-1990', 'DD-MM-YYYY')) , NVL( PP.last_update_date, to_date('01-01-1990', 'DD-MM-YYYY')) ,  NVL( PT.last_update_date, to_date('01-01-1990', 'DD-MM-YYYY')) ) AS ECC_LAST_UPDATE_DATE, 'Procurement Activities Schedule Exceptions' AS EXCEPTION_TYPE, PP.PROJECT_ID AS PROJECT_ID,  PP.SEGMENT1 AS PROJECT_NUMBER, PP.ORG_ID AS ORG_ID, PT.TASK_ID AS TASK_ID, PT.TASK_NUMBER AS TASK_NUMBER, 'RFQ' AS ACTIVITY_TYPE,  ph.segment1 AS ACTIVITY_NUMBER,  'RFQ '|| ph.segment1   AS ACTIVITY_TYPE_NUMBER, TO_CHAR(ph.po_header_id) AS ACTIVITY_ID,  rfqstatus_lkup.meaning AS po_status,  mif.SEGMENT1 AS ITEM_NUMBER, hlt1.location_code AS PO_SHIP_TO_LOCATION_NAME, NULL AS QUANTITY_ORDERED,  NULL AS QUANTITY_DELIVERED, NULL AS UOM,  pv.vendor_name AS po_supplier_name,             pvs.vendor_site_code AS po_supplier_site_name,  NULL AS PA_PROMISED_DATE,  NULL AS PROMISED_EXCEPTION_DAYS, NULL AS PA_NEED_BY_DATE, NULL AS NEED_BY_EXCEPTION_DAYS, ph.reply_date AS PA_DUE_DATE, NULL EXCEPTION_DAYS_1,'TRUE' SCHEDULE_EXCEPTION_FLAG_1,NULL EXCEPTION_DAYS_2,'TRUE' SCHEDULE_EXCEPTION_FLAG_2,NULL EXCEPTION_DAYS_3,'TRUE' SCHEDULE_EXCEPTION_FLAG_3,NULL EXCEPTION_DAYS_4,'TRUE' SCHEDULE_EXCEPTION_FLAG_4, NVL( pt.start_date, pp.start_date ) AS PROJ_TASK_START_DATE, NVL( pt.completion_date, pp.completion_date ) AS PROJ_TASK_END_DATE, pt.task_name as task_name, TRUNC(ph.reply_date) - TRUNC(NVL( pt.completion_date, pp.completion_date )) AS DUE_EXCEPTION_DAYS, NULL AS PA_EFFE_START_DATE,  NULL AS EFFE_START_EXC_DAYS, NULL AS PA_EFFE_END_DATE, NULL AS EFFE_END_EXC_DAYS, NVL( PT.START_DATE, PP.START_DATE ) AS START_DATE,  NVL( PT.COMPLETION_DATE, PP.COMPLETION_DATE ) AS END_DATE, HLT1.LANGUAGE AS LANGUAGE  FROM po_lines_all pl, po_headers_all ph,  fnd_lookup_values  rfqstatus_lkup,  hr_locations_all HL, hr_locations_all_TL hlt1,   po_rfq_vendors       prv,   po_vendors           pv,    po_vendor_sites_all  pvs,  MTL_SYSTEM_ITEMS_B mif, pa_projects_all pp, pa_tasks pt  ,(select distinct project_id from pjm_project_parameters ) p3     WHERE pp.start_date >= NVL(to_date('2021/12/12','RRRR/MM/DD HH24:MI:SS'), pp.start_date) and pp.project_id = p3.project_id  and PP.PROJECT_TYPE <> 'AWARD_PROJECT'  AND PP.TEMPLATE_FLAG = 'N'  AND PP.PROJECT_ID = PL.PROJECT_ID  AND PT.TASK_ID(+) = PL.TASK_ID  AND ph.po_header_id = pl.po_header_id  AND ph.type_lookup_code = 'RFQ'  AND ph.status_lookup_code <> 'C'  AND hl.ship_to_location_id = ph.ship_to_location_id  AND hl.ship_to_location_id = hlt1.location_id  AND MIF.ORGANIZATION_ID = HL.INVENTORY_ORGANIZATION_ID  AND mif.inventory_item_id(+) = pl.item_id  AND ph.po_header_id = prv.po_header_id(+)       AND prv.vendor_site_id = pvs.vendor_site_id(+)  AND prv.vendor_id = pvs.vendor_id(+)            AND pvs.vendor_id = pv.vendor_id(+)             AND TRUNC(ph.reply_date) > TRUNC(NVL( pt.completion_date, NVL( pp.completion_date, ph.reply_date +1 ) ))  AND rfqstatus_lkup.lookup_type = 'RFQ/QUOTE STATUS'  AND rfqstatus_lkup.lookup_code = ph.status_lookup_code  AND rfqstatus_lkup.view_application_id = 201  AND rfqstatus_lkup.security_group_id = 0  AND rfqstatus_lkup.language = hlt1.language  AND HLT1.LANGUAGE IN ('US')  AND rfqstatus_lkup.language IN ('US') )  PIVOT( MAX(PO_SHIP_TO_LOCATION_NAME) AS PO_SHIP_TO_LOCATION_NAME,  MAX (po_status) AS po_status FOR LANGUAGE IN ('US' "US"))
) x
where
2=2
Parameter Name SQL text Validation
Operating Unit
x.org_id in (select haouv.organization_id from hr_all_organization_units_vl haouv where haouv.name=:operating_unit)
LOV