26 September 2013

Oracle Apps SQL : Requisition-PO-Receipt-Invoice Number


SELECT
DISTINCT
  r.segment1 "Req Num",
  p.segment1 "PO Num",
  rsh.receipt_num "Receipt Num",
  ai.invoice_num "Invoice Num",
  pah.ACTION_DATE
FROM po_req_distributions_all rd,
  po_requisition_lines_all rl,
  po_requisition_headers_all r ,
  po_headers_all p,
  po_distributions_all d,
  RCV_SHIPMENT_HEADERS rsh,
  rcv_shipment_lines rsl,
  ap_invoice_distributions_all apid,
  ap_invoices_all ai,
  PO_ACTION_HISTORY pah
WHERE r.requisition_header_id =rl.requisition_header_id
AND rl.requisition_line_id    = rd.requisition_line_id
AND rd.distribution_id        =d.req_distribution_id (+)
AND d.po_header_id            =p.po_header_id (+)
AND d.po_distribution_id      =apid.po_distribution_id (+)
AND apid.invoice_id           = ai.invoice_id (+)
AND p.po_header_id            =rsl.po_header_id (+)
AND rsl.shipment_header_id    = rsh.shipment_header_id (+)
AND r.requisition_header_id   = pah.object_id (+)
AND pah.OBJECT_TYPE_CODE      = 'REQUISITION'
AND pah.ACTION_CODE           = 'APPROVE';

No comments: