Search This Blog

Thursday 28 May 2015

Copy APPS user / Create Read Only eBS databse user

-- Connect to APPS Database Schema

CREATE USER APPS_RO IDENTIFIED BY APPS_RO;
GRANT CONNECT, RESOURCE TO APPS_RO;


      ------------------ Synonyms List ------------------------
      /* Generate script for synonyms for new schema
      */

    SELECT   'CREATE OR REPLACE SYNONYM APPS_RO.'||DS.synonym_name|| '  FOR  '|| DS.table_owner||'.'||DS.table_name||';' script
    FROM dba_synonyms DS
    WHERE owner = 'APPS';


      ------------------ Tables List ------------------------

      /* Generate script for tables synonym for new schema
      */


    SELECT   'CREATE OR REPLACE SYNONYM APPS_RO.'||DS.TABLE_NAME|| '  FOR  '|| DS.OWNER||'.'||DS.table_name||';' script
    FROM dba_tables DS
    WHERE owner = 'APPS'
    ;


      ------------------ View List ------------------------

      /* Generate script for view synonym for new schema
      */


      SELECT   'CREATE OR REPLACE SYNONYM APPS_RO.'||DS.VIEW_NAME|| '  FOR  '|| DS.OWNER||'.'||DS.VIEW_name||';' script
      FROM dba_views DS
      WHERE owner = 'APPS';


------------------------------------ Grant SELECT(table,views) / EXECUTION(pkg,procudure,function) to Synonyms----------------------------------------

-- Connect to APPS Schema to assign rights


DECLARE
  LV_SCRIPT VARCHAR(500);
  LV_SCRIPT_PRO VARCHAR(500);
  LV_COUNTER NUMBER := 0;
  --IS_PKG_PRO_FUN_OBJ exception;
   -- pragma EXCEPTION_INIT(IS_PKG_PRO_FUN_OBJ, '-980');
 
BEGIN
 
            FOR CUR IN (
                    SELECT  'GRANT SELECT ON '||DS.synonym_name||' TO APPS_RO' SCRIPT,
                            'GRANT EXECUTE ON '||DS.synonym_name||' TO APPS_RO' SCRIPT_PRO ,
                    DS.*
                    FROM dba_synonyms DS
                    WHERE owner = 'APPS_RO'
                   -- and DS.synonym_name IN ('ACK','AP_INVOICE_DISTRIBUTIONS_ALL')
                   
             ) LOOP
           

             
                       LV_SCRIPT := CUR.SCRIPT;
                       LV_SCRIPT_PRO := CUR.SCRIPT_PRO;
                     

                       BEGIN
                       
                          EXECUTE IMMEDIATE(LV_SCRIPT);

                       
                        EXCEPTION WHEN OTHERS THEN
                         
                           BEGIN
                                 
                                EXECUTE IMMEDIATE(LV_SCRIPT_PRO);

                             EXCEPTION WHEN OTHERS THEN

                                  dbms_output.put_line(LV_SCRIPT);
                                  dbms_output.put_line(LV_SCRIPT_PRO);
                                  dbms_output.put_line('**Internal Exception ******');

                             END;
                       
                         
                       END;

             END LOOP;
           
              dbms_output.put_line('PROCESS COMPLETED');

EXCEPTION WHEN OTHERS THEN
 
       dbms_output.put_line('------------------Main Exception------------------------');

       dbms_output.put_line(LV_SCRIPT_PRO);
       dbms_output.put_line(LV_SCRIPT);

        dbms_output.put_line(SQLERRM||'~'||SQLCODE);


END;



------------------------------------------
-- Connect to APPS and execute for ('FUNCTION','PACKAGE','PROCEDURE')


BEGIN
   

    FOR CUR IN ( SELECT  'CREATE OR REPLACE SYNONYM APPS_RO.'||DP.object_name|| '  FOR  APPS.'|| DP.object_name CREATE_SYNONYME
                      ,'GRANT EXECUTE ON '||DP.object_name||' TO APPS_RO' GRANT_OBJECT
                     

              FROM DBA_PROCEDURES DP
              WHERE  1 = 1
              AND DP.OWNER = 'APPS'
              AND DP.object_type IN ('FUNCTION','PACKAGE','PROCEDURE')
              --AND DP.object_name IN('AP_INVOICES_PKG','AP_CHECKS_PKG')
              GROUP BY DP.object_name
              )
     LOOP
     
             
              EXECUTE IMMEDIATE (CUR.CREATE_SYNONYME);
              EXECUTE IMMEDIATE (CUR.GRANT_OBJECT);
         
     END LOOP;

               DBMS_OUTPUT.PUT_LINE('Process Completed !')  ;

EXCEPTION WHEN OTHERS THEN
          DBMS_OUTPUT.PUT_LINE(SQLERRM)  ;

 
END;
 

Friday 22 May 2015

Tuesday 19 May 2015

Conversion of Historical Data for Reporting Currencies and Secondary Ledgers

Conversion of Historical Data for Reporting Currencies and Secondary Ledgers

When defining a new subledger reporting currency or secondary ledger for an active primary ledger, you can use the SLA Secondary/ALC Ledger Historic Upgrade program to initialize journals.
You can determine the period from which to create ledger balances by selecting the first period for conversion. The journals are created from the selected period onwards. The first period of historic conversion should be the earliest period for which you have open transactions.
When a subledger level secondary or reporting ledger is added to an existing primary ledger, the accounting in the secondary or reporting ledger fails in the following scenarios:
  • When a final accounted transaction is reversed: A Payables invoice is created and final accounted in the primary ledger. Then, a new subledger level secondary or reporting ledger is added to this primary ledger. The same invoice is cancelled. When the Create Accounting program is run, accounting for the invoice cancellation fails for the secondary or reporting ledger, as the accounting program does not find the corresponding Invoice accounting entry to generate the transaction reversal entry (Invoice cancellation accounting) for the secondary or reporting ledger.
  • When a Payment accounting entry needs to be created using business flows: A Payables invoice is created and final accounted in the primary ledger. Then, a new subledger level secondary or reporting ledger is added to this primary ledger. A payment is generated against the same invoice. When the Create Accounting program is run, accounting for this payment fails for the secondary or reporting ledger, as the accounting program cannot find the corresponding upstream entry (Invoice accounting) to generate the downstream entry (Payment accounting) for the secondary or reporting ledger.
A new subledger level secondary/reporting ledger should not be added to an existing primary ledger that already has final accounted subledger journal entries.

Running the SLA Secondary/ALC Ledger Historic Upgrade Program

Use this procedure to run the SLA Secondary/ALC Ledger Historic Upgrade program.
Prerequisites:
Create initial balances for new ledgers:
Note: The SLA Secondary/ALC Ledger Historic Upgrade program creates journals in Oracle Subledger Accounting. These journals are created with a posting status of Posted and are never actually posted to Oracle General Ledger. To maintain historic balances in Oracle General Ledger, you must initialize balances for the new reporting currency ledger or secondary ledger.
To create initial balances for a:
  • Reporting Currency Ledger: Run the Reporting Currency: Create Opening Balance Journals in Reporting Currency program. For more information on running this program, see the Implementation Considerations, Oracle General Ledger User's Guide topic within theOracle General Ledger User's Guide.
  • Secondary Ledger: Use the Consolidation Workbench to copy initial balances. For more information on using the Consolidation Workbench, refer to the Oracle Financials Implementation Guide.
Restrictions:
  • The program cannot be used for a secondary ledger whose subledger accounting method is different from that of the primary ledger.
  • The program should be run immediately after creation of the new secondary/reporting currency ledger so that no new transactions are made between the creation of the new secondary/reporting ledger and running of the historic upgrade program.
  • All fully accounted transactions of the primary ledger must be transferred to Oracle General Ledger before running the program.
To run the SLA Secondary/ALC Ledger Historic Upgrade program:
  1. Navigate to the Submit Request form.
  2. Select SLA Secondary/ALC Ledger Historic Upgrade from the LOV in the Name field.
  3. Enter the parameters as follows:
    1. Primary Ledger: Select the primary ledger.
    2. Reporting/Secondary Ledger: Select the reporting/secondary ledger.
    3. Upgrade Start Period: Select the first period from which you wish to run the historic upgrade.
    4. Secondary Conversion Option: Select the secondary conversion option to be used when running a historic upgrade for a secondary ledger. The options are Derive from Original Transaction Rate and Use Initialization Rate.
    5. Secondary Currency Conversion Type: Select the currency conversion type or rate type to be used when running a historic upgrade for a secondary ledger.
    6. Secondary Currency Conversion Date: Select the conversion date to be used when running a historic upgrade for a secondary ledger.
    7. Mode:
      • Final: Select this value after you run the program in the Validation mode.
        This mode creates the journal entries within Oracle Subledger Accounting.
      • Validation: Select this value to run the program in Validation mode.

        Important: It is recommended to first run the program in Validation mode so that the program runs the validations that must be checked before performing the historic upgrade. If validations fail, you can view them within the log file and take action. After the program runs successfully in the Validation mode, you can run it in Final mode.
      • Recovery: Select this value to purge results after a concurrent request is terminated while in Final mode.

        Important: If you terminate the program while it is running in Final mode, then you must first run the program in Recovery mode before running the program again in Final mode. Recovery mode purges any upgrade data that may have been created during the terminated concurrent request.

    Note: In the case of a reporting currency ledger, the conversion option, rate type, and rate date are picked up from the ledger relationships defined in the Accounting Setup Manager.

Running the Upgrade Historical Subledger Transaction Accounting Program on Demand

Oracle Subledger Accounting provides a concurrent program, Upgrade Historical Subledger Transaction Accounting, that allows the historical accounting data conversion to be done independently for each subledger.
You must run the concurrent program Upgrade Historical Subledger Transaction Accounting instead of using the On Demand Upgrade Patch.
To run the Upgrade Historical Subledger Transaction Accounting, enter the following parameters:

  1. Select or enter the Application name. The list shows the application attached to the responsibility from where the concurrent program is submitted.
  2. Enter the name of the Ledger. The list shows all Primary ledgers.
  3. Enter the Start Period Name. The list shows all periods not yet upgraded and associated with the ledger selected in the above parameter.
  4. Enter the Number of Workers. The value should be greater than 1. Otherwise, the application inputs the default value of 1.
  5. Enter the Batch size. The default value is 1000.
** Copied from here under link

Thursday 14 May 2015

How to join GL tables with XLA (SubLedger Accounting) tables

GL_JE_BATCHES (je_batch_id)                   => GL_JE_HEADERS (je_batch_id)

GL_JE_HEADERS (je_header_id)                 => GL_JE_LINES (je_header_id)

GL_JE_LINES (je_header_id,je_line_num)    => GL_IMPORT_REFERENCES (je_header_id, je_line_num)

GL_IMPORT_REFERENCES (gl_sl_link_table, gl_sl_link_id)=> XLA_AE_LINES (gl_sl_link_table, gl_sl_link_id)

XLA_AE_LINES (application_id, ae_header_id)      => EADERS(application_id, ae_header_id) 

XLA_AE_HEADERS (application_id, event_id)          => XLA_EVENTS (application_id, event_id)   

XLA_EVENTS (application_id, entity_id)               => XLA.XLA_TRANSACTION_ENTITIES (application_id, entity_id)

Tuesday 12 May 2015

Chart of Accounts Segment Descriptions in Oracle eBS

SELECT GCC.CODE_COMBINATION_ID
              ,GL_FLEXFIELDS_PKG.GET_ACCOUNT_SEGMENT(GCC.CHART_OF_ACCOUNTS_ID)  GET_ACCOUNT_SEGMENT
              ,GL_FLEXFIELDS_PKG.GET_COA_NAME(GCC.CHART_OF_ACCOUNTS_ID) GET_COA_NAME
              ,GL_FLEXFIELDS_PKG.GET_CONCAT_DESCRIPTION(GCC.CHART_OF_ACCOUNTS_ID,GCC.CODE_COMBINATION_ID) GET_CONCAT_DESCRIPTION
              
                ,GCC.SEGMENT1
                ,GCC.SEGMENT2
                ,GCC.SEGMENT3
                ,GCC.SEGMENT4
                ,GCC.SEGMENT5
                ,GCC.SEGMENT6
                ,GCC.SEGMENT7
                ,GCC.SEGMENT8
                ,DECODE(GCC.SEGMENT1,NULL,'',APPS.GL_FLEXFIELDS_PKG.GET_DESCRIPTION_SQL
                                                                 (GCC.CHART_OF_ACCOUNTS_ID,1,GCC.SEGMENT1)) SEG1_DESC           
               ,DECODE(GCC.SEGMENT2,NULL,'',APPS.GL_FLEXFIELDS_PKG.GET_DESCRIPTION_SQL
                                                                ( GCC.CHART_OF_ACCOUNTS_ID,2,GCC.SEGMENT2)) SEG2_DESC 
               ,DECODE(GCC.SEGMENT3,NULL,'',APPS.GL_FLEXFIELDS_PKG.GET_DESCRIPTION_SQL
                                                                 (GCC.CHART_OF_ACCOUNTS_ID,3,GCC.SEGMENT3)) SEG3_DESC
               ,DECODE(GCC.SEGMENT4,NULL,'',APPS.GL_FLEXFIELDS_PKG.GET_DESCRIPTION_SQL
                                                                ( GCC.CHART_OF_ACCOUNTS_ID,4,GCC.SEGMENT4)) SEG4_DESC
               ,DECODE(GCC.SEGMENT5,NULL,'',APPS.GL_FLEXFIELDS_PKG.GET_DESCRIPTION_SQL
                                                                ( GCC.CHART_OF_ACCOUNTS_ID,5,GCC.SEGMENT5)) SEG5_DESC
               ,DECODE(GCC.SEGMENT6,NULL,'',APPS.GL_FLEXFIELDS_PKG.GET_DESCRIPTION_SQL
                                                               ( GCC.CHART_OF_ACCOUNTS_ID,6,GCC.SEGMENT6)) SEG6_DESC
               ,DECODE(GCC.SEGMENT7,NULL,'',APPS.GL_FLEXFIELDS_PKG.GET_DESCRIPTION_SQL
                                                               ( GCC.CHART_OF_ACCOUNTS_ID,7,GCC.SEGMENT7)) SEG7_DESC
               ,DECODE(GCC.SEGMENT9,NULL,'',APPS.GL_FLEXFIELDS_PKG.GET_DESCRIPTION_SQL
                                                               ( GCC.CHART_OF_ACCOUNTS_ID,8,GCC.SEGMENT8)) SEG8_DESC
              ,GCC.CHART_OF_ACCOUNTS_ID CHART_OF_ACCOUNTS_ID
              ,GCC.ACCOUNT_TYPE
 FROM  GL_CODE_COMBINATIONS GCC
 WHERE GCC.CHART_OF_ACCOUNTS_ID = 53662

R & D

1. Trading Community Architecture (TCA)
2. FND stands for foundation eBS tables

3. (HZ_PARTIES) HZ_XYZ it means "HUMAN ZONE". They used this code to just put parties/customers/suppliers/relationships into TCA architecture tables design. It was mostly used as part of CRM and later extended to AR and then to Suppliers

4. Application Object Library (AOL)

Find Data Base Object Source

select *
from user_source
where upper(text) like '%GONDAL%'
and type IN  ('PACKAGE','PROCEDURE','FUNTION');

Important FND Tables in EBS

FND stands for foundation tables which is combination of AOL, SYSTEM, ADMINISTRATOR, MODULES tables and is placed under FND_TOP. Below i have listed few key FND tables that along with the little description of what is it used for :
FND_APP_SERVERS : This table will track the servers used by the E-Business Suite system.
FND_DATABASES : It tracks the databases employed by the eBusiness suite. This table stores information about the database that is not instance specific.
FND_DATABASE_INSTANCES : Stores instance specific information. Every database has one or more instance.
FND_ATTACHED_DOCUMENTS : Stores information relating a document to an application entity.
FND_DOCUMENTS : Stores language-independent information about a document.
FND_CURRENCIES : Stores information about currencies.
FND_LANGUAGES : Stores information regarding languages and dialects.
FND_TERRITORIES : Stores information for countries, alternatively known as territories.
FND_CONCURRENT_PROCESSES : Stores information about concurrent managers.
FND_CONCURRENT_PROCESSORS : Stores information about immediate (subroutine) concurrent program libraries.
FND_CONCURRENT_PROGRAMS(_TL) : Stores information about concurrent programs. Each row includes a name and description of the concurrent program.
FND_CONCURRENT_QUEUES : Stores information about concurrent managers.
FND_CONCURRENT_QUEUE_SIZE : Stores information about the number of requests a concurrent manager can process at once, according to its work shift.
FND_CONCURRENT_REQUESTS : Stores information about individual concurrent requests.
FND_CONCURRENT_REQUEST_CLASS : Stores information about concurrent request types.
FND_CONC_REQ_OUTPUTS : This table stores output files created by Concurrent Request.
FND_EXECUTABLES : Stores information about concurrent program executables.
FND_DESCRIPTIVE_FLEXS(_TL) : Stores setup information about descriptive flexfields.
FND_FLEX_VALUES : Stores valid values for key and descriptive flexfield segments.
FND_FLEX_VALUE_SETS : Stores information about the value sets used by both key and descriptive flexfields.
FND_LOOKUPS : Stores information about lookup types.
FND_LOOKUP_VALUES : Stores meaning values and codes for lookup types.
FND_MENUS(_TL) : It lists the menus that appear in the Navigate Window, as determined by the System Administrator when defining responsibilities for function security.
FND_MENU_ENTRIES : Stores information about individual entries in the menus in FND_MENUS.
FND_REQUEST_GROUPS : Stores information about report security groups.
FND_REQUEST_SETS : Stores information about report sets.
FND_RESPONSIBILITY(_TL) : Stores information about responsibilities.
FND_RESP_FUNCTIONS : Stores security exclusion rules for function security menus. Security exclusion rules are lists of functions and menus inaccessible to a particular responsibility.
FND_PROFILE_OPTIONS : Stores information about profile options.
FND_SECURITY_GROUPS : Stores information about security groups used to partition data in a Service Bureau architecture.
FND_USER : Stores information about application users.
FND_APPLICATION(_TL) : Stores applications registered with Oracle Application Object Library.
FND_SEQUENCES : Stores information about the registered sequences in your applications.
FND_VIEWS : Stores information about the registered views in your applications.
FND_TABLES : Stores information about the registered tables in your applications

Find Out eBS Table Name

SELECT APPLICATION_ID,
      TABLE_ID,
      TABLE_NAME,
      USER_TABLE_NAME,
      DESCRIPTION
FROM APPLSYS.FND_TABLES
WHERE TABLE_NAME LIKE UPPER('%&TABLE_NAME%');

Friday 8 May 2015

Lookup Tabls eBS

SELECT FLV.LOOKUP_CODE, FLV.MEANING, FLV.DESCRIPTION
FROM FND_LOOKUP_TYPES FLT
     ,FND_LOOKUP_VALUES FLV
   
WHERE FLT.LOOKUP_TYPE = FLV.LOOKUP_TYPE
AND FLT.LOOKUP_TYPE = 'CHECK STATE'
AND FLT.APPLICATION_ID = 200 -- PAYABLE
AND FLV.LANGUAGE = USERENV('LANG')
AND  FLV.MEANING LIKE '%QC Hold%'

Thursday 7 May 2015

Drilldown from GL, XLA to AP Payments Transaction

SELECT apca.check_number, OU.set_of_books_id , XLAH.LEDGER_ID XLAH_LEDGER_ID,XLAL.LEDGER_ID XLAL_LEDGER_ID, GLJH.LEDGER_ID GL_LEDGER_ID,


      GLJB.NAME je_batch_name,
       GLJB.description je_batch_description,
       GLJB.running_total_accounted_dr je_batch_total_dr,
       GLJB.running_total_accounted_cr je_batch_total_cr,
       GLJB.status je_batch_status,
       GLJB.default_effective_date je_batch_effective_date,
       GLJB.default_period_name je_batch_period_name,
       GLJB.creation_date je_batch_creation_date,
       
       FDU.user_name je_batch_created_by,

       GLJH.je_category je_header_category,
       GLJH.je_source je_header_source,
       GLJH.period_name je_header_period_name,
       GLJH.NAME je_header_journal_name,
       GLJH.status je_header_journal_status,
       GLJH.creation_date je_header_created_date,
       GLJH.description je_header_description,
       GLJH.running_total_accounted_dr je_header_total_acctd_dr,
       GLJH.running_total_accounted_cr je_header_total_acctd_cr,
       
       FDU1.user_name je_header_created_by,
       
       GLJL.je_line_num je_lines_line_number,
       GLJL.ledger_id je_lines_ledger_id,
       glcc.concatenated_segments je_lines_ACCOUNT,
       GLJL.entered_dr je_lines_entered_dr,
       GLJL.entered_cr je_lines_entered_cr,
       GLJL.accounted_dr je_lines_accounted_dr,
       GLJL.accounted_cr je_lines_accounted_cr,
       GLJL.description je_lines_description,
       glcc1.concatenated_segments xla_lines_account,
       
       xlal.accounting_class_code xla_lines_acct_class_code,
       xlal.accounted_dr xla_lines_accounted_dr,
       xlal.accounted_cr xla_lines_accounted_cr,
       xlal.description xla_lines_description,
       xlal.accounting_date xla_lines_accounting_date,

       xlate.entity_code xla_trx_entity_code,
       xlate.source_id_int_1 xla_trx_source_id_int_1,
       xlate.source_id_int_2 xla_trx_source_id_int_2,
       xlate.source_id_int_3 xla_trx_source_id_int_3,
       xlate.security_id_int_1 xla_trx_security_id_int_1,
       xlate.security_id_int_2 xla_trx_security_id_int_2,
       xlate.transaction_number xla_trx_transaction_number
       
       ,APCA.CHECK_NUMBER

       
  FROM gl_je_batches GLJB,
       gl_je_headers GLJH,
       gl_je_lines GLJL,
       fnd_user FDU,
       fnd_user FDU1,
       gl_code_combinations_kfv glcc,
       gl_code_combinations_kfv glcc1,
       gl_import_references gir,
       xla_ae_lines xlal,
       xla_ae_headers xlah,
       xla_events xlae,
       xla.xla_transaction_entities xlate,
       
       ap_checks_all apca,
        HR_OPERATING_UNITS OU

 WHERE 1=1

AND GLJB.created_by = FDU.user_id
 AND GLJH.created_by = FDU1.user_id
 AND GLJB.je_batch_id = GLJH.je_batch_id
 AND GLJH.je_header_id = GLJL.je_header_id
 AND GLJL.code_combination_id = glcc.code_combination_id

 AND GLJL.je_header_id = gir.je_header_id
 AND GLJL.je_line_num = gir.je_line_num

 AND gir.gl_sl_link_table = xlal.gl_sl_link_table
 AND gir.gl_sl_link_id = xlal.gl_sl_link_id

 AND xlal.application_id = xlah.application_id
 AND xlal.ae_header_id = xlah.ae_header_id
 AND xlal.code_combination_id = glcc1.code_combination_id

 AND xlah.application_id = xlae.application_id
 AND xlah.event_id = xlae.event_id

 AND xlae.application_id = xlate.application_id
 AND xlae.entity_id = xlate.entity_id
 AND xlate.source_id_int_1 = apca.check_id

AND GLJH.je_category  in ('Payments','Purchase Invoices')

AND APCA.ORG_ID = OU.organization_id

--AND b.default_period_name       = '01_APR-2009'

and GLJH.je_header_id = 85452

 ORDER BY GLJH.je_category

AP Payments Techinical flow AP , SLA, GL

                      
SELECT AP_CHECKS_PKG.get_posting_status(ACA.CHECK_ID) Accounted_status, ACA.* 
FROM AP_CHECKS_ALL ACA
WHERE 1=1
AND ACA.CHECK_ID = 82531
--AND ACA.CHECK_NUMBER = '8299'

--------------------------------------------------
SELECT POSTED_FLAG Accounted_status, AA.*
FROM AP_INVOICE_PAYMENTS_ALL AA
WHERE AA.CHECK_ID = 82531 

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

--Please Run the following process :    **** Transfer Journal Entries to GL ***

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

-- Following  below entry created  in SLA with master entry
SELECT  xte.* 
FROM xla.xla_transaction_entities xte
WHERE 1=1
AND xte.entity_code = 'AP_PAYMENTS'
AND xte.application_id = 200 -- PAYABLE
and SOURCE_ID_INT_1 = 82531 --CHECK_ID (AP_CHECKS_ALL)
and xte.transaction_number = '8299' -- CHECK_NUMBER ( AP_CHECKS_ALL)

--------------------------------------------------
SELECT entity_id, aa.*
FROM XLA_AE_HEADERS aa
WHERE 1=1
AND aa.ENTITY_ID = 3278258 --entity_id (xla_transaction_entities)

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

SELECT *
FROM XLA_AE_LINES INV
where inv.ae_header_id = 4957030 --ae_header_id (XLA_AE_HEADERS)

Drilldown from GL, XLA to AP Invoice Transaction

SELECT  APIA.INVOICE_NUM, APIA.set_of_books_id , XLAH.LEDGER_ID XLAH_LEDGER_ID,XLAL.LEDGER_ID XLAL_LEDGER_ID, GLJH.LEDGER_ID GL_LEDGER_ID,


    GLJB.NAME JE_BATCH_NAME,
       GLJB.DESCRIPTION JE_BATCH_DESCRIPTION,
       GLJB.RUNNING_TOTAL_ACCOUNTED_DR JE_BATCH_TOTAL_DR,
       GLJB.RUNNING_TOTAL_ACCOUNTED_CR JE_BATCH_TOTAL_CR,
       GLJB.STATUS JE_BATCH_STATUS,
       GLJB.DEFAULT_EFFECTIVE_DATE JE_BATCH_EFFECTIVE_DATE,
       GLJB.DEFAULT_PERIOD_NAME JE_BATCH_PERIOD_NAME,
       GLJB.CREATION_DATE JE_BATCH_CREATION_DATE,
       
       FDU.USER_NAME JE_BATCH_CREATED_BY,

       GLJH.JE_CATEGORY JE_HEADER_CATEGORY,
       GLJH.JE_SOURCE JE_HEADER_SOURCE,
       GLJH.PERIOD_NAME JE_HEADER_PERIOD_NAME,
       GLJH.NAME JE_HEADER_JOURNAL_NAME,
       GLJH.STATUS JE_HEADER_JOURNAL_STATUS,
       GLJH.CREATION_DATE JE_HEADER_CREATED_DATE,
       GLJH.DESCRIPTION JE_HEADER_DESCRIPTION,
       GLJH.RUNNING_TOTAL_ACCOUNTED_DR JE_HEADER_TOTAL_ACCTD_DR,
       GLJH.RUNNING_TOTAL_ACCOUNTED_CR JE_HEADER_TOTAL_ACCTD_CR,
       
       FDU1.USER_NAME JE_HEADER_CREATED_BY,
       
       GLJL.JE_LINE_NUM JE_LINES_LINE_NUMBER,
       GLJL.LEDGER_ID JE_LINES_LEDGER_ID,
       GLCC.CONCATENATED_SEGMENTS JE_LINES_ACCOUNT,
       GLJL.ENTERED_DR JE_LINES_ENTERED_DR,
       GLJL.ENTERED_CR JE_LINES_ENTERED_CR,
       GLJL.ACCOUNTED_DR JE_LINES_ACCOUNTED_DR,
       GLJL.ACCOUNTED_CR JE_LINES_ACCOUNTED_CR,
       GLJL.DESCRIPTION JE_LINES_DESCRIPTION,
       GLCC1.CONCATENATED_SEGMENTS XLA_LINES_ACCOUNT,
       
       XLAL.ACCOUNTING_CLASS_CODE XLA_LINES_ACCT_CLASS_CODE,
       XLAL.ACCOUNTED_DR XLA_LINES_ACCOUNTED_DR,
       XLAL.ACCOUNTED_CR XLA_LINES_ACCOUNTED_CR,
       XLAL.DESCRIPTION XLA_LINES_DESCRIPTION,
       XLAL.ACCOUNTING_DATE XLA_LINES_ACCOUNTING_DATE,

       XLATE.ENTITY_CODE XLA_TRX_ENTITY_CODE,
       XLATE.SOURCE_ID_INT_1 XLA_TRX_SOURCE_ID_INT_1,
       XLATE.SOURCE_ID_INT_2 XLA_TRX_SOURCE_ID_INT_2,
       XLATE.SOURCE_ID_INT_3 XLA_TRX_SOURCE_ID_INT_3,
       XLATE.SECURITY_ID_INT_1 XLA_TRX_SECURITY_ID_INT_1,
       XLATE.SECURITY_ID_INT_2 XLA_TRX_SECURITY_ID_INT_2,
       XLATE.TRANSACTION_NUMBER XLA_TRX_TRANSACTION_NUMBER
       
  FROM GL_JE_BATCHES GLJB,
       GL_JE_HEADERS GLJH,
       GL_JE_LINES GLJL,

       FND_USER FDU,
       FND_USER FDU1,

       GL_CODE_COMBINATIONS_KFV GLCC,
       GL_CODE_COMBINATIONS_KFV GLCC1,
     
       GL_IMPORT_REFERENCES GIR,

       XLA_AE_LINES XLAL,
       XLA_AE_HEADERS XLAH,
       XLA_EVENTS XLAE,
       XLA.XLA_TRANSACTION_ENTITIES XLATE,
       
       AP_INVOICES_ALL APIA,
        HR_OPERATING_UNITS OU

 WHERE 1=1

AND GLJB.CREATED_BY = FDU.USER_ID
 AND GLJH.CREATED_BY = FDU1.USER_ID
 AND GLJB.JE_BATCH_ID = GLJH.JE_BATCH_ID
 AND GLJH.JE_HEADER_ID = GLJL.JE_HEADER_ID
 AND GLJL.CODE_COMBINATION_ID = GLCC.CODE_COMBINATION_ID

 AND GLJL.JE_HEADER_ID = GIR.JE_HEADER_ID
 AND GLJL.JE_LINE_NUM = GIR.JE_LINE_NUM

 AND GIR.GL_SL_LINK_TABLE = XLAL.GL_SL_LINK_TABLE
 AND GIR.GL_SL_LINK_ID = XLAL.GL_SL_LINK_ID

 AND XLAL.APPLICATION_ID = XLAH.APPLICATION_ID
 AND XLAL.AE_HEADER_ID = XLAH.AE_HEADER_ID
 AND XLAL.CODE_COMBINATION_ID = GLCC1.CODE_COMBINATION_ID

 AND XLAH.APPLICATION_ID = XLAE.APPLICATION_ID
 AND XLAH.EVENT_ID = XLAE.EVENT_ID

 AND XLAE.APPLICATION_ID = XLATE.APPLICATION_ID
 AND XLAE.ENTITY_ID = XLATE.ENTITY_ID
 AND XLATE.SOURCE_ID_INT_1 = APIA.INVOICE_ID

AND GLJH.JE_CATEGORY  IN ('PAYMENTS','PURCHASE INVOICES')



--AND B.DEFAULT_PERIOD_NAME       = '01_APR-2009'

AND GLJH.JE_HEADER_ID = 123150

 ORDER BY GLJH.JE_CATEGORY

Purchase Invoice Technical flow AP , SLA to GL


SELECT    AP_INVOICES_PKG.GET_POSTING_STATUS( AIA.INVOICE_ID) "Accounted Status"     
,APPS.AP_INVOICES_PKG.GET_APPROVAL_STATUS (
             AIA.INVOICE_ID
            ,AIA.INVOICE_AMOUNT
            ,AIA.PAYMENT_STATUS_FLAG
            ,AIA.INVOICE_TYPE_LOOKUP_CODE

            ) Approval_Status -- Invoice Staus
,AIA.*
FROM AP_INVOICES_ALL AIA
WHERE AIA.INVOICE_ID = 221309 
--AND T.INVOICE_NUM = 'TEST-IFTIKHAR'

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

SELECT    AP_INVOICES_PKG.GET_POSTING_STATUS( t.INVOICE_ID) "Accounted Status"      ,T.*
FROM AP_INVOICE_LINES_ALL T
WHERE T.INVOICE_ID = 221309 
--AND T.INVOICE_NUM = 'TEST-IFTIKHAR'

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

SELECT AP_INVOICES_PKG.GET_POSTING_STATUS( D.INVOICE_ID) "Accounting Status" ,accounting_event_id,MATCH_STATUS_FLAG ,D.*
FROM AP_INVOICE_DISTRIBUTIONS_ALL D
WHERE D.INVOICE_ID = 221309

----------------------------------------------------
SELECT *
FROM ap_payment_schedules_all AA
WHERE AA.INVOICE_ID = 221309 

----------------------------------------------------
Please Run the following process :    **** Transfer Journal Entries to GL ***

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


----  Accounting Table (Create Accounting Process ) SLA -------------------------

--Create accounting

-- Following  below entry created  in SLA with master entry
SELECT entity_id, xte.* 
FROM xla.xla_transaction_entities xte
WHERE 1=1
AND xte.entity_code = 'AP_INVOICES'
AND xte.application_id = 200 -- payable
and SOURCE_ID_INT_1 = 221309 --INVOICE_ID (AP_INVOICES_ALL)
and xte.transaction_number = 'IHG-TEST' -- INVOICE_NUM ( AP_INVOICES_ALL)

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

SELECT entity_id, aa.*
FROM XLA_AE_HEADERS aa
WHERE 1=1
AND aa.ENTITY_ID = 3278257 --entity_id (xla_transaction_entities)
--WHERE EVENT_ID = 3347721 -- accounting_event_id (AP_INVOICE_DISTRIBUTIONS_ALL)

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

SELECT *
FROM XLA_AE_LINES INV
where inv.ae_header_id = 4957029 --ae_header_id (XLA_AE_HEADERS)

Monday 4 May 2015

Oracle Apps Receivables (AR) Tables


**Transactions
RA_CUSTOMER_TRX_ALL Transaction Header table
RA_CUSTOMER_TRX_LINES_ALL Transaction Lines table along with Tax lines.
RA_CUST_TRX_LINE_GL_DIST_ALL Distribution for Transaction Lines
RA_CUST_TRX_LINE_SALESREPS_ALL Salesrep information for Transaction Lines


**Transaction Interface Tables
RA_INTERFACE_LINES_ALL Transaction Lines interface
RA_INTERFACE_SALESCREDITS_ALL Transaction Sales credit information
RA_INTERFACE_DISTRIBUTIONS_ALL Transaction Distribution information
RA_INTERFACE_ERRORS_ALL Transaction errors table
AR_PAYMENTS_INTERFACE_ALL Interface table to import receipts
AR_INTERIM_CASH_RECEIPTS_ALL Lockbox transfers the receipts that pass validation to the interim tables
AR_INTERIM_CASH_RCPT_LINES_ALL Lockbox transfers the receipts that pass validation to the interim tables


**Receipts tables
AR_CASH_RECEIPTS_ALL Cash Receipt Header tables
AR_RECEIVABLE_APPLICATIONS_ALL Stores Receipt Application details
AR_PAYMENT_SCHEDULES_ALL This table is updated when an activity occurs against an invoice, debit memo, chargeback, credit memo, on-account credit, bills receivable
AR_CASH_RECEIPT_HISTORY_ALL This Table stores all of the activity that is contained for the life cycle of a receipt.
• Each row represents one step.
• The status field for that row tells you which step the receipt has reached.
• Possible statuses are Approved, Confirmed, Remitted, Cleared, and Reversed.


**Customer Tables
HZ_PARTIES A party is an entity that can enter into a business relationship.
HZ_CUST_ACCOUNTS This table stores information about customer/financial relationships                                     established between a Party and the deploying company.
HZ_PARTY_SITES This table links a party (HZ_PARTIES) and a location                                                          (HZ_LOCATIONS) and stores location-Specific party information such                                  as a person’s mail stops at their work address.
HZ_CUST_ACCT_SITES_ALL  This table stores information about customer/financial                                                      account sites information.
HZ_CUST_SITE_USES_ALL This table stores information about the business purposes                                                  assigned to a customer account site
HZ_LOCATIONS A location is a point in geographical space                                                                    described by an address and/or geographical Indicators such as latitude or                        longitude.


------- 
Old Table ---- New Table 
------- 
RA_CUSTOMERS -- HZ_PARTIES & HZ_CUST_ACCOUNTS 
RA_ADDRESSES_ALL -- HZ_PARTY_SITES &HZ_LOC_ASSIGNMENTS 
HZ_LOCATIONS -- HZ_CUST_ACCT_SITES_ALL 
RA_SITE_USES_ALL -- HZ_CUST_SITE_USES_ALL

**Setup tables
RA_CUST_TRX_TYPES_ALL This table stores information about each transaction type for all classes of transactions, for example, invoices, commitments, and credit memos.
AR_RECEIPT_CLASSES This table stores the different receipt classes that you define.
AR_RECEIPT_METHODS This table stores information about Payment Methods, receipt attributes that you define and assign to Receipt Classes to account for receipts and their applications