SELECT DISTINCT
A.PO_NO,
A.LINE_NUM,
A.DIST_NUM,
A.ITEM_CATEGORY,
A.IS_CAPITAL,
A.SEGMENT2 PO_ACCT,
A.ACCT PO_ACCT_DESC,
A.UNIT_PRICE,
A.AMOUNT_ORDERED,
NVL (
(SELECT TO_CHAR (RT.TRANSACTION_DATE, ‘yyyy-mm-dd’)
FROM RCV_TRANSACTIONS RT
WHERE RT.PO_HEADER_ID = A.PO_HEADER_ID
AND RT.PO_LINE_ID = A.PO_LINE_ID
AND RT.PO_LINE_LOCATION_ID = A.LINE_LOCATION_ID
AND RT.PO_DISTRIBUTION_ID = A.PO_DISTRIBUTION_ID
AND RT.TRANSACTION_TYPE = ‘DELIVER’
AND ROWNUM = 1),
‘N’)
RECIEVED_FLAG,
B.SEGMENT2 SLA_ACCT,
B.ACCT SLA_ACCT_DESC,
B.ENTERED_DR,
B.ENTERED_CR,
B.ACCOUNTED_DR,
B.ACCOUNTED_CR,
C.SEGMENT2 AP_ACCT,
C.ACCT AP_ACCT_DESC,
C.AMOUNT,
A.SHIP_RECEIPT_FLAG,
A.DIST_RECEIPT_FLAG
FROM (SELECT POH.SEGMENT1 PO_NO,
POL.LINE_NUM,
POLL.LINE_LOCATION_ID,
POL.PO_LINE_ID,
POL.PO_HEADER_ID,
POD.DISTRIBUTION_NUM DIST_NUM,
POD.CODE_COMBINATION_ID,
POD.PO_DISTRIBUTION_ID,
POL.UNIT_PRICE,
POD.AMOUNT_ORDERED,
GCC.SEGMENT2,
GL_FLEXFIELDS_PKG.GET_CONCAT_DESCRIPTION (
GCC.CHART_OF_ACCOUNTS_ID,
GCC.CODE_COMBINATION_ID,
‘.’)
ACCT,
NVL (POLL.ACCRUE_ON_RECEIPT_FLAG, ‘N’) SHIP_RECEIPT_FLAG,
NVL (POD.ACCRUE_ON_RECEIPT_FLAG, ‘N’) DIST_RECEIPT_FLAG,
(SELECT SEGMENT1
FROM MTL_CATEGORIES_B
WHERE CATEGORY_ID = POL.CATEGORY_ID AND ROWNUM = 1)
ITEM_CATEGORY,
HL_PO_UTL_PKG.IS_CAPITAL (POL.CATEGORY_ID) IS_CAPITAL
FROM PO_HEADERS_ALL POH,
PO_LINES_ALL POL,
PO_LINE_LOCATIONS_ALL POLL,
PO_DISTRIBUTIONS_ALL POD,
GL_CODE_COMBINATIONS GCC
WHERE POH.PO_HEADER_ID = POL.PO_HEADER_ID
AND POH.PO_HEADER_ID = POD.PO_HEADER_ID
AND POL.PO_LINE_ID = POD.PO_LINE_ID
AND POH.PO_HEADER_ID = POLL.PO_HEADER_ID
AND POL.PO_LINE_ID = POLL.PO_LINE_ID
AND POLL.LINE_LOCATION_ID = POD.LINE_LOCATION_ID
AND POD.CODE_COMBINATION_ID = GCC.CODE_COMBINATION_ID
AND POL.ITEM_ID IS NULL /*AND poh.po_header_id IN
(SELECT * FROM tmp_po_accrue_on_receipt_flag)*/
) A,
(SELECT RT.PO_HEADER_ID,
RT.PO_LINE_ID,
RT.PO_LINE_LOCATION_ID,
RT.PO_DISTRIBUTION_ID,
RT.VENDOR_ID,
RT.VENDOR_SITE_ID,
SLA.*
FROM (SELECT XTE.SOURCE_ID_INT_1,
XL.CODE_COMBINATION_ID,
XL.ENTERED_DR,
XL.ENTERED_CR,
XL.ACCOUNTED_DR,
XL.ACCOUNTED_CR,
GCC.SEGMENT2,
GL_FLEXFIELDS_PKG.GET_CONCAT_DESCRIPTION (
GCC.CHART_OF_ACCOUNTS_ID,
GCC.CODE_COMBINATION_ID,
‘.’)
ACCT
FROM XLA.XLA_AE_HEADERS XH,
XLA.XLA_AE_LINES XL,
XLA.XLA_TRANSACTION_ENTITIES XTE,
XLA.XLA_EVENTS XEA,
GL.GL_CODE_COMBINATIONS GCC
WHERE XH.AE_HEADER_ID = XL.AE_HEADER_ID
AND XTE.ENTITY_ID = XH.ENTITY_ID
AND XL.CODE_COMBINATION_ID = GCC.CODE_COMBINATION_ID
AND XEA.EVENT_ID = XH.EVENT_ID
AND XH.BALANCE_TYPE_CODE = ‘A’
AND XH.JE_CATEGORY_NAME = ‘Receiving’
AND XL.ACCOUNTED_DR IS NOT NULL) SLA,
RCV_TRANSACTIONS RT
WHERE RT.TRANSACTION_ID = SLA.SOURCE_ID_INT_1(+)
AND RT.TRANSACTION_TYPE = ‘DELIVER’) B,
(SELECT AID.DIST_CODE_COMBINATION_ID,
POD.PO_DISTRIBUTION_ID,
POD.PO_HEADER_ID,
POD.PO_LINE_ID,
POD.LINE_LOCATION_ID,
GCC.SEGMENT2,
GL_FLEXFIELDS_PKG.GET_CONCAT_DESCRIPTION (
GCC.CHART_OF_ACCOUNTS_ID,
GCC.CODE_COMBINATION_ID,
‘.’)
ACCT,
AID.AMOUNT
FROM AP_INVOICE_DISTRIBUTIONS_ALL AID,
PO_DISTRIBUTIONS_ALL POD,
GL_CODE_COMBINATIONS GCC
WHERE AID.PO_DISTRIBUTION_ID = POD.PO_DISTRIBUTION_ID
AND AID.DIST_CODE_COMBINATION_ID = GCC.CODE_COMBINATION_ID
AND AID.LINE_TYPE_LOOKUP_CODE IN (‘ITEM’, ‘ACCRUAL’)) C
WHERE A.PO_HEADER_ID = B.PO_HEADER_ID(+)
AND A.PO_LINE_ID = B.PO_LINE_ID(+)
AND A.LINE_LOCATION_ID = B.PO_LINE_LOCATION_ID(+)
AND A.PO_DISTRIBUTION_ID = B.PO_DISTRIBUTION_ID(+)
AND A.PO_DISTRIBUTION_ID = C.PO_DISTRIBUTION_ID(+);
Here is the SQL Query for Link Between PO-RCV-XLA-AP.
Latest Posts
- R12 – How to Handle NULL for :$FLEX$.VALUE_SET_NAME In Oracle ERPAugust 25, 2023 - 1:20 pm
- R12 – How to Delete Oracle AR TransactionsMarch 22, 2019 - 8:37 pm
- How to Define Custom Key Flexfield (KFF) in R12January 19, 2018 - 5:43 pm
- AutoLock Box Concepts In R12November 10, 2017 - 8:30 am
- R12 – java.sql.SQLException: Invalid column type in OAFSeptember 15, 2017 - 9:39 am
Recent Comments