Tuesday, 20 October 2015

Link Between PO and WIP Tables in oracle apps

SELECT DISTINCT pv.vendor_name
    FROM po.po_requisition_headers_all prha
       , po.po_requisition_lines_all prla
       , po_req_distributions_all prd
       , applsys.fnd_user fu
       , wip.wip_entities we
       , po_headers_all poh
       , po_lines_all pol
       , po_line_locations_all pll
       , po_distributions_all pod
       , po_vendors pv
   WHERE prha.requisition_header_id = prla.requisition_header_id
     AND prha.created_by = fu.user_id
     AND prla.wip_entity_id = :WIP_ENTITY_ID
     AND prha.creation_date > '25-JUL-2013'
     AND prd.requisition_line_id = prla.requisition_line_id
     AND prd.distribution_id = pod.req_distribution_id
     AND pod.po_header_id = pll.po_header_id
     AND pod.po_line_id = pll.po_line_id
     AND pod.line_location_id = pll.line_location_id
     AND pll.po_line_id = pol.po_line_id
     AND pll.po_header_id = pll.po_header_id
     AND pol.po_header_id = poh.po_header_id
     AND poh.vendor_id = pv.vendor_id;


SELECT DISTINCT poh.segment1 into V_PO
    FROM po.po_requisition_headers_all prha
       , po.po_requisition_lines_all prla
       , po_req_distributions_all prd
       , applsys.fnd_user fu
       , wip.wip_entities we
       , po_headers_all poh
       , po_lines_all pol
       , po_line_locations_all pll
       , po_distributions_all pod
       , po_vendors pv
   WHERE prha.requisition_header_id = prla.requisition_header_id
     AND prha.created_by = fu.user_id
     AND prla.wip_entity_id = :WIP_ENTITY_ID
    -- AND prha.creation_date > '25-JUL-2013'
     AND prd.requisition_line_id = prla.requisition_line_id
     AND prd.distribution_id = pod.req_distribution_id
     AND pod.po_header_id = pll.po_header_id
     AND pod.po_line_id = pll.po_line_id
     AND pod.line_location_id = pll.line_location_id
     AND pll.po_line_id = pol.po_line_id
     AND pll.po_header_id = pll.po_header_id
     AND pol.po_header_id = poh.po_header_id
     AND poh.vendor_id = pv.vendor_id;

No comments:

Post a Comment