DBA Data[Home] [Help]

APPS.XLA_DATAFIXES_PUB SQL Statements

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

Line: 102

PROCEDURE delete_journal_entries
  (p_api_version                IN  NUMBER
  ,p_init_msg_list              IN  VARCHAR2
  ,p_application_id             IN  INTEGER
  ,p_event_id                   IN  INTEGER
  ,x_return_status              OUT NOCOPY VARCHAR2
  ,x_msg_count                  OUT NOCOPY NUMBER
  ,x_msg_data                   OUT NOCOPY VARCHAR2
) IS

  l_api_name          CONSTANT VARCHAR2(30) := 'delete_journal_entries';
Line: 121

     l_log_module := C_DEFAULT_MODULE||'.delete_journal_entries';
Line: 125

     trace(p_msg    => 'BEGIN of procedure delete_journal_entries',
           p_module => l_log_module,
           p_level  => C_LEVEL_PROCEDURE);
Line: 150

  SELECT MAX(NVL(gl_transfer_status_code,'N'))  -- N, NT, S, Y
  INTO   l_gl_transfer_status_code
  FROM   xla_ae_headers
  WHERE  application_id = p_application_id
  AND    event_id       = p_event_id;
Line: 168

                           '  Journal entries cannot be deleted because it has either been Transferred or set to Not Transferred.',
               p_module => l_log_module,
               p_level  => C_LEVEL_STATEMENT);
Line: 173

              ,p_error_msg => 'Journal entries cannot be deleted because it has either been Transferred or set to Not Transferred.');
Line: 182

         trace(p_msg    => 'Calling xla_journal_entries_pkg.delete_journal_entries.',
               p_module => l_log_module,
               p_level  => C_LEVEL_STATEMENT);
Line: 187

     xla_journal_entries_pkg.delete_journal_entries
        (p_application_id      => p_application_id
        ,p_event_id            => p_event_id);
Line: 195

         trace(p_msg    => 'Update xla_events event_id'||p_event_id||' to Unprocessed.',
               p_module => l_log_module,
               p_level  => C_LEVEL_STATEMENT);
Line: 199

     UPDATE XLA_EVENTS
     SET    EVENT_STATUS_CODE   = xla_events_pub_pkg.C_EVENT_UNPROCESSED
           ,PROCESS_STATUS_CODE = xla_events_pkg.C_INTERNAL_UNPROCESSED
     WHERE  application_id      = p_application_id
     AND    event_id            = p_event_id;
Line: 215

    trace(p_msg    => 'END of procedure delete_journal_entries',
          p_module => l_log_module,
          p_level  => C_LEVEL_PROCEDURE);
Line: 241

END delete_journal_entries;
Line: 249

   a) delete the incomplete MPA
   b) calls Create_Reversal_Entry of the ae_header_id to create the reversal of
      the original entry, returning the new rev_ae_header_id and rev_event_id
      i) calls Complete_Journal_Entry with rev_ae_header_id, p_event_id and
         p_rev_flag = 'Y' to validate the reversal entry rev_ae_header_id and on
         success,
         -> calls Create_MRC_Reversal_Entry to create reversal of all other
            ledgers and entries related to the original entry p_event_id.
   c) Create a new event and entity, and map the original entry to the new
      event id and entity id.
==============================================================================*/
PROCEDURE reverse_journal_entries
  (p_api_version           IN  NUMBER
  ,p_init_msg_list         IN  VARCHAR2
  ,p_application_id        IN  INTEGER
  ,p_event_id              IN  INTEGER
  ,p_reversal_method       IN  VARCHAR2
  ,p_gl_date               IN  DATE
  ,p_post_to_gl_flag       IN  VARCHAR2
  ,x_return_status         OUT NOCOPY VARCHAR2
  ,x_msg_count             OUT NOCOPY NUMBER
  ,x_msg_data              OUT NOCOPY VARCHAR2
  ,x_rev_ae_header_id      OUT NOCOPY INTEGER
  ,x_rev_event_id          OUT NOCOPY INTEGER
  ,x_rev_entity_id         OUT NOCOPY INTEGER
  ,x_new_event_id          OUT NOCOPY INTEGER
  ,x_new_entity_id         OUT NOCOPY INTEGER
) IS

  l_api_name          CONSTANT VARCHAR2(30) := 'reverse_journal_entries';
Line: 287

  SELECT xgl.currency_code, xsu.je_source_name,
         xah.entity_id,     xah.accounting_date,
         xah.ledger_id,     e.legal_entity_id,  xah.accrual_reversal_flag,
         xe.budgetary_control_flag
  FROM   xla_gl_ledgers_v xgl
       , xla_ae_headers   xah
       , xla_subledgers   xsu
       , xla_transaction_entities e
       , xla_events       xe
  WHERE xgl.ledger_id      = xah.ledger_id
  AND xsu.application_id   = xah.application_id
  AND xah.event_id         = p_event_id
  AND xah.application_id   = p_application_id
  AND ledger_category_code ='PRIMARY'
  AND e.application_id     = xah.application_id
  AND e.entity_id	   = xah.entity_id
  AND xe.application_id    = xah.application_id
  AND xe.event_id          = xah.event_id
  AND xah.accounting_entry_status_code = C_STATUS_FINAL_CODE
  AND xah.parent_ae_header_id IS NULL
  AND NOT EXISTS (SELECT 1
                  FROM   xla_ae_headers  xah2
                  WHERE  xah2.application_id = p_application_id
                  AND    xah2.event_id       = p_event_id
                  AND    xah2.accounting_entry_status_code = C_STATUS_FINAL_CODE
                  AND    NVL(xah2.gl_transfer_status_code,'N') IN ('N','NT'));  -- can be reversed only if it is transferred
Line: 352

     trace(p_msg    => 'Delete entries from xla_trial_balances',
           p_module => l_log_module,
           p_level  => C_LEVEL_PROCEDURE);
Line: 389

  SELECT xah.ae_header_id BULK COLLECT INTO l_array_je_header_id
  FROM   xla_gl_ledgers_v xgl
       , xla_ae_headers   xah
       , xla_subledgers   xsu
       , xla_transaction_entities e
       , xla_events       xe
  WHERE xgl.ledger_id      = xah.ledger_id
  AND xsu.application_id   = xah.application_id
  AND xah.event_id         = p_event_id
  AND xah.application_id   = p_application_id
  AND ledger_category_code ='PRIMARY'
  AND e.application_id     = xah.application_id
  AND e.entity_id	   = xah.entity_id
  AND xe.application_id    = xah.application_id
  AND xe.event_id          = xah.event_id
  AND xah.accounting_entry_status_code = C_STATUS_FINAL_CODE
  AND xah.parent_ae_header_id IS NULL
  AND NOT EXISTS (SELECT 1
                  FROM   xla_ae_headers  xah2
                  WHERE  xah2.application_id = p_application_id
                  AND    xah2.event_id       = p_event_id
                  AND    xah2.accounting_entry_status_code = C_STATUS_FINAL_CODE
                  AND    NVL(xah2.gl_transfer_status_code,'N') IN ('N','NT'));
Line: 459

     SELECT MAX(NVL(MPA_ACCRUAL_ENTRY_FLAG,'N'))
     INTO   l_mpa_acc_rev_flag
     FROM   xla_ae_lines
     WHERE  application_id = p_application_id
     AND    ae_header_id in (SELECT ae_header_id
                             FROM xla_ae_headers
			     WHERE event_id = p_event_id
			     AND application_id = p_application_id);
Line: 492

     FOR i in (SELECT ae_header_id
               FROM   xla_ae_headers
               WHERE  application_id      = p_application_id
               AND    event_id            = p_event_id
               AND    parent_ae_header_id IS NOT NULL
               AND    accounting_entry_status_code <> C_STATUS_FINAL_CODE ) LOOP
         IF (C_LEVEL_STATEMENT >= g_log_level) THEN
             trace(p_msg    => 'Delete journal entry = '||i.ae_header_id,
                   p_module => l_log_module,
                   p_level  => C_LEVEL_STATEMENT);
Line: 506

         DELETE xla_ae_lines
         WHERE  application_id = p_application_id
         AND    ae_header_id   = i.ae_header_id;
Line: 510

         DELETE xla_distribution_links
         WHERE  application_id = p_application_id
         AND    ae_header_id   = i.ae_header_id;
Line: 514

         DELETE  xla_ae_headers
         WHERE  application_id = p_application_id
         AND    ae_header_id   = i.ae_header_id;
Line: 524

  update xla_ae_headers
  set    accounting_entry_type_code = 'MANUAL'
  where  application_id = p_application_id
  and    event_id       = p_event_id;
Line: 570

  SELECT entity_id
  INTO   x_rev_entity_id
  FROM   xla_events
  WHERE  application_id = p_application_id
  AND    event_id       = x_rev_event_id
  AND    rownum = 1;
Line: 578

UPDATE xla_transaction_entities
  SET   (entity_code
       , source_id_int_1
       , source_id_char_1
       , security_id_int_1
       , security_id_int_2
       , security_id_int_3
       , security_id_char_1
       , security_id_char_2
       , security_id_char_3
       , source_id_int_2
       , source_id_char_2
       , source_id_int_3
       , source_id_char_3
       , source_id_int_4
       , source_id_char_4
       , valuation_method
       , source_application_id
       , upg_batch_id
       , upg_source_application_id
       , upg_valid_flag
       -- transaction_number
       -- legal_entity_id
       -- ledger_id
       , creation_date
       , created_by
       , last_update_date
       , last_updated_by
       , last_update_login) = (SELECT 'MANUAL'  -- entity_code  This also prevents transaction to be used in bflow.
                                     ,source_id_int_1
                                     ,source_id_char_1
                                     ,security_id_int_1
                                     ,security_id_int_2
                                     ,security_id_int_3
                                     ,security_id_char_1
                                     ,security_id_char_2
                                     ,security_id_char_3
                                     ,source_id_int_2
                                     ,source_id_char_2
                                     ,source_id_int_3
                                     ,source_id_char_3
                                     ,source_id_int_4
                                     ,source_id_char_4
                                     ,valuation_method
                                     ,source_application_id
                                     ,upg_batch_id
                                     ,upg_source_application_id
                                     ,upg_valid_flag
                                     -- transaction_number
                                     -- legal_entity_id
                                     -- ledger_id
                                     ,sysdate
                                     ,fnd_global.user_id
                                     ,sysdate
                                     ,fnd_global.user_id
                                     ,fnd_global.user_id
                           FROM   xla_transaction_entities
                           WHERE  application_id = p_application_id
                           AND    entity_id      = l_entity_id)
  WHERE application_id = p_application_id
  AND   entity_id      = x_rev_entity_id;
Line: 677

  UPDATE xla_events
  SET    event_status_code    = xla_events_pub_pkg.C_EVENT_PROCESSED
       , process_status_code  = xla_events_pub_pkg.C_EVENT_PROCESSED
       ,(event_type_code
       , event_date
       , reference_num_1
       , reference_num_2
       , reference_num_3
       , reference_num_4
       , reference_char_1
       , reference_char_2
       , reference_char_3
       , reference_char_4
       , reference_date_1
       , reference_date_2
       , reference_date_3
       , reference_date_4
       , on_hold_flag
       , upg_batch_id
       , upg_source_application_id
       , upg_valid_flag
       , transaction_date
       , budgetary_control_flag
       , merge_event_set_id
       -- event_number
       , creation_date
       , created_by
       , last_update_date
       , last_updated_by
       , last_update_login
       , program_update_date
       , program_application_id
       , program_id
       , request_id) = (SELECT 'MANUAL'  -- event_type_code
                             , event_date
                             , reference_num_1
                             , reference_num_2
                             , reference_num_3
                             , reference_num_4
                             , reference_char_1
                             , reference_char_2
                             , reference_char_3
                             , reference_char_4
                             , reference_date_1
                             , reference_date_2
                             , reference_date_3
                             , reference_date_4
                             , on_hold_flag
                             , upg_batch_id
                             , upg_source_application_id
                             , upg_valid_flag
                             , transaction_date
                             , budgetary_control_flag
                             , merge_event_set_id
                             -- event_number
                             , sysdate
                             , fnd_global.user_id
                             , sysdate
                             , fnd_global.user_id
                             , fnd_global.user_id
                             , sysdate
                             , -1
                             , -1
                             , -1
                        FROM   xla_events
                        WHERE  application_id = p_application_id
                        AND    event_id       = p_event_id)
  WHERE application_id = p_application_id
  AND   event_id       = x_new_event_id
  RETURNING entity_id INTO x_new_entity_id;
Line: 754

  UPDATE xla_transaction_entities
  SET   (entity_code
       , source_id_int_1
       , source_id_char_1
       , security_id_int_1
       , security_id_int_2
       , security_id_int_3
       , security_id_char_1
       , security_id_char_2
       , security_id_char_3
       , source_id_int_2
       , source_id_char_2
       , source_id_int_3
       , source_id_char_3
       , source_id_int_4
       , source_id_char_4
       , valuation_method
       , source_application_id
       , upg_batch_id
       , upg_source_application_id
       , upg_valid_flag
       -- transaction_number
       -- legal_entity_id
       -- ledger_id
       , creation_date
       , created_by
       , last_update_date
       , last_updated_by
       , last_update_login) = (SELECT 'MANUAL'  -- entity_code  This also prevents transaction to be used in bflow.
                                     ,source_id_int_1
                                     ,source_id_char_1
                                     ,security_id_int_1
                                     ,security_id_int_2
                                     ,security_id_int_3
                                     ,security_id_char_1
                                     ,security_id_char_2
                                     ,security_id_char_3
                                     ,source_id_int_2
                                     ,source_id_char_2
                                     ,source_id_int_3
                                     ,source_id_char_3
                                     ,source_id_int_4
                                     ,source_id_char_4
                                     ,valuation_method
                                     ,source_application_id
                                     ,upg_batch_id
                                     ,upg_source_application_id
                                     ,upg_valid_flag
                                     -- transaction_number
                                     -- legal_entity_id
                                     -- ledger_id
                                     ,sysdate
                                     ,fnd_global.user_id
                                     ,sysdate
                                     ,fnd_global.user_id
                                     ,fnd_global.user_id
                           FROM   xla_transaction_entities
                           WHERE  application_id = p_application_id
                           AND    entity_id      = l_entity_id)
  WHERE application_id = p_application_id
  AND   entity_id      = x_new_entity_id;
Line: 828

         trace(p_msg    => 'Update xla_ae_headers',
               p_module => l_log_module,
               p_level  => C_LEVEL_STATEMENT);
Line: 832

  UPDATE xla_ae_headers
  SET     entity_id        = x_new_entity_id
         ,event_id         = x_new_event_id
         ,event_type_code  = 'MANUAL'
         ,description      = 'Data fix entry: event_id of '||p_event_id
  WHERE  application_id = p_application_id
  AND    event_id       = p_event_id
  RETURNING ae_header_id  BULK COLLECT INTO l_array_ae_header_id;
Line: 842

         trace(p_msg    => 'Update xla_ae_lines',
               p_module => l_log_module,
               p_level  => C_LEVEL_STATEMENT);
Line: 847

     UPDATE xla_ae_lines
     SET    description         = 'Data fix entry: event_id of '||p_event_id
        --  business_class_code = NULL    -- This is not needed to prevent use by bflow since the entity_code is now 'MANUAL'
     WHERE  application_id = p_application_id
     AND    ae_header_id   = l_array_ae_header_id(i);
Line: 854

         trace(p_msg    => 'Update xla_distribution_links',
               p_module => l_log_module,
               p_level  => C_LEVEL_STATEMENT);
Line: 859

     UPDATE xla_distribution_links
     SET    event_id       = x_new_event_id
     WHERE  application_id = p_application_id
     AND    ae_header_id   = l_array_ae_header_id(i);
Line: 866

         trace(p_msg    => 'Update xla_events',
               p_module => l_log_module,
               p_level  => C_LEVEL_STATEMENT);
Line: 873

  UPDATE XLA_EVENTS
  SET    EVENT_STATUS_CODE   = xla_events_pub_pkg.C_EVENT_UNPROCESSED
        ,PROCESS_STATUS_CODE = xla_events_pkg.C_INTERNAL_UNPROCESSED
  WHERE   application_id = p_application_id
  AND     event_id       = p_event_id;
Line: 883

         trace(p_msg    => 'Update descriptions',
               p_module => l_log_module,
               p_level  => C_LEVEL_STATEMENT);
Line: 887

  UPDATE xla_ae_headers
  SET    description    = 'Data fix reversal entry: event_id of '||x_new_event_id
  WHERE  application_id = p_application_id
  AND    event_id       = x_rev_event_id
  RETURNING ae_header_id  BULK COLLECT INTO l_array_ae_header_id;
Line: 894

     UPDATE xla_ae_lines
     SET    description    = 'Data fix reversal entry: event_id of '||x_new_event_id
     WHERE  application_id = p_application_id
     AND    ae_header_id   = l_array_ae_header_id(i);
Line: 996

  SELECT DECODE(NVL(budgetary_control_flag,'N'),'Y', C_STATUS_FUNDS_RESERVE, C_STATUS_FINAL),process_status_code
  INTO   l_accounting_mode, l_process_status
  FROM   xla_events
  WHERE  application_id = p_application_id
  AND    event_id       = p_event_id;
Line: 1021

  INSERT INTO xla_acct_prog_events_gt (event_id, ledger_id)
  VALUES (p_event_id, null);
Line: 1045

  SELECT process_status_code
  INTO   l_process_status
  FROM   xla_events
  WHERE  application_id = p_application_id
  AND    event_id       = p_event_id;
Line: 1146

  UPDATE xla_ae_headers
  SET    gl_transfer_status_code = 'NT'
  WHERE  application_id          = p_application_id
  AND    ae_header_id            = p_ae_header_id
  AND    accounting_entry_status_code = C_STATUS_FINAL_CODE
  AND    gl_transfer_status_code = 'N';    -- if already transferred, S or Y, then do not set to NT.
Line: 1155

         trace(p_msg    => 'Rows updated = '||l_dummy,
               p_module => l_log_module,
               p_level  => C_LEVEL_STATEMENT);
Line: 1250

  SELECT count(*)
  INTO   l_dummy
  FROM   xla_ae_headers
  WHERE  application_id = p_application_id
  AND    ae_header_id   = p_ae_header_id
  AND    accounting_entry_status_code = C_STATUS_FINAL_CODE;
Line: 1282

  FOR i IN (SELECT error_message_name
            FROM   xla_upg_errors
            WHERE  application_id = p_application_id
            AND    ae_header_id   = p_ae_header_id) LOOP
         Log_error(p_error_name  => i.ERROR_MESSAGE_NAME);
Line: 1360

     UPDATE XLA_AE_HEADERS
     SET    LAST_UPDATE_DATE = sysdate
           ,UPG_BATCH_ID     = -9999
     WHERE  application_id = p_application_id
     AND    ae_header_id   = p_ae_header_id;
Line: 1376

     UPDATE XLA_AE_LINES
     SET    LAST_UPDATE_DATE = sysdate
           ,UPG_BATCH_ID     = -9999
     WHERE  application_id = p_application_id
     AND    ae_header_id   = p_ae_header_id
     AND    ae_line_num    = p_ae_line_num;
Line: 1393

     UPDATE XLA_EVENTS
     SET    LAST_UPDATE_DATE = sysdate
           ,UPG_BATCH_ID     = -9999
     WHERE  application_id = p_application_id
     AND    event_id       = p_event_id;
Line: 1405

         UPDATE XLA_AE_HEADERS
         SET    LAST_UPDATE_DATE = sysdate
               ,UPG_BATCH_ID     = -9999
         WHERE  application_id = p_application_id
         AND    event_id       = p_event_id
         RETURNING ae_header_id  BULK COLLECT INTO l_array_ae_header_id;
Line: 1413

            UPDATE XLA_AE_LINES
            SET    LAST_UPDATE_DATE       = sysdate
                  ,UPG_BATCH_ID           = -9999
              WHERE  application_id = p_application_id
              AND    ae_header_id   = l_array_ae_header_id(i);