Script for All Purchase Order
Details with Line , Distribution Level Information in Details
SELECT ph.segment1
po_number,
--####################################################################
--All Purchase Order Details
with Line , Distribution Level Information in Details
--####################################################################
TO_CHAR (ph.creation_date, 'DD-MON-YYYY') po_date,
--ph.vendor_id,
--pl.po_header_id,
ph.comments,
pv.vendor_name,
pv.segment1 vendor_num,
ph.AUTHORIZATION_STATUS
PO_STATUS,
pl.line_num,
pl.item_description,
pl.quantity,
pl.unit_price,
pl.amount,
pl.quantity * pl.unit_price * NVL (ph.rate, 1) line_amount,
(SELECT CONCATENATED_SEGMENTS
FROM apps.gl_code_combinations_kfv
WHERE code_combination_id = pd.code_combination_id)
dist_account
FROM apps.po_distributions_all pd,
apps.po_line_locations_all pll,
apps.po_lines_all pl,
apps.po_headers_all ph,
apps.po_vendors pv
WHERE pd.line_location_id = pll.line_location_id(+)
AND pd.org_id
= pll.org_id(+)
AND pll.po_line_id = pl.po_line_id(+)
AND pll.org_id = pl.org_id(+)
AND pl.po_header_id
= ph.po_header_id(+)
AND pl.org_id
= ph.org_id(+)
AND ph.vendor_id
= pv.vendor_id
--AND ph.segment1 LIKE
'151900004%'
AND ph.creation_date
BETWEEN :P_FROM AND :P_TO
ORDER BY ph.segment1, pl.line_num;