SELECT DISTINCT c.vendor_id , a.business_unit , a.po_id , a.po_dt , c.vendor_name_short FROM ps_po_hdr_fs a , PS_PO_LINE_SHIP_FS b , ps_vendor c , ps_po_line_fs d WHERE a.business_unit = b.business_unit AND a.po_id = b.po_id AND a.vendor_setid = c.setid AND a.vendor_id = c.vendor_id AND A.BUSINESS_UNIT = D.BUSINESS_UNIT AND A.PO_ID = D.PO_ID AND (a.po_status IN ('C','D','X','PX') OR (a.chng_ord_batch > 0 AND a.po_status IN ('A','PA','O')) OR (D.CNTRCT_ID <> ' ' AND A.PO_STATUS = 'A') OR (EXISTS ( SELECT 'X' FROM PS_CC_TRANS_LINE CCL WHERE CCL.BUSINESS_UNIT = B.BUSINESS_UNIT AND CCL.PO_ID = B.PO_ID AND CCL.PO_LINE_NBR = B.LINE_NBR AND CCL.PO_SCHED_NBR = B.SCHED_NBR AND A.PO_STATUS = 'A'))) AND a.ers_action = 'N' AND a.in_process_flg = 'N' AND b.cancel_status <> 'X'
|