Sunday, 24 June 2018

Open PO details query in Oracle Apps R12


--Open PO query.
SELECT
    pha.segment1 ponumber,
    hou.name organization_code,
    pha.type_lookup_code potype,
    trunc(pha.creation_date) cdate,
    pv.vendor_name supplier,
    pv.segment1 supplier_number,
    pvs.vendor_site_code suppliersite,
    hl1.location_code shipto_loc,
    hl2.location_code billto_loc,
    (SELECT pla1.quantity * pla1.unit_price
     FROM po_lines_all pla1
     WHERE 1=1
     AND pla1.po_line_id = pla.po_line_id) PO_LINE_AMT ,
    pha.currency_code currency,
    papf.full_name buyer,
    pha.authorization_status,
    pha.comments comments,
    atl.name terms,
    plla.need_by_date,
    plla.promised_date,
    pha.approved_date,
    pha.closed_code
FROM
    apps.po_headers_all pha,
    apps.ap_suppliers pv,
    apps.ap_supplier_sites_all pvs,
    hr_locations hl1,
    hr_locations hl2,
    apps.per_all_people_f papf,
    apps.po_lines_all pla,
    hr_operating_units hou,
    apps.ap_terms_tl atl,
    apps.po_line_locations_all plla
WHERE
        pha.vendor_id = pv.vendor_id
    AND pha.type_lookup_code      NOT IN ('RFQ','QUOTATION')
    AND pha.vendor_site_id = pvs.vendor_site_id
    AND pha.ship_to_location_id = hl1.location_id
    AND pha.bill_to_location_id = hl2.location_id
    AND pha.agent_id = papf.person_id
    AND pha.po_header_id = pla.po_header_id
    AND pha.org_id = hou.organization_id
    AND pha.terms_id = atl.term_id
    AND plla.po_header_id = pha.po_header_id
    AND pla.po_line_id = plla.po_line_id
    AND pha.org_id = plla.org_id
    AND pha.closed_code = 'OPEN'
    AND pha.org_id = 7891
    AND pha.authorization_status = 'APPROVED'
ORDER BY 1

No comments:

Post a Comment

Query to find request set and its responsibility

  SELECT FA.application_name,        fr.responsibility_name program_attached_to,        frg.request_group_name,        fcp.request_set_name,...