DBA Data[Home] [Help]

APPS.GL_LEDGERS_PKG SQL Statements

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

Line: 12

         SELECT DISTINCT ledger.chart_of_accounts_id       -- glcd.object_id,
                    FROM gl_ledger_config_details glcd, gl_ledgers ledger
                   WHERE glcd.configuration_id = x_config_id
                     AND glcd.setup_step_code = 'NONE'
                     AND ledger.ledger_id = glcd.object_id;
Line: 19

         SELECT ledger_id,ledger_category_code
           FROM gl_ledgers
          WHERE configuration_id = x_config_id;
Line: 24

          SELECT haou.organization_id
               , haou.date_from
               ,haou.name
               ,haou.type
               ,haou.internal_external_flag
               ,haou.location_id
               ,hou.set_of_books_id
               ,null usable_flag
               ,hou.short_code
               ,hou.default_legal_context_id
               ,haou.object_version_number
          FROM  hr_operating_units hou,
                hr_all_organization_units haou
          WHERE set_of_books_id = p_ledger_id
            AND haou.organization_id = hou.organization_id;
Line: 52

      x_update_prim_ledger_warning BOOLEAN;
Line: 65

         SELECT ledger_id, NAME, chart_of_accounts_id, description,
                period_set_name, accounted_period_type,
                implicit_access_set_id
           INTO x_ledger_id, x_name, x_chart_of_accounts_id, x_description,
                x_period_set_name, x_accounted_period_type,
                x_access_set_id
           FROM gl_ledgers
          WHERE ledger_id = v_ledgers.ledger_id;
Line: 88

                      x_last_updated_by => fnd_global.user_id,
                      x_last_update_login => fnd_global.login_id,
                      x_creation_date => SYSDATE,
                      x_description => x_description);
Line: 98

               UPDATE gl_ledgers
                  SET implicit_access_set_id = x_access_set_id
                WHERE ledger_id = x_ledger_id;
Line: 106

       * Update Operating unit's descriptive flexfiled org_information6 so
       * that operating unit can be selected for entering transaction against it
       */

     for v_orgs in c_org_curr (pri_ledger_id)
     loop
       hr_organization_api.update_operating_unit
       (
         p_organization_id       => v_orgs.organization_id
        ,p_effective_date        => v_orgs.date_from
        ,p_usable_flag                       => v_orgs.usable_flag
        ,p_object_version_number             => v_orgs.object_version_number
        ,p_update_prim_ledger_warning        => x_update_prim_ledger_warning
        ,p_duplicate_org_warning             => x_duplicate_org_warning
       );
Line: 152

   PROCEDURE insert_row(
      p_api_version              IN       NUMBER := 1.0,
      p_init_msg_list            IN       VARCHAR2 := fnd_api.g_false,
      p_commit                   IN       VARCHAR2 := fnd_api.g_false,
      p_validate_only            IN       VARCHAR2 := fnd_api.g_true,
      p_record_version_number    IN       NUMBER := NULL,
      x_return_status            OUT NOCOPY VARCHAR2,
      x_msg_count                OUT NOCOPY NUMBER,
      x_msg_data                 OUT NOCOPY VARCHAR2,
      x_rowid                    IN OUT NOCOPY VARCHAR2,
      x_ledger_id                         NUMBER,
      x_name                              VARCHAR2,
      x_short_name                        VARCHAR2,
      x_chart_of_accounts_id              NUMBER,
      x_currency_code                     VARCHAR2,
      x_period_set_name                   VARCHAR2,
      x_accounted_period_type             VARCHAR2,
      x_first_ledger_period_name          VARCHAR2,
      x_ret_earn_code_combination_id      NUMBER,
      x_suspense_allowed_flag             VARCHAR2,
      x_suspense_ccid                     NUMBER,
      x_allow_intercompany_post_flag      VARCHAR2,
      x_enable_avgbal_flag                VARCHAR2,
      x_enable_budgetary_control_f        VARCHAR2,
      x_require_budget_journals_flag      VARCHAR2,
      x_enable_je_approval_flag           VARCHAR2,
      x_enable_automatic_tax_flag         VARCHAR2,
      x_consolidation_ledger_flag         VARCHAR2,
      x_translate_eod_flag                VARCHAR2,
      x_translate_qatd_flag               VARCHAR2,
      x_translate_yatd_flag               VARCHAR2,
      x_automatically_created_flag        VARCHAR2,
      x_track_rounding_imbalance_f        VARCHAR2,
      --x_mrc_ledger_type_code              VARCHAR2,
      x_le_ledger_type_code               VARCHAR2,
      x_bal_seg_value_option_code         VARCHAR2,
      x_mgt_seg_value_option_code         VARCHAR2,
      x_last_update_date                  DATE,
      x_last_updated_by                   NUMBER,
      x_creation_date                     DATE,
      x_created_by                        NUMBER,
      x_last_update_login                 NUMBER,
      x_description                       VARCHAR2,
      x_future_enterable_periods_lmt      NUMBER,
      x_latest_opened_period_name         VARCHAR2,
      x_latest_encumbrance_year           NUMBER,
      x_cum_trans_ccid                    NUMBER,
      x_res_encumb_ccid                   NUMBER,
      x_net_income_ccid                   NUMBER,
      x_balancing_segment                 VARCHAR2,
      x_rounding_ccid                     NUMBER,
      x_transaction_calendar_id           NUMBER,
      x_daily_translation_rate_type       VARCHAR2,
      x_period_average_rate_type          VARCHAR2,
      x_period_end_rate_type              VARCHAR2,
      x_context                           VARCHAR2,
      x_attribute1                        VARCHAR2,
      x_attribute2                        VARCHAR2,
      x_attribute3                        VARCHAR2,
      x_attribute4                        VARCHAR2,
      x_attribute5                        VARCHAR2,
      x_attribute6                        VARCHAR2,
      x_attribute7                        VARCHAR2,
      x_attribute8                        VARCHAR2,
      x_attribute9                        VARCHAR2,
      x_attribute10                       VARCHAR2,
      x_attribute11                       VARCHAR2,
      x_attribute12                       VARCHAR2,
      x_attribute13                       VARCHAR2,
      x_attribute14                       VARCHAR2,
      x_attribute15                       VARCHAR2,
      x_set_manual_flag                   VARCHAR2,
      --x_child_ledger_access_code          VARCHAR2,
      x_ledger_category_code              VARCHAR2,
      x_configuration_id                  NUMBER,
      x_sla_accounting_method_code        VARCHAR2,
      x_sla_accounting_method_type        VARCHAR2,
      x_sla_description_language          VARCHAR2,
      x_sla_entered_cur_bal_sus_ccid      NUMBER,
      x_sla_bal_by_ledger_curr_flag       VARCHAR2,
      x_sla_ledger_cur_bal_sus_ccid       NUMBER,
      x_alc_ledger_type_code              VARCHAR2,
      x_criteria_set_id                   NUMBER,
      x_enable_secondary_track_flag       VARCHAR2 DEFAULT 'N',
      x_enable_reval_ss_track_flag        VARCHAR2 DEFAULT 'N',
      x_enable_reconciliation_flag        VARCHAR2 DEFAULT 'N',
      x_sla_ledger_cash_basis_flag        VARCHAR2 DEFAULT 'N',
      x_create_je_flag                    VARCHAR2 DEFAULT 'Y',
      x_commitment_budget_flag            VARCHAR2 DEFAULT NULL,
      x_net_closing_bal_flag              VARCHAR2 DEFAULT 'N',
      x_auto_jrnl_rev_flag                VARCHAR2 DEFAULT 'N') IS
      CURSOR c IS
         SELECT ROWID
           FROM gl_ledgers
          WHERE NAME = x_name;
Line: 249

      l_api_name          CONSTANT VARCHAR(30)   := 'insert_row';
Line: 273

        select period_name
        from gl_periods
        where period_set_name = x_period_set_name
        and period_type = x_accounted_period_type
        order by period_year, period_num;
Line: 279

        select completion_status_code
        from gl_ledger_configurations
        where configuration_id = x_configuration_id;
Line: 354

               x_last_updated_by => x_last_updated_by,
               x_last_update_login => x_last_update_login,
               x_creation_date => x_creation_date,
               x_description => x_description); */
Line: 369

               'SELECT ' || x_bal_seg_column_name
               || ' FROM gl_code_combinations WHERE chart_of_accounts_id = :1 '
               || ' AND code_combination_id = :2 ';
Line: 386

         SELECT conversion_type
           INTO t_period_average_rate_type
           FROM gl_daily_conversion_types_v
          WHERE conversion_type <> 'User'
            AND conversion_type <> 'EMU FIXED'
            AND conversion_type = x_period_average_rate_type;
Line: 404

         SELECT conversion_type
           INTO t_period_end_rate_type
           FROM gl_daily_conversion_types_v
          WHERE conversion_type <> 'User'
            AND conversion_type <> 'EMU FIXED'
            AND conversion_type = x_period_end_rate_type;
Line: 420

            SELECT language_code
              INTO t_sla_description_language
              FROM fnd_languages_vl
             WHERE (installed_flag = 'I' OR installed_flag = 'B')
               AND language_code = x_sla_description_language;
Line: 435

            SELECT criteria_set_id
              INTO t_criteria_set_id
              FROM gl_autorev_criteria_sets
             WHERE criteria_set_id = x_criteria_set_id;
Line: 461

      INSERT INTO gl_ledgers
                  (ledger_id, NAME, short_name, chart_of_accounts_id,
                   currency_code, period_set_name,
                   accounted_period_type, first_ledger_period_name,
                   ret_earn_code_combination_id, suspense_allowed_flag,
                   allow_intercompany_post_flag,
                   enable_average_balances_flag,
                   enable_budgetary_control_flag,
                   require_budget_journals_flag, enable_je_approval_flag,
                   enable_automatic_tax_flag, consolidation_ledger_flag,
                   translate_eod_flag, translate_qatd_flag,
                   translate_yatd_flag, automatically_created_flag,
                   track_rounding_imbalance_flag,-- mrc_ledger_type_code,
                   object_type_code, le_ledger_type_code,
                   bal_seg_value_option_code, bal_seg_column_name,
                   bal_seg_value_set_id, mgt_seg_value_option_code,
                   mgt_seg_column_name, mgt_seg_value_set_id,
                   implicit_access_set_id, last_update_date, last_updated_by,
                   creation_date, created_by, last_update_login,
                   description, future_enterable_periods_limit,
                   ledger_attributes, latest_opened_period_name,
                   latest_encumbrance_year, cum_trans_code_combination_id,
                   res_encumb_code_combination_id,
                   net_income_code_combination_id,
                   rounding_code_combination_id, transaction_calendar_id,
                   daily_translation_rate_type, period_average_rate_type,
                   period_end_rate_type, CONTEXT, attribute1,
                   attribute2, attribute3, attribute4, attribute5,
                   attribute6, attribute7, attribute8, attribute9,
                   attribute10, attribute11, attribute12,
                   attribute13, attribute14, attribute15,
                   --child_ledger_access_code,
                   ledger_category_code, configuration_id,
                   sla_accounting_method_code,
                   sla_accounting_method_type, sla_description_language,
                   sla_entered_cur_bal_sus_ccid,
                   sla_bal_by_ledger_curr_flag,
                   sla_ledger_cur_bal_sus_ccid, alc_ledger_type_code,
                   criteria_set_id,enable_secondary_track_flag,
                   enable_reval_ss_track_flag, enable_reconciliation_flag,
                   sla_ledger_cash_basis_flag, create_je_flag, complete_flag,commitment_budget_flag,net_closing_bal_flag,automate_sec_jrnl_rev_flag)
           VALUES (x_ledger_id, x_name, x_short_name, x_chart_of_accounts_id,
                   x_currency_code, x_period_set_name,
                   x_accounted_period_type, decode(x_ledger_category_code,'ALC',
                   x_first_ledger_period_name,v_first_ledger_period_name),
                   x_ret_earn_code_combination_id, x_suspense_allowed_flag,
                   x_allow_intercompany_post_flag,
                   x_enable_avgbal_flag,
                   x_enable_budgetary_control_f,
                   x_require_budget_journals_flag, x_enable_je_approval_flag,
                   x_enable_automatic_tax_flag, x_consolidation_ledger_flag,
                   x_translate_eod_flag, x_translate_qatd_flag,
                   x_translate_yatd_flag, x_automatically_created_flag,
                   x_track_rounding_imbalance_f, --x_mrc_ledger_type_code,
                   'L', x_le_ledger_type_code,
                   x_bal_seg_value_option_code, x_bal_seg_column_name,
                   x_bal_seg_value_set_id, x_mgt_seg_value_option_code,
                   x_mgt_seg_column_name, x_mgt_seg_value_set_id,
                   NULL, x_last_update_date, x_last_updated_by,
                   x_creation_date, x_created_by, x_last_update_login,
                   x_description, x_future_enterable_periods_lmt,
                   'L',
                       -- 'Y' || fnd_global.newline || 'Y' || fnd_global.newline || 'L',
                       x_latest_opened_period_name,
                   x_latest_encumbrance_year, x_cum_trans_ccid,
                   x_res_encumb_ccid,
                   x_net_income_ccid,
                   x_rounding_ccid, x_transaction_calendar_id,
                   x_daily_translation_rate_type, x_period_average_rate_type,
                   x_period_end_rate_type, x_context, x_attribute1,
                   x_attribute2, x_attribute3, x_attribute4, x_attribute5,
                   x_attribute6, x_attribute7, x_attribute8, x_attribute9,
                   x_attribute10, x_attribute11, x_attribute12,
                   x_attribute13, x_attribute14, x_attribute15,
                   --x_child_ledger_access_code,
                   x_ledger_category_code, x_configuration_id,
                   x_sla_accounting_method_code,
                   x_sla_accounting_method_type, x_sla_description_language,
                   x_sla_entered_cur_bal_sus_ccid,
                   x_sla_bal_by_ledger_curr_flag,
                   x_sla_ledger_cur_bal_sus_ccid, x_alc_ledger_type_code,
                   x_criteria_set_id, x_enable_secondary_track_flag,
                   x_enable_reval_ss_track_flag, x_enable_reconciliation_flag,
                   x_sla_ledger_cash_basis_flag, x_create_je_flag, l_complete_flag,x_commitment_budget_flag,x_net_closing_bal_flag,x_auto_jrnl_rev_flag);
Line: 565

      gl_conc_control_pkg.insert_conc_ledger(x_ledger_id, x_last_update_date,
                                             x_last_updated_by,
                                             x_creation_date, x_created_by,
                                             x_last_update_login);
Line: 573

         gl_period_statuses_pkg.insert_led_ps(x_ledger_id, x_period_set_name,
                                              x_accounted_period_type,
                                              x_last_update_date,
                                              x_last_updated_by,
                                              x_last_update_login,
                                              x_creation_date, x_created_by);
Line: 600

         SELECT code_combination_id
           INTO x_suspense_ccid_temp
           FROM gl_code_combinations
          WHERE code_combination_id = x_suspense_ccid;
Line: 612

         gl_suspense_accounts_pkg.insert_ledger_suspense
                                                       (x_ledger_id,
                                                        x_suspense_ccid_temp,
                                                        x_last_update_date,
                                                        x_last_updated_by);
Line: 631

         gl_ledgers_pkg.update_gl_system_usages(x_consolidation_ledger_flag);
Line: 632

         gl_ledgers_pkg.insert_gl_net_income_accounts(x_ledger_id,
                                                      v_balancing_segment,

                                                      --x_balancing_segment,
                                                      x_net_income_ccid,
                                                      x_creation_date,
                                                      x_created_by,
                                                      x_last_update_date,
                                                      x_last_updated_by,
                                                      x_last_update_login,
                                                      '', '', '', '');
Line: 677

   END insert_row;
Line: 681

   PROCEDURE update_row(
      p_api_version              IN       NUMBER := 1.0,
      p_init_msg_list            IN       VARCHAR2 := fnd_api.g_false,
      p_commit                   IN       VARCHAR2 := fnd_api.g_false,
      p_validate_only            IN       VARCHAR2 := fnd_api.g_true,
      p_record_version_number    IN       NUMBER := NULL,
      x_return_status            OUT NOCOPY VARCHAR2,
      x_msg_count                OUT NOCOPY NUMBER,
      x_msg_data                 OUT NOCOPY VARCHAR2,
      x_rowid                             VARCHAR2,
      x_ledger_id                         NUMBER,
      x_name                              VARCHAR2,
      x_short_name                        VARCHAR2,
      x_chart_of_accounts_id              NUMBER,
      x_currency_code                     VARCHAR2,
      x_period_set_name                   VARCHAR2,
      x_accounted_period_type             VARCHAR2,
      x_first_ledger_period_name          VARCHAR2,
      x_ret_earn_code_combination_id      NUMBER,
      x_suspense_allowed_flag             VARCHAR2,
      x_suspense_ccid                     NUMBER,
      x_allow_intercompany_post_flag      VARCHAR2,
      x_enable_avgbal_flag                VARCHAR2,
      x_enable_budgetary_control_f        VARCHAR2,
      x_require_budget_journals_flag      VARCHAR2,
      x_enable_je_approval_flag           VARCHAR2,
      x_enable_automatic_tax_flag         VARCHAR2,
      x_consolidation_ledger_flag         VARCHAR2,
      x_translate_eod_flag                VARCHAR2,
      x_translate_qatd_flag               VARCHAR2,
      x_translate_yatd_flag               VARCHAR2,
      x_automatically_created_flag        VARCHAR2,
      x_track_rounding_imbalance_f        VARCHAR2,
      --x_mrc_ledger_type_code              VARCHAR2,
      x_le_ledger_type_code               VARCHAR2,
      x_bal_seg_value_option_code         VARCHAR2,
      x_mgt_seg_value_option_code         VARCHAR2,
      x_implicit_access_set_id            NUMBER,
      x_last_update_date                  DATE,
      x_last_updated_by                   NUMBER,
      x_last_update_login                 NUMBER,
      x_description                       VARCHAR2,
      x_future_enterable_periods_lmt      NUMBER,
      x_latest_opened_period_name         VARCHAR2,
      x_latest_encumbrance_year           NUMBER,
      x_cum_trans_ccid                    NUMBER,
      x_res_encumb_ccid                   NUMBER,
      x_net_income_ccid                   NUMBER,
      x_balancing_segment                 VARCHAR2,
      x_rounding_ccid                     NUMBER,
      x_transaction_calendar_id           NUMBER,
      x_daily_translation_rate_type       VARCHAR2,
      x_period_average_rate_type          VARCHAR2,
      x_period_end_rate_type              VARCHAR2,
      x_context                           VARCHAR2,
      x_attribute1                        VARCHAR2,
      x_attribute2                        VARCHAR2,
      x_attribute3                        VARCHAR2,
      x_attribute4                        VARCHAR2,
      x_attribute5                        VARCHAR2,
      x_attribute6                        VARCHAR2,
      x_attribute7                        VARCHAR2,
      x_attribute8                        VARCHAR2,
      x_attribute9                        VARCHAR2,
      x_attribute10                       VARCHAR2,
      x_attribute11                       VARCHAR2,
      x_attribute12                       VARCHAR2,
      x_attribute13                       VARCHAR2,
      x_attribute14                       VARCHAR2,
      x_attribute15                       VARCHAR2,
      x_set_manual_flag                   VARCHAR2,
      --x_child_ledger_access_code          VARCHAR2,
      x_ledger_category_code              VARCHAR2,
      x_configuration_id                  NUMBER,
      x_sla_accounting_method_code        VARCHAR2,
      x_sla_accounting_method_type        VARCHAR2,
      x_sla_description_language          VARCHAR2,
      x_sla_entered_cur_bal_sus_ccid      NUMBER,
      x_sla_bal_by_ledger_curr_flag       VARCHAR2,
      x_sla_ledger_cur_bal_sus_ccid       NUMBER,
      x_alc_ledger_type_code              VARCHAR2,
      x_criteria_set_id                   NUMBER,
      x_enable_secondary_track_flag       VARCHAR2 DEFAULT 'N',
      x_enable_reval_ss_track_flag        VARCHAR2 DEFAULT 'N',
      x_enable_reconciliation_flag        VARCHAR2 DEFAULT 'N',
      x_sla_ledger_cash_basis_flag        VARCHAR2 DEFAULT 'N',
      x_create_je_flag                    VARCHAR2 DEFAULT 'Y',
      x_commitment_budget_flag            VARCHAR2 DEFAULT NULL,
      x_net_closing_bal_flag              VARCHAR2 DEFAULT 'N',
      x_auto_jrnl_rev_flag                VARCHAR2 DEFAULT 'N') IS
      l_api_version                    NUMBER        := p_api_version;
Line: 772

      l_api_name              CONSTANT VARCHAR(30)   := 'update_row';
Line: 811

         SELECT DISTINCT object_id
                    FROM gl_ledger_config_details
                   WHERE object_type_code = 'PRIMARY'
                     AND setup_step_code = 'NONE'
                     AND configuration_id IN(
                            SELECT configuration_id
                              FROM gl_ledger_config_details
                             WHERE object_type_code = 'SECONDARY'
                               AND setup_step_code = 'NONE'
                               AND object_id = x_ledger_id);
Line: 827

         SELECT DISTINCT rs.target_ledger_id
                    FROM gl_ledger_relationships rs, gl_ledgers lg
                   WHERE rs.source_ledger_id = x_ledger_id
                     AND rs.application_id = 101
                     AND rs.target_ledger_category_code = 'ALC'
                     AND rs.relationship_type_code in ('JOURNAL', 'SUBLEDGER')
                     AND lg.ledger_id = rs.target_ledger_id;
Line: 835

         SELECT        *
                  FROM gl_ledgers
                 WHERE ledger_id = x_ledger_id;
Line: 978

           SELECT conversion_type
             INTO t_period_average_rate_type
             FROM gl_daily_conversion_types_v
            WHERE conversion_type <> 'User'
              AND conversion_type <> 'EMU FIXED'
              AND conversion_type = x_period_average_rate_type;
Line: 994

           SELECT conversion_type
             INTO t_period_end_rate_type
             FROM gl_daily_conversion_types_v
            WHERE conversion_type <> 'User'
              AND conversion_type <> 'EMU FIXED'
              AND conversion_type = x_period_end_rate_type;
Line: 1010

            SELECT language_code
              INTO t_sla_description_language
              FROM fnd_languages_vl
             WHERE (installed_flag = 'I' OR installed_flag = 'B')
               AND language_code = x_sla_description_language;
Line: 1025

            SELECT criteria_set_id
              INTO t_criteria_set_id
              FROM gl_autorev_criteria_sets
             WHERE criteria_set_id = x_criteria_set_id;
Line: 1039

      SELECT NAME, short_name
        INTO x_current_name, x_current_short_name
        FROM gl_ledgers
       WHERE ledger_id = x_ledger_id;
Line: 1046

         UPDATE gl_ledger_relationships
            SET target_ledger_name = x_name
          WHERE target_ledger_id = x_ledger_id
            AND (   target_ledger_category_code <> 'ALC'
                 OR (    target_ledger_category_code = 'ALC'
                     AND relationship_type_code <> 'BALANCE'));
Line: 1056

         UPDATE gl_ledger_relationships
            SET target_ledger_short_name = x_short_name
          WHERE target_ledger_id = x_ledger_id
            AND (   target_ledger_category_code <> 'ALC'
                 OR (    target_ledger_category_code = 'ALC'
                     AND relationship_type_code <> 'BALANCE'));
Line: 1068

            UPDATE gl_ledger_config_details
               SET object_name = x_name
             WHERE configuration_id = x_configuration_id
               AND object_id = x_ledger_id
               AND object_type_code = x_ledger_category_code;
Line: 1075

         SELECT bal_seg_value_option_code, sla_accounting_method_code,
                sla_accounting_method_type, allow_intercompany_post_flag
           INTO x_current_bsv_option_code, x_current_sla_actg_method_code,
                x_current_sla_actg_method_type, x_current_allow_intercom_flag
           FROM gl_ledgers
          WHERE ledger_id = x_ledger_id;
Line: 1083

            INSERT INTO gl_ledger_config_details
                        (configuration_id, object_type_code,
                         object_id, object_name, setup_step_code,
                         next_action_code, status_code, created_by,
                         last_update_login, last_update_date,
                         last_updated_by, creation_date)
                 VALUES (x_configuration_id, x_ledger_category_code,
                         x_ledger_id, x_name, 'BSV_ASSIGNMENTS',
                         'ASSIGN_BSV', 'NOT_STARTED', x_last_update_login,
                         x_last_update_login, x_last_update_date,
                         x_last_updated_by, x_last_update_date);
Line: 1094

            UPDATE gl_ledgers
               SET bal_seg_value_option_code = x_bal_seg_value_option_code
             WHERE ledger_id IN(
                      SELECT DISTINCT target_ledger_id
                                 FROM gl_ledger_relationships
                                WHERE source_ledger_id = x_ledger_id
                                  AND target_ledger_category_code = 'ALC');
Line: 1107

            INSERT INTO gl_ledger_config_details
                        (configuration_id, object_type_code,
                         object_id, object_name, setup_step_code,
                         next_action_code, status_code,
                         created_by, last_update_login,
                         last_update_date, last_updated_by,
                         creation_date)
                 VALUES (x_configuration_id, x_ledger_category_code,
                         x_ledger_id, x_name, 'SLAM_SETUP',
                         'REVIEW_DEFAULTS', 'CONFIRMED',
                         x_last_update_login, x_last_update_login,
                         x_last_update_date, x_last_updated_by,
                         x_last_update_date);
Line: 1128

         /* move to after update ledger
         IF (x_ledger_category_code = 'PRIMARY') THEN
            xla_acct_setup_pub_pkg.setup_ledger_options(x_ledger_id,
                                                        x_ledger_id);
Line: 1144

            DELETE FROM gl_ledger_config_details
                  WHERE configuration_id = x_configuration_id
                    AND object_type_code = x_ledger_category_code
                    AND object_id = x_ledger_id
                    AND object_name = x_name
                    AND setup_step_code = 'SLAM_SETUP';
Line: 1156

            UPDATE gl_ledger_config_details
               SET next_action_code = 'REVIEW_DEFAULTS',
                   status_code = 'CONFIRMED',
                   last_update_login = x_last_update_login,
                   last_update_date = x_last_update_date,
                   last_updated_by = x_last_updated_by
             WHERE configuration_id = x_configuration_id
               AND object_type_code = x_ledger_category_code
               AND object_id = x_ledger_id
               AND object_name = x_name
               AND setup_step_code = 'SLAM_SETUP';
Line: 1185

/*         UPDATE gl_ledgers
            SET future_enterable_periods_limit =
                                                x_future_enterable_periods_lmt
          WHERE ledger_id IN(
                   SELECT DISTINCT target_ledger_id
                              FROM gl_ledger_relationships
                             WHERE source_ledger_id = x_ledger_id
                               --AND target_ledger_id <> source_ledger_id
                               AND target_ledger_category_code = 'ALC'); */
Line: 1204

            INSERT INTO gl_ledger_config_details
                        (configuration_id, object_type_code,
                         object_id, object_name, setup_step_code,
                         next_action_code, status_code, created_by,
                         last_update_login, last_update_date,
                         last_updated_by, creation_date)
                 VALUES (x_configuration_id, x_ledger_category_code,
                         x_ledger_id, x_name, 'INTRA_BAL',
                         'DEFINE_RULES', 'NOT_STARTED', x_last_update_login,
                         x_last_update_login, x_last_update_date,
                         x_last_updated_by, x_last_update_date);
Line: 1218

            DELETE      gl_ledger_config_details
                  WHERE configuration_id = x_configuration_id
                    AND object_id = x_ledger_id
                    AND setup_step_code = 'INTRA_BAL';
Line: 1245

         SELECT code_combination_id
           INTO x_cum_trans_ccid_temp
           FROM gl_code_combinations
          WHERE code_combination_id = x_cum_trans_ccid;
Line: 1255

         SELECT code_combination_id
           INTO x_res_encumb_ccid_temp
           FROM gl_code_combinations
          WHERE code_combination_id = x_res_encumb_ccid;
Line: 1265

         SELECT code_combination_id
           INTO x_net_income_ccid_temp
           FROM gl_code_combinations
          WHERE code_combination_id = x_net_income_ccid;
Line: 1275

         SELECT code_combination_id
           INTO x_rounding_ccid_temp
           FROM gl_code_combinations
          WHERE code_combination_id = x_rounding_ccid;
Line: 1289

      UPDATE gl_ledgers
         SET                                        --ledger_id = x_ledger_id,
            NAME = x_name,
            short_name = x_short_name,
            --chart_of_accounts_id = x_chart_of_accounts_id,
            --currency_code = x_currency_code,
            --period_set_name = x_period_set_name,
            --accounted_period_type = x_period_type,
            first_ledger_period_name = x_first_ledger_period_name,
            ret_earn_code_combination_id = x_ret_earn_code_combination_id,
            suspense_allowed_flag = x_suspense_allowed_flag,
            allow_intercompany_post_flag = x_allow_intercompany_post_flag,
            enable_average_balances_flag = x_enable_avgbal_flag,
            enable_budgetary_control_flag = x_enable_budgetary_control_f,
            require_budget_journals_flag = x_require_budget_journals_flag,
            enable_je_approval_flag = x_enable_je_approval_flag,
            enable_automatic_tax_flag = x_enable_automatic_tax_flag,
            consolidation_ledger_flag = x_consolidation_ledger_flag,
            translate_eod_flag = x_translate_eod_flag,
            translate_qatd_flag = x_translate_qatd_flag,
            translate_yatd_flag = x_translate_yatd_flag,
            automatically_created_flag = x_automatically_created_flag,
            track_rounding_imbalance_flag = x_track_rounding_imbalance_f,
         --   mrc_ledger_type_code = x_mrc_ledger_type_code,
            le_ledger_type_code = x_le_ledger_type_code,
            bal_seg_value_option_code = x_bal_seg_value_option_code,
            --bal_seg_column_name = x_bal_seg_column_name,
            --bal_seg_value_set_id = x_bal_seg_value_set_id,
            mgt_seg_value_option_code = x_mgt_seg_value_option_code,
            --mgt_seg_column_name = x_mgt_seg_column_name,
            --mgt_seg_value_set_id = x_mgt_seg_value_set_id,
            last_update_date = x_last_update_date,
            last_updated_by = x_last_updated_by,
            last_update_login = x_last_update_login,
            description = x_description,
            future_enterable_periods_limit = x_future_enterable_periods_lmt,
            latest_opened_period_name = x_latest_opened_period_name,
            --latest_encumbrance_year = x_latest_encumbrance_year,
            cum_trans_code_combination_id = x_cum_trans_ccid_temp,
            res_encumb_code_combination_id = x_res_encumb_ccid_temp,
            net_income_code_combination_id = x_net_income_ccid_temp,
            rounding_code_combination_id = x_rounding_ccid_temp,
            transaction_calendar_id = x_transaction_calendar_id,
            daily_translation_rate_type = x_daily_translation_rate_type,
            period_average_rate_type = x_period_average_rate_type,
            period_end_rate_type = x_period_end_rate_type,
            CONTEXT = x_context,
            attribute1 = x_attribute1,
            attribute2 = x_attribute2,
            attribute3 = x_attribute3,
            attribute4 = x_attribute4,
            attribute5 = x_attribute5,
            attribute6 = x_attribute6,
            attribute7 = x_attribute7,
            attribute8 = x_attribute8,
            attribute9 = x_attribute9,
            attribute10 = x_attribute10,
            attribute11 = x_attribute11,
            attribute12 = x_attribute12,
            attribute13 = x_attribute13,
            attribute14 = x_attribute14,
            attribute15 = x_attribute15,
            --child_ledger_access_code = x_child_ledger_access_code,
            ledger_category_code = x_ledger_category_code,
            configuration_id = x_configuration_id,
            --association_level_code = x_association_level_code,
            sla_accounting_method_code = p_sla_accounting_method_code,
            sla_accounting_method_type = p_sla_accounting_method_type,
            sla_description_language = p_sla_description_language,
            sla_entered_cur_bal_sus_ccid = p_sla_entered_cur_bal_sus_ccid,
            sla_bal_by_ledger_curr_flag = p_sla_bal_by_ledger_curr_flag,
            sla_ledger_cur_bal_sus_ccid = p_sla_ledger_cur_bal_sus_ccid,
            sla_sequencing_flag =
                 DECODE(p_sla_sequencing_flag,
                        'N', NULL,
                        sla_sequencing_flag),
            alc_ledger_type_code = x_alc_ledger_type_code,
            criteria_set_id = x_criteria_set_id,
            enable_secondary_track_flag = x_enable_secondary_track_flag,
            enable_reval_ss_track_flag = x_enable_reval_ss_track_flag,
            enable_reconciliation_flag = x_enable_reconciliation_flag,
            sla_ledger_cash_basis_flag = x_sla_ledger_cash_basis_flag,
            create_je_flag = x_create_je_flag,
            commitment_budget_flag = x_commitment_budget_flag,
            net_closing_bal_flag   =x_net_closing_bal_flag,
	    automate_sec_jrnl_rev_flag = x_auto_jrnl_rev_flag
       WHERE ledger_id = x_ledger_id;
Line: 1402

         SELECT completion_status_code
           INTO x_completion_status
           FROM gl_ledger_configurations
          WHERE configuration_id = x_configuration_id;
Line: 1413

         UPDATE gl_ledgers alclg
            SET (future_enterable_periods_limit, suspense_allowed_flag,
                 allow_intercompany_post_flag, bal_seg_value_option_code,
                 mgt_seg_value_option_code, sla_accounting_method_code,
                 sla_accounting_method_type, sla_description_language,
                 sla_bal_by_ledger_curr_flag, sla_sequencing_flag,
                 sla_entered_cur_bal_sus_ccid, sla_ledger_cur_bal_sus_ccid,
                 last_update_date, last_updated_by, last_update_login,
                 first_ledger_period_name, ret_earn_code_combination_id,
                 track_rounding_imbalance_flag, enable_average_balances_flag,
                 cum_trans_code_combination_id, res_encumb_code_combination_id,
                 net_income_code_combination_id, rounding_code_combination_id,
                 enable_automatic_tax_flag, consolidation_ledger_flag,
                 translate_eod_flag, translate_qatd_flag, translate_yatd_flag,
                 transaction_calendar_id, daily_translation_rate_type,
                 criteria_set_id, period_average_rate_type,
                 period_end_rate_type, enable_secondary_track_flag,
                 enable_reval_ss_track_flag, enable_reconciliation_flag,
                 sla_ledger_cash_basis_flag, context, attribute1,
                 attribute2, attribute3, attribute4, attribute5,
                 attribute6, attribute7, attribute8, attribute9,
                 attribute10, attribute11, attribute12, attribute13,
                 attribute14, attribute15) =
                   (SELECT srclg.future_enterable_periods_limit,
                           decode(l_suspense_changed, 'Y',
                                  srclg.suspense_allowed_flag,
                                  alclg.suspense_allowed_flag),
                           DECODE(l_intercom_changed, 'Y',
                                  srclg.allow_intercompany_post_flag,
                                  alclg.allow_intercompany_post_flag),
                           srclg.bal_seg_value_option_code,
                           srclg.mgt_seg_value_option_code,
                           srclg.sla_accounting_method_code,
                           srclg.sla_accounting_method_type,
                           srclg.sla_description_language,
                           srclg.sla_bal_by_ledger_curr_flag,
                           srclg.sla_sequencing_flag,

                           -- SLA sus CCIDs of ALC must be same as its source's
                           srclg.sla_entered_cur_bal_sus_ccid,
                           srclg.sla_ledger_cur_bal_sus_ccid,
                           srclg.last_update_date, srclg.last_updated_by,
                           srclg.last_update_login,
                           decode(srclg.complete_flag, 'Y',
                              alclg.first_ledger_period_name,
                              srclg.first_ledger_period_name),
                           decode(l_ret_changed, 'Y',
                                  srclg.ret_earn_code_combination_id,
                                  alclg.ret_earn_code_combination_id),
                           decode(srclg.track_rounding_imbalance_flag,'Y',
                                  'Y', alclg.track_rounding_imbalance_flag),
                           decode(srclg.complete_flag, 'Y',
                                  alclg.enable_average_balances_flag,
                                  srclg.enable_average_balances_flag),
                           decode(l_cta_changed, 'Y',
                                  srclg.cum_trans_code_combination_id,
                                  alclg.cum_trans_code_combination_id),
                           decode(l_reserv_encum_changed, 'Y',
                                  srclg.res_encumb_code_combination_id,
                                  alclg.res_encumb_code_combination_id),
                           decode(srclg.complete_flag, 'Y',
                                  alclg.net_income_code_combination_id,
                                  srclg.net_income_code_combination_id),
                           decode(alclg.rounding_code_combination_id, null,
                                  srclg.rounding_code_combination_id, -1,
                                  srclg.rounding_code_combination_id,
                                  alclg.rounding_code_combination_id),
                           decode(l_autotax_changed, 'Y',
                                  srclg.enable_automatic_tax_flag,
                                  alclg.enable_automatic_tax_flag),
                           decode(srclg.complete_flag, 'Y',
                                  alclg.consolidation_ledger_flag,
                                  srclg.consolidation_ledger_flag),
                           decode(l_trans_eod_changed, 'Y',
                                   srclg.translate_eod_flag,
                                   alclg.translate_eod_flag),
                           decode(l_trans_qatd_changed, 'Y',
                                   srclg.translate_qatd_flag,
                                   alclg.translate_qatd_flag),
                           decode(l_trans_yatd_changed, 'Y',
                                   srclg.translate_yatd_flag,
                                   alclg.translate_yatd_flag),
                           decode(srclg.complete_flag, 'Y',
                                   alclg.transaction_calendar_id,
                                   srclg.transaction_calendar_id),
                           decode(srclg.complete_flag, 'Y',
                                   alclg.daily_translation_rate_type,
                                   srclg.daily_translation_rate_type),
                           srclg.criteria_set_id,
                           decode(l_period_avg_rt_changed, 'Y',
                                   srclg.period_average_rate_type,
                                   alclg.period_average_rate_type),
                           decode(l_period_end_rt_changed, 'Y',
                                   srclg.period_end_rate_type,
                                   alclg.period_end_rate_type),
                           decode(srclg.complete_flag, 'Y',
                                alclg.enable_secondary_track_flag,
                                srclg.enable_secondary_track_flag),
                           decode(srclg.complete_flag, 'Y',
                                alclg.enable_reval_ss_track_flag,
                                srclg.enable_reval_ss_track_flag),
                           srclg.enable_reconciliation_flag,
                           srclg.sla_ledger_cash_basis_flag,
                           srclg.context,
                           srclg.attribute1,
                           srclg.attribute2,
                           srclg.attribute3,
                           srclg.attribute4,
                           srclg.attribute5,
                           srclg.attribute6,
                           srclg.attribute7,
                           srclg.attribute8,
                           srclg.attribute9,
                           srclg.attribute10,
                           srclg.attribute11,
                           srclg.attribute12,
                           srclg.attribute13,
                           srclg.attribute14,
                           srclg.attribute15
                      FROM gl_ledgers srclg
                     WHERE ledger_id = x_ledger_id)
          WHERE ledger_id IN(
                   SELECT target_ledger_id
                     FROM gl_ledger_relationships
                    WHERE source_ledger_id = x_ledger_id
                      AND target_ledger_category_code = 'ALC'
                      AND relationship_type_code IN('SUBLEDGER', 'JOURNAL'));
Line: 1544

         gl_access_sets_pkg.update_implicit_access_set
                                (x_access_set_id => x_implicit_access_set_id,
                                 x_name => x_name,
                                 x_last_update_date => x_last_update_date,
                                 x_last_updated_by => x_last_updated_by,
                                 x_last_update_login => x_last_update_login);
Line: 1553

        update gl_ledger_configurations
        set name = x_name
        where configuration_id =
           (select configuration_id
            from gl_ledger_config_details
            where object_id = x_ledger_id
            and object_type_code = 'PRIMARY'
            and setup_step_code = 'NONE');
Line: 1581

               'SELECT ' || x_bal_seg_column_name
               || ' FROM gl_code_combinations WHERE chart_of_accounts_id = :1 '
               || ' AND code_combination_id = :2 ';
Line: 1594

         gl_ledgers_pkg.update_gl_system_usages(x_consolidation_ledger_flag);
Line: 1595

         gl_ledgers_pkg.insert_gl_net_income_accounts(x_ledger_id,
                                                      v_balancing_segment,
                                                      --x_balancing_segment,
                                                      x_net_income_ccid,
                                                      x_last_update_date,
                                                      x_last_updated_by,
                                                      x_last_update_date,
                                                      x_last_updated_by,
                                                      x_last_update_login,
                                                      '', '', '', '');
Line: 1611

         SELECT code_combination_id
           INTO x_suspense_ccid_temp
           FROM gl_code_combinations
          WHERE code_combination_id = x_suspense_ccid;
Line: 1624

         gl_ledgers_pkg.led_update_other_tables(x_ledger_id,
                                                x_last_update_date,
                                                x_last_updated_by,
                                                x_suspense_ccid_temp);
Line: 1634

                 gl_ledgers_pkg.led_update_other_tables(v_alc.target_ledger_id,
                                                x_last_update_date,
                                                x_last_updated_by,
                                                x_suspense_ccid_temp);
Line: 1678

   END update_row;
Line: 1685

         SELECT 'Duplicate'
           FROM gl_ledgers l
          WHERE l.NAME = x_name AND(x_rowid IS NULL OR l.ROWID <> x_rowid);
Line: 1690

         SELECT 'Duplicate'
           FROM gl_access_sets a
          WHERE a.NAME = x_name AND a.automatically_created_flag <> 'Y';
Line: 1738

         SELECT 'Duplicate'
           FROM gl_ledgers l
          WHERE l.short_name = x_short_name
            AND (x_rowid IS NULL OR l.ROWID <> x_rowid);
Line: 1772

         SELECT gl_ledgers_s.NEXTVAL
           FROM DUAL;
Line: 1807

         SELECT 'X'
           FROM fnd_id_flex_structures s
          WHERE s.application_id = 101
            AND s.id_flex_code = 'GL#'
            AND s.id_flex_num = x_chart_of_accounts_id
            AND s.freeze_flex_definition_flag = 'Y';
Line: 1847

         SELECT s.application_column_name, s.flex_value_set_id
           FROM fnd_id_flex_segments s, fnd_segment_attribute_values v
          WHERE s.application_id = v.application_id
            AND s.id_flex_code = v.id_flex_code
            AND s.id_flex_num = v.id_flex_num
            AND s.application_column_name = v.application_column_name
            AND v.application_id = 101
            AND v.id_flex_code = 'GL#'
            AND v.id_flex_num = x_chart_of_accounts_id
            AND v.segment_attribute_type = 'GL_BALANCING'
            AND v.attribute_value = 'Y';
Line: 1860

         SELECT s.application_column_name, s.flex_value_set_id
           FROM fnd_id_flex_segments s, fnd_segment_attribute_values v
          WHERE s.application_id = v.application_id
            AND s.id_flex_code = v.id_flex_code
            AND s.id_flex_num = v.id_flex_num
            AND s.application_column_name = v.application_column_name
            AND v.application_id = 101
            AND v.id_flex_code = 'GL#'
            AND v.id_flex_num = x_chart_of_accounts_id
            AND v.segment_attribute_type = 'GL_MANAGEMENT'
            AND v.attribute_value = 'Y';
Line: 1918

   PROCEDURE insert_row(
      x_rowid                    IN OUT NOCOPY VARCHAR2,
      x_ledger_id                         NUMBER,
      x_name                              VARCHAR2,
      x_short_name                        VARCHAR2,
      x_chart_of_accounts_id              NUMBER,
      x_chart_of_accounts_name            VARCHAR2,
      x_currency_code                     VARCHAR2,
      x_period_set_name                   VARCHAR2,
      x_user_period_type                  VARCHAR2,
      x_accounted_period_type             VARCHAR2,
      x_first_ledger_period_name          VARCHAR2,
      x_ret_earn_code_combination_id      NUMBER,
      x_suspense_allowed_flag             VARCHAR2,
      x_suspense_ccid                     NUMBER,
      x_allow_intercompany_post_flag      VARCHAR2,
      x_enable_avgbal_flag                VARCHAR2,
      x_enable_budgetary_control_f        VARCHAR2,
      x_require_budget_journals_flag      VARCHAR2,
      x_enable_je_approval_flag           VARCHAR2,
      x_enable_automatic_tax_flag         VARCHAR2,
      x_consolidation_ledger_flag         VARCHAR2,
      x_translate_eod_flag                VARCHAR2,
      x_translate_qatd_flag               VARCHAR2,
      x_translate_yatd_flag               VARCHAR2,
      x_automatically_created_flag        VARCHAR2,
      x_track_rounding_imbalance_f        VARCHAR2,
      x_alc_ledger_type_code              VARCHAR2,
      x_le_ledger_type_code               VARCHAR2,
      x_bal_seg_value_option_code         VARCHAR2,
      x_bal_seg_column_name               VARCHAR2,
      x_bal_seg_value_set_id              NUMBER,
      x_mgt_seg_value_option_code         VARCHAR2,
      x_mgt_seg_column_name               VARCHAR2,
      x_mgt_seg_value_set_id              NUMBER,
      x_last_update_date                  DATE,
      x_last_updated_by                   NUMBER,
      x_creation_date                     DATE,
      x_created_by                        NUMBER,
      x_last_update_login                 NUMBER,
      x_description                       VARCHAR2,
      x_future_enterable_periods_lmt      NUMBER,
      x_latest_opened_period_name         VARCHAR2,
      x_latest_encumbrance_year           NUMBER,
      x_cum_trans_ccid                    NUMBER,
      x_res_encumb_ccid                   NUMBER,
      x_net_income_ccid                   NUMBER,
      x_balancing_segment                 VARCHAR2,
      x_rounding_ccid                     NUMBER,
      x_transaction_calendar_id           NUMBER,
      x_transaction_calendar_name         VARCHAR2,
      x_daily_translation_rate_type       VARCHAR2,
      x_daily_user_translation_type       VARCHAR2,
      x_period_average_rate_type          VARCHAR2,
      x_period_avg_user_rate_type         VARCHAR2,
      x_period_end_rate_type              VARCHAR2,
      x_period_end_user_rate_type         VARCHAR2,
      x_context                           VARCHAR2,
      x_attribute1                        VARCHAR2,
      x_attribute2                        VARCHAR2,
      x_attribute3                        VARCHAR2,
      x_attribute4                        VARCHAR2,
      x_attribute5                        VARCHAR2,
      x_attribute6                        VARCHAR2,
      x_attribute7                        VARCHAR2,
      x_attribute8                        VARCHAR2,
      x_attribute9                        VARCHAR2,
      x_attribute10                       VARCHAR2,
      x_attribute11                       VARCHAR2,
      x_attribute12                       VARCHAR2,
      x_attribute13                       VARCHAR2,
      x_attribute14                       VARCHAR2,
      x_attribute15                       VARCHAR2,
      x_set_manual_flag                   VARCHAR2) IS
      CURSOR c IS
         SELECT ROWID
           FROM gl_ledgers
          WHERE NAME = x_name;
Line: 2022

                    x_last_updated_by => x_last_updated_by,
                    x_last_update_login => x_last_update_login,
                    x_creation_date => x_creation_date,
                    x_description => x_description);
Line: 2027

      INSERT INTO gl_ledgers
                  (ledger_id, NAME, short_name,
                   chart_of_accounts_id, currency_code,
                   period_set_name, accounted_period_type,
                   first_ledger_period_name,
                   ret_earn_code_combination_id, suspense_allowed_flag,
                   allow_intercompany_post_flag,
                   enable_average_balances_flag,
                   enable_budgetary_control_flag,
                   require_budget_journals_flag,
                   enable_je_approval_flag, enable_automatic_tax_flag,
                   consolidation_ledger_flag, translate_eod_flag,
                   translate_qatd_flag, translate_yatd_flag,
                   automatically_created_flag,
                   track_rounding_imbalance_flag, alc_ledger_type_code,
                   ledger_category_code, object_type_code,
                   le_ledger_type_code, bal_seg_value_option_code,
                   bal_seg_column_name, bal_seg_value_set_id,
                   mgt_seg_value_option_code, mgt_seg_column_name,
                   mgt_seg_value_set_id, implicit_access_set_id,
                   last_update_date, last_updated_by, creation_date,
                   created_by, last_update_login, description,
                   future_enterable_periods_limit, ledger_attributes,
                   latest_opened_period_name, latest_encumbrance_year,
                   cum_trans_code_combination_id,
                   res_encumb_code_combination_id,
                   net_income_code_combination_id,
                   rounding_code_combination_id, transaction_calendar_id,
                   daily_translation_rate_type,
                   period_average_rate_type, period_end_rate_type,
                   CONTEXT, attribute1, attribute2, attribute3,
                   attribute4, attribute5, attribute6, attribute7,
                   attribute8, attribute9, attribute10, attribute11,
                   attribute12, attribute13, attribute14, attribute15
                   ,net_closing_bal_flag,automate_sec_jrnl_rev_flag)--Added the net closing bal flag for bug 8612291
           VALUES (x_ledger_id, x_name, x_short_name,
                   x_chart_of_accounts_id, x_currency_code,
                   x_period_set_name, x_accounted_period_type,
                   x_first_ledger_period_name,
                   x_ret_earn_code_combination_id, x_suspense_allowed_flag,
                   x_allow_intercompany_post_flag,
                   x_enable_avgbal_flag,
                   x_enable_budgetary_control_f,
                   x_require_budget_journals_flag,
                   x_enable_je_approval_flag, x_enable_automatic_tax_flag,
                   x_consolidation_ledger_flag, x_translate_eod_flag,
                   x_translate_qatd_flag, x_translate_yatd_flag,
                   x_automatically_created_flag,
                   x_track_rounding_imbalance_f, x_alc_ledger_type_code,
                   'NONE', 'L',
                   x_le_ledger_type_code, x_bal_seg_value_option_code,
                   x_bal_seg_column_name, x_bal_seg_value_set_id,
                   x_mgt_seg_value_option_code, x_mgt_seg_column_name,
                   x_mgt_seg_value_set_id, x_access_set_id,
                   x_last_update_date, x_last_updated_by, x_creation_date,
                   x_created_by, x_last_update_login, x_description,
                   x_future_enterable_periods_lmt, 'L',
                   x_latest_opened_period_name, x_latest_encumbrance_year,
                   x_cum_trans_ccid,
                   x_res_encumb_ccid,
                   x_net_income_ccid,
                   x_rounding_ccid, x_transaction_calendar_id,
                   x_daily_translation_rate_type,
                   x_period_average_rate_type, x_period_end_rate_type,
                   x_context, x_attribute1, x_attribute2, x_attribute3,
                   x_attribute4, x_attribute5, x_attribute6, x_attribute7,
                   x_attribute8, x_attribute9, x_attribute10, x_attribute11,
                   x_attribute12, x_attribute13, x_attribute14, x_attribute15,
                   'N','N');--Added the default value for net closing bal flag for bug 8612291
Line: 2113

      gl_conc_control_pkg.insert_conc_ledger(x_ledger_id, x_last_update_date,
                                             x_last_updated_by,
                                             x_creation_date, x_created_by,
                                             x_last_update_login);
Line: 2119

      gl_period_statuses_pkg.insert_led_ps(x_ledger_id, x_period_set_name,
                                           x_accounted_period_type,
                                           x_last_update_date,
                                           x_last_updated_by,
                                           x_last_update_login,
                                           x_creation_date, x_created_by);
Line: 2134

         gl_suspense_accounts_pkg.insert_ledger_suspense(x_ledger_id,
                                                         x_suspense_ccid,
                                                         x_last_update_date,
                                                         x_last_updated_by);
Line: 2147

         gl_ledgers_pkg.update_gl_system_usages(x_consolidation_ledger_flag);
Line: 2148

         gl_ledgers_pkg.insert_gl_net_income_accounts(x_ledger_id,
                                                      x_balancing_segment,
                                                      x_net_income_ccid,
                                                      x_creation_date,
                                                      x_created_by,
                                                      x_last_update_date,
                                                      x_last_updated_by,
                                                      x_last_update_login,
                                                      '', '', '', '');
Line: 2158

   END insert_row;
Line: 2230

         SELECT        *
                  FROM gl_ledgers
                 WHERE ROWID = x_rowid
         FOR UPDATE OF NAME NOWAIT;
Line: 2429

   PROCEDURE update_row(
      x_rowid                             VARCHAR2,
      x_ledger_id                         NUMBER,
      x_name                              VARCHAR2,
      x_short_name                        VARCHAR2,
      x_chart_of_accounts_id              NUMBER,
      x_chart_of_accounts_name            VARCHAR2,
      x_currency_code                     VARCHAR2,
      x_period_set_name                   VARCHAR2,
      x_user_period_type                  VARCHAR2,
      x_accounted_period_type             VARCHAR2,
      x_first_ledger_period_name          VARCHAR2,
      x_ret_earn_code_combination_id      NUMBER,
      x_suspense_allowed_flag             VARCHAR2,
      x_suspense_ccid                     NUMBER,
      x_allow_intercompany_post_flag      VARCHAR2,
      x_enable_avgbal_flag                VARCHAR2,
      x_enable_budgetary_control_f        VARCHAR2,
      x_require_budget_journals_flag      VARCHAR2,
      x_enable_je_approval_flag           VARCHAR2,
      x_enable_automatic_tax_flag         VARCHAR2,
      x_consolidation_ledger_flag         VARCHAR2,
      x_translate_eod_flag                VARCHAR2,
      x_translate_qatd_flag               VARCHAR2,
      x_translate_yatd_flag               VARCHAR2,
      x_automatically_created_flag        VARCHAR2,
      x_track_rounding_imbalance_f        VARCHAR2,
      x_alc_ledger_type_code              VARCHAR2,
      x_le_ledger_type_code               VARCHAR2,
      x_bal_seg_value_option_code         VARCHAR2,
      x_bal_seg_column_name               VARCHAR2,
      x_bal_seg_value_set_id              NUMBER,
      x_mgt_seg_value_option_code         VARCHAR2,
      x_mgt_seg_column_name               VARCHAR2,
      x_mgt_seg_value_set_id              NUMBER,
      x_implicit_access_set_id            NUMBER,
      x_last_update_date                  DATE,
      x_last_updated_by                   NUMBER,
      x_last_update_login                 NUMBER,
      x_description                       VARCHAR2,
      x_future_enterable_periods_lmt      NUMBER,
      x_latest_opened_period_name         VARCHAR2,
      x_latest_encumbrance_year           NUMBER,
      x_cum_trans_ccid                    NUMBER,
      x_res_encumb_ccid                   NUMBER,
      x_net_income_ccid                   NUMBER,
      x_balancing_segment                 VARCHAR2,
      x_rounding_ccid                     NUMBER,
      x_transaction_calendar_id           NUMBER,
      x_transaction_calendar_name         VARCHAR2,
      x_daily_translation_rate_type       VARCHAR2,
      x_daily_user_translation_type       VARCHAR2,
      x_period_average_rate_type          VARCHAR2,
      x_period_avg_user_rate_type         VARCHAR2,
      x_period_end_rate_type              VARCHAR2,
      x_period_end_user_rate_type         VARCHAR2,
      x_context                           VARCHAR2,
      x_attribute1                        VARCHAR2,
      x_attribute2                        VARCHAR2,
      x_attribute3                        VARCHAR2,
      x_attribute4                        VARCHAR2,
      x_attribute5                        VARCHAR2,
      x_attribute6                        VARCHAR2,
      x_attribute7                        VARCHAR2,
      x_attribute8                        VARCHAR2,
      x_attribute9                        VARCHAR2,
      x_attribute10                       VARCHAR2,
      x_attribute11                       VARCHAR2,
      x_attribute12                       VARCHAR2,
      x_attribute13                       VARCHAR2,
      x_attribute14                       VARCHAR2,
      x_attribute15                       VARCHAR2,
      x_set_manual_flag                   VARCHAR2) IS
   BEGIN
      UPDATE gl_ledgers
         SET ledger_id = x_ledger_id,
             NAME = x_name,
             short_name = x_short_name,
             chart_of_accounts_id = x_chart_of_accounts_id,
             currency_code = x_currency_code,
             period_set_name = x_period_set_name,
             accounted_period_type = x_accounted_period_type,
             first_ledger_period_name = x_first_ledger_period_name,
             ret_earn_code_combination_id = x_ret_earn_code_combination_id,
             suspense_allowed_flag = x_suspense_allowed_flag,
             allow_intercompany_post_flag = x_allow_intercompany_post_flag,
             enable_average_balances_flag = x_enable_avgbal_flag,
             enable_budgetary_control_flag = x_enable_budgetary_control_f,
             require_budget_journals_flag = x_require_budget_journals_flag,
             enable_je_approval_flag = x_enable_je_approval_flag,
             enable_automatic_tax_flag = x_enable_automatic_tax_flag,
             consolidation_ledger_flag = x_consolidation_ledger_flag,
             translate_eod_flag = x_translate_eod_flag,
             translate_qatd_flag = x_translate_qatd_flag,
             translate_yatd_flag = x_translate_yatd_flag,
             automatically_created_flag = x_automatically_created_flag,
             track_rounding_imbalance_flag = x_track_rounding_imbalance_f,
             alc_ledger_type_code = x_alc_ledger_type_code,
             le_ledger_type_code = x_le_ledger_type_code,
             bal_seg_value_option_code = x_bal_seg_value_option_code,
             bal_seg_column_name = x_bal_seg_column_name,
             bal_seg_value_set_id = x_bal_seg_value_set_id,
             mgt_seg_value_option_code = x_mgt_seg_value_option_code,
             mgt_seg_column_name = x_mgt_seg_column_name,
             mgt_seg_value_set_id = x_mgt_seg_value_set_id,
             last_update_date = x_last_update_date,
             last_updated_by = x_last_updated_by,
             last_update_login = x_last_update_login,
             description = x_description,
             future_enterable_periods_limit = x_future_enterable_periods_lmt,
             latest_opened_period_name = x_latest_opened_period_name,
             latest_encumbrance_year = x_latest_encumbrance_year,
             cum_trans_code_combination_id = x_cum_trans_ccid,
             res_encumb_code_combination_id = x_res_encumb_ccid,
             net_income_code_combination_id = x_net_income_ccid,
             rounding_code_combination_id = x_rounding_ccid,
             transaction_calendar_id = x_transaction_calendar_id,
             daily_translation_rate_type = x_daily_translation_rate_type,
             period_average_rate_type = x_period_average_rate_type,
             period_end_rate_type = x_period_end_rate_type,
             CONTEXT = x_context,
             attribute1 = x_attribute1,
             attribute2 = x_attribute2,
             attribute3 = x_attribute3,
             attribute4 = x_attribute4,
             attribute5 = x_attribute5,
             attribute6 = x_attribute6,
             attribute7 = x_attribute7,
             attribute8 = x_attribute8,
             attribute9 = x_attribute9,
             attribute10 = x_attribute10,
             attribute11 = x_attribute11,
             attribute12 = x_attribute12,
             attribute13 = x_attribute13,
             attribute14 = x_attribute14,
             attribute15 = x_attribute15
       WHERE ROWID = x_rowid;
Line: 2572

      gl_access_sets_pkg.update_implicit_access_set
                                 (x_access_set_id => x_implicit_access_set_id,
                                  x_name => x_name,
                                  x_last_update_date => x_last_update_date,
                                  x_last_updated_by => x_last_updated_by,
                                  x_last_update_login => x_last_update_login);
Line: 2585

      gl_ledgers_pkg.led_update_other_tables(x_ledger_id, x_last_update_date,
                                             x_last_updated_by,
                                             x_suspense_ccid);
Line: 2588

   END update_row;
Line: 2591

   PROCEDURE select_row(
      recinfo                    IN OUT NOCOPY gl_ledgers%ROWTYPE) IS
   BEGIN
      SELECT *
        INTO recinfo
        FROM gl_ledgers
       WHERE ledger_id = recinfo.ledger_id;
Line: 2598

   END select_row;
Line: 2601

   PROCEDURE select_columns(
      x_ledger_id                         NUMBER,
      x_name                     IN OUT NOCOPY VARCHAR2) IS
      recinfo   gl_ledgers%ROWTYPE;
Line: 2607

      select_row(recinfo);
Line: 2609

   END select_columns;
Line: 2612

   PROCEDURE update_gl_system_usages(
      cons_lgr_flag                       VARCHAR2) IS
   BEGIN
      UPDATE gl_system_usages
         SET average_balances_flag = 'Y',
             consolidation_ledger_flag =
                    DECODE(cons_lgr_flag,
                           'Y', 'Y',
                           consolidation_ledger_flag)
       WHERE EXISTS(
                SELECT '1'
                  FROM gl_system_usages
                 WHERE average_balances_flag = 'N'
                    OR (    (cons_lgr_flag = 'Y')
                        AND consolidation_ledger_flag = 'N'));
Line: 2627

   END update_gl_system_usages;
Line: 2630

   PROCEDURE insert_gl_net_income_accounts(
      x_ledger_id                         NUMBER,
      x_balancing_segment                 VARCHAR2,
      x_net_income_ccid                   NUMBER,
      x_creation_date                     DATE,
      x_created_by                        NUMBER,
      x_last_update_date                  DATE,
      x_last_updated_by                   NUMBER,
      x_last_update_login                 NUMBER,
      x_request_id                        NUMBER,
      x_program_application_id            NUMBER,
      x_program_id                        NUMBER,
      x_program_update_date               DATE) IS
   BEGIN
      INSERT INTO gl_net_income_accounts
                  (ledger_id, bal_seg_value, code_combination_id,
                   creation_date, created_by, last_update_date,
                   last_updated_by, last_update_login, request_id,
                   program_application_id, program_id,
                   program_update_date)
           VALUES (x_ledger_id, x_balancing_segment, x_net_income_ccid,
                   x_creation_date, x_created_by, x_last_update_date,
                   x_last_updated_by, x_last_update_login, x_request_id,
                   x_program_application_id, x_program_id,
                   x_program_update_date);
Line: 2655

   END insert_gl_net_income_accounts;
Line: 2658

   PROCEDURE led_update_other_tables(
      x_ledger_id                         NUMBER,
      x_last_update_date                  DATE,
      x_last_updated_by                   NUMBER,
      x_suspense_ccid                     NUMBER) IS
      FOUND   BOOLEAN;
Line: 2677

         gl_suspense_accounts_pkg.update_ledger_suspense(x_ledger_id,
                                                         x_suspense_ccid,
                                                         x_last_update_date,
                                                         x_last_updated_by);
Line: 2685

            gl_suspense_accounts_pkg.insert_ledger_suspense
                                                         (x_ledger_id,
                                                          x_suspense_ccid,
                                                          x_last_update_date,
                                                          x_last_updated_by);
Line: 2692

   END led_update_other_tables;
Line: 2699

         SELECT 'avg translated'
           FROM DUAL
          WHERE EXISTS(
                   SELECT 'X'
                     FROM gl_translation_tracking
                    WHERE ledger_id = x_ledger_id
                      AND average_translation_flag = 'Y'
                      AND earliest_ever_period_name <>
                                                    earliest_never_period_name);
Line: 2731

      UPDATE gl_je_sources
         SET journal_approval_flag = 'Y'
       WHERE je_source_name = 'Manual';
Line: 2737

   PROCEDURE insert_set(
      x_rowid                    IN OUT NOCOPY VARCHAR2,
      x_access_set_id            IN OUT NOCOPY NUMBER,
      x_ledger_id                         NUMBER,
      x_name                              VARCHAR2,
      x_short_name                        VARCHAR2,
      x_chart_of_accounts_id              NUMBER,
      x_period_set_name                   VARCHAR2,
      x_accounted_period_type             VARCHAR2,
      x_default_ledger_id                 NUMBER,
      x_last_update_date                  DATE,
      x_last_updated_by                   NUMBER,
      x_creation_date                     DATE,
      x_created_by                        NUMBER,
      x_last_update_login                 NUMBER,
      x_description                       VARCHAR2,
      x_context                           VARCHAR2,
      x_attribute1                        VARCHAR2,
      x_attribute2                        VARCHAR2,
      x_attribute3                        VARCHAR2,
      x_attribute4                        VARCHAR2,
      x_attribute5                        VARCHAR2,
      x_attribute6                        VARCHAR2,
      x_attribute7                        VARCHAR2,
      x_attribute8                        VARCHAR2,
      x_attribute9                        VARCHAR2,
      x_attribute10                       VARCHAR2,
      x_attribute11                       VARCHAR2,
      x_attribute12                       VARCHAR2,
      x_attribute13                       VARCHAR2,
      x_attribute14                       VARCHAR2,
      x_attribute15                       VARCHAR2) IS
      l_bal_seg_column_name    VARCHAR2(25);
Line: 2776

         SELECT ROWID
           FROM gl_ledgers
          WHERE NAME = x_name;
Line: 2795

                          x_last_updated_by => x_last_updated_by,
                          x_last_update_login => x_last_update_login,
                          x_creation_date => x_creation_date,
                          x_description => x_description);
Line: 2800

      INSERT INTO gl_ledgers
                  (ledger_id, NAME, short_name,
                   chart_of_accounts_id, currency_code, period_set_name,
                   accounted_period_type, first_ledger_period_name,
                   ret_earn_code_combination_id, suspense_allowed_flag,
                   allow_intercompany_post_flag,
                   track_rounding_imbalance_flag,
                   enable_average_balances_flag,
                   enable_budgetary_control_flag,
                   require_budget_journals_flag, enable_je_approval_flag,
                   enable_automatic_tax_flag, consolidation_ledger_flag,
                   translate_eod_flag, translate_qatd_flag,
                   translate_yatd_flag, automatically_created_flag,
                   alc_ledger_type_code, ledger_category_code,
                   object_type_code, le_ledger_type_code,
                   bal_seg_value_option_code, bal_seg_column_name,
                   mgt_seg_value_option_code, mgt_seg_column_name,
                   bal_seg_value_set_id, mgt_seg_value_set_id,
                   implicit_access_set_id, future_enterable_periods_limit,
                   ledger_attributes, enable_reconciliation_flag,
                   last_update_date, last_updated_by,
                   creation_date, created_by, last_update_login,
                   description, CONTEXT, attribute1, attribute2,
                   attribute3, attribute4, attribute5, attribute6,
                   attribute7, attribute8, attribute9, attribute10,
                   attribute11, attribute12, attribute13,
                   attribute14, attribute15, create_je_flag,net_closing_bal_flag,automate_sec_jrnl_rev_flag)--Added the net closing bal flag for bug 8612291
           VALUES (x_ledger_id, x_name, x_short_name,
                   x_chart_of_accounts_id, 'X',               -- currency_code
                                               x_period_set_name,
                   x_accounted_period_type, 'X',   -- first_ledger_period_name
                   -1,                         -- ret_earn_code_combination_id
                      'N',                            -- suspense_allowed_flag
                   'N',                        -- allow_intercompany_post_flag
                   'N',                       -- track_rounding_imbalance_flag
                   'N',                        -- enable_average_balances_flag
                   'N',                       -- enable_budgetary_control_flag
                   'N',                        -- require_budget_journals_flag
                       'N',                         -- enable_je_approval_flag
                   'N',                           -- enable_automatic_tax_flag
                       'N',                       -- consolidation_ledger_flag
                   'N',                                  -- translate_eod_flag
                       'N',                             -- translate_qatd_flag
                   'N',                                 -- translate_yatd_flag
                       'N',                      -- automatically_created_flag
                   'NONE',                             -- alc_ledger_type_code
                          'NONE',                      -- ledger_category_code
                   'S',                                    -- object_type_code
                       'U',                             -- le_ledger_type_code
                   'I',                           -- bal_seg_value_option_code
                       l_bal_seg_column_name,
                   'I',                           -- mgt_seg_value_option_code
                       l_mgt_seg_column_name,
                   l_bal_seg_value_set_id, l_mgt_seg_value_set_id,
                   x_access_set_id, 0,       -- future_enterable_periods_limit
                   'S', 'N',  -- ledger_attributes, enable_reconciliation_flag
                   x_last_update_date, x_last_updated_by,
                   x_creation_date, x_created_by, x_last_update_login,
                   x_description, x_context, x_attribute1, x_attribute2,
                   x_attribute3, x_attribute4, x_attribute5, x_attribute6,
                   x_attribute7, x_attribute8, x_attribute9, x_attribute10,
                   x_attribute11, x_attribute12, x_attribute13,
                   x_attribute14, x_attribute15,
                   'N',-- create_je_flag
                   'N','N');  --Added the default value net closing bal flag for bug 8612291
Line: 2878

   END insert_set;
Line: 2907

         SELECT        *
                  FROM gl_ledgers
                 WHERE ROWID = x_rowid
         FOR UPDATE OF NAME NOWAIT;
Line: 2984

   PROCEDURE update_set(
      x_rowid                             VARCHAR2,
      x_access_set_id                     NUMBER,
      x_ledger_id                         NUMBER,
      x_name                              VARCHAR2,
      x_short_name                        VARCHAR2,
      x_chart_of_accounts_id              NUMBER,
      x_period_set_name                   VARCHAR2,
      x_accounted_period_type             VARCHAR2,
      x_default_ledger_id                 NUMBER,
      x_last_update_date                  DATE,
      x_last_updated_by                   NUMBER,
      x_last_update_login                 NUMBER,
      x_description                       VARCHAR2,
      x_context                           VARCHAR2,
      x_attribute1                        VARCHAR2,
      x_attribute2                        VARCHAR2,
      x_attribute3                        VARCHAR2,
      x_attribute4                        VARCHAR2,
      x_attribute5                        VARCHAR2,
      x_attribute6                        VARCHAR2,
      x_attribute7                        VARCHAR2,
      x_attribute8                        VARCHAR2,
      x_attribute9                        VARCHAR2,
      x_attribute10                       VARCHAR2,
      x_attribute11                       VARCHAR2,
      x_attribute12                       VARCHAR2,
      x_attribute13                       VARCHAR2,
      x_attribute14                       VARCHAR2,
      x_attribute15                       VARCHAR2) IS
   BEGIN
      UPDATE gl_ledgers
         SET ledger_id = x_ledger_id,
             NAME = x_name,
             short_name = x_short_name,
             chart_of_accounts_id = x_chart_of_accounts_id,
             period_set_name = x_period_set_name,
             accounted_period_type = x_accounted_period_type,
             last_update_date = x_last_update_date,
             last_updated_by = x_last_updated_by,
             last_update_login = x_last_update_login,
             description = x_description,
             CONTEXT = x_context,
             attribute1 = x_attribute1,
             attribute2 = x_attribute2,
             attribute3 = x_attribute3,
             attribute4 = x_attribute4,
             attribute5 = x_attribute5,
             attribute6 = x_attribute6,
             attribute7 = x_attribute7,
             attribute8 = x_attribute8,
             attribute9 = x_attribute9,
             attribute10 = x_attribute10,
             attribute11 = x_attribute11,
             attribute12 = x_attribute12,
             attribute13 = x_attribute13,
             attribute14 = x_attribute14,
             attribute15 = x_attribute15
       WHERE ROWID = x_rowid;
Line: 3049

      gl_access_sets_pkg.update_implicit_access_set
                                   (x_access_set_id => x_access_set_id,
                                    x_name => x_name,
                                    x_last_update_date => x_last_update_date,
                                    x_last_updated_by => x_last_updated_by,
                                    x_last_update_login => x_last_update_login);
Line: 3057

      UPDATE gl_access_sets
         SET default_ledger_id = x_default_ledger_id
       WHERE access_set_id = x_access_set_id;
Line: 3060

   END update_set;
Line: 3068

         SELECT 1
         FROM   GL_LEDGER_SET_NORM_ASSIGN
         WHERE  ledger_set_id = x_ledger_set_id
         AND    ledger_id     = x_default_ledger_id
         AND    (status_code  <> 'D' OR status_code IS NULL)
         AND    rownum < 2;
Line: 3078

      updated_by    NUMBER;
Line: 3079

      update_login  NUMBER;
Line: 3080

      update_date   DATE;
Line: 3091

      SELECT last_updated_by, last_update_login, last_update_date
      INTO   updated_by, update_login, update_date
      FROM   GL_LEDGERS
      WHERE  ledger_id = x_ledger_set_id;
Line: 3096

      GL_LEDGER_SET_NORM_ASSIGN_PKG.Insert_Row(
         rowid,
         x_ledger_set_id,
         x_default_ledger_id,
         'L',          -- object_type_code
         update_date,  -- last_update_date
         updated_by,   -- last_updated_by
         update_date,  -- creation_date
         updated_by,   -- created_by
         update_login, -- last_update_login
         NULL,         -- start_date
         NULL,         -- end_date
         NULL,         -- context
         NULL,         -- attribute1
         NULL,         -- attribute2
         NULL,         -- attribute3
         NULL,         -- attribute4
         NULL,         -- attribute5
         NULL,         -- attribute6
         NULL,         -- attribute7
         NULL,         -- attribute8
         NULL,         -- attribute9
         NULL,         -- attribute10
         NULL,         -- attribute11
         NULL,         -- attribute12
         NULL,         -- attribute13
         NULL,         -- attribute14
         NULL,         -- attribute15
         NULL);        -- request_id
Line: 3249

   PROCEDURE insert_set(
      x_ledger_id               NUMBER,
      x_name                    VARCHAR2,
      x_short_name              VARCHAR2,
      x_chart_of_accounts_id    NUMBER,
      x_period_set_name         VARCHAR2,
      x_accounted_period_type   VARCHAR2,
      x_default_ledger_id       NUMBER,
      x_date                    DATE,
      x_user_id                 NUMBER,
      x_login_id                NUMBER,
      x_description             VARCHAR2,
      x_context                 VARCHAR2,
      x_attribute1              VARCHAR2,
      x_attribute2              VARCHAR2,
      x_attribute3              VARCHAR2,
      x_attribute4              VARCHAR2,
      x_attribute5              VARCHAR2,
      x_attribute6              VARCHAR2,
      x_attribute7              VARCHAR2,
      x_attribute8              VARCHAR2,
      x_attribute9              VARCHAR2,
      x_attribute10             VARCHAR2,
      x_attribute11             VARCHAR2,
      x_attribute12             VARCHAR2,
      x_attribute13             VARCHAR2,
      x_attribute14             VARCHAR2,
      x_attribute15             VARCHAR2) IS
      l_bal_seg_column_name   VARCHAR2(25);
Line: 3300

                           x_last_updated_by       => x_user_id,
                           x_last_update_login     => x_login_id,
                           x_creation_date         => x_date,
                           x_description           => x_description);
Line: 3305

      INSERT INTO GL_LEDGERS
         (ledger_id, name, short_name, chart_of_accounts_id, currency_code,
          period_set_name, accounted_period_type, first_ledger_period_name,
          ret_earn_code_combination_id, suspense_allowed_flag,
          allow_intercompany_post_flag, track_rounding_imbalance_flag,
          enable_average_balances_flag, enable_budgetary_control_flag,
          require_budget_journals_flag, enable_je_approval_flag,
          enable_automatic_tax_flag, consolidation_ledger_flag,
          translate_eod_flag, translate_qatd_flag,
          translate_yatd_flag, automatically_created_flag,
          alc_ledger_type_code, ledger_category_code,
          object_type_code, le_ledger_type_code,
          bal_seg_value_option_code, bal_seg_column_name,
          mgt_seg_value_option_code, mgt_seg_column_name,
          bal_seg_value_set_id, mgt_seg_value_set_id,
          implicit_access_set_id, future_enterable_periods_limit,
          ledger_attributes, enable_reconciliation_flag,
          last_update_date, last_updated_by, last_update_login,
          creation_date, created_by, description,
          context, attribute1, attribute2, attribute3,
          attribute4, attribute5, attribute6, attribute7,
          attribute8, attribute9, attribute10, attribute11,
          attribute12, attribute13, attribute14, attribute15,
          create_je_flag,net_closing_bal_flag,automate_sec_jrnl_rev_flag)--Added the net closing bal flag for bug 8612291
      VALUES
         (x_ledger_id, x_name, x_short_name, x_chart_of_accounts_id, 'X',
          x_period_set_name, x_accounted_period_type, 'X',
          -1, 'N', -- ret_earn_code_combination_id, suspense_allowed_flag
          'N','N', -- allow_intercompany_post_flag, track_rounding_imbalance_flag
          'N','N', -- enable_average_balances_flag, enable_budgetary_control_flag
          'N','N', -- require_budget_journals_flag, enable_je_approval_flag
          'N','N', -- enable_automatic_tax_flag, consolidation_ledger_flag
          'N','N', -- translate_eod_flag, translate_qatd_flag
          'N','N', -- translate_yatd_flag, automatically_created_flag
          'NONE','NONE', -- alc_ledger_type_code, ledger_category_code
          'S','U', -- object_type_code, le_ledger_type_code
          'I',     -- bal_seg_value_option_code
          l_bal_seg_column_name,
          'I',     -- mgt_seg_value_option_code
          l_mgt_seg_column_name,
          l_bal_seg_value_set_id, l_mgt_seg_value_set_id,
          l_access_set_id, 0, -- future_enterable_periods_limit
          'S', 'N', -- ledger_attributes, enable_reconciliation_flag
          x_date, x_user_id, x_login_id,
          x_date, x_user_id, x_description,
          x_context, x_attribute1, x_attribute2, x_attribute3,
          x_attribute4, x_attribute5, x_attribute6, x_attribute7,
          x_attribute8, x_attribute9, x_attribute10, x_attribute11,
          x_attribute12, x_attribute13, x_attribute14, x_attribute15,
          'N', -- enable_reconciliation_flag, create_je_flag
          'N','N');--Added the net closing bal flag for bug 8612291
Line: 3356

   END insert_set;
Line: 3359

   PROCEDURE update_set(
      x_ledger_id               NUMBER,
      x_name                    VARCHAR2,
      x_short_name              VARCHAR2,
      x_chart_of_accounts_id    NUMBER,
      x_period_set_name         VARCHAR2,
      x_accounted_period_type   VARCHAR2,
      x_default_ledger_id       NUMBER,
      x_date                    DATE,
      x_user_id                 NUMBER,
      x_login_id                NUMBER,
      x_description             VARCHAR2,
      x_context                 VARCHAR2,
      x_attribute1              VARCHAR2,
      x_attribute2              VARCHAR2,
      x_attribute3              VARCHAR2,
      x_attribute4              VARCHAR2,
      x_attribute5              VARCHAR2,
      x_attribute6              VARCHAR2,
      x_attribute7              VARCHAR2,
      x_attribute8              VARCHAR2,
      x_attribute9              VARCHAR2,
      x_attribute10             VARCHAR2,
      x_attribute11             VARCHAR2,
      x_attribute12             VARCHAR2,
      x_attribute13             VARCHAR2,
      x_attribute14             VARCHAR2,
      x_attribute15             VARCHAR2) IS
      l_access_set_id   NUMBER(15);
Line: 3389

      UPDATE GL_LEDGERS
      SET    name                  = x_name,
             short_name            = x_short_name,
             chart_of_accounts_id  = x_chart_of_accounts_id,
             period_set_name       = x_period_set_name,
             accounted_period_type = x_accounted_period_type,
             last_update_date      = x_date,
             last_updated_by       = x_user_id,
             last_update_login     = x_login_id,
             description           = x_description,
             context               = x_context,
             attribute1            = x_attribute1,
             attribute2            = x_attribute2,
             attribute3            = x_attribute3,
             attribute4            = x_attribute4,
             attribute5            = x_attribute5,
             attribute6            = x_attribute6,
             attribute7            = x_attribute7,
             attribute8            = x_attribute8,
             attribute9            = x_attribute9,
             attribute10           = x_attribute10,
             attribute11           = x_attribute11,
             attribute12           = x_attribute12,
             attribute13           = x_attribute13,
             attribute14           = x_attribute14,
             attribute15           = x_attribute15
      WHERE  ledger_id = x_ledger_id
      RETURNING implicit_access_set_id INTO l_access_set_id;
Line: 3424

      GL_ACCESS_SETS_PKG.update_implicit_access_set
                                  (x_access_set_id     => l_access_set_id,
                                   x_name              => x_name,
                                   x_last_update_date  => x_date,
                                   x_last_updated_by   => x_user_id,
                                   x_last_update_login => x_login_id);
Line: 3432

      UPDATE GL_ACCESS_SETS
      SET    default_ledger_id = x_default_ledger_id
      WHERE  access_set_id = l_access_set_id;
Line: 3435

   END update_set;
Line: 3441

  select distinct cg1.object_id ledger_id,cg1.object_type_code
  from gl_ledger_config_details cg1, gl_ledger_config_details cg2
  where cg2.object_id = x_le_id
  and cg1.configuration_id = cg2.configuration_id
  and cg1.object_type_code in ('PRIMARY','SECONDARY');
Line: 3455

       delete from gl_legal_entities_bsvs
       where legal_entity_id = x_le_id;
Line: 3458

       delete from gl_ledger_norm_seg_vals
       where  legal_entity_id = x_le_id
       and    segment_type_code = 'B'
       and    segment_value_type_code = 'S';
Line: 3469

	       select count(*) into BSVCount from
	       gl_ledger_norm_seg_vals where ledger_id = PLSL.ledger_id;
Line: 3473

	       update gl_ledgers
	       set bal_seg_value_option_code = 'A'
	       where ledger_id = PLSL.ledger_id;
Line: 3477

	       update gl_ledgers
	       set bal_seg_value_option_code = 'A'
               where ledger_id in
               (
                 select distinct target_ledger_id from gl_ledger_relationships
                 where  source_ledger_id = PLSL.ledger_id
                 and target_ledger_category_code = 'ALC'
                 and relationship_type_code not in('NONE','BALANCE')
	       );
Line: 3506

        select l.ledger_id, cd2.configuration_id
        from gl_ledgers l, gl_le_value_sets lv,
             gl_ledger_config_details cd1, gl_ledger_config_details cd2
        where lv.legal_entity_id = x_le_id
        and lv.flex_value_set_id = x_value_set_id
        and cd1.object_id = lv.legal_entity_id
        and cd1.object_type_code = 'LEGAL_ENTITY'
        and cd1.setup_step_code = 'NONE'
        and cd2.configuration_id = cd1.configuration_id
        and cd2.object_type_code in ('PRIMARY', 'SECONDARY')
        and cd2.setup_step_code = 'NONE'
        and l.bal_seg_value_set_id = lv.flex_value_set_id
        and l.ledger_id = cd2.object_id;
Line: 3520

        select rowid
        from gl_ledger_norm_seg_vals
        where ledger_id = c_ledger_id
        and segment_type_code = 'B'
        and segment_value = x_bsv_value
        and segment_value_type_code = 'S'
        FOR UPDATE NOWAIT;
Line: 3528

       SELECT 'has_le_bsv'
       FROM   GL_LEDGER_NORM_SEG_VALS
       WHERE  ledger_id = c_ledger_id
       AND    legal_entity_id IS NOT NULL
       AND    segment_type_code = 'B'
       AND    segment_value_type_code = 'S'
       AND    rownum<2;
Line: 3536

        select completion_status_code
        from gl_ledger_configurations
        where configuration_id =
                (select configuration_id
                 from gl_ledger_config_details
                 where object_id = x_le_id
                 and object_type_code = 'LEGAL_ENTITY');
Line: 3554

            GL_LEDGER_NORM_SEG_VALS_PKG.Insert_Row(
              X_Rowid                   => l_rowid,
              X_Ledger_Id               => l_ledger_id,
              X_Segment_Type_Code       => 'B',
              X_Segment_Value           =>  x_bsv_value,
              X_Segment_Value_Type_Code => 'S',
              X_Record_Id               => GL_LEDGER_NORM_SEG_VALS_PKG.Get_Record_Id,
              X_Last_Update_Date        => sysdate,
              X_Last_Updated_By         => fnd_global.user_id,
              X_Creation_Date           => sysdate,
              X_Created_By              => fnd_global.user_id,
              X_Last_Update_Login       => fnd_global.login_id,
              X_Start_Date              => x_start_date,
              X_End_Date                => x_end_date,
              X_Context                 => null,
              X_Attribute1              => null,
              X_Attribute2              => null,
              X_Attribute3              => null,
              X_Attribute4              => null,
              X_Attribute5              => null,
              X_Attribute6              => null,
              X_Attribute7              => null,
              X_Attribute8              => null,
              X_Attribute9              => null,
              X_Attribute10             => null,
              X_Attribute11             => null,
              X_Attribute12             => null,
              X_Attribute13             => null,
              X_Attribute14             => null,
              X_Attribute15             => null,
              X_Request_Id              => null);
Line: 3585

            update gl_ledger_norm_seg_vals
            set legal_entity_id = x_le_id,
                last_update_date = sysdate,
                last_updated_by = fnd_global.user_id,
                last_update_login = fnd_global.login_id
            where ledger_id = l_ledger_id
            and segment_type_code = 'B'
            and segment_value = x_bsv_value
            and segment_value_type_code = 'S';
Line: 3594

            insert into  gl_ledger_config_details
              (configuration_id,
               object_type_code,
               object_id,
               object_name,
               setup_step_code,
               next_action_code,
               status_code,
               created_by,
               last_update_login,
               last_update_date,
               last_updated_by,
               creation_date)
             select
               configuration_id,
               object_type_code,
               object_id,
               object_name,
               'INTER_ASSG',
               'ASSIGN_ACCTS',
               'NOT_STARTED',
               fnd_global.user_id,
               fnd_global.login_id,
               sysdate,
               fnd_global.user_id,
               sysdate
              from gl_ledger_config_details
              where object_id = l_ledger_id
              and object_type_code <> 'LEGAL_ENTITY'
              and setup_step_code = 'NONE'
              and configuration_id = l_config_id
              and NOT EXISTS(select 1
                            from gl_ledger_config_details
                            where object_id = l_ledger_id
                            and object_type_code <> 'LEGAL_ENTITY'
                            and setup_step_code = 'INTER_ASSG');
Line: 3630

            update gl_ledgers
            set bal_seg_value_option_code = 'I'
            where ledger_id = l_ledger_id
            and bal_seg_value_option_code = 'A';
Line: 3634

            update gl_ledgers
            set bal_seg_value_option_code = 'I'
            where ledger_id in
            (select target_ledger_id
             from gl_ledger_relationships
             where source_ledger_id = l_ledger_id
             and   target_ledger_category_code = 'ALC'
             and   relationship_type_code in ('JOURNAL','SUBLEDGER') )
            and bal_seg_value_option_code = 'A';
Line: 3645

                delete from gl_ledger_norm_seg_vals
                where rowid = l_rowid;
Line: 3652

                  delete gl_ledger_norm_seg_vals
                  where  ledger_id = l_ledger_id
                  and    segment_type_code = 'B'
                  and    segment_value_type_code = 'S';
Line: 3657

                  update gl_ledgers
                  set    bal_seg_value_option_code = 'A'
                  where  ledger_id = l_ledger_id
                  and    bal_seg_value_option_code = 'I';
Line: 3662

                  update gl_ledgers
                  set    bal_seg_value_option_code = 'A'
                  where  ledger_id in
                 (select target_ledger_id
                  from gl_ledger_relationships
                  where source_ledger_id = l_ledger_id
                  and   target_ledger_category_code = 'ALC'
                  and   relationship_type_code in ('JOURNAL','SUBLEDGER') )
                  and   bal_seg_value_option_code = 'I';
Line: 3674

                GL_LEDGER_NORM_SEG_VALS_PKG.Delete_Row(
                    X_Rowid   => l_rowid);
Line: 3679

                update gl_ledger_norm_seg_vals
                set start_date = x_start_date,
                    end_date = x_end_date,
                    last_update_date = sysdate,
                    last_updated_by = fnd_global.user_id,
                    last_update_login = fnd_global.login_id
                where rowid = l_rowid;
Line: 3687

                update gl_ledger_norm_seg_vals
                set start_date = x_start_date,
                    end_date = x_end_date,
                    status_code = decode(status_code, 'I', 'I', 'U'),
                    last_update_date = sysdate,
                    last_updated_by = fnd_global.user_id,
                    last_update_login = fnd_global.login_id
                where rowid = l_rowid;
Line: 3718

        select application_table_name, value_column_name,
        nvl(meaning_column_name, 'null'), enabled_column_name,
        start_date_column_name, end_date_column_name,
        additional_where_clause
        from fnd_flex_validation_tables
        where flex_value_set_id = c_flex_value_set_id;
Line: 3725

        select BAL_SEG_VALUE_SET_ID
        from gl_ledgers
        where ledger_id = c_ledger_id;
Line: 3749

        sql_stmt := 'select '||l_meaning_col_name||' from '||l_table_name||
                    ' where '||l_value_col_name||
                    ' = :1 and '||l_enabled_col_name||' =''Y'''
                    ||' and nvl('||l_start_date_col_name||',sysdate)<=sysdate'
                    ||' and nvl('||l_end_date_col_name||',sysdate)>=sysdate';
Line: 3777

      SELECT min(start_date) begins, max(end_date) ends
      FROM gl_periods
      WHERE period_set_name = x_period_set_name
      AND   period_type     = x_period_type;
Line: 3783

      SELECT accounting_date
      FROM gl_date_period_map
      WHERE period_name     = not_assigned
      AND   period_set_name = x_period_set_name
      AND   period_type     = x_period_type
      AND   accounting_date BETWEEN beginning AND ending;
Line: 3791

      SELECT max(accounting_date)
      FROM gl_date_period_map
      WHERE period_name    <> not_assigned
      AND   period_set_name = x_period_set_name
      AND   period_type     = x_period_type
      AND   accounting_date < gap_date;
Line: 3799

      SELECT min(accounting_date)
      FROM gl_date_period_map
      WHERE period_name    <> not_assigned
      AND   period_set_name = x_period_set_name
      AND   period_type     = x_period_type
      AND   accounting_date > gap_date;
Line: 3845

        select 'Duplicate'
        from   GL_LEDGERS LEDGERS
        where  LEDGERS.NAME = x_object_name
        and    LEDGERS.LEDGER_ID <> x_object_id
        UNION
        select 'Duplicate'
        from   GL_ACCESS_SETS ACCESS_SETS
        where  ACCESS_SETS.NAME = x_object_name
        and    ACCESS_SETS.AUTOMATICALLY_CREATED_FLAG <> 'Y'
        UNION
        select 'Duplicate'
        from GL_LEDGER_RELATIONSHIPS
        where target_ledger_category_code = 'ALC'
        and relationship_type_code = 'BALANCE'
        and target_ledger_name = x_object_name;
Line: 3876

        select 'Duplicate'
        from   GL_LEDGERS GL_LEDGERS
        where  GL_LEDGERS.SHORT_NAME = x_ledger_short_name
        and    GL_LEDGERS.LEDGER_ID  <> x_ledger_id
        UNION
        select 'Duplicate'
        from GL_LEDGER_RELATIONSHIPS
        where target_ledger_category_code = 'ALC'
        and relationship_type_code = 'BALANCE'
        and target_ledger_short_name = x_ledger_short_name;
Line: 3903

        SELECT 'Duplicate'
        FROM   gl_ledger_relationships
        WHERE  application_id = 101
          AND  target_ledger_name = x_target_ledger_name
          AND  relationship_type_code <> 'NONE'
          AND  relationship_id <> x_relationship_id
          AND  target_ledger_id <> x_ledger_id
        UNION
          SELECT name
          FROM   GL_LEDGERS
          WHERE  name            = x_target_ledger_name
          AND    ledger_id       <> NVL(x_ledger_id,-1)
        UNION
          SELECT 'Duplicate'
          FROM   GL_ACCESS_SETS a
          WHERE  a.name = x_target_ledger_name
          AND    a.automatically_created_flag <> 'Y';
Line: 3937

        SELECT 'Duplicate'
        FROM   gl_ledger_relationships
        WHERE  application_id = 101
          AND  target_ledger_short_name = x_ledger_short_name
          AND  relationship_type_code <> 'NONE'
          AND  relationship_id <> x_relationship_id
          AND  target_ledger_id <> x_ledger_id
        UNION
          SELECT short_name
            FROM gl_ledgers
           WHERE short_name = x_ledger_short_name
             AND ledger_id <> NVL(x_ledger_id,-1);
Line: 3964

                update gl_ledger_configurations
                set completion_status_code = 'CONFIRMED'
                where configuration_id = x_object_id;
Line: 3968

                update gl_ledgers
                set complete_flag = 'Y'
                where configuration_id = x_object_id
                and ledger_category_code in ('PRIMARY', 'SECONDARY', 'ALC');
Line: 3973

                update gl_ledgers
                set complete_flag = 'Y'
                where ledger_id = x_object_id;
Line: 3983

         SELECT 'translated'
         FROM DUAL
         WHERE EXISTS(
                SELECT 'X'
                FROM gl_translation_tracking
                WHERE ledger_id = x_ledger_id
                AND actual_flag = 'A'
                AND ((earliest_ever_period_year*10000)+earliest_ever_period_num) <
                    ((earliest_never_period_year*10000)+earliest_never_period_num));
Line: 4011

        SELECT  max(pr.end_date - pr.start_date)+1
        FROM    GL_PERIODS pr, GL_PERIOD_TYPES pty
        WHERE   pr.period_type = pty.period_type
        AND    ((pr.period_set_name, pr.period_type)
               IN (SELECT period_set_name, accounted_period_type
                   FROM   gl_ledgers where ledger_id = x_ledger_id))
        GROUP BY pr.period_set_name, pty.user_period_type, pty.period_type
        HAVING (max(pr.end_date - pr.start_date)+1) >=35;
Line: 4048

          SELECT object_id
          FROM gl_ledger_config_details
          WHERE configuration_id = x_config_id
          AND object_type_code = 'LEGAL_ENTITY';
Line: 4057

           delete from gl_ledger_config_details
           where configuration_id = x_config_id
           and object_type_code = 'PRIMARY'
           and setup_step_code = 'OU_SETUP';