0% found this document useful (0 votes)
455 views3 pages

Project Related Requisitions POS

The document contains SQL queries that select purchase order (PO) and purchase requisition (PR) data from various tables, including the PO header, line, and distribution tables as well as the PR header, line, and distribution tables. The queries filter for specific projects, join the tables to retrieve related data, and in some cases calculate totals. Multiple project IDs are included in one query.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
455 views3 pages

Project Related Requisitions POS

The document contains SQL queries that select purchase order (PO) and purchase requisition (PR) data from various tables, including the PO header, line, and distribution tables as well as the PR header, line, and distribution tables. The queries filter for specific projects, join the tables to retrieve related data, and in some cases calculate totals. Multiple project IDs are included in one query.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

select distinct 'PO' TYPE,currency_code,poh.segment1 po_number ,(pol.UNIT_PRICE* nvl([Link],1)) rate,[Link], 0 PO,AUTHORIZATION_STATUS, msi.segment1,[Link] ,pol.

po_line_id from po_headers_all poh, po_lines_all pol, po_distributions_all pod , mtl_system_items msi where pod.project_id in (select project_id From pa_projects_all where segment1=:porjec t_no) and poh.po_header_id = pol.po_header_id and pol.po_line_id = pod.po_line_id AND AUTHORIZATION_STATUS !='REJECTED' and msi.inventory_item_id = pol.item_id and pol.cancelled_by is null AND msi.organization_id = 88 UNION ALL select distinct 'PRS' TYPE,null, prh.segment1 req_no,prl.UNIT_PRICE,[Link] y,prl.line_location_id,AUTHORIZATION_STATUS, msi.segment1,[Link] ,prl.requisition_line_id from po_req_distributions_all prd, po_requisition_lines_all prl, po_requisition_headers_all prh, mtl_system_items msi where prd.project_id in (select project_id From pa_projects_all where segment1=: porject_no) and prh.requisition_header_id = prl.requisition_header_id and prl.requisition_line_id = prd.requisition_line_id and prl.line_location_id is null AND AUTHORIZATION_STATUS NOT IN ('RETURNED','REJECTED') and (prl.MODIFIED_BY_AGENT_FLAG is null or prl.MODIFIED_BY_AGENT_FLAG='N') AND msi.inventory_item_id = prl.item_id and msi.organization_id = 88 -----------------------------------------------------------

SELECT SUM(RATE*QUANTITY) FROM( select 'PO' TYPE,currency_code,poh.segment1 po_number ,(pol.UNIT_PRICE*nvl(poh.r ate,1)) rate,[Link], 0 PO,AUTHORIZATION_STATUS from po_headers_all poh, po_lines_all pol, po_distributions_all pod where pod.project_id in (select project_id From pa_projects_all where segment1=:porjec t_no) and poh.po_header_id = pol.po_header_id and pol.po_line_id = pod.po_line_id AND AUTHORIZATION_STATUS !='REJECTED' UNION ALL select 'PRS' TYPE,null, prh.segment1 req_no,prl.UNIT_PRICE,[Link],[Link] e_location_id,AUTHORIZATION_STATUS from po_req_distributions_all prd, po_requisition_lines_all prl, po_requisition_headers_all prh where prd.project_id in (select project_id From pa_projects_all where segment1=:

porject_no) and prh.requisition_header_id = prl.requisition_header_id prl.requisition_line_id = prd.requisition_line_id and prl.line_location_id is null AND AUTHORIZATION_STATUS NOT IN ('RETURNED','REJECTED') ) A

and

----------------------------MULTIPLE PROJECTS ----------------------------select 'PO' TYPE,currency_code,poh.segment1 po_number ,(pol.UNIT_PRICE*nvl(poh.r ate,1)) rate,[Link], 0 PO,AUTHORIZATION_STATUS,ppa.segment1 project_no fro m po_headers_all poh, po_lines_all pol, po_distributions_all pod , pa_projects_all ppa where pod.project_id =ppa.project_id and ppa.segment1 in('10828','11347') an d poh.po_header_id = pol.po_header_id and pol.po_line_id = pod.po_line_id AND AUTHORIZATION_STATUS !='REJECTED' UNION ALL select 'PRS' TYPE,null, prh.segment1 req_no,prl.UNIT_PRICE,[Link],[Link] e_location_id,AUTHORIZATION_STATUS,ppa.segment1 project_no from po_req_distributions_all prd, po_requisition_lines_all prl, po_requisition_headers_all prh, pa_projects_all ppa where prd.project_id =ppa.project_id and ppa.segment1 in('10828','11347') an d prh.requisition_header_id = prl.requisition_header_id and prl.requisition_line_id = prd.requisition_line_id and prl.line_location_id is null AND AUTHORIZATION_STATUS NOT IN ('RETURNED','REJECTED') ---------------------------------------

select currency_code,poh.segment1 po_number ,(pol.UNIT_PRICE*nvl([Link],1)) ra te,[Link], 0 PO,AUTHORIZATION_STATUS from po_headers_all poh, po_lines_all pol, po_distributions_all pod where pod.project_id in (select project_id From pa_projects_all where segment1=:porjec t_no) and poh.po_header_id = pol.po_header_id and pol.po_line_id = pod.po_line_id UNION ALL select null, prh.segment1 req_no,prl.UNIT_PRICE,[Link],prl.line_location_i d,AUTHORIZATION_STATUS from po_req_distributions_all prd,

po_requisition_lines_all prl, po_requisition_headers_all prh where prd.project_id in (select project_id From pa_projects_all where segment1=: porject_no) and prh.requisition_header_id = prl.requisition_header_id and prl.requisition_line_id = prd.requisition_line_id and prl.line_location_id is null

You might also like