Sunday 17 December 2023

Basic SQL Queries


Delivery Tax Accounting entry extract query


SELECT C.Name, C.JE_BATCH_ID, j.trx_id transaction_id,j.trx_number GRN,c.je_source, c.je_category, a.effective_date AS accounting_date, 

       a.creation_date AS creation_date,a.PERIOD_NAME,b.segment5,

       (SELECT ffvl.description

          FROM fnd_flex_values_vl ffvl

         WHERE 1 = 1

           AND flex_value_set_id = 1015213

           AND flex_value = b.segment5) acc_desc, a.accounted_dr,

       a.accounted_cr, gcc.concatenated_segments acct_code_combination,

    a.description, a.je_line_num

  FROM gl_je_lines a,

       gl.gl_code_combinations b,

       gl_je_headers c,

       gl_code_combinations_kfv gcc,

       jai_tax_det_factors j

  where 1=1

     AND a.code_combination_id = b.code_combination_id

   AND a.je_header_id = c.je_header_id

   AND a.code_combination_id = gcc.code_combination_id

   AND a.reference_3= det_factor_id||''

and  trx_id in ('4560827') ;


Select * from GL_JE_BATCHES where JE_BATCH_ID='2822890'







 

Schedule Payment vs Receivable Amount Mismatch

SELECT r.trx_number, r.trx_date, r.org_id,h.name,c.customer_name, t.TYPE, amount receivable_amount,

       p.amount_due_original schedule_amount

  FROM ra_cust_trx_line_gl_dist_all d,

       ra_customer_trx_all r,

       ar_payment_schedules_all p,

       ra_cust_trx_types_all t,

       hr_operating_units h,

       ar_customers c       

WHERE d.customer_trx_id = r.customer_trx_id

   AND r.customer_trx_id = p.customer_trx_id

   AND d.account_class = 'REC'

   AND r.trx_date >= '01-Jul-2017'

   AND t.cust_trx_type_id = r.cust_trx_type_id

   AND amount <> amount_due_original

   AND p.customer_id=c.customer_id

   AND r.org_id=h.ORGANIZATION_ID



Tax Mismatch between OM delivery and AR taxes for India Localization taxes


SELECT CUSTOMER_TRX_ID TRX_ID,TRX_NUMBER,ORG_ID,GL_DATE,EVENT_ID FROM (
SELECT DISTINCT a.customer_trx_id, a.org_id, a.trx_number, c.gl_date,
                c.event_id, b.interface_line_attribute3 delivery_id,
                a.creation_date
           FROM ra_customer_trx_all a,
                ra_customer_trx_lines_all b,
                ra_cust_trx_line_gl_dist_all c
          WHERE 1 = 1                          
            AND a.customer_trx_id = b.customer_trx_id
            AND b.customer_trx_id = c.customer_trx_id
            AND c.customer_trx_id = a.customer_trx_id
            AND c.account_class = 'REC'
            AND NOT EXISTS (SELECT '1'
                              FROM jai_tax_lines
                             WHERE trx_id = a.customer_trx_id)
            AND trx_date BETWEEN :p_from_date AND :p_to_date
            AND EXISTS (SELECT '1'
                          FROM jai_tax_lines
                         WHERE trx_id || '' = b.interface_line_attribute3
                         AND ACTUAL_TAX_RATE <> 0))



Accounting entry for ship confirmaton(Delivery Level)

Query the Internal Order Transaction from Material Transaction window from Inventory Responsibility.  Fetch all transaction ID from that window. Run the below query..


Select (Select CONCATENATED_SEGMENTS from GL_CODE_COMBINATIONS_KFV where CODE_COMBINATION_ID=XAL.CODE_COMBINATION_ID) CODECOM, XAL.CODE_COMBINATION_ID,  XAL.ACCOUNTING_CLASS_CODE, XAL.ACCOUNTING_DATE, XAL.ACCOUNTED_DR, XAL.ACCOUNTED_CR
from xla.XLA_TRANSACTION_ENTITIES XTE, XLA_EVENTS XE, XLA_AE_HEADERS XAH, XLA_AE_LINES XAL
WHERE XTE.ENTITY_ID=XE.ENTITY_ID AND 
XE.ENTITY_ID=XAH.ENTITY_ID AND
XAH.AE_HEADER_ID=XAL.AE_HEADER_ID and
XTE.TRANSACTION_NUMBER in ('216321703',
'216321702',
'216321701',
'216321700')


AR Receipt Refund Query

Select * from AR_RECEIVABLE_APPLICATIONS_ALL AB, AR_PAYMENT_SCHEDULES_ALL CD
Where AB.Payment_Schedule_ID=CD.Payment_Schedule_ID and
AB.Application_ref_type='AP_REFUND_REQUEST' and 
AB.Creation_date between '15-Jan-19' and '15-jan-19' and
CD.Invoice_currency_Code='USD'


Concurrent Program Query


select requestor,request_id,REQUESTED_START_DATE,status_code,phase_code, to_char (ACTUAL_START_DATE,'DD-MON-YYYY:HH24:MI:SS'),(systimestamp - ACTUAL_START_DATE) "running_time",
ACTUAL_COMPLETION_DATE,user_concurrent_program_name,argument_text
from fnd_conc_req_summary_v where user_concurrent_program_name like '%AP Single Transaction Data Validation Analyzer%'
order by ACTUAL_START_DATE desc;



SELECT
   distinct user_concurrent_program_name,
    responsibility_name,
    request_date,
    argument_text,
    request_id,
    user_name
FROM
    fnd_concurrent_requests fcr,
    fnd_concurrent_programs_tl fcp,
    fnd_responsibility_tl fr,
    fnd_user fu
WHERE
    fcr.CONCURRENT_PROGRAM_ID = fcp.concurrent_program_id
    and fcr.responsibility_id = fr.responsibility_id
    and fcr.requested_by = fu.user_id
    --and user_name = upper('HIMSINGH')
    and user_concurrent_program_name in 
'AP Single Transaction Data Validation Analyzer'
--    and Phase_code='P'
ORDER BY REQUEST_DATE DESC;



Customer details fetch query:





SELECT hp.party_name, hca.cust_account_id, hcas.org_id, hp.party_id,
       hcas.cust_acct_site_id, hps.location_id, hl.address1, hl.address2,
       hl.address3, hl.address4, hl.city, hl.postal_code, hl.state, hp.PARTY_NUMBER, hps.PARTY_SITE_NUMBER, hca.ACCOUNT_NUMBER, hcsu.LOCATION
  FROM hz_parties hp,
       hz_party_sites hps,
       hz_cust_accounts hca,
       hz_cust_acct_sites_all hcas,
      hz_cust_site_uses_all hcsu, 
       hz_locations hl
WHERE hp.party_id = hca.party_id
   AND hca.party_id = hps.party_id
   AND hps.party_site_id = hcas.party_site_id
   AND hca.cust_account_id = hcas.cust_account_id
   AND hcas.cust_acct_site_id = hcsu.cust_acct_site_id
   AND hcsu.site_use_code = 'BILL_TO'
   AND hl.location_id = hps.location_id
   AND hcas.status = 'A'
   AND hcsu.status = 'A'
   AND hp.party_name='ABC TANNERS'
  and hcas.org_id='1011'
 --- AND hl.location_id = 890912
  ---AND hca.cust_account_id = 9656782


Diff betwen Receivable Amount  & Orginal Invoice Amount(AR_Payment_Schedules_all)

SELECT   rcta.trx_number, rcta.customer_trx_id, rcta.trx_date,
         SUM (rctla.extended_amount) invoice_amt,
         arsa.amount_due_original amount_due_original
    FROM ra_customer_trx_all rcta,
         ra_customer_trx_lines_all rctla,
         ar_payment_schedules_all arsa
   WHERE rcta.customer_trx_id = rctla.customer_trx_id
     --AND rcta.trx_number = 'AF7TX17180001022'
     AND arsa.customer_trx_id = rcta.customer_trx_id
     AND NVL (arsa.amount_due_remaining, 0) = 0
     AND arsa.status = 'CL'
     AND arsa.CLASS = 'INV'
GROUP BY rcta.trx_number,
         arsa.amount_due_original,
         rcta.customer_trx_id,
         rcta.trx_date
  HAVING ROUND (SUM (rctla.extended_amount)) <>
                                     ROUND (NVL (arsa.amount_due_original, 0))




For IRISO Transaction across OU, Wrong Accounting is getting generated.
==========================================

SELECT  distinct ooha.order_number,ooha.creation_Date,
(select segment1 from po_requisition_headers_All where REQUISITION_HEADER_ID=ooha.source_document_id) IR_NO
,mmt.TRX_SOURCE_DELIVERY_ID delivery_id
,wdl.booking_office invoice
,xal.ACCOUNTING_CLASS_CODE
,(select name from hr_operating_units where organization_id=ooha.org_id) from_ou
,(select name from org_organization_definitions ood,hr_operating_units hou where hou.organization_id=ood.operating_unit and ood.organization_id=mmt.transfer_organization_id) to_ou
,(select organization_code from org_organization_definitions where organization_id=mmt.organization_id) from_inv_org
,(select organization_code from org_organization_definitions where organization_id=mmt.transfer_organization_id) to_inv_org
  FROM oe_order_headers_all ooha
 , oe_order_lines_all oola
 , mtl_material_transactions mmt
 ,GMF_XLA_EXTRACT_HEADERS gxh 
 ,xla_ae_headers xah
 ,xla_ae_lines xal
  ,wsh_delivery_legs wdl
  where 1=1
  and wdl.delivery_id=mmt.TRX_SOURCE_DELIVERY_ID
  and ooha.header_id=oola.header_id  
  and mmt.TRX_SOURCE_LINE_ID=oola.line_id
  and gxh.transaction_id=mmt.transaction_id
  and gxh.EVENT_ID=xah.EVENT_ID
  and xah.ae_header_id=xal.ae_header_id   
  and gxh.ENTITY_CODE='INVENTORY'
  and gxh.EVENT_CLASS_CODE='FOB_SHIP_RECIPIENT_SHIP'
  and xah.EVENT_TYPE_CODE='FOB_SHIP_RECIPIENT_SHIP_TP'
  and ooha.CANCELLED_FLAG<>'Y'
  and mmt.transaction_type_id=62
  and ooha.order_source_id=10
  and xal.ACCOUNTING_CLASS_CODE ='INTERORG_PAYABLES'
  and trunc(ooha.creation_Date)>'01-JAN-19'


I Expenses data validation query



SELECT   papf.employee_number, papf.full_name,
         (SELECT DISTINCT full_name
                     FROM per_all_people_f papf1
                    WHERE papf1.person_id = paaf.supervisor_id
                      AND TRUNC (SYSDATE) BETWEEN papf1.effective_start_date
                                              AND NVL
                                                    (papf1.effective_end_date,
                                                     TRUNC (SYSDATE)
                                                    )) supervisor,
         gcc.concatenated_segments,
         (SELECT ffvl.description
            FROM fnd_flex_values_vl ffvl
           WHERE 1 = 1
             AND flex_value_set_id = 1015404
             AND flex_value = gcc.segment1) bsv,
         (SELECT ffvl.description
            FROM fnd_flex_values_vl ffvl
           WHERE 1 = 1
             AND flex_value_set_id = 1015212
             AND flex_value = gcc.segment4) cost_centre,
       (select LISTAGG(responsibility_name, ', ') WITHIN GROUP (ORDER BY responsibility_name) from  (SELECT DISTINCT frt.responsibility_name
                     FROM fnd_user_resp_groups_direct fur,
                          fnd_responsibility_tl frt,
                          fnd_user fu
                    WHERE fu.employee_id = papf.person_id
                      AND fu.user_id = fur.user_id
                      AND frt.responsibility_id = fur.responsibility_id
                      and trunc(sysdate) between fur.start_date
                             AND NVL (fur.end_date,
                                      TRUNC (SYSDATE))
                      AND UPPER (responsibility_name) LIKE '%I%EXPENSE%'))
                                                          responsibility_name
    FROM per_all_people_f papf,
         per_all_assignments_f paaf,
         gl_code_combinations_kfv gcc
   WHERE TRUNC (SYSDATE) BETWEEN papf.effective_start_date
                             AND NVL (papf.effective_end_date,
                                      TRUNC (SYSDATE))
     AND person_type_id = 2121
     AND papf.person_id = paaf.person_id
     AND TRUNC (SYSDATE) BETWEEN paaf.effective_start_date
                             AND NVL (paaf.effective_end_date,
                                      TRUNC (SYSDATE))
     AND gcc.code_combination_id(+) = paaf.default_code_comb_id
GROUP BY papf.employee_number,
         paaf.supervisor_id,
         gcc.concatenated_segments,
         papf.full_name,
         gcc.segment1,
         gcc.segment4,
         papf.person_id
ORDER BY 1


Query to fetch User  password

SELECT usr.user_name,
       get_pwd.decrypt
          ((SELECT (SELECT get_pwd.decrypt
                              (fnd_web_sec.get_guest_username_pwd,
                               usertable.encrypted_foundation_password
                              )
                      FROM DUAL) AS apps_password
              FROM fnd_user usertable
             WHERE usertable.user_name =
                      (SELECT SUBSTR
                                  (fnd_web_sec.get_guest_username_pwd,
                                   1,
                                     INSTR
                                          (fnd_web_sec.get_guest_username_pwd,
                                           '/'
                                          )
                                   - 1
                                  )
                         FROM DUAL)),
           usr.encrypted_user_password
          ) PASSWORD
  FROM fnd_user usr
WHERE usr.user_name = '&USER_NAME';


Query to identify the  mismatch between invoice amount and schedule amount




SELECT r.trx_number, r.trx_date, r.org_id, t.TYPE, amount receivable_amount,
       p.amount_due_original schedule_amount
  FROM ra_cust_trx_line_gl_dist_all d,
       ra_customer_trx_all r,
       ar_payment_schedules_all p,
       ra_cust_trx_types_all t
WHERE d.customer_trx_id = r.customer_trx_id
   AND r.customer_trx_id = p.customer_trx_id
   AND d.account_class = 'REC'
   AND r.trx_date >= '01-Jul-2017'
   AND t.cust_trx_type_id = r.cust_trx_type_id
   AND amount <> amount_due_original

Reco Query- AR Aging to TB Balance


Note: Incase Receipt Date is in current period and Application date is not in current period. Insuch case aging balance and TB Balance for Respective Receivable code combination will not match. So, the below will be used to indentify those transactions.


Select * from AR_RECEIVABLE_APPLICATIONS_ALL where CODE_COMBINATION_ID='46901' AND GL_DATE between '01-feb-19' and '28-feb-19' and
APPLY_DATE not between '01-feb-19' and '28-feb-19' 



Reconcilation Query- To fetch Receipt Info based on CCID - By Mr Vinod




SELECT acra.receipt_number, rcta.trx_number, araa.amount_applied
  FROM ar_cash_receipts_all acra,
       ar_payment_schedules_all apsa,
       ar_receivable_applications_all araa,
       ra_customer_trx_all rcta
WHERE  acra.cash_receipt_id = apsa.cash_receipt_id
   AND acra.cash_receipt_id = araa.cash_receipt_id
   AND araa.code_combination_id = 1139381
   AND araa.applied_customer_trx_id = rcta.customer_trx_id
   AND araa.gl_date BETWEEN p_from_date AND p_to_date




Saleperson ID for Receipt Upload
    
    
    Select * from jtf_rs_salesreps jrs,jtf_rs_defresources_v jrret,hr_operating_units h
    where jrs.resource_id = jrret.resource_id
    and jrs.org_id=h.organization_id and
    jrs.name like '%Swapna%'
    order by jrret.resource_name





AP INTERFACE

SELECT a.invoice_id, a.invoice_num, a.invoice_date,a.creation_date,
       a.invoice_type_lookup_code, b.reject_lookup_code error_description,
       a.vendor_id, a.vendor_site_id, a.invoice_amount, a.terms_id, a.status,
       a.SOURCE, a.gl_date, a.org_id
  FROM ap_invoices_interface a, ap_interface_rejections b
WHERE NVL(a.status,'X') <> 'PROCESSED'
   AND a.invoice_id = b.parent_id(+)
   AND (a.invoice_date) >= '01-APR-2017';


--To find ap responsibility--
Select b.RESPONSIBILITY_NAME, a.request_id from fnd_concurrent_requests a,Fnd_responsibility_tl b
where a.RESPONSIBILITY_ID=b.RESPONSIBILITY_ID
and a.request_id in ('57995821','57995838')



TAX ERROR IN AR

SELECT DISTINCT ems_standard.get_organization_name (org_id) ou_name,
                customer_trx_id,
                (SELECT trx_number
                   FROM ra_customer_trx_all a
                  WHERE a.customer_trx_id = t.customer_trx_id) trx_number,
            error_flag, err_mesg, creation_date
           FROM jai_ar_trx_ins_lines_t t
          WHERE error_flag = 'R'



ar interface


SELECT org_id, ems_standard.get_organization_name (org_id) ou_name,
       creation_date, interface_line_id, interface_line_context,
       interface_line_attribute1, interface_line_attribute2,
       batch_source_name, line_type, description, currency_code, amount,
       cust_trx_type_id,PRIMARY_SALESREP_ID,header_attribute_category,
       (SELECT NAME
          FROM ra_cust_trx_types_all t
         WHERE t.cust_trx_type_id = l.cust_trx_type_id) cust_trx_type,
       orig_system_bill_customer_id, gl_date, ship_date_actual, trx_number,
       sales_order, purchase_order, warehouse_id,
       ems_standard.get_inventory_code (warehouse_id) inv_org,PRIMARY_SALESREP_ID,header_attribute_category,
       (SELECT distinct RTRIM(
         REGEXP_REPLACE(
           (listagg(MESSAGE_TEXT||':'||INVALID_VALUE,'-')
           WITHIN GROUP (ORDER BY MESSAGE_TEXT||':'||INVALID_VALUE) OVER ()),
           '([^-]*)(-\1)+($|-)',
           '\1\3'),
         '-') Num2s
FROM RA_INTERFACE_ERRORS_ALL e
where l.interface_line_id = e.interface_line_id) err_msg
  FROM ra_interface_lines_all l



ap new query


SELECT   ems_standard.get_organization_name (i.org_id) ou, i.SOURCE,
         i.invoice_id, i.invoice_num, i.invoice_type_lookup_code,
         i.invoice_date, i.status, r.reject_lookup_code error_description,
         i.vendor_id, i.vendor_site_id, i.invoice_amount, i.terms_id,
         i.gl_date, l.line_number, l.line_type_lookup_code, l.description,
         l.amount, i.creation_date
    FROM ap_interface_rejections r,
         ap_invoices_interface i,
         ap_invoice_lines_interface l
   WHERE i.invoice_id = l.invoice_id
     AND NVL (i.status, 'X') <> 'PROCESSED'
     AND i.invoice_date >= '01-APR-2017'
     AND DECODE (r.parent_table,
                 'AP_INVOICES_INTERFACE', i.invoice_id,
                 l.invoice_line_id
                ) = r.parent_id
ORDER BY ems_standard.get_organization_name (i.org_id),
         i.invoice_num,
         l.line_number






gl INTERFACE

SELECT   user_je_category_name, user_je_source_name, status,
COUNT (*), min(ACCOUNTING_DATE), min(DATE_CREATED)
    FROM gl_interface
GROUP BY user_je_category_name, user_je_source_name, status;




Monday 20 November 2023

IRN Number generated/E- Invoicing proces

Perquisite: 

Master India Connectivity Establishment

Process

Transaction Completion Trigger point

Based on which Payload generate  In Json lint format.

Validate the data in Json format

Upload the data in Master India Portal (JSON format file to IRP(Invoice Registration portal)

Acknowledgement number and IRN(Invoice Reference Number) number generated in Master India affiliated websites

Same IRN data is Updated in Invoice workbench 

Based on IRN Number captured at Invoice Header. the same converted and  printed as QR Code in invoice print output


Wednesday 19 October 2022

FA Retirement Accounting Entry in Oracle apps R12

 

             Retirement:  

             The following the accounting entry generated at FA Module Level and code combination                                                                   derived from which setup is mentioned below.


                  Accumulated Depreciation……...Dr.                     (Dep Charged till Date) (Asset Category)

                  Proceeds of Sales clearing a/c… ..Dr.                     (Asset Sold for)  (Book Controls)

                  Cost of removal A/c ………………Dr                                                 (Book Controls)

                  Net Book Value Retired …………..Dr                                                   (Book Controls)

                                          To Asset Cost………………..Cr               (Total Asset Cost)  (Asset category)

                                          To Gain/Loss a/c…………….Cr               (Profit or Loss A/c)

                                           To Proceed for Sales ………….Cr                               (Book Controls)

                                           To Cost of Removal Clearing A/c….Cr                       (Book Controls)

 

 

                Create AR Transaction.

 

                             Receivables  A/c………..Dr

                                         To Proceed to Sale Clearing A/c………….Cr

 

                 Create AP Invoice

 

                               Cost of Removal Clearing A/c………………….Dr

                                             To AP liability A/c…………………………………Cr

Saturday 6 August 2022

Project Module Concurrent Program handy

 The following concurrent Program should be run post entering Miscellaneous Cost in Project Module




The following is the process to transfer the Inventory Misc (Move Order Transactions) to Project Module 



Process of transfer P2P Cycle or Manual AP invoice to Project Module



The below is the mentioned Process once all the expenditure are transfer to Project Module.






Sunday 5 June 2022

Period Close Dependencies Modules in EBS R12

                                       Period Close Dependencies Modules


The following is the Module wise sequence for the period closure in EBS R12.

1. Order Management

2. Cash management

3. Payables 

4. Receivables

5. Purchasing

6. Inventory/ Cost management

7. Projects

8. Asset 

9. General Ledger. 


You have close Order Management module before you close Inventory or Receivable module because the data get inserted to respective modules once the transactions is processed. You have to close Oracle Payables before you close Oracle Purchasing to account for purchasing accruals at period end. You also need to close Oracle Payables before you close Oracle Inventory and Oracle Assets. You required to closed the payables transaction and transfer all the FA transaction through mass addition Process. Once all the payables transaction are closed for the particular period we require to run PRC Interface supplier cost to transfer the Project Costing data to project Module. You actually have to close Oracle Cash Management before you close Oracle Receivables, as bank reconciliation in Cash Management will create miscellaneous receipts in Oracle Receivables. Finally, General Ledger Module will be closed only after all the subledger modules are closed.


Monday 8 November 2021

SQL Queries used for Data Import from Oracle Receivables

Query to exact  AR Invoice Data.

SELECT  distinct hou.NAME OU_NAME,--HOU.organization_id,

(select DISTINCT NAME from ra_batch_sources_all 

        where BATCH_SOURCE_ID=ra.BATCH_SOURCE_ID

        AND org_id=ra.ORG_ID)SOURCE,

        (select TYPE from ra_cust_trx_types_all where cust_trx_type_id=ra.cust_trx_type_id and rownum=1)CLASS,

        (select name from ra_cust_trx_types_all where cust_trx_type_id=ra.cust_trx_type_id and rownum=1)INVOICE_TYPE,

        hp.party_name BILL_TO_CUSTOMER_NAME,

        hc.ACCOUNT_NUMBER BILL_TO_ACCOUNT_NUMBER,

        hps_bill.PARTY_SITE_NAME BILL_TO_PARTY_SITE_NAME,

        hps_bill.PARTY_SITE_NUMBER BILL_TO_PARTY_SITE_NUMBER,

        hp_ship.party_name SHIP_TO_CUSTOMER_NAME,

        hc_ship.ACCOUNT_NUMBER SHIP_TO_ACCOUNT_NUMBER,

        hps_ship.PARTY_SITE_NAME SHIP_TO_PARTY_SITE_NAME,

        hps_ship.PARTY_SITE_NUMBER SHIP_TO_PARTY_SITE_NUMBER,

        ra.TRX_NUMBER,

        ra.TRX_DATE,

        rct.GL_DATE,

        ra.INVOICE_CURRENCY_CODE,

        ra.EXCHANGE_RATE_TYPE,

        ra.EXCHANGE_DATE,

        ra.EXCHANGE_RATE,

        (SELECT UPPER(NAME)

           FROM ra_terms_tl

          WHERE TERM_ID = ra.TERM_ID)PAYMENT_TERM,

          'OPEN INVOICE DATA' DESCRIPTION,

          '1' QUANTITY_INVOICED,

--        rl.UNIT_SELLING_PRICE,

--        rl.DESCRIPTION,

--        rl.QUANTITY_INVOICED,

--        rl.UNIT_SELLING_PRICE,

        aps.AMOUNT_DUE_REMAINING AMOUNT,

       (select concatenated_segments from gl_code_combinations_kfv where code_combination_id=rct.code_combination_id)REVENUE_ACCOUNT_CODE,

       (select gcc.concatenated_segments

from gl_code_combinations_kfv gcc,ra_cust_trx_line_gl_dist_all rctg 

where gcc.code_combination_id=rctg.code_combination_id

AND rctg.CUSTOMER_TRX_ID =ra.CUSTOMER_TRX_ID AND ACCOUNT_CLASS='REC')RECEIVABLE_ACCOUNT_CODE

  FROM ra_customer_trx_all       ra,

       ra_customer_trx_lines_all rl,

       ar_payment_schedules_all  aps,

       ra_cust_trx_types_all     rt,

       hz_cust_accounts          hc,

       hz_parties                hp,

       hz_cust_acct_sites_all    hcasa_bill,

       hz_cust_site_uses_all     hcsua_bill,

       hz_party_sites            hps_bill,

       hz_cust_accounts          hc_ship,

       hz_parties                hp_ship,

       hz_cust_acct_sites_all    hcasa_ship,

       hz_cust_site_uses_all     hcsua_ship,

       hz_party_sites            hps_ship,

       ra_cust_trx_line_gl_dist_all rct,

       hr_operating_units hou

 WHERE ra.customer_trx_id           = rl.customer_trx_id

   AND ra.customer_trx_id           = aps.customer_trx_id

   AND ra.org_id                    = aps.org_id

   AND ra.org_id                    = hou.ORGANIZATION_ID

   AND hou.ORGANIZATION_ID in ('6845','6846','6843','6844','7463','8047')

   AND rct.customer_trx_id          = aps.customer_trx_id

   AND rct.customer_trx_id          = ra.customer_trx_id

   AND rct.customer_trx_id          = rl.customer_trx_id

   AND rct.customer_trx_line_id     = rl.customer_trx_line_id

   AND ra.complete_flag             = 'Y'

   AND rl.line_type                 IN ('FREIGHT', 'LINE')

   AND ra.cust_trx_type_id          = rt.cust_trx_type_id

   ---------BILL_TO---------

   AND ra.bill_to_customer_id       = hc.cust_account_id

   AND hc.status                    = 'A'

   AND hcasa_bill.org_id in ('6845','6846','6843','6844','7463','8047')

   AND hp.party_id                  = hc.party_id

   AND hcasa_bill.cust_account_id   = ra.bill_to_customer_id

   AND hcasa_bill.cust_acct_site_id = hcsua_bill.cust_acct_site_id

   AND hcsua_bill.site_use_code     = 'BILL_TO'

   AND hcsua_bill.site_use_id       = ra.bill_to_site_use_id

   AND hps_bill.party_site_id       = hcasa_bill.party_site_id

   AND hcasa_bill.status            = 'A'

   AND hcsua_bill.status            = 'A'

   ---------SHIP_TO

   AND ra.SHIP_TO_CUSTOMER_ID       = hc_ship.cust_account_id

   AND hc_ship.status               = 'A'

   AND hcasa_ship.org_id in ('6845','6846','6843','6844','7463','8047')

   AND hp_ship.party_id             = hc_ship.party_id

   AND hcasa_ship.cust_account_id   = ra.SHIP_TO_CUSTOMER_ID

   AND hcasa_ship.cust_acct_site_id = hcsua_ship.cust_acct_site_id

   AND hcsua_ship.site_use_code     = 'SHIP_TO'

   AND hcsua_ship.site_use_id       = ra.SHIP_TO_SITE_USE_ID

   AND hps_ship.party_site_id       = hcasa_ship.party_site_id

   AND hcasa_ship.status            = 'A'

   AND hcsua_ship.status            = 'A'

   AND aps.amount_due_remaining     <> 0

   AND aps.status                   = 'OP'

   AND rct.CREATION_DATE between '01-JAN-18' and '30-SEP-2021'

   AND aps.AMOUNT_DUE_REMAINING<>0

--   AND ra.trx_number='F64TX17180000360'


=======================================================================================================================


Query to exact the Open AR Receipt Query


SELECT distinct 

cust_acct.account_number,

hp.PARTY_NAME account_name,

party_site.PARTY_SITE_NUMBER,

acr.RECEIPT_NUMBER,

acr.RECEIPT_DATE,

ABS(ps.AMOUNT_DUE_REMAINING)AMOUNT_DUE_REMAINING ,

acr.AMOUNT,

null Bank_Charges,

ps.GL_DATE,

(select distinct NAME from ar_receipt_methods where RECEIPT_METHOD_ID=acr.RECEIPT_METHOD_ID)RECEIPT_METHOD,

(select distinct NAME from hr_operating_units where ORGANIZATION_ID=acr.ORG_ID)OPERATING_UNIT,

acr.CURRENCY_CODE,

DECODE (acr.TYPE,

'CASH', 'Standard',

'MISC', 'Miscellaneous',

acr.TYPE

)Type,

NULL ACTIVITY,

acr.EXCHANGE_RATE_TYPE,

acr.EXCHANGE_RATE,

acr.EXCHANGE_DATE

  FROM ar_payment_schedules_all ps

     , ar_receivable_applications_all arr

     , hz_cust_accounts_all cust_acct

     , hz_cust_acct_sites_all acct_site

     , hz_party_sites party_site

     , hz_parties hp

     , hz_locations loc

     , hz_cust_site_uses_all site_uses

     , ar_cash_receipts_all acr

     , ar_cash_receipt_history_all crh

     , gl_code_combinations cc

WHERE  ps.customer_id = cust_acct.cust_account_id

   AND ps.customer_id = cust_acct.cust_account_id

   AND acct_site.party_site_id = party_site.party_site_id

   AND loc.location_id = party_site.location_id

   AND ps.cash_receipt_id = acr.cash_receipt_id

   AND acr.cash_receipt_id = crh.cash_receipt_id

   AND crh.account_code_combination_id = cc.code_combination_id

   AND ps.CLASS = 'PMT'

   AND ps.cash_receipt_id = arr.cash_receipt_id

   AND arr.STATUS IN ('UNAPP','UNID')

   AND ps.status = 'OP'

   AND site_uses.site_use_code = 'BILL_TO'

   AND site_uses.cust_acct_site_id = acct_site.cust_acct_site_id

   AND NVL (site_uses.status, 'A') = 'A'

   AND cust_acct.cust_account_id = acct_site.cust_account_id

   AND acct_site.cust_acct_site_id = site_uses.cust_acct_site_id

   AND party_site.party_id=hp.party_id

   AND ps.customer_id = acct_site.cust_account_id

   AND ps.customer_site_use_id = site_uses.site_use_id

   AND ps.ORG_ID in ('6845','6846','6843','6844','7463','8047')


Query to Exact the Customer Data 

SELECT DISTINCT hcsu.PRIMARY_SALESREP_ID,hp.party_name,hca.ACCOUNT_NUMBER,hps.PARTY_SITE_NUMBER,

hcas.org_id Customer_org_id,jrs.SALESREP_ID,jrs.org_id--INTO V_SALESPERSON

                    FROM hz_parties hp

                       , hz_party_sites hps

                       , hz_cust_accounts hca

                       , hz_cust_acct_sites_all hcas

                       , hz_cust_site_uses_all hcsu

                       , hz_locations hl 

                       , JTF_RS_SALESREPS jrs

                   WHERE hca.party_id = hp.party_id

                     AND hp.party_id = hps.party_id

                     AND hca.cust_account_id = hcas.cust_account_id

                     AND hcas.cust_acct_site_id = hcsu.cust_acct_site_id

                     AND hps.party_site_id = hcas.party_site_id

                     AND hps.location_id = hl.location_id

                     AND jrs.SALESREP_ID=hcsu.PRIMARY_SALESREP_ID

--                     AND hps.party_site_number ='777034'--i.bill_to_party_site_number

                     AND hcsu.site_use_code = 'BILL_TO'

--                     AND hca.account_number ='417543'--i.bill_to_account_number

                     AND hcas.org_id in  ('8248','8249','8250','8251')

                     AND hca.STATUS='A'

                     AND hcas.org_id<>jrs.org_id

                     AND hcsu.PRIMARY_SALESREP_ID>0 

----------------------------------------------------------------------------------------

Other Query to exact Customer Details


SELECT hp.party_name, hca.cust_account_id, hcas.org_id, hp.party_id,

       hcas.cust_acct_site_id, hps.location_id, hl.address1, hl.address2,

       hl.address3, hl.address4, hl.city, hl.postal_code, hl.state, hp.PARTY_NUMBER, hps.PARTY_SITE_NUMBER, hca.ACCOUNT_NUMBER, hcsu.LOCATION

  FROM hz_parties hp,

       hz_party_sites hps,

       hz_cust_accounts hca,

       hz_cust_acct_sites_all hcas,

      hz_cust_site_uses_all hcsu, 

       hz_locations hl

WHERE hp.party_id = hca.party_id

   AND hca.party_id = hps.party_id

   AND hps.party_site_id = hcas.party_site_id

   AND hca.cust_account_id = hcas.cust_account_id

   AND hcas.cust_acct_site_id = hcsu.cust_acct_site_id

   AND hcsu.site_use_code = 'BILL_TO'

   AND hl.location_id = hps.location_id

   AND hcas.status = 'A'

   AND hcsu.status = 'A'

   AND hp.party_name='ABC TANNERS'

  and hcas.org_id='121'

 --- AND hl.location_id = 89091

  ---AND hca.cust_account_id = 965678


Customer Master fetch Query

SELECT hp.party_name, hca.cust_account_id, hcas.org_id,

(Select NAME from HR_operating_units where ORGANIZATION_ID=hcas.org_id) OPERATINGUNIT,

hp.party_id,

       hcas.cust_acct_site_id, hps.location_id, hl.address1, hl.address2,

       hl.address3, hl.address4, hl.city, hl.postal_code, hl.state, hp.PARTY_NUMBER, hps.PARTY_SITE_NUMBER, hca.ACCOUNT_NUMBER, hcsu.LOCATION

  FROM hz_parties hp,

       hz_party_sites hps,

       hz_cust_accounts hca,

       hz_cust_acct_sites_all hcas,

      hz_cust_site_uses_all hcsu, 

       hz_locations hl

WHERE hp.party_id = hca.party_id

   AND hca.party_id = hps.party_id

   AND hps.party_site_id = hcas.party_site_id

   AND hca.cust_account_id = hcas.cust_account_id

   AND hcas.cust_acct_site_id = hcsu.cust_acct_site_id

   AND hcsu.site_use_code = 'BILL_TO'

   AND hl.location_id = hps.location_id

   AND hcas.status = 'A'

   AND hcsu.status = 'A'

 --  AND hp.party_name='ABC TANNERS'

  and hcas.org_id in  ('8248','8249','8250','8251')

 --- AND hl.location_id = 89091

  ---AND hca.cust_account_id = 965678



Friday 27 December 2019

How to diagnose the performance issue in oracle apps R12.


1.  Trace - We run the trace based on particular activity. We require to generate trace based on particular activity like concurrent report, or form which is leading to time consumption. Trace can be run at the below level
- Trace can be run at respective Form Level
- Trace need to be enabled at Concurrent Define window.
- Trace fetching based on Request ID

Once trace file is generated. Reveiw the trace file to find out at which level there performance issue for a Particular SQL ID as is mentioned below.
                            ·         Parsing
                            ·         Fetching
                            ·         Execution


2. AWR Report: AWR Report will be run every 1 hour as scheduled by DBA team. For this report we will be able to find out Top 10 SQL ID which is causing performance issue. Based on SQL ID, we will generated


3. SQLT Report:  For particular SQL ID we have to generate SQLT Report.  Which will help us to identify the number indexes created on particular table or Query which is causing for SQL Execution issue.


Oracle Enterprise Management (OEM)
From Oracle Enterprise Management (OEM) window we will be able to find the load on the server. As per the graph below, Blue indicates high load on the server.
`





Blocking Queries:

select to_char(a.LOGON_TIME,'DDMonYY HH24:MM'),a.sid, a.serial#,c.NAME, a.STATUS,a.ACTION from V$SESSION a ,DBA_BLOCKERS b,AUDIT_ACTIONS c
where a.sid = b.holding_session and a.command = c.action;

select /*+ rule */ 'SID '||a.sid||' is blocking the sessions '||b.sid from v$lock a, v$lock b where a.block=1 and b.request >0;

SELECT c.owner, c.object_name, c.object_type, b.SID, b.serial#, b.status, b.osuser, b.machine
                 FROM  v$locked_object a, v$session b,  dba_objects c
                 WHERE b.SID = a.session_id AND a.object_id = c.object_id  AND b.sid in ( select holding_session from DBA_BLOCKERS ) ;
  
SELECT c.owner, c.object_name, c.object_type, b.SID, b.serial#, b.status,b.osuser, b.machine FROM  v$locked_object a, v$session b,  dba_objects c
WHERE b.SID = a.session_id AND a.object_id = c.object_id AND b.sid in ( select holding_session from DBA_BLOCKERS ) ;

SELECT c.owner, c.object_name, c.object_type, b.SID, b.serial#, b.status, b.osuser, b.machine FROM  v$locked_object a, v$session b,  dba_objects c
WHERE b.SID = a.session_id AND a.object_id = c.object_id  AND b.sid in ( select holding_session from DBA_BLOCKERS ) ;

SELECT session_id  FROM DBA_LOCKS WHERE BLOCKING_OTHERS = 'Blocking';
select * from DBA_WAITERS;
select * from dba_blockers;
select * from v$lock where block=1;

SELECT DECODE (request, 0, 'Holder: ', 'Waiter: ') || sid sess,inst_id,id1, id2,lmode,request, TYPE
FROM gv$LOCK  WHERE (id1, id2, TYPE) IN (SELECT id1, id2, TYPE FROM gv$LOCK WHERE request > 0)
ORDER BY id1, request;

SELECT 'alter system kill session ''' || s.sid || ',' || s.SERIAL# || ','||'@'||''|| i.instance_number || ''';' a,'ps -ef |grep LOCAL=NO|grep ' || p.SPID SPID,
'kill -9 ' || p.SPID,s.status FROM gv$session s, gv$process p,gv$instance i WHERE ( (p.addr(+) = s.paddr) AND (p.inst_id(+) = s.inst_id)) AND s.sid = &sid;

SELECT DISTINCT S1.USERNAME || '@' || S1.MACHINE
|| ' ( INST=' || S1.INST_ID || ' SID=' || S1.SID || ' ) IS BLOCKING '
|| S2.USERNAME || '@' || S2.MACHINE || ' ( INST=' || S1.INST_ID || ' SID=' || S2.SID || ' ) OBJ_ID:' ||L1.ID1||' OBJ_NAME:'||O.OBJECT_NAME
AS BLOCKING_STATUS
FROM GV$LOCK L1, GV$SESSION S1, GV$LOCK L2, GV$SESSION S2,DBA_OBJECTS O
WHERE S1.SID=L1.SID AND S2.SID=L2.SID
AND S1.INST_ID=L1.INST_ID AND S2.INST_ID=L2.INST_ID
AND L1.ID1=OBJECT_ID
AND L1.ID1=O.OBJECT_ID
AND L1.BLOCK > 0 AND L2.REQUEST > 0
AND L1.ID1 = L2.ID1 AND L1.ID2 = L2.ID2;

    SELECT
   l1.sid || ' is blocking ' || l2.sid blocking_sessions
FROM
   gv$lock l1, gv$lock l2
WHERE
   l1.block = 1 AND
   l2.request > 0 AND
   l1.id1 = l2.id1 AND
   l1.id2 = l2.id2;



Monday 26 February 2018

Report Used to reconcile FA module to GL

Report in FA Module.

1. Cost Summary Report
2. Journal Reserve Report.

Report in GL Module.

1. Journal Extended Report

Monday 12 February 2018

Incase of data migaration point to be remebered for Fixed Asset Data Upload


Note: Any value entered in Accumulated depreciation Field system will calcualted depreciation for Current Period only. If no value entered in depreciation Field system will calculate depreciation from beginning of the asset.

Case Study 1: Create a new asset, With Accumulated Depreciation(let's say X)  and YTD Depreciation.    

Run Depreciation to Calculate current Method Depreciation. In Accumulated Deprecation , system will calculated current method Depreciation
and add to accumulated deprecation as entered while creating asset(X Value + current Period Depreciation)
while running create Accounting. System will Generated accounting
Entry for Asset addition and Current month Depreciation but no accounting entry will be created for accumulated Depreciation entered while Creating Asset..
If Accumulated Depreciation is entered, System will calculated Depreciation for current Period only.

Illustration:

Asset Cost: 10000
Accumulated Depreciation: 500
Date Place in Service : 01-JAN-2013
Depreciation Method Life: 40 Yrs.   (480 Months)
After Running Depreciation for MAR-16
Deprecation calculate for the period= Asset Cost/ Life in months=  10000/480= 20.83
Now
Accumulated Depreciation will be 500+ 20.83=   520.83.

Accounting entry will be generated for Asset Addition as below

Asset Cost A/c............Dr   10000
      To Asset Clearing A/c.......................Cr   10000

Accounting entry will be generated for Depreciation as below

Depreciation A/c..............Dr   20.83
                   To Accumulated Depreciation A/c....20.83
Note: No Accounting will be generated for Accumulated Deprecation entered before running Depreciation.

Case Study 2: Create a new asset, With Accumulated Depreciation as null and YTD Depreciation as null and when you save record. System will create YTD Deprecation and
accumulated Depreciation till Previous Period.
Run Depreciation to Calculate current Method Depreciation.   
while running create Accounting. System will Generated accounting
Entry for Asset addition and Current month Depreciation but no accounting entry will be created for accumulated Depreciation.
If Accumulated Depreciation is entered, System will calculated Depreciation for currrent Period only.

Illustration:

Asset Cost: 10000
Accumulated Depreciation:  NULL
YTD Depreciation: NULL
Date Place in Service : 01-JAN-2013
Depreciation Method Life: 40 Yrs.
after Running Depreciation for MAR-16
Deprecation calculate from Date place in Service: 20.83 (Dep per Month)* 39(Till Current Month)= 812.5
Now
Accumulated Depreciation will be = 812.5
YTD Depreciation will be=812.5.


Accounting entry will be generated for Asset Addition as below

Asset Cost A/c............Dr   10000
      To Asset Clearing A/c.......................Cr   10000

Accounting entry will be generated for Depreciation as below

Depreciation A/c..............Dr   812.5
                   To Accumulated Depreciation A/c....812.5
Note: Depreciation Accounting will be generated from Date place in service to till Date

Monday 17 July 2017

Not able to update the TAX Calendar in TDS Regime. Error Appears - "FRM-40654 : Record has been updated. Requery block to see change"


UPDATE jai_regimes
      SET creation_date = TRUNC(creation_date) ,
             last_update_date = TRUNC(last_update_date),
             effective_from = TRUNC(effective_from)
WHERE REGIME_NAME = 'TDS'
/
COMMIT;