--For Blanket po   
   select poh.po_header_id 
         ,poh.segment1 po_number
         ,poh.type_lookup_code
         ,poh.vendor_id
         ,poh.vendor_site_id
         ,poh.currency_code
         ,poh.start_date
         ,poh.end_date
         ,poh.authorization_status
         ,pol.po_line_id
         ,pol.item_id
         ,pol.item_description
         ,pol.category_id
         ,pol.unit_price 
         ,por.po_release_id
         ,por.release_type
         ,por.release_num
         ,por.release_date
         ,poll.line_location_id
         ,poll.need_by_date
         ,poll.promised_date
         ,poll.taxable_flag
         ,poll.closed_code
         ,pod.po_distribution_id
         ,pod.quantity_ordered
         ,pod.destination_type_code
         ,pod.destination_organization_id
         ,pod.distribution_type
   FROM   po_headers_all poh
         ,po_lines_all   pol
         ,po_releases_all por
         ,po_line_locations_all poll
         ,po_distributions_all  pod
  WHERE  1 = 1
    AND  poh.po_header_id  = pol.po_header_id
    AND  poh.po_header_id  = por.po_header_id   
    AND  poll.po_header_id = poh.po_header_id
    AND  poll.po_line_id   = pol.po_line_id
    AND  poll.po_release_id= por.po_release_id
    AND  pod.po_line_id    = pol.po_line_id    
    AND  pod.po_release_id = por.po_release_id
    AND  poh.po_header_id  = &po_header_id; 
    
    select poh.po_header_id
         ,poh.segment1 po_number
         ,poh.type_lookup_code
         ,poh.vendor_id
         ,poh.vendor_site_id
         ,poh.currency_code         
         ,poh.authorization_status
         ,pol.po_line_id
         ,pol.item_id
         ,pol.item_description
         ,pol.category_id
         ,pol.unit_price          
         ,poll.line_location_id
         ,poll.need_by_date
         ,poll.promised_date
         ,poll.taxable_flag
         ,poll.closed_code
         ,pod.po_distribution_id
         ,pod.quantity_ordered
         ,pod.destination_type_code
         ,pod.destination_organization_id
         ,pod.distribution_type
   FROM   po_headers_all poh
         ,po_lines_all   pol         
         ,po_line_locations_all poll
         ,po_distributions_all  pod
  WHERE  1 = 1
    AND  poh.po_header_id     = pol.po_header_id          
    AND  poll.po_header_id    = poh.po_header_id
    AND  poll.po_line_id      = pol.po_line_id    
    AND  pod.po_line_id       = pol.po_line_id   
    AND  pod.line_location_id = poll.line_location_id
    AND  pod.po_header_id     = poh.po_header_id
    AND  poh.po_header_id  = &Po_header_id;
For invoice related information please have a look into below link
 
Do you think this Article is useful?
 
0 Responses to “Queries joining the main Purchase tables with their important columns listed”
Post a Comment