SELECT DISTINCT poh.po_header_id,
pov.segment1 vendor_no,
poh.segment1 REFERENCE_NUM,
poh.AUTHORIZATION_STATUS PROCESS_CODE,
poh.TYPE_LOOKUP_CODE DOCUMENT_TYPE_CODE,
poh.currency_code CURRENCY_CODE,
(SELECT full_name
FROM per_all_people_f
WHERE person_id = poh.agent_id)
AGENT_NAME,
pov.vendor_name,
(SELECT vendor_site_code
FROM po_vendor_sites_all
WHERE vendor_site_id = poh.vendor_site_id)
VENDOR_SITE_CODE,
(SELECT location_code
FROM hr_locations
WHERE location_id = poh.ship_to_location_id)
SHIP_TO_LOCATION,
(SELECT location_code
FROM hr_locations
WHERE location_id = poh.bill_to_location_id)
BILL_TO_LOCATION,
poh.ATTRIBUTE_CATEGORY,
poh.ATTRIBUTE1,
poh.ATTRIBUTE2,
poh.ATTRIBUTE3,
poh.ATTRIBUTE4,
poh.ATTRIBUTE5,
poh.ATTRIBUTE6,
poh.ATTRIBUTE7,
poh.ATTRIBUTE8,
poh.ATTRIBUTE9,
poh.ATTRIBUTE10,
poh.ATTRIBUTE11,
poh.ATTRIBUTE12,
poh.ATTRIBUTE13,
poh.ATTRIBUTE14,
poh.ATTRIBUTE15,
poh.Rate EXCHANGE_RATE,
poh.rate_type EXCHANGE_RATE_TYPE,
poh.rate_date EXCHANGE_RATE_DATE,
'' BATCH_ID,
ood.operating_unit
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
new
SELECT DISTINCT poh.po_header_id,
pov.segment1 vendor_no,
poh.segment1 REFERENCE_NUM,
poh.AUTHORIZATION_STATUS PROCESS_CODE,
poh.TYPE_LOOKUP_CODE DOCUMENT_TYPE_CODE,
poh.currency_code CURRENCY_CODE,
(SELECT full_name
FROM per_all_people_f
WHERE person_id = poh.agent_id)
AGENT_NAME,
pov.vendor_name,
(SELECT vendor_site_code
FROM po_vendor_sites_all
WHERE vendor_site_id = poh.vendor_site_id)
VENDOR_SITE_CODE,
(SELECT location_code
FROM hr_locations
WHERE location_id = poh.ship_to_location_id)
SHIP_TO_LOCATION,
(SELECT location_code
FROM hr_locations
WHERE location_id = poh.bill_to_location_id)
BILL_TO_LOCATION,
(SELECT NAME
FROM AP_TERMS
WHERE TERM_ID = poh.TERMS_ID)
payment_term,
POH.FOB_LOOKUP_CODE,
POH.BILL_TO_LOCATION_ID,
POH.SHIP_TO_LOCATION_ID,
POL.QUANTITY,
POL.UNIT_PRICE,
PLL.PROMISED_DATE,
poh.ATTRIBUTE_CATEGORY,
poh.ATTRIBUTE1,
poh.ATTRIBUTE2,
poh.ATTRIBUTE3,
poh.ATTRIBUTE4,
poh.ATTRIBUTE5,
poh.ATTRIBUTE6,
poh.ATTRIBUTE7,
poh.ATTRIBUTE8,
poh.ATTRIBUTE9,
poh.ATTRIBUTE10,
poh.ATTRIBUTE11,
poh.ATTRIBUTE12,
poh.ATTRIBUTE13,
poh.ATTRIBUTE14,
poh.ATTRIBUTE15,
poh.Rate EXCHANGE_RATE,
poh.rate_type EXCHANGE_RATE_TYPE,
poh.rate_date EXCHANGE_RATE_DATE,
'' BATCH_ID,
ood.operating_unit
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
AND POH.SEGMENT1 IN ('42405822',
'42405843',
'42405897',
'42405952',
'42406032',
'42406077',
'42406104',
'42406112',
'42406182',
'42406269',
'44402482',
'44402511',
'47402318',
'47402322',
'47402336',
'47402414',
'47402422',
'43404694',
'43404721',
'43404734',
'43404792',
'43404966',
'43405019',
'43405021',
'43405036')
pov.segment1 vendor_no,
poh.segment1 REFERENCE_NUM,
poh.AUTHORIZATION_STATUS PROCESS_CODE,
poh.TYPE_LOOKUP_CODE DOCUMENT_TYPE_CODE,
poh.currency_code CURRENCY_CODE,
(SELECT full_name
FROM per_all_people_f
WHERE person_id = poh.agent_id)
AGENT_NAME,
pov.vendor_name,
(SELECT vendor_site_code
FROM po_vendor_sites_all
WHERE vendor_site_id = poh.vendor_site_id)
VENDOR_SITE_CODE,
(SELECT location_code
FROM hr_locations
WHERE location_id = poh.ship_to_location_id)
SHIP_TO_LOCATION,
(SELECT location_code
FROM hr_locations
WHERE location_id = poh.bill_to_location_id)
BILL_TO_LOCATION,
poh.ATTRIBUTE_CATEGORY,
poh.ATTRIBUTE1,
poh.ATTRIBUTE2,
poh.ATTRIBUTE3,
poh.ATTRIBUTE4,
poh.ATTRIBUTE5,
poh.ATTRIBUTE6,
poh.ATTRIBUTE7,
poh.ATTRIBUTE8,
poh.ATTRIBUTE9,
poh.ATTRIBUTE10,
poh.ATTRIBUTE11,
poh.ATTRIBUTE12,
poh.ATTRIBUTE13,
poh.ATTRIBUTE14,
poh.ATTRIBUTE15,
poh.Rate EXCHANGE_RATE,
poh.rate_type EXCHANGE_RATE_TYPE,
poh.rate_date EXCHANGE_RATE_DATE,
'' BATCH_ID,
ood.operating_unit
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
new
SELECT DISTINCT poh.po_header_id,
pov.segment1 vendor_no,
poh.segment1 REFERENCE_NUM,
poh.AUTHORIZATION_STATUS PROCESS_CODE,
poh.TYPE_LOOKUP_CODE DOCUMENT_TYPE_CODE,
poh.currency_code CURRENCY_CODE,
(SELECT full_name
FROM per_all_people_f
WHERE person_id = poh.agent_id)
AGENT_NAME,
pov.vendor_name,
(SELECT vendor_site_code
FROM po_vendor_sites_all
WHERE vendor_site_id = poh.vendor_site_id)
VENDOR_SITE_CODE,
(SELECT location_code
FROM hr_locations
WHERE location_id = poh.ship_to_location_id)
SHIP_TO_LOCATION,
(SELECT location_code
FROM hr_locations
WHERE location_id = poh.bill_to_location_id)
BILL_TO_LOCATION,
(SELECT NAME
FROM AP_TERMS
WHERE TERM_ID = poh.TERMS_ID)
payment_term,
POH.FOB_LOOKUP_CODE,
POH.BILL_TO_LOCATION_ID,
POH.SHIP_TO_LOCATION_ID,
POL.QUANTITY,
POL.UNIT_PRICE,
PLL.PROMISED_DATE,
poh.ATTRIBUTE_CATEGORY,
poh.ATTRIBUTE1,
poh.ATTRIBUTE2,
poh.ATTRIBUTE3,
poh.ATTRIBUTE4,
poh.ATTRIBUTE5,
poh.ATTRIBUTE6,
poh.ATTRIBUTE7,
poh.ATTRIBUTE8,
poh.ATTRIBUTE9,
poh.ATTRIBUTE10,
poh.ATTRIBUTE11,
poh.ATTRIBUTE12,
poh.ATTRIBUTE13,
poh.ATTRIBUTE14,
poh.ATTRIBUTE15,
poh.Rate EXCHANGE_RATE,
poh.rate_type EXCHANGE_RATE_TYPE,
poh.rate_date EXCHANGE_RATE_DATE,
'' BATCH_ID,
ood.operating_unit
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
AND POH.SEGMENT1 IN ('42405822',
'42405843',
'42405897',
'42405952',
'42406032',
'42406077',
'42406104',
'42406112',
'42406182',
'42406269',
'44402482',
'44402511',
'47402318',
'47402322',
'47402336',
'47402414',
'47402422',
'43404694',
'43404721',
'43404734',
'43404792',
'43404966',
'43405019',
'43405021',
'43405036')
No comments:
Post a Comment