Skip to main content

Find AP invoice Data in AP, XLA and GL tables by using Invoice_ID

AP:

Find AP Invoice Summary Data:

SELECT ai.invoice_id,
  SUBSTR(ai.invoice_num,1,25) invoice_num,
  SUBSTR(aps.vendor_name,1,25) vendor_name,
  ai.invoice_date,
  ai.invoice_amount,
  ai.base_amount,
  SUBSTR(ai.invoice_type_lookup_code,1,15) invoice_type_lookup_code,
  SUBSTR(ai.invoice_currency_code,1,3) invoice_currency_code,
  SUBSTR(ai.payment_currency_code,1,3) payment_currency_code,
  ai.legal_entity_id,
  ai.org_id
FROM AP_INVOICES_ALL ai,
  AP_SUPPLIERS aps,
  AP_SUPPLIER_SITES_ALL avs
WHERE ai.invoice_id   = '&Invoice_ID'
AND ai.vendor_id      = aps.vendor_id(+)
and AI.VENDOR_SITE_ID = AVS.VENDOR_SITE_ID(+)

ORDER BY ai.invoice_id ASC;

Find AP Invoice Lines Summary:


SELECT LINE_NUMBER,
  LINE_TYPE_LOOKUP_CODE,
  LINE_SOURCE,
  ACCOUNTING_DATE,
  PERIOD_NAME,
  AMOUNT,
  SUMMARY_TAX_LINE_ID,
  DEFERRED_ACCTG_FLAG,
  ORG_ID
FROM AP_INVOICE_LINES_ALL
where INVOICE_ID = '&Invoice_ID'
ORDER BY LINE_NUMBER ASC;

Find AP Invoice Distributions Summary:


SELECT INVOICE_ID,
  INVOICE_LINE_NUMBER,
  SUBSTR(DISTRIBUTION_LINE_NUMBER,1,8) DISTRIBUTION_LINE_NUMBER,
  SUBSTR(LINE_TYPE_LOOKUP_CODE,1,9) LINE_TYPE_LOOKUP_CODE,
  ACCOUNTING_DATE,
  PERIOD_NAME,
  AMOUNT,
  BASE_AMOUNT,
  POSTED_FLAG,
  MATCH_STATUS_FLAG,
  ENCUMBERED_FLAG,
  HISTORICAL_FLAG,
  SUBSTR(DIST_CODE_COMBINATION_ID,1,15) DIST_CODE_COMBINATION_ID,
  SUBSTR(ACCOUNTING_EVENT_ID,1,15) ACCOUNTING_EVENT_ID,
  SUBSTR(BC_EVENT_ID,1,15) BC_EVENT_ID,
  SUBSTR(INVOICE_DISTRIBUTION_ID,1,15) INVOICE_DISTRIBUTION_ID,
  SUBSTR(PARENT_REVERSAL_ID,1,15) PARENT_REVERSAL_ID,
  SUBSTR(PO_DISTRIBUTION_ID,1,15) PO_DISTRIBUTION_ID,
  SUMMARY_TAX_LINE_ID,
  DETAIL_TAX_DIST_ID,
  ORG_ID
FROM AP_INVOICE_DISTRIBUTIONS_ALL
WHERE INVOICE_ID = '&Invoice_ID'
order by INVOICE_LINE_NUMBER,
  DISTRIBUTION_LINE_NUMBER ASC;

XLA

Find AP Invoice data in XLA_EVENTS table:

SELECT DISTINCT XE.*
FROM AP_INVOICES_ALL AI ,
  XLA_EVENTS XE ,
  XLA.XLA_TRANSACTION_ENTITIES XTE
WHERE XTE.APPLICATION_ID        =200
AND XE.APPLICATION_ID           =200
AND AI.INVOICE_ID               ='&Invoice_ID'
AND XTE.LEDGER_ID               =AI.SET_OF_BOOKS_ID
AND XTE.ENTITY_CODE             ='AP_INVOICES'
AND NVL(XTE.SOURCE_ID_INT_1,-99)=AI.INVOICE_ID
AND XTE.ENTITY_ID               =XE.ENTITY_ID
order by XE.ENTITY_ID ,
  XE.EVENT_NUMBER;

Find AP Invoice data in XLA_AE_HEADERS table:


SELECT DISTINCT XEH.*
FROM XLA_AE_HEADERS XEH ,
  AP_INVOICES_ALL AI ,
  XLA_EVENTS XE ,
  XLA.XLA_TRANSACTION_ENTITIES XTE
WHERE XTE.APPLICATION_ID        =200
AND XEH.APPLICATION_ID          =200
AND XE.APPLICATION_ID           =200
AND XE.ENTITY_ID                =XTE.ENTITY_ID
AND XE.EVENT_ID                 =XEH.EVENT_ID
AND XTE.ENTITY_ID               =XEH.ENTITY_ID
AND AI.INVOICE_ID               ='&Invoice_ID'
AND XTE.LEDGER_ID               =AI.SET_OF_BOOKS_ID
AND XTE.ENTITY_CODE             ='AP_INVOICES'
AND NVL(XTE.SOURCE_ID_INT_1,-99)=AI.INVOICE_ID
order by XEH.EVENT_ID ,
  XEH.AE_HEADER_ID ASC;

Find AP Invoice data in XLA_AE_LINES table:


 select distinct XEL.*
  FROM XLA_AE_LINES XEL ,
  XLA_AE_HEADERS XEH ,
  AP_INVOICES_ALL AI ,
  XLA_EVENTS XE ,
  XLA.XLA_TRANSACTION_ENTITIES XTE
WHERE XTE.APPLICATION_ID        =200
AND XEL.APPLICATION_ID          =200
AND XEH.APPLICATION_ID          =200
AND XE.APPLICATION_ID           =200
AND AI.INVOICE_ID               ='&Invoice_ID'
AND XE.ENTITY_ID                =XTE.ENTITY_ID
AND XE.EVENT_ID                 =XEH.EVENT_ID
AND XEL.AE_HEADER_ID            =XEH.AE_HEADER_ID
AND XTE.ENTITY_CODE             ='AP_INVOICES'
AND NVL(XTE.SOURCE_ID_INT_1,-99)=AI.INVOICE_ID
AND XTE.ENTITY_ID               =XEH.ENTITY_ID
AND XTE.LEDGER_ID               =AI.SET_OF_BOOKS_ID
order by XEL.AE_HEADER_ID ,
  XEL.AE_LINE_NUM ASC;


General Ledger:

Find AP Invoice Data in GL_JE_BATCHES table:

SELECT DISTINCT GJB.*
FROM GL_IMPORT_REFERENCES GIR,
  GL_JE_BATCHES GJB,
  XLA_AE_LINES AEL,
  XLA_AE_HEADERS AEH,
  XLA_EVENTS AEA
WHERE AEA.EVENT_ID IN
  (SELECT AID.ACCOUNTING_EVENT_ID
  FROM AP_INVOICE_DISTRIBUTIONS_ALL AID
  WHERE AID.INVOICE_ID = '&Invoice_ID'
  )
AND AEL.GL_SL_LINK_ID    = GIR.GL_SL_LINK_ID
AND AEL.GL_SL_LINK_TABLE =GIR.GL_SL_LINK_TABLE
AND AEA.APPLICATION_ID   = 200
AND AEH.APPLICATION_ID   = 200
AND AEL.APPLICATION_ID   = 200
AND AEA.EVENT_ID         = AEH.EVENT_ID
AND AEH.AE_HEADER_ID     = AEL.AE_HEADER_ID
AND GJB.JE_BATCH_ID      = GIR.JE_BATCH_ID;

Find AP Invoice data in GL_JE_HEDAERS Table:


SELECT DISTINCT GJH.*
FROM GL_IMPORT_REFERENCES GIR,
  GL_JE_HEADERS GJH,
  XLA_AE_LINES AEL,
  XLA_AE_HEADERS AEH,
  XLA_EVENTS AEA
WHERE AEA.EVENT_ID IN
  (SELECT AID.ACCOUNTING_EVENT_ID
  FROM AP_INVOICE_DISTRIBUTIONS_ALL AID
  WHERE AID.INVOICE_ID = '&Invoice_ID'
  )
AND AEL.GL_SL_LINK_ID    = GIR.GL_SL_LINK_ID
AND AEL.GL_SL_LINK_TABLE =GIR.GL_SL_LINK_TABLE
AND AEA.APPLICATION_ID   = 200
AND AEH.APPLICATION_ID   = 200
AND AEL.APPLICATION_ID   = 200
AND AEA.EVENT_ID         = AEH.EVENT_ID
and AEH.AE_HEADER_ID     = AEL.AE_HEADER_ID
AND GJH.JE_HEADER_ID     = GIR.JE_HEADER_ID;

Find AP Invoice Data in GL_JE_LINES Table:


SELECT DISTINCT GLL.*
FROM GL_IMPORT_REFERENCES GIR,
  GL_JE_LINES GLL,
  XLA_AE_LINES AEL,
  XLA_AE_HEADERS AEH,
  XLA_EVENTS AEA
WHERE AEA.EVENT_ID IN
  (SELECT AID.ACCOUNTING_EVENT_ID
  FROM AP_INVOICE_DISTRIBUTIONS_ALL AID
  WHERE AID.INVOICE_ID = '&Invoice_ID'
  )
AND AEL.GL_SL_LINK_ID    = GIR.GL_SL_LINK_ID
AND AEL.GL_SL_LINK_TABLE =GIR.GL_SL_LINK_TABLE
AND AEA.APPLICATION_ID   = 200
AND AEH.APPLICATION_ID   = 200
AND AEL.APPLICATION_ID   = 200
AND AEA.EVENT_ID         = AEH.EVENT_ID
AND AEH.AE_HEADER_ID     = AEL.AE_HEADER_ID
and GLL.JE_HEADER_ID     = GIR.JE_HEADER_ID
AND GLL.JE_LINE_NUM      = GIR.JE_LINE_NUM;

Find AP Invoice Data in GL_IMPORT_REFERENCES Table:


SELECT DISTINCT GIR.*
FROM GL_IMPORT_REFERENCES GIR,
  XLA_AE_LINES AEL,
  XLA_AE_HEADERS AEH,
  XLA_EVENTS AEA
WHERE AEA.EVENT_ID IN
  (SELECT AID.ACCOUNTING_EVENT_ID
  FROM AP_INVOICE_DISTRIBUTIONS_ALL AID
  WHERE AID.INVOICE_ID = '&Invoice_ID'
  )
AND AEL.GL_SL_LINK_ID    = GIR.GL_SL_LINK_ID
AND AEL.GL_SL_LINK_TABLE =GIR.GL_SL_LINK_TABLE
AND AEA.APPLICATION_ID   = 200
AND AEH.APPLICATION_ID   = 200
AND AEL.APPLICATION_ID   = 200
and AEA.EVENT_ID         = AEH.EVENT_ID
AND AEH.AE_HEADER_ID     = AEL.AE_HEADER_ID;

Find The Account Code Combinations used for a specific AP Invoice:


SELECT DISTINCT GCC.*
FROM GL_CODE_COMBINATIONS GCC
WHERE GCC.CODE_COMBINATION_ID IN
  ( SELECT DISTINCT XEL.CODE_COMBINATION_ID
  FROM XLA_AE_LINES XEL ,
    XLA_AE_HEADERS XEH ,
    AP_INVOICES_ALL AI ,
    XLA.XLA_TRANSACTION_ENTITIES XTE
  WHERE XTE.APPLICATION_ID        =200
  AND XEH.APPLICATION_ID          =200
  AND XEL.APPLICATION_ID          =200
  AND AI.INVOICE_ID               ='1317327'
  AND XEL.AE_HEADER_ID            =XEH.AE_HEADER_ID
  AND XTE.ENTITY_CODE             ='AP_INVOICES'
  AND NVL(XTE.SOURCE_ID_INT_1,-99)=AI.INVOICE_ID
  AND XTE.LEDGER_ID               =AI.SET_OF_BOOKS_ID
  AND XTE.ENTITY_ID               =XEH.ENTITY_ID
  UNION ALL
  SELECT DISTINCT XEL.CODE_COMBINATION_ID
  FROM XLA_AE_LINES XEL ,
    XLA_AE_HEADERS XEH ,
    AP_INVOICE_PAYMENTS_ALL AIP ,
    XLA.XLA_TRANSACTION_ENTITIES XTE
  WHERE XTE.APPLICATION_ID        =200
  AND XEL.APPLICATION_ID          =200
  AND XEH.APPLICATION_ID          =200
  AND AIP.INVOICE_ID              ='1317327'
  AND XEL.AE_HEADER_ID            =XEH.AE_HEADER_ID
  AND XTE.ENTITY_CODE             ='AP_PAYMENTS'
  AND XTE.LEDGER_ID               =AIP.SET_OF_BOOKS_ID
  AND NVL(XTE.SOURCE_ID_INT_1,-99)=AIP.CHECK_ID
  AND XTE.ENTITY_ID               =XEH.ENTITY_ID
  UNION ALL
  SELECT DISTINCT PO.CODE_COMBINATION_ID
  FROM AP_INVOICE_DISTRIBUTIONS_ALL AID ,
    PO_DISTRIBUTIONS_ALL PO
  WHERE AID.INVOICE_ID        ='1317327'
  AND AID.PO_DISTRIBUTION_ID IS NOT NULL
  and PO.PO_DISTRIBUTION_ID   =AID.PO_DISTRIBUTION_ID
  );

Comments

Popular posts from this blog

Create Accounting for a Payment generates errors 95333 and 95359

Create Accounting for a Payment generates errors 95333 and 95359 Error: 95333: A conversion rate does not exist to convert USD to AUD for the conversion type Corporate and conversion date 20-MAR-09 for line -25. Please use the Daily Rates form in General Ledger to enter a conversion rate for these currencies, conversion date and conversion type. 95359: There is no accounted amount for the subledger journal entry line. Please inform your system administrator or support representative that: The source assigned to the accounting attribute Accounted Amount has no value for extract line number 88547. Please make sure the source assigned to the accounting attribute Accounted Amount has a valid value, or assign a different source to this accounting attribute. Solution: 1. Specify a conversion rate for the currencies and conversion date mentioned in the error message 95333 Navigation under the General Ledger responsibility: Setup > Currencies > Currency Rates Manager > Daily Rates ...

Public API’s for FA Transactions

Public API’s for FA Transactions So far Oracle FA is have all the good things except the lack on reporting.Oracle FA is now offer lot of public API's that can be used to interfacing with third party or Oracle application other modules. Here are some of transaction's API's:   Additions API if you have requirement to add assets directly via PL/SQL then use  FA_ADDITION_PUB.DO_ADDITION. If you have selected the Allow CIP Assets check box on the Book Controls window of a tax book when adding CIP assets using the Additions API, the this API automatically adds those CIP assets to that tax book at the same time that they are added to the corporate book. Adjustments API you can make cost adjustments to your assetsdirectly via PL/SQL using  FA_ADJUSTMENT_PUB.DO_ADJUSTMENT  for any  process adjustment. Detail can be found in appendix H) You can use this API if you have a custom interface that makes it difficult to use with the existing Oracle Assets interfaces for adjusti...

AP Table Relation Oracle Apps

AP Table Relation Oracle Apps ORACLE PAYABLE TABLE RELATION Source Table Dependent Table Condition AP_INVOICE_LINES_ALL AIL ZX_LINES_SUMMARY ZLS AIL.invoice_id = ZLS.trx_id and  ZLS.application_id  = 200 and  ZLS.entity_code  = 'AP_INVOICES' and  ZLS.event_class_code  in ('STANDARD INVOICES', 'PREPAYMENT INVOICES', 'EXPENSE REPORTS') and  AIL.summary_tax_line_id = ZLS.summary_tax_line_id AP_INVOICE_LINES_ALL AIL ZX_LINES ZL AIL.invoice_id = ZL.trx_id and  ZL.application_id  = 200 and  ZL.entity_code  = 'AP_INVOICES' and  ZL.event_class_code  in ('STANDARD INVOICES', 'PREPAYMENT INVOICES', 'EXPENSE REPORTS') and  AIL.line_number = ZL.trx_line_number AP_INVOICE_DISTRIBUTIONS_ALL AID ZX_REC_NREC_DIST ZD AID.invoice_id = ZD.trx_id and  ZD.application_id  = 200 and  ZD.entity_code  = 'AP_INVOICES' and  ZD.event_class_code  in ('STANDARD INVOICES', 'PREPAYMENT INVOICES', 'EXPENSE REPORTS') and...