--PO CREATED And RECEIPT NOT DONE
SELECT ORG_ID,SEGMENT1,CREATION_DATE,CLOSED_CODE,pha.po_Header_id,To_char(CREATION_DATE,'DD-MON-YYYY HH24:MI:SS') Creation_Date_Time
FROM apps. po_Headers_all pha
WHERE pha. vendor_order_num LIKE '%SA%'
AND attribute15 NOT LIKE '%X'
AND cancel_flag <> 'Y'
AND NOT EXISTS
(SELECT 1
FROM apps. rcv_shipment_lines rsl
WHERE PHA. PO_HEADER_ID = RSL. PO_HEADER_ID
)ORDER BY CREATION_DATE DESC;
----------------------------------------------------------------------------------------------
--For Partially received POS
SELECT --pha. ORG_ID,pha. po_HEADER_ID,pha. SEGMENT1,pha. CREATION_DATE,pha. CLOSED_CODE
distinct pha. po_header_id, pha. creation_date
FROM apps. po_Headers_all pha,
apps. po_lines_all pla
WHERE pha. vendor_order_num LIKE '%SA%'
AND pha. attribute15 NOT LIKE '%X'
AND pha. cancel_flag <> 'Y'
and pla. po_header_Id = pha. po_Header_id
and Pha. po_header_id not in (harcode list of PO header IDs returned by the previous query.. they should not be included here.)
AND NOT EXISTS
(SELECT 1
FROM apps. rcv_shipment_lines rsl
WHERE pha. po_header_id = rsl. po_Header_id
and pla. po_line_id = rsl. po_line_id
)ORDER BY creation_date DESC
SELECT ORG_ID,SEGMENT1,CREATION_DATE,CLOSED_CODE,pha.po_Header_id,To_char(CREATION_DATE,'DD-MON-YYYY HH24:MI:SS') Creation_Date_Time
FROM apps. po_Headers_all pha
WHERE pha. vendor_order_num LIKE '%SA%'
AND attribute15 NOT LIKE '%X'
AND cancel_flag <> 'Y'
AND NOT EXISTS
(SELECT 1
FROM apps. rcv_shipment_lines rsl
WHERE PHA. PO_HEADER_ID = RSL. PO_HEADER_ID
)ORDER BY CREATION_DATE DESC;
----------------------------------------------------------------------------------------------
--For Partially received POS
SELECT --pha. ORG_ID,pha. po_HEADER_ID,pha. SEGMENT1,pha. CREATION_DATE,pha. CLOSED_CODE
distinct pha. po_header_id, pha. creation_date
FROM apps. po_Headers_all pha,
apps. po_lines_all pla
WHERE pha. vendor_order_num LIKE '%SA%'
AND pha. attribute15 NOT LIKE '%X'
AND pha. cancel_flag <> 'Y'
and pla. po_header_Id = pha. po_Header_id
and Pha. po_header_id not in (harcode list of PO header IDs returned by the previous query.. they should not be included here.)
AND NOT EXISTS
(SELECT 1
FROM apps. rcv_shipment_lines rsl
WHERE pha. po_header_id = rsl. po_Header_id
and pla. po_line_id = rsl. po_line_id
)ORDER BY creation_date DESC
No comments:
Post a Comment