Friday, November 26, 2021

Query to get all Purchase Requisition without a Purchase Order in Oracle APPS

SELECT prh.segment1 requisition_number,
         TO_CHAR(prh.creation_date, 'DD-MON-RRRR') created_on,
         TO_CHAR(prl.creation_date, 'DD-MON-RRRR') line_creation_date,
         prl.line_num,
         msi.segment1 item_code,
         prl.item_description description,
         prl.quantity ,
         TO_CHAR(prl.need_by_date, 'DD-MON-RRRR') required_date,
         requestor.full_name requestor_name,
         buyers.agent_name buyer_name
    FROM po.po_requisition_headers_all prh,
         po.po_requisition_lines_all prl,
         apps.per_people_f requestor,
         (SELECT DISTINCT agent_id, agent_name 
    FROM apps.po_agents_v) buyers,
         po.po_req_distributions_all prd,
         inv.mtl_system_items_b msi,
         po.po_line_locations_all pll,
         po.po_lines_all pl,
         po.po_headers_all ph
   WHERE     prh.requisition_header_id = prl.requisition_header_id
         AND prl.requisition_line_id = prd.requisition_line_id
         AND requestor.person_id = prh.preparer_id
         AND prh.creation_date BETWEEN requestor.effective_start_date
                                   AND requestor.effective_end_date
         AND buyers.agent_id(+) = msi.buyer_id
         AND msi.inventory_item_id = prl.item_id
         AND msi.organization_id = prl.destination_organization_id
         AND pll.line_location_id(+) = prl.line_location_id
         AND pll.po_header_id = ph.po_header_id(+)
         AND pll.po_line_id = pl.po_line_id(+)
         AND prh.authorization_status = 'APPROVED'
         AND pll.line_location_id IS NULL
         AND prl.closed_code IS NULL
         AND NVL (prl.cancel_flag, 'N') <> 'Y'
         AND prh.org_id = 123456
ORDER BY 1, 2

No comments:

Post a Comment

SupplierAddressImportTemplate.xlsm South Africa Suburb Field mapping in POZ_SUPPLIER_ADDRESSES_INT

Suburb mpping in Supplier Address Import Template will be mapped to Address Element Attribute2 (HZ_LOCATIONS. ADDR_ELEMENT_ATTRIBUTE2)