Monday, 31 October 2011

po_line

/* Formatted on 08-08-2011 15:57:51 (QP5 v5.115.810.9015) */
SELECT   DISTINCT
         pl.po_header_id,
         pl.po_line_id,
         (SELECT   segment1
            FROM   po_headers_all poh
           WHERE   poh.po_header_id = pl.po_header_id
                   AND poh.org_id = pl.org_id)
            L_REFERENCE_NUM,
         pl.line_num,
         pll.shipment_num,
         plt.line_type,
         msi.segment1 Item_Code,
         msi.DESCRIPTION Item_Desc,
         pl.ITEM_DESCRIPTION,
         pl.unit_meas_lookup_code uom_code,
         pl.quantity,
         pl.unit_price,
         pll.promised_date,
         ood.organization_code ship_to_organization_code,
         hloc.location_code l_ship_to_location,
         pll.invoice_close_tolerance inv_cl_toler,
         pll.receive_close_tolerance rec_cl_toler,
         pl.attribute_category l_attribute_category,
         pl.attribute1 l_attribute1,
         pl.attribute2 l_attribute2,
         pl.attribute3 l_attribute3,
         pl.attribute4 l_attribute4,
         pl.attribute5 l_attribute5,
         pl.attribute6 l_attribute6,
         pl.attribute7 l_attribute7,
         pl.attribute8 l_attribute8,
         pl.attribute9 l_attribute9,
         pl.attribute10 l_attribute10,
         pl.attribute11 l_attribute11,
         pl.attribute12 l_attribute12,
         pl.attribute13 l_attribute13,
         pl.attribute14 l_attribute14,
         pl.attribute15 l_attribute15,
         pl.po_line_id,
         pl.po_header_id
  FROM   po_lines_all pl,
         po_line_types plt,
         mtl_system_items_b msi,
         po_line_locations_all pll,
         org_organization_definitions ood,
         hr_locations_all hloc
 WHERE       pl.line_type_id = plt.line_type_id
         AND pl.item_id = msi.inventory_item_id(+)
         AND pl.po_line_id = pll.po_line_id
         AND pl.org_id = pll.org_id
         AND hloc.location_id(+) = pll.ship_to_location_id
         AND ood.organization_id(+) = pll.ship_to_organization_id
         AND pl.org_id = ood.operating_unit
         AND ood.set_of_books_id = 5
         AND TRUNC (pl.creation_date) BETWEEN '01-jul-2011' AND '31-jul-2011'
        

No comments:

Post a Comment