All the history of PO
SELECT PHA.SEGMENT1 PO_NUM,
PHA.REVISION_NUM,
PLA.LINE_NUM PO_LINE_NUM,
PLLA.SHIPMENT_NUM,
PLA.ITEM_DESCRIPTION,
PLA.UNIT_MEAS_LOOKUP_CODE,
PLA.LIST_PRICE_PER_UNIT,
PLA.CANCEL_FLAG,
PLA.CANCEL_DATE,
PLA.QUANTITY PO_LINE_QUANTITY,
PHA.AUTHORIZATION_STATUS HEADER_APPROVAL_STATUS,PHA.APPROVED_FLAG HEADER_APPROVED_FLAG,PHA.APPROVED_DATE HEADER_APPROVED_DATE,
PHA.CLOSED_CODE HEADER_CLOSURE_STATUS,
PLA.CLOSED_CODE LINE_CLOSURE_STATUS,
PLLA.CLOSED_CODE SHIPMENT_CLORSURE_STATUS,
PLLA.APPROVED_FLAG SHIPMENT_APPROVED_FLAG,PLLA.APPROVED_DATE SHIPMENT_APPROVED_DATE,
PHA.CANCEL_FLAG PO_CANCEL_FLAG,PLA.CANCEL_FLAG LINE_CANCEL_FLAG,PLLA.CANCEL_FLAG SHIPMENT_CANCEL_FLAG
,PHA.ORG_ID,
PV.VENDOR_NAME,
APSS.VENDOR_SITE_CODE
FROM PO.PO_LINE_LOCATIONS_ARCHIVE_ALL PLLA,
PO.PO_LINES_ARCHIVE_ALL PLA,
PO.PO_HEADERS_ARCHIVE_ALL PHA,
APPS.PO_VENDORS PV,
APPS.AP_SUPPLIER_SITES_ALL APSS
WHERE PLA.PO_LINE_ID = PLLA.PO_LINE_ID
AND PHA.VENDOR_ID=PV.VENDOR_ID
AND PHA.VENDOR_SITE_ID=APSS.VENDOR_SITE_ID
AND PLA.PO_HEADER_ID = PLLA.PO_HEADER_ID
AND PHA.PO_HEADER_ID = PLA.PO_HEADER_ID
-- AND PHA.SEGMENT1 in('&PO_NUM') --Specify Purcahse order number
AND PHA.REVISION_NUM=PLA.REVISION_NUM
AND PLA.REVISION_NUM=PLLA.REVISION_NUM
AND PHA.REVISION_NUM=PLLA.REVISION_NUM
-- AND PLA.ITEM_DESCRIPTION like '&ITEM_DESCRIPTION' --Specify any item for view those PO
ORDER BY PHA.SEGMENT1,PLA.LINE_NUM,PLLA.SHIPMENT_NUM;