Friday, August 24, 2018

Data Flow from AR to XLA to GL in Oracle APPS

GL tables are linked to Subledger Accounting (XLA tables).

Regarding gl_import_references, there is a one-to-one correspondence between XLA_AE_LINES and GL_IMPORT_REFERENCES.

GL_SL_LINK_ID and GL_SL_LINK_TABLE forms the link between these 2 tables.

Drilldown from GL to AR retrieves information from following tables mainly:

XLA_EVENTS
XLA_AE_HEADERS

The main Receivables Headers tables:

RA_CUSTOMER_TRX_ALL (Transactions)
AR_CASH_RECEIPTS_ALL (Receipts)
AR_ADJUSTMENTS_ALL

The linking between GL and AR is done between following tables mainly:

XLA_TRANSACTION_ENTITIES
XLA_SUBLEDGERS
GL_JE_SOURCES
GL_JE_CATEGORIES
GL_IMPORT_REFERENCES
GL_JE_HEADERS


11i GL_IMPORT_REFERENCES.reference_10
RA_CUST_TRX_LINE_GL_DIST, AR_RECEIVABLE_APPLICATIONS, AR_MISC_CASH_DISTRIBUTIONS

in R12:-
SELECT DISTINCT xdl.source_distribution_type 
                  FROM gl_import_references gir
                      ,xla_ae_lines xal
                      ,xla_ae_headers xah
                      ,xla_events xe
                      ,xla_distribution_links xdl
                 WHERE gir.je_header_id = :p_je_header_id
                   AND gir.je_line_num = :p_je_line_num
                   AND gir.gl_sl_link_id = xal.gl_sl_link_id
                   AND gir.gl_sl_link_table = xal.gl_sl_link_table 
                   AND xal.ae_header_id = xah.ae_header_id
                   AND xah.event_id = xe.event_id
                   AND xah.application_id = xe.application_id
                   AND xah.entity_id = xe.entity_id
                   AND xe.event_id = xdl.event_id 
                   AND xdl.ae_line_num = xal.ae_line_num
                   AND xah.ae_header_id = xdl.ae_header_id
                   AND xal.ae_header_id = xdl.ref_ae_header_id

RA_CUST_TRX_LINE_GL_DIST_ALL, AR_DISTRIBUTIONS_ALL and AR_MISC_CASH_DISTRIBUTIONS_ALL


Below is the Query for AR Invoice (RA_CUST_TRX_LINE_GL_DIST_ALL)
SELECT b.*
                              FROM gl_import_references gir
                                  ,xla_ae_lines xal
                                  ,xla_ae_headers xah
                                  ,xla_events xe
                                  ,xla_distribution_links xdl
                                  ,ra_cust_trx_line_gl_dist_all b
                             WHERE gir.je_header_id = :p_je_header_id
                               AND je_line_num = :p_je_line_num
                               AND gir.gl_sl_link_id = xal.gl_sl_link_id
                               AND gir.gl_sl_link_table = xal.gl_sl_link_table 
                               AND xal.ae_header_id = xah.ae_header_id
                               AND xah.event_id = xe.event_id
                               AND xah.application_id = xe.application_id
                               AND xah.entity_id = xe.entity_id
                               AND xe.event_id = xdl.event_id 
                               AND xdl.ae_line_num = xal.ae_line_num
                               AND xah.ae_header_id = xdl.ae_header_id
                               AND xal.ae_header_id = xdl.ref_ae_header_id

                               AND xdl.source_distribution_id_num_1 = b.cust_trx_line_gl_dist_id 

Below is the Query in case of AR_DISTRIBUTIONS_ALL
SELECT ada.*
                              FROM gl_import_references gir
                                  ,xla_ae_lines xal
                                  ,xla_ae_headers xah
                                  ,xla_events xe
                                  ,xla_distribution_links xdl
                                  ,ar_distributions_all ada
                                  ,ar_receivable_applications_all araa
                             WHERE gir.je_header_id =:p_je_header_id
                               AND gir.je_line_num = :p_je_line_num
                               AND gir.gl_sl_link_id = xal.gl_sl_link_id
                               AND gir.gl_sl_link_table = xal.gl_sl_link_table 
                               AND xal.ae_header_id = xah.ae_header_id
                               AND xah.event_id = xe.event_id
                               AND xah.application_id = xe.application_id
                               AND xah.entity_id = xe.entity_id
                               AND xe.event_id = xdl.event_id 
                               AND xdl.ae_line_num = xal.ae_line_num
                               AND xah.ae_header_id = xdl.ae_header_id
                               AND xdl.source_distribution_type = 'AR_DISTRIBUTIONS_ALL' 
                               AND xdl.source_distribution_id_num_1 = ada.line_id

                               AND ada.source_id = araa.receivable_application_id

Below is the Query in Case of AR_MISC_CASH_DISTRIBUTIONS_ALL
 SELECT msd.* 
                              FROM gl_import_references gir
                                  ,xla_ae_lines xal
                                  ,xla_ae_headers xah
                                  ,xla_distribution_links xdl
                                  ,ar_misc_cash_distributions_all msd
                                  ,ar_distributions_all dist
                                  ,ar_cash_receipts_all acr
                                  ,ar_receivables_trx_all art
                             where gir.je_header_id = :p_je_header_id
                               AND gir.je_line_num = :p_je_line_num
                               AND gir.gl_sl_link_id = xal.gl_sl_link_id
                               AND xah.ae_header_id = xal.ae_header_id
                               AND xdl.source_distribution_type = 'AR_DISTRIBUTIONS_ALL'
                               AND xdl.event_id = xah.event_id
                               AND xah.ae_header_id = xdl.ae_header_id
                               AND msd.event_id = xah.event_id
                               AND msd.misc_cash_distribution_id = dist.source_id
                               --AND dist.source_type = 'MISCCASH'
                               AND acr.cash_receipt_id = msd.cash_receipt_id
                               AND acr.type = 'MISC'

                               AND art.receivables_trx_id = acr.receivables_trx_id 

No comments:

Post a Comment

Query To Fetch AP Invoice Details From SO Number(Doc ID 2949013.1)

SELECT dh.source_order_number       ,df.source_line_number as so_line_number   ,df.fulfill_line_number    ,ddr.doc_user_key as po_number...