SELECT DISTINCT h.business_unit , d.po_id , d.line_nbr , d.sched_nbr , d.distrib_line_num FROM ps_po_line_distrib d , ps_po_line_ship s , ps_po_line l , ps_po_hdr h , PS_BU_ITEMS_INV b WHERE h.po_type <> 'KAN' AND l.business_unit = h.business_unit AND l.po_id = h.po_id AND s.business_unit = l.business_unit AND s.po_id = l.po_id AND s.line_nbr = l.line_nbr AND s.production_id = ' ' AND d.business_unit_in <> ' ' AND d.business_unit = s.business_unit AND d.po_id = s.po_id AND d.line_nbr = s.line_nbr AND d.sched_nbr = s.sched_nbr AND d.dst_acct_type = 'DST' AND b.business_unit = d.business_unit_in AND b.inv_item_id = l.inv_item_id AND ((h.po_status IN ('O','PA','A','D') AND l.cancel_status = 'A' AND s.cancel_status = 'A' AND d.distrib_ln_status IN ('O','P')) OR peg_status IN ('10', '20'))
|