DBA Data[Home] [Help]

APPS.XLA_TRANSFER_PKG SQL Statements

The following lines contain the word 'select', 'insert', 'update' or 'delete':

Line: 43

|     01-Mar-2005  Shishir Joshi   Inserting -1 value for set of books when |
|                                  inserting rows into the                  |
|                                  gl_interface_confrol table per Deborah's |
|                                  recommendation. JI is modified to        |
|                                  support intercompany functionality.      |
|     15-Apr-2005  Swapna Vellani  Added mutl-table Journal Import.         |
|     04-Aug-2005  Wynne Chan      Bug 4458381 - Public Sector Enhancements |
|     07-Oct-2005  Shishir Joshi   Trial Balance chnages. Bug 4630945       |
|     30-Nov-2005  Vinay Kumar     Bug4769315 Added filter on application_id|
|     13-Jan-2005  Vinay Kumar     Modified the logic to pick JE to transfer|
|                                  and signature of gl_transfer_main        |
|                                  Bug 4945075 Acoid creating n1_index and  |
|                                    n2_index on GL INTERFACE Table         |
|     03-Mar-2006  Vinay Kumar     Bug 5041325 Removed the procedure        |
|                                   update_gl_sl_link                       |
|     09-Mar-2006  S. Singhania    Bug 5056632.                             |
|                                    - Modified validate_input_parameters.  |
|                                    - Added paramter p_caller to           |
|                                      gl_tranfer_main                      |
|                                    - Modified select_journal_entries.     |
|                                    - Modified logic to get group_ids      |
|     02-Jun-2006 Vinay Kumar     Bug 5254655  Fix for Standalone Transfer  |
|                                      to GL                                |
|     22-Aug-2006 Ejaz Sayyed     Bug#5437400 - update gl_transfer_date in  |
|                                 set_transfer_status procedure and         |
|                                  in select_journal_entries procedure,     |
|                                 set trnsfr status code 'S'for combined mod|
|                                 and remove parameter p_ledger_id          |
|     22-Aug-2006 V. Swapna        Bug 5438564. Comment out the call to     |
|                                  validate_accounting_periods to handle    |
|                                  a performance issue.                     |
|     4-Sep-2008   rajose          bug#7320079 To pass the je_source_name   |
|                                  while spawning data manager. This helps  |
|                                  in finding the application from          |
|				   which the data manager has been spawned. |
+===========================================================================*/
-- Constants

C_LEVEL_STATEMENT     CONSTANT NUMBER := FND_LOG.LEVEL_STATEMENT;
Line: 303

| INSERT ROWS INTO THE GL_INTERFACE_CONTROL                          |
|                                                                    |
=====================================================================*/
PROCEDURE insert_interface_control(p_ledger_id NUMBER
                                   ,p_table_name VARCHAR2) IS

   l_log_module  VARCHAR2(240);
Line: 312

      l_log_module := C_DEFAULT_MODULE||'.insert_interface_control';
Line: 315

      trace('insert_interface_control.Begin',C_LEVEL_PROCEDURE,l_Log_module);
Line: 326

   INSERT INTO gl_interface_control
   (
    je_source_name,
    status,
    interface_run_id,
    group_id,
    set_of_books_id,
    packet_id,
    interface_table_name,
    processed_table_code
    )
   VALUES
   (
    g_je_source_name,
    'S',
    g_interface_run_id,
    g_group_id,
    -1,
    Decode(g_budgetary_control_flag, 'N', NULL, -3),
    p_table_name,
    'S' --7512923 Save rows in interface control table
   );
Line: 350

      trace(SQL%ROWCOUNT|| ' rows inserted into the interface control table' ,C_LEVEL_STATEMENT,l_Log_module);
Line: 354

      trace('insert_interface_control.End',C_LEVEL_PROCEDURE,l_Log_module);
Line: 361

      trace('Insert into the GL_INTERFACE_CONTROL failed',C_LEVEL_UNEXPECTED,l_Log_module);
Line: 365

END insert_interface_control;
Line: 386

PROCEDURE insert_transfer_log ( p_ledger_id NUMBER) IS

   l_log_module  VARCHAR2(240);
Line: 391

      l_log_module := C_DEFAULT_MODULE||'.insert_transfer_log';
Line: 394

      trace('insert_transfer_log.Begin',C_LEVEL_PROCEDURE,l_Log_module);
Line: 398

      trace('Inserting a row into the transfer to GL log table.',C_LEVEL_STATEMENT,l_Log_module);
Line: 401

   INSERT INTO xla_transfer_logs
     (
       application_id
      ,ledger_id
      ,parent_group_id
      ,group_id
      ,transfer_status_code
      ,CREATION_DATE
      ,CREATED_BY
      ,LAST_UPDATE_DATE
      ,LAST_UPDATED_BY
      ,LAST_UPDATE_LOGIN
      ,PROGRAM_UPDATE_DATE
      ,PROGRAM_APPLICATION_ID
      ,PROGRAM_ID
      ,REQUEST_ID
      )
   VALUES
    (
       g_application_id
      ,p_ledger_id
      ,g_parent_group_id
      ,g_group_id
      ,'INCOMPLETE'                            -- Incomplete
      ,SYSDATE
      ,g_user_id
      ,SYSDATE
      ,xla_environment_pkg.g_usr_id
      ,xla_environment_pkg.g_login_id
      ,SYSDATE
      ,xla_environment_pkg.g_prog_appl_id
      ,xla_environment_pkg.g_prog_id
      ,xla_environment_pkg.g_Req_Id
    );
Line: 437

      trace('insert_transfer_log.End',C_LEVEL_PROCEDURE,l_Log_module);
Line: 446

        (p_location => 'xla_transfer_pkg.insert_transfer_log');
Line: 447

END insert_transfer_log;
Line: 546

      UPDATE xla_transfer_logs
      SET    gllezl_request_id  = l_gllezl_request_id
      WHERE  group_id           = g_group_id;
Line: 576

      SELECT ledger_id
            ,NAME
            ,ledger_category_code
       FROM  xla_ledger_relationships_v xlr
      WHERE  xlr.primary_ledger_id         = p_ledger_id
        AND  xlr.relationship_enabled_flag = 'Y'
        AND  EXISTS (SELECT 1
                       FROM xla_ledger_options xlo
                      WHERE application_id = p_application_id
                        AND DECODE(xlr.ledger_category_code
                                   ,'ALC',xlr.ledger_id
                                   ,xlo.ledger_id) = xlr.ledger_id
                        AND DECODE(xlr.ledger_category_code
                                   ,'SECONDARY',xlo.capture_event_flag
                                   ,'N') = 'N'
                        AND DECODE(xlr.ledger_category_code
                                   ,'ALC','Y'
                                   ,xlo.enabled_flag) = 'Y')
      ORDER BY DECODE(xlr.ledger_category_code,
                     'PRIMARY',1,
                     'ALC',2
                     ,3);
Line: 619

   SELECT NAME
         ,ledger_category_code
         ,enable_budgetary_control_flag
   INTO   l_ledger_name
         ,l_ledger_category_code
         ,g_budgetary_control_flag
   FROM   gl_ledgers led
   WHERE  led.ledger_id = p_ledger_id;
Line: 681

      trace('Total number of ledgers selected = '|| g_all_ledgers_tab.COUNT,C_LEVEL_PROCEDURE,l_Log_module);
Line: 726

      SELECT xlo.transfer_to_gl_mode_code
      INTO   g_transfer_summary_mode
      FROM   xla_ledger_options xlo
      WHERE  xlo.application_id = g_application_id
      AND    xlo.ledger_id      = p_ledger_id;
Line: 737

            ,p_value_1        => 'The ledger setup is not complete. Please run Update Subledger Accounting Options program for your application '||
                                 'ledger_id = '||p_ledger_id||
                                 ' application_id = '|| g_application_id
            ,p_token_2        => 'LOCATION'
            ,p_value_2        => 'xla_events_pkg.get_ledger_options');
Line: 749

            SELECT access_set_id
            INTO   l_access_set_id
            FROM   gl_access_sets aset, gl_ledgers led
            WHERE  aset.chart_of_accounts_id = led.chart_of_accounts_id
            AND    led.ledger_id             = p_ledger_id
            AND    aset.access_set_id IN (g_access_set_id, g_sec_access_set_id)
            AND    ROWNUM = 1;
Line: 771

      SELECT implicit_access_set_id
      INTO   l_access_set_id
      FROM   gl_ledgers led
      WHERE  led.ledger_id = p_ledger_id;
Line: 1028

      SELECT group_id
            ,gllezl_request_id
      BULK COLLECT INTO
            g_group_id_tab
           ,g_gllezl_requests_tab
      FROM   xla_transfer_logs xtb1
      WHERE  application_id = g_application_id
        AND  request_id NOT IN
            ( SELECT xtb.request_id
                        FROM   xla_transfer_logs       xtb
                              ,fnd_concurrent_requests fcr
                        WHERE  xtb.application_id       = g_application_id
                        AND    xtb.transfer_status_code = 'INCOMPLETE'
                       --AND    xtb.gllezl_request_id IS NOT NULL
                        AND    xtb.request_id           = fcr.request_id
                        AND    fcr.phase_code IN ('R','P','I'));
Line: 1058

        UPDATE xla_ae_headers
        SET    group_id                = NULL
              ,gl_transfer_status_code = 'N'
              ,gl_transfer_date        = NULL
              ,program_update_date     = SYSDATE
              ,program_id              = g_program_id
              ,request_id              = g_request_id
        WHERE  group_id = g_group_id_tab(i);
Line: 1069

        trace(SQL%ROWCOUNT || ' Headers updated.',C_LEVEL_STATEMENT,l_log_module);
Line: 1076

        DELETE xla_transfer_logs
        WHERE  group_id = g_group_id_tab(i);
Line: 1085

         DELETE xla_transfer_ledgers
         WHERE  group_id = g_group_id_tab(i);
Line: 1094

            trace(SQL%ROWCOUNT || 'Rows deleted from the XLA_TRANSFER_LEDGERS',C_LEVEL_STATEMENT,l_log_module);
Line: 1109

              trace('Calling gl_journal_import_sla_pkg.delete_batches',C_LEVEL_EVENT,l_log_module);
Line: 1111

             gl_journal_import_sla_pkg.delete_batches
                (x_je_source_name => g_je_source_name
                ,x_group_id       => g_primary_ledgers_tab(i).group_id
                );
Line: 1166

      trace('Number of ledgers selected for a period validation = ' ||g_all_ledgers_tab.count,C_LEVEL_STATEMENT,l_log_module);
Line: 1183

   SELECT actual_flag,budget_flag,encumbrance_flag
   INTO   l_actual_flag, l_budget_flag, l_encum_flag
   FROM (SELECT MAX(DECODE(NVL(ALLOW_ACTUALS_FLAG,'N'),'Y','Y','Z')) actual_flag
               ,MAX(DECODE(NVL(ALLOW_BUDGETS_FLAG,'N'),'Y','Y','Z')) budget_flag
               ,MAX(DECODE(NVL(ALLOW_encumbrance_FLAG,'N'),'Y','Y','Z')) encumbrance_flag
         FROM   xla_event_class_attrs
         WHERE  application_id     = g_application_id
         GROUP BY allow_actuals_flag, allow_budgets_flag, allow_encumbrance_flag
         ORDER BY actual_flag,budget_flag,encumbrance_flag)
   WHERE ROWNUM = 1;
Line: 1208

         'SELECT DISTINCT aeh.period_name
                        ,aeh.ledger_id
         FROM   xla_ae_headers aeh
               ,gl_period_statuses gps
               ,TABLE (CAST(:1 AS XLA_NUMBER_ARRAY_TYPE))led
         WHERE  aeh.application_id                  = :2                --g_application_id
         AND    aeh.ledger_id                       = led.column_value
         AND    aeh.entity_id                       = :3                --g_entity_id
         AND    aeh.gl_transfer_status_code         = ''N''
         AND    aeh.accounting_entry_status_code    = ''F''
         AND    aeh.balance_type_code               = ''A''
         AND    gps.application_id                  = 101
         AND    gps.ledger_id                       = aeh.ledger_id
         AND    gps.period_name                     = aeh.period_name
         AND    NVL(gps.adjustment_period_flag,''N'') = ''N''
         AND    gps.closing_status IN (''C'',''N'',''P'')';
Line: 1273

         SELECT DISTINCT gps.period_year
                       ,gbv.budget_name
         FROM    xla_ae_headers           aeh
               ,gl_period_statuses       gps
               ,gl_budget_period_ranges  gbp
               ,gl_budget_versions       gbv
               ,TABLE (CAST(:1 AS XLA_NUMBER_ARRAY_TYPE))led
         WHERE aeh.application_id      = :2
         AND   aeh.ledger_id           = led.column_value
         AND   aeh.balance_type_code   = ''B''
         AND   aeh.entity_id           = :3 --g_entity_id
         AND   aeh.gl_transfer_status_code         = ''N''
         AND   aeh.accounting_entry_status_code    = ''F''
         AND   gps.application_id                  = 101
         AND   gps.ledger_id                       = aeh.ledger_id
         AND   gps.period_name                     = aeh.period_name
         AND   NVL(gps.adjustment_period_flag,''N'') = ''N''
         AND   gps.period_year                     = gbp.period_year
         AND   aeh.budget_version_id               = gbp.budget_version_id
         AND   gbp.open_flag                       <> ''O''
         AND   gbv.budget_version_id               = aeh.budget_version_id ';
Line: 1334

           ' SELECT DISTINCT aeh.ledger_id
                   ,gll.latest_encumbrance_year
           FROM    xla_ae_headers        aeh
                  ,gl_period_statuses         gps
                  ,gl_ledgers                 gll
                  ,TABLE (CAST(:1 AS XLA_NUMBER_ARRAY_TYPE))led
            WHERE aeh.application_id      = :2                  --g_application_id
            AND   aeh.entity_id           = :3                  --g_entity_id
            AND   aeh.ledger_id           = led.column_value
            AND   aeh.balance_type_code   = ''E''
            AND   aeh.ledger_id           = gll.ledger_id
            AND   aeh.gl_transfer_status_code         = ''N''
            AND   aeh.accounting_entry_status_code    = ''F''
            AND   gps.application_id                  = 101
            AND   gps.ledger_id                       = aeh.ledger_id
            AND   gps.period_name                     = aeh.period_name
            AND   gps.period_year                     > gll.latest_encumbrance_year ';
Line: 1391

        'SELECT DISTINCT aeh.period_name
                        ,aeh.ledger_id
        FROM    xla_ae_headers             aeh
               ,gl_period_statuses         gps
               ,xla_transaction_entities   xte
               ,xla_event_types_b          xet
               ,xla_event_class_attrs      xec
               ,xla_ledger_relationships_v xlr
               ,TABLE (CAST(:1 AS XLA_NUMBER_ARRAY_TYPE))led
         WHERE xte.entity_id           = aeh.entity_id
         AND   aeh.application_id      = :2 --g_application_id
         AND   aeh.ledger_id           = led.column_value
         AND   aeh.accounting_date    <= :3 --g_end_date
         AND   aeh.balance_type_code   = ''A''
         AND   aeh.ledger_id           = xlr.ledger_id
         AND   xte.entity_code         = xec.entity_code
         AND   xte.application_id      = xec.application_id
         AND   xec.application_id      = xet.application_id
         AND   xec.entity_code         = xet.entity_code
         AND   xec.event_class_code    = xet.event_class_code
         AND   xec.event_class_group_code
                                       = NVL(:4,xec.event_class_group_code)
         AND   xet.event_type_code     = aeh.event_type_code
         AND   xet.application_id      = aeh.application_id
         AND   xet.entity_code         = xte.entity_code
         AND   aeh.gl_transfer_status_code         = ''N''
         AND   aeh.accounting_entry_status_code    = ''F''
         AND   gps.application_id                  = 101
         AND   gps.ledger_id                       = aeh.ledger_id
         AND   gps.period_name                     = aeh.period_name
         AND   NVL(gps.adjustment_period_flag,''N'') = ''N''
         AND   gps.closing_status IN (''C'',''N'',''P'')'
         || g_transaction_security;
Line: 1471

        SELECT DISTINCT gps.period_year
                       ,gbv.budget_name
        FROM    xla_ae_headers           aeh
               ,xla_transaction_entities xte
               ,xla_event_types_b        xet
               ,xla_event_class_attrs    xec
               ,gl_period_statuses       gps
               ,gl_budget_period_ranges  gbp
               ,gl_budget_versions       gbv
               ,TABLE (CAST(:1 AS XLA_NUMBER_ARRAY_TYPE))led
         WHERE xte.entity_id           = aeh.entity_id
         AND   aeh.application_id      = :2
         AND   aeh.ledger_id           = led.column_value
         AND   aeh.accounting_date    <= :3 --g_end_date
         AND   aeh.balance_type_code   = ''B''
         AND   xte.entity_code         = xec.entity_code
         AND   xte.application_id      = xec.application_id
         AND   xec.application_id      = xet.application_id
         AND   xec.entity_code         = xet.entity_code
         AND   xec.event_class_code    = xet.event_class_code
         AND   xec.event_class_group_code
                                       = NVL(:4,xec.event_class_group_code)
         AND   xet.event_type_code     = aeh.event_type_code
         AND   xet.application_id      = aeh.application_id
         AND   xet.entity_code         = xte.entity_code
         AND   aeh.gl_transfer_status_code         = ''N''
         AND   aeh.accounting_entry_status_code    = ''F''
         AND   gps.application_id                  = 101
         AND   gps.ledger_id                       = aeh.ledger_id
         AND   gps.period_name                     = aeh.period_name
         AND   NVL(gps.adjustment_period_flag,''N'') = ''N''
         AND   gps.period_year                     = gbp.period_year
         AND   aeh.budget_version_id               = gbp.budget_version_id
         AND   gbp.open_flag                       <> ''O''
         AND   gbv.budget_version_id               = aeh.budget_version_id '
         || g_transaction_security;
Line: 1547

           ' SELECT DISTINCT aeh.ledger_id
                          ,gll.latest_encumbrance_year
           FROM    xla_ae_headers        aeh
                  ,gl_period_statuses         gps
                  ,xla_transaction_entities   xte
                  ,xla_event_types_b          xet
                  ,xla_event_class_attrs      xec
                  ,gl_ledgers                 gll
                  ,TABLE (CAST(:1 AS XLA_NUMBER_ARRAY_TYPE))led
            WHERE xte.entity_id           = aeh.entity_id
            AND   aeh.application_id      = :2 --g_application_id
            AND   aeh.ledger_id           = led.column_value
            AND   aeh.accounting_date    <= :3 --g_end_date
            AND   aeh.balance_type_code   = ''E''
            AND   aeh.ledger_id           = gll.ledger_id
            AND   xte.entity_code         = xec.entity_code
            AND   xte.application_id      = xec.application_id
            AND   xec.application_id      = xet.application_id
            AND   xec.entity_code         = xet.entity_code
            AND   xec.event_class_code    = xet.event_class_code
            AND   xec.event_class_group_code = NVL(:4,xec.event_class_group_code)
            AND   xet.event_type_code     = aeh.event_type_code
            AND   xet.application_id      = aeh.application_id
            AND   xet.entity_code         = xte.entity_code
            AND   aeh.gl_transfer_status_code         = ''N''
            AND   aeh.accounting_entry_status_code    = ''F''
            AND   gps.application_id                  = 101
            AND   gps.ledger_id                       = aeh.ledger_id
            AND   gps.period_name                     = aeh.period_name
            AND   gps.period_year                     > gll.latest_encumbrance_year '
            || g_transaction_security;
Line: 1632

  THE PROCEDURE selects AND marks THE journal entries
*====================================================================*/
-- removed parameter p_ledger_id
PROCEDURE select_journal_entries IS
    l_statement   VARCHAR2(4000);
Line: 1641

      l_log_module := C_DEFAULT_MODULE||'.select_journal_entries';
Line: 1645

      trace('select_journal_entries.Begin',C_LEVEL_PROCEDURE,l_log_module);
Line: 1648

      trace('Number of ledgers selected = ' || g_ledger_id_tab.COUNT,C_LEVEL_STATEMENT,l_log_module);
Line: 1662

            UPDATE /*+ index(XLA_AE_HEADERS,XLA_AE_HEADERS_N1) */
               xla_ae_headers
            SET    gl_transfer_date             = sysdate,
                   gl_transfer_status_code      = 'S'
            WHERE  application_id               = g_application_id
            AND    ledger_id                    = g_ledger_id_tab(i)
            AND    group_id                     = g_group_id
            AND    gl_transfer_status_code      = 'N'
            AND    accounting_entry_status_code = 'F';
Line: 1676

            trace('Selecting journal entris for the document ' || g_entity_id,C_LEVEL_STATEMENT,l_log_module);
Line: 1679

            UPDATE xla_ae_headers aeh
            SET    program_update_date          = SYSDATE,
                   program_id                   = g_program_id,
                   request_id                   = g_request_id,
                   group_id                     = g_group_id,
                   gl_transfer_date             = sysdate,
                   gl_transfer_status_code      = 'S'
            WHERE  application_id               = g_application_id
            AND    ledger_id                    = g_ledger_id_tab(i)
            AND    gl_transfer_status_code      = 'N'
            AND    entity_id                    = g_entity_id
            AND    accounting_entry_status_code = 'F';
Line: 1696

            trace('Selecting journal entries for the accounting batch id ' || g_accounting_batch_id,C_LEVEL_STATEMENT,l_log_module);
Line: 1699

           UPDATE xla_ae_headers aeh
           SET    program_update_date          = SYSDATE,
                  program_id                   = g_program_id,
                  group_id                     = g_group_id,
                  gl_transfer_date             = SYSDATE,
                  gl_transfer_status_code      = 'S'
           WHERE  application_id               = g_application_id
           AND    ledger_id                    = g_ledger_id_tab(i)
           AND    gl_transfer_status_code      = 'N'
           AND    accounting_batch_id          = g_accounting_batch_id
           AND    accounting_entry_status_code = 'F';
Line: 1718

           UPDATE xla_ae_headers aeh
           SET    program_update_date          = SYSDATE,
                  program_id                   = g_program_id,
                  request_id                   = g_request_id,
                  gl_transfer_date             = sysdate,
                  gl_transfer_status_code      = 'S',
                  group_id                     = g_group_id
           WHERE  application_id               = g_application_id
           AND    ledger_id                    = g_ledger_id_tab(i)
           AND    entity_id                    = g_entity_id
           AND    gl_transfer_status_code      = 'N'
           AND    accounting_entry_status_code = 'F'
           ;
Line: 1740

               ' UPDATE
               (SELECT /*+ leading(aeh,xet,xte) use_hash(xet,xec,xeca) use_nl(xte)
                swap_join_inputs(xet) swap_join_inputs(xec) swap_join_inputs(xeca) */
                aeh.program_update_date -- added hint per performance change 7259699
                      ,aeh.program_id
                      ,aeh.request_id
                      ,aeh.gl_transfer_date
                      ,aeh.gl_transfer_status_code
                      ,aeh.group_id
                FROM   xla_ae_headers           aeh
                      ,xla_transaction_entities xte
                      ,xla_event_types_b        xet
                      ,xla_event_class_attrs    xeca
                      ,xla_event_classes_b      xec
                WHERE xte.entity_id           = aeh.entity_id
                AND   xte.application_id      = :1 --g_application_id
                AND   aeh.application_id      = xte.application_id
                AND   aeh.ledger_id           = :2 --g_ledger_id_tab(i)
                AND   aeh.accounting_date    <= :3 --g_end_date
                AND   xte.entity_code         = xec.entity_code
                AND   xeca.application_id      = xec.application_id
                AND   xeca.event_class_code    = xec.event_class_code
                AND   xeca.entity_code         = xec.entity_code
                AND   xeca.event_class_group_code = Nvl(:4,xeca.event_class_group_code)
                AND   xec.event_class_code     = xet.event_class_code
                AND   xet.event_type_code      = aeh.event_type_code
                AND   xet.application_id       = aeh.application_id
                AND   xec.application_id       = xet.application_id
                AND   xet.event_class_code     = xec.event_class_code
                AND   aeh.gl_transfer_status_code         = ''N''
                AND   aeh.accounting_entry_status_code    = ''F''
               '
                || g_transaction_security
                || ' ) SET program_update_date = SYSDATE
                 ,program_id                   = :5 --g_program_id
                 ,request_id                   = :6 --g_request_id
                 ,gl_transfer_date             = Sysdate
                 ,group_id                     = :7 --g_group_id
                 ,gl_transfer_status_code      = ''S''';
Line: 1808

         trace('Total journal entries selected = ' || l_je_count,C_LEVEL_STATEMENT,l_log_module);
Line: 1840

      trace('select_journal_entries.End',C_LEVEL_PROCEDURE,l_log_module);
Line: 1850

      (p_location => 'xla_transfer_pkg.select_journal_entries');
Line: 1851

END select_journal_entries;
Line: 1886

   SELECT js.je_source_name
         ,user_je_source_name
   INTO   g_je_source_name
         ,g_user_source_name
   FROM   gl_je_sources  js
         ,xla_subledgers xsl
   WHERE  xsl.application_id = g_application_id
   AND    js.je_source_name  = xsl.je_source_name;
Line: 1910

     gl_interface_insert

  DESCRIPTION
   Inserts ROWS INTO THE GL_ITERFACE TABLE

  SCOPE - PRIVATE

  EXTERNAL PROCEDURES/FUNCTIONS ACCESSED

  ARGUMENTS


  NOTES

 +===========================================================================*/

PROCEDURE insert_gl_interface IS
  l_log_module  VARCHAR2(240);
Line: 1934

      l_log_module := C_DEFAULT_MODULE||'.insert_gl_interface';
Line: 1938

      trace('gl_interface_insert.Begin',C_LEVEL_PROCEDURE,l_log_module);
Line: 1972

      l_statement := 'INSERT INTO '||g_gl_interface_table_name||
          '(
        status,                           ledger_id
       ,user_je_source_name,              user_je_category_name
       ,accounting_date
       ,currency_code
       ,date_created,                     created_by
       ,actual_flag
       ,budget_version_id
       ,encumbrance_type_id
       ,code_combination_id,              stat_amount
       ,entered_dr
       ,entered_cr
       ,accounted_dr
       ,accounted_cr
       ,reference1
       ,reference4
       ,reference5
       ,reference10
       ,reference11
       ,subledger_doc_sequence_id
       ,subledger_doc_sequence_value
       ,gl_sl_link_table
       ,gl_sl_link_id
       ,request_id
       ,ussgl_transaction_code
       ,je_header_id,                     group_id
       ,period_name,                      jgzz_recon_ref
       ,reference_date
       ,funds_reserved_flag
       ,reference25
       ,reference26
       ,reference27
       ,reference28
       ,reference29
       ,reference30
       )
   SELECT /*+ ordered index(aeh,xla_ae_headers_n1) use_nl(jc,led,ael,gps) */
           ''NEW'',                        aeh.ledger_id
           ,:1     ,                       jc.user_je_category_name
          ,DECODE(:2, ''P'' , gps.end_date , aeh.accounting_date)
          ,DECODE(aeh.balance_type_code , ''E'' , led.currency_code , ael.currency_code)
          ,SYSDATE,                        :3
          ,aeh.balance_type_code
          ,aeh.budget_version_id
          ,ael.encumbrance_type_id         -- 4458381
          ,ael.code_combination_id,        ael.statistical_amount
          ,DECODE(aeh.balance_type_code, ''E'', ael.accounted_dr, ael.entered_dr) -- 4458381
          ,DECODE(aeh.balance_type_code, ''E'', ael.accounted_cr, ael.entered_cr) -- 4458381
          ,accounted_dr
          ,accounted_cr
          ,:4                               -- Reference1
          ,DECODE(reference_date , NULL , NULL
                  ,TO_CHAR(reference_date,''DD-MON-YYYY''))||
           DECODE(:5 , ''A'' , TO_CHAR(aeh.accounting_date ,''DD-MON-YYYY'')
                  ,''P'' ,aeh.period_name
                  ,''D'' ,aeh.ae_header_id)  --Reference4
          ,DECODE(:6,''D'',substrb(aeh.description,1,240),null)
          ,DECODE(DECODE(:7,''D'',''D'',''S'')||ael.gl_transfer_mode_code
                 ,''SS'',null,substrb(ael.description,1,240))
          ,DECODE(:8||ael.gl_transfer_mode_code,
                  ''AS'',jgzz_recon_ref,
                  ''PS'',jgzz_recon_ref,
                  aeh.ae_header_id||''-''||ael.ae_line_num) -- Reference11
          ,aeh.doc_sequence_id
          ,aeh.doc_sequence_value
          ,ael.gl_sl_link_table
          ,ael.gl_sl_link_id
          ,:9
          ,ael.ussgl_transaction_code
          ,aeh.ae_header_id,             :10
          ,aeh.period_name,              ael.jgzz_recon_ref
          ,aeh.reference_date
	  ,decode(led.enable_budgetary_control_flag
                ,''Y'',
                   decode(aeh.funds_status_code, ''A'', ''Y'', ''S'', ''Y'', ''P'', ''Y'', NULL)
                  ,''Y'')
           ,aeh.entity_id
           ,aeh.event_id
           ,ael.ae_header_id
           ,ael.ae_line_num
           ,ael.accounted_dr
           ,ael.accounted_cr
   FROM   xla_ae_headers     aeh
         ,xla_ae_lines       ael
         ,gl_je_categories   jc
         ,gl_period_statuses gps
         ,gl_ledgers         led
   WHERE ael.application_id        = aeh.application_id
   AND   ael.ae_header_id          = aeh.ae_header_id
   AND   aeh.group_id              = :11
   AND   aeh.application_id        = :12                --4769315
   AND   aeh.je_category_name      = jc.je_category_name
   AND   gps.application_id        = 101
   AND   gps.ledger_id             = aeh.ledger_id
   AND   led.ledger_id             = gps.ledger_id
   AND   aeh.period_name           = gps.period_name
   AND   aeh.gl_transfer_status_code = ''S''';
Line: 2099

      trace(SQL%ROWCOUNT || '   rows are inserted into the GL_INTERFACE table',C_LEVEL_STATEMENT,l_log_module);
Line: 2104

      trace(SQL%ROWCOUNT || '   rows are inserted into the GL_INTERFACE table',C_LEVEL_STATEMENT,l_log_module);
Line: 2111

      trace('gl_interface_insert.End',C_LEVEL_PROCEDURE,l_log_module);
Line: 2118

      (p_location => 'xla_transfer_pkg.gl_interface_insert');
Line: 2119

END insert_gl_interface;
Line: 2195

               trace('selecting from gl interface '|| g_gl_interface_table_name,C_LEVEL_PROCEDURE,l_log_module);
Line: 2201

          'select  status   from ' ||g_gl_interface_table_name||
          ' where user_je_source_name= :1
           and group_id = :2
           and request_id = :4
           and status like ''E%''
           and rownum=1 ' into l_gl_status
           using g_user_source_name,g_primary_ledgers_tab(i).group_id, g_primary_ledgers_tab(i).gllezl_request_id;
Line: 2291

 |  Updates the transfer to GL status to yes to indicate that journal entries|
 |  have been transferred successfully.                                      |
 | SCOPE - PRIVATE                                                           |
 |                                                                           |
 | EXTERNAL PROCEDURES/FUNCTIONS ACCESSED                                    |
 |                                                                           |
 | ARGUMENTS                                                                 |
 |                                                                           |
 | NOTES                                                                     |
 |                                                                           |
 +===========================================================================*/
PROCEDURE set_transfer_status IS
   l_log_module  VARCHAR2(240);
Line: 2320

      UPDATE /*+ index(XLA_AE_HEADERS,XLA_AE_HEADERS_N1) */
             xla_ae_headers
      SET    gl_transfer_status_code = 'Y',
             gl_transfer_date        = sysdate -- bug#5437400
      WHERE  group_id                = g_group_id_tab(i)
        AND  application_id          = g_application_id;  --4769315
Line: 2338

 |    delete_transfer_log                                                    |
 |                                                                           |
 | DESCRIPTION                                                               |
 |  Deletes the transfer to GL log.                                          |
 |                                                                           |
 | SCOPE - PRIVATE                                                           |
 |                                                                           |
 |                                                                           |
 | EXTERNAL PROCEDURES/FUNCTIONS ACCESSED                                    |
 |                                                                           |
 | ARGUMENTS                                                                 |
 |                                                                           |
 | NOTES                                                                     |
 |                                                                           |
 +===========================================================================*/
PROCEDURE delete_transfer_log IS
   l_log_module  VARCHAR2(240);
Line: 2357

      l_log_module := C_DEFAULT_MODULE||'.delete_transfer_log';
Line: 2361

      trace('delete_transfer_log.Begin',C_LEVEL_PROCEDURE,l_log_module);
Line: 2371

      DELETE xla_transfer_logs
      WHERE group_id = g_group_id_tab(i);
Line: 2375

      trace('delete_transfer_log.End',C_LEVEL_PROCEDURE,l_log_module);
Line: 2380

     (p_location => 'xla_transfer_pkg.delete_transfer_log');
Line: 2381

END delete_transfer_log;
Line: 2385

 |    insert_secondary_ledgers                                               |
 |                                                                           |
 | DESCRIPTION                                                               |
 |  Keeps track of journal entries transferred for secondary ledgers         |
 |                                                                           |
 | SCOPE - PRIVATE                                                           |
 |                                                                           |
 |                                                                           |
 | EXTERNAL PROCEDURES/FUNCTIONS ACCESSED                                    |
 |                                                                           |
 | ARGUMENTS                                                                 |
 |    p_secondary_ledger_id -- Secondary ledger identifier                   |                    |
 | NOTES                                                                     |
 |                                                                           |
 +===========================================================================*/
PROCEDURE insert_secondary_ledgers ( p_secondary_ledger_id  IN NUMBER ) IS
   l_log_module  VARCHAR2(240);
Line: 2404

      l_log_module := C_DEFAULT_MODULE||'.insert_secondary_ledgers';
Line: 2408

      trace('insert_secondary_ledgers.Begin',C_LEVEL_PROCEDURE,l_log_module);
Line: 2412

      trace('insert_secondary_ledgers.End',C_LEVEL_PROCEDURE,l_log_module);
Line: 2414

   INSERT INTO xla_transfer_ledgers
      (GROUP_ID
      ,SECONDARY_LEDGER_ID
      ,PRIMARY_LEDGER_ID
      ,CREATION_DATE
      ,CREATED_BY
      ,LAST_UPDATE_DATE
      ,LAST_UPDATED_BY
      ,LAST_UPDATE_LOGIN
      ,PROGRAM_UPDATE_DATE
      ,PROGRAM_APPLICATION_ID
      ,PROGRAM_ID
      ,REQUEST_ID
      )
   VALUES
      (g_group_id
      ,p_secondary_ledger_id
      ,g_primary_ledger_id
      ,SYSDATE
      ,g_user_id
      ,SYSDATE
      ,xla_environment_pkg.g_usr_id
      ,xla_environment_pkg.g_login_id
      ,SYSDATE
      ,xla_environment_pkg.g_prog_appl_id
      ,xla_environment_pkg.g_prog_id
      ,xla_environment_pkg.g_Req_Id
      );
Line: 2445

     (p_location => 'xla_transfer_pkg.insert_secondary_ledgers');
Line: 2446

END insert_secondary_ledgers;
Line: 2453

 |  The procedure performs the finishing tasks after inserting journal       |
 |  entries into the GL interface table.                                     |
 |                                                                           |
 |                                                                           |
 | SCOPE - PRIVATE                                                           |
 |                                                                           |
 |                                                                           |
 | EXTERNAL PROCEDURES/FUNCTIONS ACCESSED                                    |
 |                                                                           |
 | ARGUMENTS                                                                 |
 |     p_submit_gl_post  Submit GL post                                      |
 |                                                                           |
 | NOTES                                                                     |
 |                                                                           |
 +===========================================================================*/

PROCEDURE complete_batch(p_submit_gl_post VARCHAR2) IS
   l_req_id      NUMBER;
Line: 2506

            trace('Inserting a row into the XLA_TRANSFER_LEDGERS table.',C_LEVEL_STATEMENT,l_log_module);
Line: 2509

         insert_secondary_ledgers
            (p_secondary_ledger_id => g_primary_ledgers_tab(i).ledger_id
            );
Line: 2534

      delete_transfer_log;
Line: 2599

   SELECT COUNT(1)
     INTO l_cnt
     FROM xla_tb_definitions_b    xtd
         ,xla_tb_defn_je_sources  xjs
    WHERE xtd.definition_code = xjs.definition_code
      AND xjs.je_source_name  = p_je_source_name
      and xtd.ledger_id       = p_ledger_id;
Line: 2780

      g_group_id_tab.DELETE;
Line: 2821

         g_ledger_id_tab.DELETE;
Line: 2832

            SELECT gl_journal_import_s.NEXTVAL
            INTO   g_primary_ledgers_tab(i).interface_run_id
            FROM   dual;
Line: 2836

            SELECT gl_journal_import_s.NEXTVAL
                  ,gl_interface_control_s.NEXTVAL
            INTO   g_primary_ledgers_tab(i).interface_run_id
                  ,g_primary_ledgers_tab(i).group_id
            FROM   dual;
Line: 2874

               trace('Ledgers selected for the processing',C_LEVEL_STATEMENT,l_log_module);
Line: 2887

            trace('Inserting an entry into the audit table',C_LEVEL_STATEMENT,l_log_module);
Line: 2892

         select_journal_entries;
Line: 2899

            insert_transfer_log(g_primary_ledgers_tab(i).ledger_id);
Line: 2903

            insert_gl_interface;
Line: 2906

                  insert_interface_control
                     (p_ledger_id        => g_primary_ledgers_tab(i).ledger_id
                     ,p_table_name       => g_gl_interface_table_name
                     );
Line: 3018

      delete_transfer_log;
Line: 3027

      UPDATE xla_ae_headers
        SET    group_id                = NULL
              ,gl_transfer_status_code = 'N'
              ,gl_transfer_date        = NULL
              ,program_update_date     = SYSDATE
              ,program_id              = g_program_id
              ,request_id              = g_request_id
        WHERE  group_id = g_primary_ledgers_tab(i).group_id;
Line: 3036

  delete_transfer_log;