The blog provides the Oracle Apps R12 Purchase Order (PO) SQL Query to get Tax details and another Oracle Apps R12 Purchase Order (PO) SQL Query to get Tax details mapped with Purchase Order and the Associated Item with price and shipment details.
Oracle Apps R12 Purchase Order Query to get Tax Columns
SELECT PO_TAX_QUERY.ORDER_NO1,
PO_TAX_QUERY.TAX_RATE, SUM (NVL (PO_TAX_QUERY.TAX_AMOUNT, 0)) TAX_AMOUNT,
PO_TAX_QUERY.TAX_NAME, PO_TAX_QUERY.TAX_LINE_NO
FROM (SELECT H.SEGMENT1 ORDER_NO1, JAI_PO_TAXES_TBL.LINE_LOCATION_ID,
JAI_PO_TAXES_TBL.TAX_RATE TAX_RATE,
JAI_PO_TAXES_TBL.TAX_AMOUNT,
RTRIM (NVL (JAI_CMN_TAXES_ALL_TBL.TAX_DESCR, NULL)) TAX_NAME,
JAI_PO_TAXES_TBL.TAX_LINE_NO
FROM PO.PO_HEADERS_ALL H,
PO_LINES_ALL PO_LINES_ALL_TBL,
JAI_PO_TAXES JAI_PO_TAXES_TBL,
JAI_CMN_TAXES_ALL JAI_CMN_TAXES_ALL_TBL
WHERE JAI_PO_TAXES_TBL.TAX_ID = JAI_CMN_TAXES_ALL_TBL.TAX_ID(+)
AND JAI_CMN_TAXES_ALL_TBL.END_DATE IS NULL
AND PO_LINES_ALL_TBL.PO_LINE_ID = JAI_PO_TAXES_TBL.PO_LINE_ID(+)
AND PO_LINES_ALL_TBL.PO_HEADER_ID = JAI_PO_TAXES_TBL.PO_HEADER_ID(+)
AND H.PO_HEADER_ID = PO_LINES_ALL_TBL.PO_HEADER_ID(+)
AND JAI_PO_TAXES_TBL.TAX_AMOUNT < > 0
AND H.TYPE_LOOKUP_CODE = 'STANDARD'
AND H.SEGMENT1 = :PO_ORDER
ORDER BY JAI_PO_TAXES_TBL.TAX_LINE_NO) PO_TAX_QUERY
GROUP BY PO_TAX_QUERY.ORDER_NO1,
PO_TAX_QUERY.TAX_RATE,
PO_TAX_QUERY.TAX_NAME,
PO_TAX_QUERY.TAX_LINE_NO
ORDER BY TAX_LINE_NO
Oracle Apps Purchase Order Query to PO, Tax and Item Details
SELECT PO_HEADERS_ALL_TBL.SEGMENT1,
PO_LINES_ALL_TBL.LINE_NUM,
PO_LINE_LOC_ALL_TBL.SHIPMENT_NUM,
PO_HEADERS_ALL_TBL.COMMENTS,
MSI.SEGMENT1 "ITEM CODE",
PO_LINES_ALL_TBL.ITEM_DESCRIPTION,
PO_LINES_ALL_TBL.UNIT_MEAS_LOOKUP_CODE "UOM",
PO_LINES_ALL_TBL.BASE_UNIT_PRICE, PO_LINES_ALL_TBL.UNIT_PRICE,
PO_LINES_ALL_TBL.QUANTITY,
(PO_LINES_ALL_TBL.UNIT_PRICE * PO_LINES_ALL_TBL.QUANTITY) "LINE AMOUNT",
ZL_DET_FACTORS_TBL.INPUT_TAX_CLASSIFICATION_CODE,
ZL_DET_FACTORS_TBL.USER_DEFINED_FISC_CLASS,
ZX_LINES_TBL.TAX_RATE,
ZX_LINES_TBL.TAXABLE_AMT
FROM ZX_LINES_DET_FACTORS ZL_DET_FACTORS_TBL,
ZX_LINES ZX_LINES_TBL,
PO_HEADERS_ALL PO_HEADERS_ALL_TBL,
PO_LINES_ALL PO_LINES_ALL_TBL,
PO_LINE_LOCATIONS_ALL PO_LINE_LOC_ALL_TBL,
MTL_SYSTEM_ITEMS_B MSI,
PO_DISTRIBUTIONS_ALL PDA
WHERE 1=1
AND PO_HEADERS_ALL_TBL.PO_HEADER_ID = PO_LINES_ALL_TBL.PO_HEADER_ID
AND PO_LINES_ALL_TBL.PO_LINE_ID = PO_LINE_LOC_ALL_TBL.PO_LINE_ID
AND PDA.PO_HEADER_ID = PO_HEADERS_ALL_TBL.PO_HEADER_ID
AND PDA.PO_LINE_ID = PO_LINES_ALL_TBL.PO_LINE_ID
AND PDA.DESTINATION_ORGANIZATION_ID = MSI.ORGANIZATION_ID(+)
AND ZL_DET_FACTORS_TBL.TRX_ID = ZX_LINES_TBL.TRX_ID
AND ZX_LINES_TBL.TRX_ID = PO_LINE_LOC_ALL_TBL.PO_HEADER_ID
AND ZL_DET_FACTORS_TBL.ENTITY_CODE = 'PURCHASE_ORDER'
AND PO_HEADERS_ALL_TBL.SEGMENT1 = :P_PO_NUMBER