Monday, 31 October 2011

po_distribution_v1

SELECT distinct
poh.po_header_id,
pol.po_line_id,
 poh.segment1 D_REFERENCE_NUM
, pol.line_num D_LINE_NUM
, pll.shipment_num D_SHIP_NUM
, pod.distribution_num
, pod.quantity_ordered QUANTITY_ORDERED
,(SELECT concatenated_segments
     FROM gl_code_combinations_kfv
    WHERE code_combination_id = pod.code_combination_id) CHARGE_ACCOUNT,
   pod.attribute_category D_ATTRIBUTE_CATEGORY,
   pod.attribute1 D_ATTRIBUTE1,
   pod.attribute2 D_ATTRIBUTE2,
   pod.attribute3 D_ATTRIBUTE3,
   pod.attribute4 D_ATTRIBUTE4,
   pod.attribute5 D_ATTRIBUTE5,
   pod.attribute6 D_ATTRIBUTE6,
   pod.attribute7 D_ATTRIBUTE7,
   pod.attribute8 D_ATTRIBUTE8,
   pod.attribute9 D_ATTRIBUTE9,
   pod.attribute10 D_ATTRIBUTE10,
   pod.attribute11 D_ATTRIBUTE11,
   pod.attribute12 D_ATTRIBUTE12,
   pod.attribute13 D_ATTRIBUTE13,
   pod.attribute14 D_ATTRIBUTE14,
   pod.attribute15 D_ATTRIBUTE15
FROM po_distributions_all pod
, mtl_system_items_b msi
, po_line_locations_all pll
, po_lines_all pol
, po_releases por
, po_headers_all poh
, po_vendors pov
, po_line_types plt
, org_organization_definitions ood
WHERE poh.po_header_id = pol.po_header_id
AND pol.po_line_id = pll.po_line_id
AND pll.line_location_id = pod.line_location_id
AND pol.item_id = msi.inventory_item_id (+)
AND poh.vendor_id = pov.vendor_id (+)
AND pll.po_release_id = por.po_release_id (+)
AND pol.line_type_id = plt.line_type_id
AND trunc(poh.creation_date) between '01-JUL-2011' and '31-JUL-2011'
AND poh.org_id = ood.operating_unit
AND ood.set_of_books_id = 5

No comments:

Post a Comment