Professional Documents
Culture Documents
Payment
Let’s start with Invoices.
GL_JE_HEADERS
GL_IMPORT_REFERENCES
XLA_AE_LINES
XLA_AE_HEADERS
XLA_TRANSACTION_ENTITIES
AP_INVOICES_ALL
Now, when we are given a Journal entry with JE_SOURCE as ‘Payables’ and JE_CATEGORY as ‘Purchase Invoice’, we got to track its JE_HEADER_ID. Here is the step by step
process.
Step 1: For instance, we are going to track the invoice against the maximum JE_HEADER_ID with Payables source and Purchase Invoices Category. Here is the query for it;
SELECT MAX(JE_HEADER_ID )
INTO V_JE_HEADER_ID
FROM GL_JE_HEADERS
WHERE JE_SOURCE = ‘Payables’
AND JE_CATEGORY= ‘Purchase Invoices’;
Step 2: Now we are going to check the corresponding GL_SL_LINK_ID against this JE_HEADER_ID. We can get these link ids through the query,
SELECT GL_SL_LINK_ID
FROM GL_IMPORT_REFERENCES
WHERE JE_HEADER_ID = V_JE_HEADER_ID;
Step 3: And to get to the relevant lines in sub-ledger modules we need to find lines against the identified GL_SL_LINK_IDs from XLA_AE_LINES table. Here is the query to get to
the sub-ledger lines
Step 4: Now we will find ENTITY_ID against the identified header_id. Here is the query,
SELECT ENTITY_ID
INTO V_ENTITY_ID
FROM XLA_AE_HEADERS
WHERE AE_HEADER_ID = V_AE_HEADER_ID;
Step 5: Now, we will get the SOURCE_ID_INT_1 against identified XLA_TRANSACTION to get to the Payables transaction.
SELECT SOURCE_ID_INT_1
INTO V_SOURCE_ID
FROM XLA_TRANSACTION_ENTITIES
WHERE ENTITY_ID = V_ENTITY_ID;
Step 6: Now is the last step, we will use this source id as invoice id to get to the invoice in payables.
SELECT *
FROM AP_INVOICES_ALL
WHERE INVOICE_ID = V_SOURCE_ID;
So, here is the drilldown from General Ledger to Payables Invoices. We got to change in step 1 for JE_CATEGORY as ‘Payments’ and the query becomes
SELECT MAX(JE_HEADER_ID )
INTO V_JE_HEADER_ID
FROM GL_JE_HEADERS
WHERE JE_SOURCE = ‘Payables’
AND JE_CATEGORY= ‘Payments’;
And in step 6, we got to find check details against the identified SOURCE_ID, which makes the SQL as
SELECT *
FROM AP_CHECKS_ALL
WHERE CHECK_ID = V_SOURCE_ID;
Link Between AP and GL with XLA tables in R12 ,AP to GL Link in oracle apps, Data Flow from APto XLA to GL
.xla_transaction_entities entity_id is linked with xla events and xla ae headers and xla ae lines
AP to GL link
SELECT distinct
AIA.DOC_SEQUENCE_VALUE,
aia.INVOICE_NUM ,
aia.attribute6 "INVOICE_ID",--IN11i
aia.GL_DATE,
aia.INVOICE_AMOUNT,
xev.event_type_code,
gcc.SEGMENT1
|| '.'
|| gcc.SEGMENT2
|| '.'
|| gcc.SEGMENT3
|| '.'
|| gcc.SEGMENT4
|| '.'
|| gcc.SEGMENT5
|| '.'
|| gcc.SEGMENT6
|| '.'
|| gcc.SEGMENT7
"CODE_COMBINATION",
aia.GL_DATE,
xah.PERIOD_NAME,
GJH.JE_SOURCE
xla.xla_transaction_entities XTE,
xla_events xev,
xla_ae_headers XAH,
xla_ae_lines XAL,
GL_IMPORT_REFERENCES gir,
gl_je_headers gjh,
gl_je_lines gjl,
gl_code_combinations gcc,
ap_suppliers aps
ORDER BY 1, aia.GL_DATE