Showing posts with label SQL QUERIES. Show all posts
Showing posts with label SQL QUERIES. Show all posts

Monday, 29 January 2018

Reconciliation of AP and GL in Oracle Apps R12

Reconciliation of  AP and GL in Oracle Apps R12

In this post , We will be discussed about Reconciliation of  AP and GL in Oracle Apps R12. We will be discuss about reconciliation method uses in oracle apps r12 to reconcile the ap and gl. We will go step by step for the Reconciliation of  AP and GL in Oracle Apps R12. In AP and GL reconciliation , we do reconcile the liability accounts balances between the ap and gl. Here below is the detail explanation about 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.

Steps for the Reconciliation of  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 Learn Oracle Fusion , Please Follow the Oracle Fusion Tutorial


Reconciliation of  AP and GL in Oracle Apps R12

Thursday, 25 January 2018

Workflow Customization : How to restrict PO approval Notification to send to some specific Employees in the Position Hierarchy.



Workflow Customization : How to restrict PO approval Notification to send to some specific Employees in the Position Hierarchy.


Step1:- Open the PO approval workflow in workflow builder and then open Find Approver Process as below.






Step2:- Go to Get First Manager Approval Hierarchy Function in the process.



Step3:- Copy the name of PLSQL function
PO_REQAPPROVAL_FINDAPPRV1.GETMGR_PO_HIER


 
 
Step4:- Go to this package in Database and open it.
 
Step5:- In this package go to function as below
 

FUNCTION GetMgrHRHier(itemtype VARCHAR2, itemkey VARCHAR2)
 

Step6:- You can see below here in this function , workflow is setting the value of Next approver.
 
 
 
 
 
if you found this post helpful and you liked it then follow this blog to get notifications for the upcoming posts.
 
Step7:-  These are two below cursors are using to set the next approver. You just to put Not in condition in their where conditions with that employee Id's for which you don't want to sent approval Notification.
 
 

CURSOR c1 (p_empid NUMBER, p_business_group_id NUMBER) IS

SELECT pafe.supervisor_id

FROM   Per_All_Assignments_f pafe,  -- <BUG 6615913>

       Per_All_People_f ppfs,       -- <BUG 6615913>

       Per_All_Assignments_f pafs,  -- <BUG 6615913>

       per_person_types_v ppts,

       per_person_type_usages_f pptu

WHERE  pafe.business_group_id = p_business_group_id

       AND pafe.person_id = p_empid

       AND Trunc(SYSDATE) BETWEEN pafe.Effective_Start_Date

                              AND pafe.Effective_End_Date

       AND pafe.Primary_Flag = 'Y'

       AND pafe.Assignment_Type IN ('E','C')

       AND ppfs.Person_Id = pafe.Supervisor_Id

       AND Trunc(SYSDATE) BETWEEN ppfs.Effective_Start_Date

                              AND ppfs.Effective_End_Date

       AND pafs.Person_Id = ppfs.Person_Id

       AND Trunc(SYSDATE) BETWEEN pafs.Effective_Start_Date

                              AND pafs.Effective_End_Date

       AND pafs.Primary_Flag = 'Y'

       AND pafs.Assignment_Type IN ('E','C')

       AND pptu.Person_Id = ppfs.Person_Id

       AND ppts.person_type_id = pptu.person_type_id
       AND ppts.System_Person_Type IN ('EMP','EMP_APL','CWK');  


Tuesday, 23 January 2018

Part2: PO Workflow Customization to send Workflow Notification to Buyer Supervisor in Oracle Apps.



In this post I will share pending steps Part2: PO Workflow Customization to send Workflow Notification to Buyer Supervisor in Oracle Apps.

For part 1 of this topic please go through this below url.

http://rpforacle.blogspot.in/2018/01/part1-po-workflow-customization-to-send-notifications-to-buyer-supervisor.html

Step10 :-  Give the values for Notification function as below  


Step11:- Now Click on Node Tab of the same Notification functions as below.

select performer as below.
 
 
Step 12:- Now again Right click on the process window and click on New Function as below.
 
 
if you found this post helpful and you liked it then follow this blog to get notifications for the upcoming posts.
Step13:- Create end function as below and give values as below.




Step14:- You Process will be designed as below. After that you need to bounce workflow builder and you can test the changes in Your Development Instance.




Please share your thoughts and comments on that.



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

Monday, 22 January 2018

Oracle APPS R12 Creditor Ageing SQL query


Oracle APPS R12 Creditor Ageing SQL query


select  v.vendor_id,hp.party_name,vs.VENDOR_SITE_CODE,VENDOR_TYPE_LOOKUP_CODE,
(select SUM(case when sign(amount_remaining)=-1 then (-1*amount_remaining)-amount_applied else amount_remaining-amount_applied end) net_bal from (
select  v.vendor_id,hp.party_name,i.INVOICE_AMOUNT,i.INVOICE_NUM,i.invoice_id,I.INVOICE_DATE,i.gl_date,I.INVOICE_TYPE_LOOKUP_CODE,vs.VENDOR_SITE_CODE,VENDOR_TYPE_LOOKUP_CODE,ps.amount_remaining,
case when invoIce_type_lookup_code='PREPAYMENT' THEN i.INVOICE_AMOUNT-nvl((SELECT
  sum((-1)*(ail.amount - NVL(ail.included_tax_amount,0)))
  FROM   AP_INVOICES_ALL ai,AP_INVOICES_ALL ai2,
  AP_INVOICE_LINES_ALL ail,
  AP_SUPPLIERS pv
  WHERE ai.invoice_id = ail.invoice_id
  AND  ai2.invoice_id= ail.prepay_invoice_id
  AND   ail.amount< 0
  AND   NVL(ail.discarded_flag,'N') <> 'Y'
  AND   ail.line_type_lookup_code= 'PREPAY'
  AND   ai.vendor_id = pv.vendor_id
  AND   ai.invoice_type_lookup_code NOT IN ('PREPAYMENT', 'CREDIT','DEBIT')
  AND   ai2.invoice_id =i.INVOICE_ID),0) ELSE 0 END amount_applied
FROM    ap_payment_schedules_ALL ps,
        ap_invoices_ALL i,
        hz_parties hp,
        ap_suppliers v,
        po_vendor_sites_all vs
WHERE   i.invoice_id = ps.invoice_id
AND  i.invoice_id  NOT IN  (62575)
AND     i.party_id = hp.party_id
AND    hp.party_id = v.party_id (+)
AND     i.vendor_site_id = vs.vendor_site_id (+)
AND     i.vendor_site_id=nvl(:p_site_id, i.vendor_site_id)
AND     i.cancelled_date IS NULL
and  APPS.AP_INVOICES_PKG.GET_APPROVAL_STATUS
           (
            I.INVOICE_ID
           ,I.INVOICE_AMOUNT
           ,I.PAYMENT_STATUS_FLAG
           ,I.INVOICE_TYPE_LOOKUP_CODE
           ) <>'NEVER APPROVED'
--AND     (nvl(ps.amount_remaining, 0) * nvl(i.exchange_rate,1))  != 0
--AND     i.payment_status_flag in ('N','P')
AND    ( (i.INVOICE_TYPE_LOOKUP_CODE<>'PREPAYMENT' and i.payment_status_flag in ('N','P')) or (i.INVOICE_TYPE_LOOKUP_CODE='PREPAYMENT' and i.payment_status_flag='Y' ))
--and      v.VENDOR_TYPE_LOOKUP_CODE=nvl(:P_VENDOR_TYPE_LOOKUP_CODE,v.VENDOR_TYPE_LOOKUP_CODE)
and nvl(v.VENDOR_TYPE_LOOKUP_CODE, 'X')=nvl(:P_VENDOR_TYPE_LOOKUP_CODE,nvl(v.VENDOR_TYPE_LOOKUP_CODE, 'X'))
--&P_ORDER_BY, I.GL_DATE
order by I.GL_DATE,i.INVOICE_NUM)
where vendor_id=v.vendor_id
and to_date(gl_date) between to_date(trunc(sysdate)-30) and to_date(trunc(sysdate))) ONE,
-----------------------ONE---------------
(select SUM(case when sign(amount_remaining)=-1 then (-1*amount_remaining)-amount_applied else amount_remaining-amount_applied end) net_bal from (
select  v.vendor_id,hp.party_name,i.INVOICE_AMOUNT,i.INVOICE_NUM,i.invoice_id,I.INVOICE_DATE,i.gl_date,I.INVOICE_TYPE_LOOKUP_CODE,vs.VENDOR_SITE_CODE,VENDOR_TYPE_LOOKUP_CODE,ps.amount_remaining,
case when invoIce_type_lookup_code='PREPAYMENT' THEN i.INVOICE_AMOUNT-nvl((SELECT
  sum((-1)*(ail.amount - NVL(ail.included_tax_amount,0)))
  FROM   AP_INVOICES_ALL ai,AP_INVOICES_ALL ai2,
  AP_INVOICE_LINES_ALL ail,
  AP_SUPPLIERS pv
  WHERE ai.invoice_id = ail.invoice_id
  AND  ai2.invoice_id= ail.prepay_invoice_id
  AND   ail.amount< 0
  AND   NVL(ail.discarded_flag,'N') <> 'Y'
  AND   ail.line_type_lookup_code= 'PREPAY'
  AND   ai.vendor_id = pv.vendor_id
  AND   ai.invoice_type_lookup_code NOT IN ('PREPAYMENT', 'CREDIT','DEBIT')
  AND   ai2.invoice_id =i.INVOICE_ID),0) ELSE 0 END amount_applied
FROM    ap_payment_schedules_ALL ps,
        ap_invoices_ALL i,
        hz_parties hp,
        ap_suppliers v,
        po_vendor_sites_all vs
WHERE   i.invoice_id = ps.invoice_id
AND     i.party_id = hp.party_id
AND    hp.party_id = v.party_id (+)
AND     i.vendor_site_id = vs.vendor_site_id (+)
AND     i.vendor_site_id=nvl(:p_site_id, i.vendor_site_id)
AND     i.cancelled_date IS NULL
and  APPS.AP_INVOICES_PKG.GET_APPROVAL_STATUS
           (
            I.INVOICE_ID
           ,I.INVOICE_AMOUNT
           ,I.PAYMENT_STATUS_FLAG
           ,I.INVOICE_TYPE_LOOKUP_CODE
           ) <>'NEVER APPROVED'
AND    ( (i.INVOICE_TYPE_LOOKUP_CODE<>'PREPAYMENT' and i.payment_status_flag in ('N','P')) or (i.INVOICE_TYPE_LOOKUP_CODE='PREPAYMENT' and i.payment_status_flag='Y' ))
--and      v.VENDOR_TYPE_LOOKUP_CODE=nvl(:P_VENDOR_TYPE_LOOKUP_CODE,v.VENDOR_TYPE_LOOKUP_CODE)
and nvl(v.VENDOR_TYPE_LOOKUP_CODE, 'X')=nvl(:P_VENDOR_TYPE_LOOKUP_CODE,nvl(v.VENDOR_TYPE_LOOKUP_CODE, 'X'))
--&P_ORDER_BY, I.GL_DATE
order by I.GL_DATE,i.INVOICE_NUM)
where vendor_id=v.vendor_id
and to_date(gl_date) between to_date(trunc(sysdate)-45) and to_date(trunc(sysdate-31))) TWO,
------------------------------------------TWO-------------------------------
(select SUM(case when sign(amount_remaining)=-1 then (-1*amount_remaining)-amount_applied else amount_remaining-amount_applied end) net_bal from (
select  v.vendor_id,hp.party_name,i.INVOICE_AMOUNT,i.INVOICE_NUM,i.invoice_id,I.INVOICE_DATE,i.gl_date,I.INVOICE_TYPE_LOOKUP_CODE,vs.VENDOR_SITE_CODE,VENDOR_TYPE_LOOKUP_CODE,ps.amount_remaining,
case when invoIce_type_lookup_code='PREPAYMENT' THEN i.INVOICE_AMOUNT-nvl((SELECT
  sum((-1)*(ail.amount - NVL(ail.included_tax_amount,0)))
  FROM   AP_INVOICES_ALL ai,AP_INVOICES_ALL ai2,
  AP_INVOICE_LINES_ALL ail,
  AP_SUPPLIERS pv
  WHERE ai.invoice_id = ail.invoice_id
  AND  ai2.invoice_id= ail.prepay_invoice_id
  AND   ail.amount< 0
  AND   NVL(ail.discarded_flag,'N') <> 'Y'
  AND   ail.line_type_lookup_code= 'PREPAY'
  AND   ai.vendor_id = pv.vendor_id
  AND   ai.invoice_type_lookup_code NOT IN ('PREPAYMENT', 'CREDIT','DEBIT')
  AND   ai2.invoice_id =i.INVOICE_ID),0) ELSE 0 END amount_applied
FROM    ap_payment_schedules_ALL ps,
        ap_invoices_ALL i,
        hz_parties hp,
        ap_suppliers v,
        po_vendor_sites_all vs
WHERE   i.invoice_id = ps.invoice_id
AND  i.invoice_id  NOT IN  (62575)
AND     i.party_id = hp.party_id
AND    hp.party_id = v.party_id (+)
AND     i.vendor_site_id = vs.vendor_site_id (+)
AND     i.vendor_site_id=nvl(:p_site_id, i.vendor_site_id)
AND     i.cancelled_date IS NULL
and  APPS.AP_INVOICES_PKG.GET_APPROVAL_STATUS
           (
            I.INVOICE_ID
           ,I.INVOICE_AMOUNT
           ,I.PAYMENT_STATUS_FLAG
           ,I.INVOICE_TYPE_LOOKUP_CODE
           ) <>'NEVER APPROVED'
AND    ( (i.INVOICE_TYPE_LOOKUP_CODE<>'PREPAYMENT' and i.payment_status_flag in ('N','P')) or (i.INVOICE_TYPE_LOOKUP_CODE='PREPAYMENT' and i.payment_status_flag='Y' ))
--and      v.VENDOR_TYPE_LOOKUP_CODE=nvl(:P_VENDOR_TYPE_LOOKUP_CODE,v.VENDOR_TYPE_LOOKUP_CODE)
and nvl(v.VENDOR_TYPE_LOOKUP_CODE, 'X')=nvl(:P_VENDOR_TYPE_LOOKUP_CODE,nvl(v.VENDOR_TYPE_LOOKUP_CODE, 'X'))
--&P_ORDER_BY, I.GL_DATE
order by I.GL_DATE,i.INVOICE_NUM)
where vendor_id=v.vendor_id
and to_date(gl_date) between to_date(trunc(sysdate)-60) and to_date(trunc(sysdate-46))) THREE,
------------------------------------------------THREE'-------------------------------------
(select SUM(case when sign(amount_remaining)=-1 then (-1*amount_remaining)-amount_applied else amount_remaining-amount_applied end) net_bal from (
select  v.vendor_id,hp.party_name,i.INVOICE_AMOUNT,i.INVOICE_NUM,i.invoice_id,I.INVOICE_DATE,i.gl_date,I.INVOICE_TYPE_LOOKUP_CODE,vs.VENDOR_SITE_CODE,VENDOR_TYPE_LOOKUP_CODE,ps.amount_remaining,
case when invoIce_type_lookup_code='PREPAYMENT' THEN i.INVOICE_AMOUNT-nvl((SELECT
  sum((-1)*(ail.amount - NVL(ail.included_tax_amount,0)))
  FROM   AP_INVOICES_ALL ai,AP_INVOICES_ALL ai2,
  AP_INVOICE_LINES_ALL ail,
  AP_SUPPLIERS pv
  WHERE ai.invoice_id = ail.invoice_id
  AND  ai2.invoice_id= ail.prepay_invoice_id
  AND   ail.amount< 0
  AND   NVL(ail.discarded_flag,'N') <> 'Y'
  AND   ail.line_type_lookup_code= 'PREPAY'
  AND   ai.vendor_id = pv.vendor_id
  AND   ai.invoice_type_lookup_code NOT IN ('PREPAYMENT', 'CREDIT','DEBIT')
  AND   ai2.invoice_id =i.INVOICE_ID),0) ELSE 0 END amount_applied
FROM    ap_payment_schedules_ALL ps,
        ap_invoices_ALL i,
        hz_parties hp,
        ap_suppliers v,
        po_vendor_sites_all vs
WHERE   i.invoice_id = ps.invoice_id
AND     i.party_id = hp.party_id
AND    hp.party_id = v.party_id (+)
AND     i.vendor_site_id = vs.vendor_site_id (+)
AND     i.vendor_site_id=nvl(:p_site_id, i.vendor_site_id)
AND     i.cancelled_date IS NULL
and  APPS.AP_INVOICES_PKG.GET_APPROVAL_STATUS
           (
            I.INVOICE_ID
           ,I.INVOICE_AMOUNT
           ,I.PAYMENT_STATUS_FLAG
           ,I.INVOICE_TYPE_LOOKUP_CODE
           ) <>'NEVER APPROVED'
--AND     (nvl(ps.amount_remaining, 0) * nvl(i.exchange_rate,1))  != 0
--AND     i.payment_status_flag in ('N','P')
AND    ( (i.INVOICE_TYPE_LOOKUP_CODE<>'PREPAYMENT' and i.payment_status_flag in ('N','P')) or (i.INVOICE_TYPE_LOOKUP_CODE='PREPAYMENT' and i.payment_status_flag='Y' ))
--and      v.VENDOR_TYPE_LOOKUP_CODE=nvl(:P_VENDOR_TYPE_LOOKUP_CODE,v.VENDOR_TYPE_LOOKUP_CODE)
and nvl(v.VENDOR_TYPE_LOOKUP_CODE, 'X')=nvl(:P_VENDOR_TYPE_LOOKUP_CODE,nvl(v.VENDOR_TYPE_LOOKUP_CODE, 'X'))
--&P_ORDER_BY, I.GL_DATE
order by I.GL_DATE,i.INVOICE_NUM)
where vendor_id=v.vendor_id
and to_date(gl_date) between to_date(trunc(sysdate)-90) and to_date(trunc(sysdate-61))) FOUR,
--------------------------------------FOUR-------------------------------
(select SUM(case when sign(amount_remaining)=-1 then (-1*amount_remaining)-amount_applied else amount_remaining-amount_applied end) net_bal from (
select  v.vendor_id,hp.party_name,i.INVOICE_AMOUNT,i.INVOICE_NUM,i.invoice_id,I.INVOICE_DATE,i.gl_date,I.INVOICE_TYPE_LOOKUP_CODE,vs.VENDOR_SITE_CODE,VENDOR_TYPE_LOOKUP_CODE,ps.amount_remaining,
case when invoIce_type_lookup_code='PREPAYMENT' THEN i.INVOICE_AMOUNT-nvl((SELECT
  sum((-1)*(ail.amount - NVL(ail.included_tax_amount,0)))
  FROM   AP_INVOICES_ALL ai,AP_INVOICES_ALL ai2,
  AP_INVOICE_LINES_ALL ail,
  AP_SUPPLIERS pv
  WHERE ai.invoice_id = ail.invoice_id
  AND  ai2.invoice_id= ail.prepay_invoice_id
  AND   ail.amount< 0
  AND   NVL(ail.discarded_flag,'N') <> 'Y'
  AND   ail.line_type_lookup_code= 'PREPAY'
  AND   ai.vendor_id = pv.vendor_id
  AND   ai.invoice_type_lookup_code NOT IN ('PREPAYMENT', 'CREDIT','DEBIT')
  AND   ai2.invoice_id =i.INVOICE_ID),0) ELSE 0 END amount_applied
FROM    ap_payment_schedules_ALL ps,
        ap_invoices_ALL i,
        hz_parties hp,
        ap_suppliers v,
        po_vendor_sites_all vs
WHERE   i.invoice_id = ps.invoice_id
AND     i.party_id = hp.party_id
AND    hp.party_id = v.party_id (+)
AND     i.vendor_site_id = vs.vendor_site_id (+)
AND     i.vendor_site_id=nvl(:p_site_id, i.vendor_site_id)
AND     i.cancelled_date IS NULL
and  APPS.AP_INVOICES_PKG.GET_APPROVAL_STATUS
           (
            I.INVOICE_ID
           ,I.INVOICE_AMOUNT
           ,I.PAYMENT_STATUS_FLAG
           ,I.INVOICE_TYPE_LOOKUP_CODE
           ) <>'NEVER APPROVED'
AND    ( (i.INVOICE_TYPE_LOOKUP_CODE<>'PREPAYMENT' and i.payment_status_flag in ('N','P')) or (i.INVOICE_TYPE_LOOKUP_CODE='PREPAYMENT' and i.payment_status_flag='Y' ))
--and      v.VENDOR_TYPE_LOOKUP_CODE=nvl(:P_VENDOR_TYPE_LOOKUP_CODE,v.VENDOR_TYPE_LOOKUP_CODE)
and nvl(v.VENDOR_TYPE_LOOKUP_CODE, 'X')=nvl(:P_VENDOR_TYPE_LOOKUP_CODE,nvl(v.VENDOR_TYPE_LOOKUP_CODE, 'X'))
--&P_ORDER_BY, I.GL_DATE
order by I.GL_DATE,i.INVOICE_NUM)
where vendor_id=v.vendor_id
and to_date(gl_date) between to_date(trunc(sysdate)-120) and to_date(trunc(sysdate-91)))  FIVE,
---------------------------FIVE---------------------------------
(select SUM(case when sign(amount_remaining)=-1 then (-1*amount_remaining)-amount_applied else amount_remaining-amount_applied end) net_bal from (
select  v.vendor_id,hp.party_name,i.INVOICE_AMOUNT,i.INVOICE_NUM,i.invoice_id,I.INVOICE_DATE,i.gl_date,I.INVOICE_TYPE_LOOKUP_CODE,vs.VENDOR_SITE_CODE,VENDOR_TYPE_LOOKUP_CODE,ps.amount_remaining,
case when invoIce_type_lookup_code='PREPAYMENT' THEN i.INVOICE_AMOUNT-nvl((SELECT
  sum((-1)*(ail.amount - NVL(ail.included_tax_amount,0)))
  FROM   AP_INVOICES_ALL ai,AP_INVOICES_ALL ai2,
  AP_INVOICE_LINES_ALL ail,
  AP_SUPPLIERS pv
  WHERE ai.invoice_id = ail.invoice_id
  AND  ai2.invoice_id= ail.prepay_invoice_id
  AND   ail.amount< 0
  AND   NVL(ail.discarded_flag,'N') <> 'Y'
  AND   ail.line_type_lookup_code= 'PREPAY'
  AND   ai.vendor_id = pv.vendor_id
  AND   ai.invoice_type_lookup_code NOT IN ('PREPAYMENT', 'CREDIT','DEBIT')
  AND   ai2.invoice_id =i.INVOICE_ID),0) ELSE 0 END amount_applied
FROM    ap_payment_schedules_ALL ps,
        ap_invoices_ALL i,
        hz_parties hp,
        ap_suppliers v,
        po_vendor_sites_all vs
WHERE   i.invoice_id = ps.invoice_id
AND     i.party_id = hp.party_id
AND    hp.party_id = v.party_id (+)
AND     i.vendor_site_id = vs.vendor_site_id (+)
AND     i.vendor_site_id=nvl(:p_site_id, i.vendor_site_id)
AND     i.cancelled_date IS NULL
and  APPS.AP_INVOICES_PKG.GET_APPROVAL_STATUS
           (
            I.INVOICE_ID
           ,I.INVOICE_AMOUNT
           ,I.PAYMENT_STATUS_FLAG
           ,I.INVOICE_TYPE_LOOKUP_CODE
           ) <>'NEVER APPROVED'
AND    ( (i.INVOICE_TYPE_LOOKUP_CODE<>'PREPAYMENT' and i.payment_status_flag in ('N','P')) or (i.INVOICE_TYPE_LOOKUP_CODE='PREPAYMENT' and i.payment_status_flag='Y' ))
--and      v.VENDOR_TYPE_LOOKUP_CODE=nvl(:P_VENDOR_TYPE_LOOKUP_CODE,v.VENDOR_TYPE_LOOKUP_CODE)
and nvl(v.VENDOR_TYPE_LOOKUP_CODE, 'X')=nvl(:P_VENDOR_TYPE_LOOKUP_CODE,nvl(v.VENDOR_TYPE_LOOKUP_CODE, 'X'))
--&P_ORDER_BY, I.GL_DATE
order by I.GL_DATE,i.INVOICE_NUM)
where vendor_id=v.vendor_id
and to_date(gl_date) between to_date(trunc(sysdate)-180) and to_date(trunc(sysdate-121))) SIX,
------------------------SIX----------------------
(select SUM(case when sign(amount_remaining)=-1 then (-1*amount_remaining)-amount_applied else amount_remaining-amount_applied end) net_bal from (
select  v.vendor_id,hp.party_name,i.INVOICE_AMOUNT,i.INVOICE_NUM,i.invoice_id,I.INVOICE_DATE,i.gl_date,I.INVOICE_TYPE_LOOKUP_CODE,vs.VENDOR_SITE_CODE,VENDOR_TYPE_LOOKUP_CODE,ps.amount_remaining,
case when invoIce_type_lookup_code='PREPAYMENT' THEN i.INVOICE_AMOUNT-nvl((SELECT
  sum((-1)*(ail.amount - NVL(ail.included_tax_amount,0)))
  FROM   AP_INVOICES_ALL ai,AP_INVOICES_ALL ai2,
  AP_INVOICE_LINES_ALL ail,
  AP_SUPPLIERS pv
  WHERE ai.invoice_id = ail.invoice_id
  AND  ai2.invoice_id= ail.prepay_invoice_id
  AND   ail.amount< 0
  AND   NVL(ail.discarded_flag,'N') <> 'Y'
  AND   ail.line_type_lookup_code= 'PREPAY'
  AND   ai.vendor_id = pv.vendor_id
  AND   ai.invoice_type_lookup_code NOT IN ('PREPAYMENT', 'CREDIT','DEBIT')
  AND   ai2.invoice_id =i.INVOICE_ID),0) ELSE 0 END amount_applied
FROM    ap_payment_schedules_ALL ps,
        ap_invoices_ALL i,
        hz_parties hp,
        ap_suppliers v,
        po_vendor_sites_all vs
WHERE   i.invoice_id = ps.invoice_id
AND     i.party_id = hp.party_id
AND    hp.party_id = v.party_id (+)
AND     i.vendor_site_id = vs.vendor_site_id (+)
AND     i.vendor_site_id=nvl(:p_site_id, i.vendor_site_id)
AND     i.cancelled_date IS NULL
and  APPS.AP_INVOICES_PKG.GET_APPROVAL_STATUS
           (
            I.INVOICE_ID
           ,I.INVOICE_AMOUNT
           ,I.PAYMENT_STATUS_FLAG
           ,I.INVOICE_TYPE_LOOKUP_CODE
           ) <>'NEVER APPROVED'
AND    ( (i.INVOICE_TYPE_LOOKUP_CODE<>'PREPAYMENT' and i.payment_status_flag in ('N','P')) or (i.INVOICE_TYPE_LOOKUP_CODE='PREPAYMENT' and i.payment_status_flag='Y' ))
--and      v.VENDOR_TYPE_LOOKUP_CODE=nvl(:P_VENDOR_TYPE_LOOKUP_CODE,v.VENDOR_TYPE_LOOKUP_CODE)
and nvl(v.VENDOR_TYPE_LOOKUP_CODE, 'X')=nvl(:P_VENDOR_TYPE_LOOKUP_CODE,nvl(v.VENDOR_TYPE_LOOKUP_CODE, 'X'))
--&P_ORDER_BY, I.GL_DATE
order by I.GL_DATE,i.INVOICE_NUM)
where vendor_id=v.vendor_id
and to_date(gl_date) between to_date(trunc(sysdate)-365) and to_date(trunc(sysdate-181))) SEVEN,
------------SEVEV----------------
(select SUM(case when sign(amount_remaining)=-1 then (-1*amount_remaining)-amount_applied else amount_remaining-amount_applied end) net_bal from (
select  v.vendor_id,hp.party_name,i.INVOICE_AMOUNT,i.INVOICE_NUM,i.invoice_id,I.INVOICE_DATE,i.gl_date,I.INVOICE_TYPE_LOOKUP_CODE,vs.VENDOR_SITE_CODE,VENDOR_TYPE_LOOKUP_CODE,ps.amount_remaining,
case when invoIce_type_lookup_code='PREPAYMENT' THEN i.INVOICE_AMOUNT-nvl((SELECT
  sum((-1)*(ail.amount - NVL(ail.included_tax_amount,0)))
  FROM   AP_INVOICES_ALL ai,AP_INVOICES_ALL ai2,
  AP_INVOICE_LINES_ALL ail,
  AP_SUPPLIERS pv
  WHERE ai.invoice_id = ail.invoice_id
  AND  ai2.invoice_id= ail.prepay_invoice_id
  AND   ail.amount< 0
  AND   NVL(ail.discarded_flag,'N') <> 'Y'
  AND   ail.line_type_lookup_code= 'PREPAY'
  AND   ai.vendor_id = pv.vendor_id
  AND   ai.invoice_type_lookup_code NOT IN ('PREPAYMENT', 'CREDIT','DEBIT')
  AND   ai2.invoice_id =i.INVOICE_ID),0) ELSE 0 END amount_applied
FROM    ap_payment_schedules_ALL ps,
        ap_invoices_ALL i,
        hz_parties hp,
        ap_suppliers v,
        po_vendor_sites_all vs
WHERE   i.invoice_id = ps.invoice_id
AND     i.party_id = hp.party_id
AND    hp.party_id = v.party_id (+)
AND     i.vendor_site_id = vs.vendor_site_id (+)
AND     i.vendor_site_id=nvl(:p_site_id, i.vendor_site_id)
--and i.vendor_id=1231
--AND     ((to_date(to_char(SYSDATE,'DD-MON-RR'),'DD-MON-RR') - decode(:P_AGING_DATE,'D',ps.due_date,'I',I.INVOICE_DATE)) --pks
          --    between :C_MINDAYS and  :C_MAXDAYS)
--AND     i.invoice_type_lookup_code like :C_INVOICE_TYPE_SELECT
AND     i.cancelled_date IS NULL
and  APPS.AP_INVOICES_PKG.GET_APPROVAL_STATUS
           (
            I.INVOICE_ID
           ,I.INVOICE_AMOUNT
           ,I.PAYMENT_STATUS_FLAG
           ,I.INVOICE_TYPE_LOOKUP_CODE
           ) <>'NEVER APPROVED'
--AND     (nvl(ps.amount_remaining, 0) * nvl(i.exchange_rate,1))  != 0
--AND     i.payment_status_flag in ('N','P')
AND    ( (i.INVOICE_TYPE_LOOKUP_CODE<>'PREPAYMENT' and i.payment_status_flag in ('N','P')) or (i.INVOICE_TYPE_LOOKUP_CODE='PREPAYMENT' and i.payment_status_flag='Y' ))
--and      v.VENDOR_TYPE_LOOKUP_CODE=nvl(:P_VENDOR_TYPE_LOOKUP_CODE,v.VENDOR_TYPE_LOOKUP_CODE)
and nvl(v.VENDOR_TYPE_LOOKUP_CODE, 'X')=nvl(:P_VENDOR_TYPE_LOOKUP_CODE,nvl(v.VENDOR_TYPE_LOOKUP_CODE, 'X'))
--&P_ORDER_BY, I.GL_DATE
order by I.GL_DATE,i.INVOICE_NUM)
where vendor_id=v.vendor_id
and to_date(gl_date) < to_date(trunc(sysdate)-366))  EIGHT
FROM    ap_payment_schedules_ALL ps,
        ap_invoices_ALL i,
        hz_parties hp,
        ap_suppliers v,
        po_vendor_sites_all vs
WHERE   i.invoice_id = ps.invoice_id
AND     i.party_id = hp.party_id
AND    hp.party_id = v.party_id (+)
AND     i.vendor_site_id = vs.vendor_site_id (+)
AND     i.vendor_site_id=nvl(:p_site_id, i.vendor_site_id)
AND     i.cancelled_date IS NULL
and  APPS.AP_INVOICES_PKG.GET_APPROVAL_STATUS
           (
            I.INVOICE_ID
           ,I.INVOICE_AMOUNT
           ,I.PAYMENT_STATUS_FLAG
           ,I.INVOICE_TYPE_LOOKUP_CODE
           ) <>'NEVER APPROVED'
AND    ( (i.INVOICE_TYPE_LOOKUP_CODE<>'PREPAYMENT' and i.payment_status_flag in ('N','P')) or (i.INVOICE_TYPE_LOOKUP_CODE='PREPAYMENT' and i.payment_status_flag='Y' ))
--and      v.VENDOR_TYPE_LOOKUP_CODE=nvl(:P_VENDOR_TYPE_LOOKUP_CODE,v.VENDOR_TYPE_LOOKUP_CODE)
and nvl(v.VENDOR_TYPE_LOOKUP_CODE, 'X')=nvl(:P_VENDOR_TYPE_LOOKUP_CODE,nvl(v.VENDOR_TYPE_LOOKUP_CODE, 'X'))
--&P_ORDER_BY, I.GL_DATE
group by
v.vendor_id,hp.party_name,vs.VENDOR_SITE_CODE,VENDOR_TYPE_LOOKUP_CODE

Tuesday, 16 January 2018

How to Migrate OAF personalizations from One Instance to Another Instance Automatically.


Hi Friends ,In this post I will show you how you can migrate your OAF personalization from one instance to another instance automatically.

If you are working on any project and  you have done lot of personalization in OAF pages now you are moving all the things to production so there is one option you can create personalization manually in production but this is a time consuming job and risky too because you can do mistakes so for this I am showing you the easy  quick and error free method to migrate OAF personalization from test to Production.

In Functional Administrator responsibility , you can directly go to Personalization Tab and there you can migrate your Personalizations


Step1 : -  I am sharing below profile , you have to set valid server path of you instance from where you want to copy the Personalizations.

'FND: Personalization Document Root Path'
As an example I set path /usr/tmp
 
Step2:- Go to Functional Administrator.
 
Step3- Go to Personalization Tab
Then Go to Personalization Repository.
 
 
 
 

Step 4:- Then enter the Document path/ page path for which you want to download all your Personalizations as below.
Select pages and click on Export to File System button.

This will save the Personalization registration in a file and will put this file under  path '/usr/tmp'
'FND: Personalization Document Root Path'
As an example I set path /usr/tmp


You have to copy this file in your desktop.
 

Step 8:- After Copy the file in you desktop. Then you have move this file to your target system server path.

You have to copy that path where you have moved this personalization registration file in target system/production.

Then again open the Target system application and set the below profile
'FND: Personalization Document Root Path'  to the path where you have moved the personalization file in your target system.

Step9 :- Then again go to Target system application and go to functional administrator and then personalization tab and Click on Exported Personalization's and upload all the personalization registrations.

After this you can check your personalization has been created in your targeted application.
 

Contact us for any Collaboration, Project Support & On Job Support Work

Name

Email *

Message *