Tables Used,
1)PO_HEADERS_ALL
2)PO_LINES_ALL
3)PO_LINE_LOCATIONS_ALL
4)PO_DISTRIBUTIONS_ALL
5)PO_LOOKUP_CODES
6)PO_VENDORS
7)PO_VENDOR_SITES_ALL
8)HR_LOCATIONS
9)PER_PEOPLE_F
10)MTL_SYSTEM_ITEMS_B
SELECT PHA.SEGMENT1 "PO_NUMBER",
PLC.DESCRIPTION "TYPE",
PV.VENDOR_NAME "SUPPLIER",
PVSA.VENDOR_SITE_CODE "SITE",
H1.LOCATION_CODE "SHIP_TO",
H2.LOCATION_CODE "BILL_TO",
PHA.CURRENCY_CODE "CURRENCY",
PPF.FULL_NAME "BUYER",
PHA.AUTHORIZATION_STATUS "STATUS",
PLA.PO_LINE_ID,
PLA.LINE_NUM,
PLA.PURCHASE_BASIS "LINE_TYPE",
MSIB.SEGMENT1"ITEM",
PLA.ITEM_DESCRIPTION,
PLA.UNIT_MEAS_LOOKUP_CODE "UOM",
PLA.QUANTITY,
PLA.UNIT_PRICE "PRICE",
PLLA.LINE_LOCATION_ID,
H3.LOCATION_CODE "LINE_SHIP_TO",
PLLA.QUANTITY "lINE_LOCATION_QTY",
PDA.PO_DISTRIBUTION_ID,
PDA.REQ_HEADER_REFERENCE_NUM "REQ_NUM",
GCC.SEGMENT1||'-'||GCC.SEGMENT2||'-'||GCC.SEGMENT3||'-'||GCC.SEGMENT4||'-'||GCC.SEGMENT5 "CHARGE_ACCOUNT"
FROM PO_HEADERS_ALL PHA,
PO_LINES_ALL PLA,
PO_LINE_LOCATIONS_ALL PLLA,
PO_DISTRIBUTIONS_ALL PDA,
PO_LOOKUP_CODES PLC,
PO_VENDORS PV,
PO_VENDOR_SITES_ALL PVSA,
HR_LOCATIONS H1,
HR_LOCATIONS H2,
HR_LOCATIONS H3,
PER_PEOPLE_F PPF,
GL_CODE_COMBINATIONS GCC,
MTL_SYSTEM_ITEMS_B MSIB
WHERE PHA.PO_HEADER_ID=PLA.PO_HEADER_ID
AND UPPER(PHA.TYPE_LOOKUP_CODE)=UPPER(PLC.LOOKUP_CODE)
AND PLC.LOOKUP_TYPE='PO TYPE'
AND PHA.VENDOR_ID= PV.VENDOR_ID
AND PHA.VENDOR_SITE_ID=PVSA.VENDOR_SITE_ID
--AND PV.VENDOR_ID=PVSA.VENDOR_ID
AND PHA.SHIP_TO_LOCATION_ID=H1.LOCATION_ID
AND PHA.BILL_TO_LOCATION_ID=H2.LOCATION_ID
AND PLLA.SHIP_TO_LOCATION_ID=H3.LOCATION_ID
AND PPF.PERSON_ID=PHA.AGENT_ID
AND PLA.ITEM_ID=MSIB.INVENTORY_ITEM_ID
AND PLA.ORG_ID=MSIB.ORGANIZATION_ID
AND PLA.PO_LINE_ID=PLLA.PO_LINE_ID
AND PLLA.LINE_LOCATION_ID=PDA.LINE_LOCATION_ID
AND GCC.CODE_COMBINATION_ID=PDA.CODE_COMBINATION_ID
AND PHA.SEGMENT1='Enter your PO Number'