Monday, 29 January 2018

Reconciliation of AP and GL in Oracle Apps R12


Reconciliation of  AP and GL in Oracle Apps R12


In Friends , in this post I will share you the SQL queries by which you can easily reconcile from AP and GL in Oracle Apps R12.




Step1:- First you need to run this below query from Oracle Apps DB for your AP Liability accounts.In this example I am doing reconciliation of my AP Liability Natural account 24103390 and you can select any dates of the month for which you want to do reconciliation.


select JE_SOURCE,sum(nvl(accounted_dr,0))-sum(nvl(accounted_cr,0)) Balanace from gl_je_headers a1,gl_je_lines a2,gl_code_combinations gcc
 where a1.JE_HEADER_ID=a2.JE_HEADER_ID
 and a2.CODE_COMBINATION_ID=gcc.CODE_COMBINATION_ID
 and gcc.segment5=24103390
 and effective_date between :p_from_date and :p_to_date
 and A2.status='P'
 GROUP BY JE_SOURCE

This above query will give you the source from which your data is coming in GL. You have to put Manual Invoice amount separate in the sheet to do the reco between AP and GL because manual entry will not come in AP and this entry is directly entered in GL so when you will do the reco you will always get a difference of that manual entry value but by this query you will know this difference.


Step2:- Now that you need to run this query with Account wise and put that in Excel.

select JE_SOURCE,GCC.CONCATENATED_SEGMENTS,sum(nvl(accounted_dr,0))-sum(nvl(accounted_cr,0)) Balanace from gl_je_headers a1,gl_je_lines a2,gl_code_combinations_kfv gcc
 where a1.JE_HEADER_ID=a2.JE_HEADER_ID
 and a2.CODE_COMBINATION_ID=gcc.CODE_COMBINATION_ID
 and gcc.segment5=24103390
 and effective_date between :p_from_date and :p_to_date
 and A2.status='P'
 GROUP BY JE_SOURCE,GCC.CONCATENATED_SEGMENTS



Step3:- Now run this query which will fetch the Payables/AP data for you Liability accounts.In this example I am doing reconciliation of my AP Liability Natural account 24103390 and you can select any dates of the month for which you want to do reconciliation.

 select CONCATENATED_SEGMENTS,sum(T_LEDGER_dr)-sum(T_LEDGER_Cr) bal from (
 SELECT
CASE WHEN
        XAL.PARTY_ID = (SELECT MAX(DUPLICATE_VENDOR_ID) FROM AP_DUPLICATE_VENDORS_ALL WHERE DUPLICATE_VENDOR_ID = XAL.PARTY_ID) THEN
        (SELECT MAX(VENDOR_ID) FROM AP_DUPLICATE_VENDORS_ALL WHERE DUPLICATE_VENDOR_ID = XAL.PARTY_ID)
        ELSE XAL.PARTY_ID
        END PARTY_ID,
        NVL(CASE WHEN
        XAL.PARTY_SITE_ID = (SELECT MAX(DUPLICATE_VENDOR_SITE_ID) FROM AP_DUPLICATE_VENDORS_ALL WHERE DUPLICATE_VENDOR_ID = XAL.PARTY_ID AND DUPLICATE_VENDOR_SITE_ID = XAL.PARTY_SITE_ID) THEN
        (SELECT MAX(VENDOR_SITE_ID) FROM AP_DUPLICATE_VENDORS_ALL WHERE DUPLICATE_VENDOR_ID = XAL.PARTY_ID AND DUPLICATE_VENDOR_SITE_ID = XAL.PARTY_SITE_ID)
        ELSE XAL.PARTY_SITE_ID
        END,XAL.PARTY_SITE_ID) PARTY_SITE_ID,
 GCC.CONCATENATED_SEGMENTS,GCC.CODE_COMBINATION_ID,
 0 O_LEDGER_CR,0 O_LEDGER_DR,
 NVL(XAL.ACCOUNTED_CR,0) T_LEDGER_CR,
 NVL(XAL.ACCOUNTED_DR,0) T_LEDGER_DR
 FROM
 XLA.XLA_TRANSACTION_ENTITIES XTE,
 XLA.XLA_AE_HEADERS XAH,
 XLA.XLA_AE_LINES XAL,
 GL_CODE_COMBINATIONS_KFV GCC
 WHERE 1 = 1
 AND :P_APPLICATION_ID=200
 AND XAL.APPLICATION_ID=200
 AND XTE.LEDGER_ID = XAH.LEDGER_ID
 AND XTE.ENTITY_ID = XAH.ENTITY_ID
 AND XTE.APPLICATION_ID = XAL.APPLICATION_ID
 AND XAH.AE_HEADER_ID = XAL.AE_HEADER_ID
 AND XAL.GL_SL_LINK_TABLE = 'XLAJEL'
 AND ACCOUNTING_CLASS_CODE IN ('LIABILITY','PREPAID_EXPENSE')
 AND XAL.CODE_COMBINATION_ID = GCC.CODE_COMBINATION_ID
 and xal.CODE_COMBINATION_ID in  (SELECT CODE_COMBINATION_ID FROM GL_CODE_COMBINATIONS
 WHERE 1=1
 AND SEGMENT5=24103390)
-- AND XAL.PARTY_ID=&VENDOR_ID
 AND NVL(XAL.GL_TRANSFER_MODE_CODE,'N')='S'
 AND TRUNC(XAL.ACCOUNTING_DATE) >= :FROM_DATE
 AND TRUNC(XAL.ACCOUNTING_DATE) <= :TO_DATE
 AND SECURITY_ID_INT_1=:P_ORG_ID)
 group by CONCATENATED_SEGMENTS


Step4:- Now match the accounts fetched with Step 2 and 3 and find the difference.




If you want to see Other OAF Related Posts , Please visit Below URL.
https://rpforacle.blogspot.in/2013/03/oaf_10.html

If you want to see  Oracle Fusion Related Posts , Please visit Below URL.
https://rpforacle.blogspot.in/2018/01/oracle-fusion-learning-tutorial.html
If you want to Learn Oracle Workflow Builder, Please visit Below URL.
https://rpforacle.blogspot.in/2018/01/oracle-workflow-learning-tutorial-1.html




 

0 comments:

Post a Comment