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

Find Table Column List SQL Server

SELECT *
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'TABLE_NAME'

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');