1 Reply Latest reply on Oct 14, 2011 12:05 AM by Sandeep Gandhi, Consultant

    Link between purchase Requestion & PO

    user13140975
      This query contain requisition info
      ===========================
      select --prh.requisition_header_id,
      -- note_to_agent,
      --prh.requisition_header_id header_id,
      -- MSI.INVENTORY_ITEM_ID,
      prd.distribution_id,
      prd.requisition_line_id,
      msi.segment1 || '.' ||msi.segment2 || '.' || msi.segment3 item_code,
      msi.description ,
      unit_meas_lookup_code uom,
      prh.segment1 requisition_num,
      trunc(prh.creation_date) pr_date,
      prh.authorization_status requestion_satatus,
      prl.quantity
      from po_requisition_headers_all prh,
      po_requisition_lines_all prl,
      mtl_system_items_b msi,
      po_req_distributions_all prd
      where prh.requisition_header_id = prl.requisition_header_id
      and prh.requisition_header_id= prd.distribution_id
      and msi.inventory_item_id=prl.item_id
      and msi.organization_id=prl.destination_organization_id
      and prl.destination_organization_id=101
      --and TYPE_LOOKUP_CODE='Purchase'
      and prh.segment1='120111374'

      above query contain distribution_id
      ========================I have made a PO by above requisition===============

      SELECT poh.PO_HEADER_ID,
      poh.segment1,
      pol.QUANTITY,
      pol.UNIT_PRICE,
      poh.VENDOR_ID,
      pod.req_distribution_id
      FROM po_headers_all poh, po_lines_all pol, po_distributions_all pod
      WHERE poh.po_header_id = pol.po_header_id
      AND poh.po_header_id(+) = pod.po_header_id
      AND POL.PO_LINE_ID = POD.PO_LINE_ID
      AND poh.po_header_id = '55255'

      But there haven't any req_distribution_id Related data. I want to used it at inline view.
      Plz somebody help me.