The following lines contain the word 'select', 'insert', 'update' or 'delete':
select 'GL_CODE_COMBINATIONS' , c.table_id, g.application_column_name,
g.segment_num, s.concatenated_segment_delimiter
from fnd_columns c, fnd_id_flex_segments g, fnd_id_flex_structures s
where g.application_id = 101
and g.id_flex_code = 'GL#'
and g.id_flex_num = (
select accounting_flex_structure
from fa_book_controls where book_type_code = X_book)
and g.enabled_flag = 'Y'
and c.application_id = g.application_id
and c.table_id = (select table_id
from fnd_tables
where table_name = 'GL_CODE_COMBINATIONS'
and application_id = 101)
and c.column_name = g.application_column_name
and s.application_id = g.application_id
and s.id_flex_code = g.id_flex_code
and s.id_flex_num = g.id_flex_num
union -- asset key
select 'FA_ASSET_KEYWORDS', c.table_id,g.application_column_name, g.segment_num, s.concatenated_segment_delimiter
from fnd_columns c, fnd_id_flex_segments g, fnd_id_flex_structures s
where g.application_id = 140
and g.id_flex_code = 'KEY#'
and g.id_flex_num = ( select asset_key_flex_structure
from fa_system_controls)
and g.enabled_flag = 'Y'
and c.application_id = 140
and c.table_id = (select table_id
from fnd_tables
where table_name = 'FA_ASSET_KEYWORDS'
and application_id = 140)
and c.column_name = g.application_column_name
and s.application_id = g.application_id
and s.id_flex_code = g.id_flex_code
and s.id_flex_num = g.id_flex_num
union -- location
select 'FA_LOCATIONS', c.table_id, g.application_column_name, g.segment_num, s.concatenated_segment_delimiter
from fnd_columns c, fnd_id_flex_segments g, fnd_id_flex_structures s
where g.application_id = 140
and g.id_flex_code = 'LOC#'
and g.id_flex_num = ( select location_flex_structure
from fa_system_controls)
and g.enabled_flag = 'Y'
and c.application_id = 140
and c.table_id = (select table_id
from fnd_tables
where table_name = 'FA_LOCATIONS'
and application_id = 140)
AND c.column_name = g.application_column_name
and s.application_id = g.application_id
and s.id_flex_code = g.id_flex_code
and s.id_flex_num = g.id_flex_num
union -- category
select 'FA_CATEGORIES_B', c.table_id, g.application_column_name, g.segment_num, s.concatenated_segment_delimiter
from fnd_columns c, fnd_id_flex_segments g, fnd_id_flex_structures s
where g.application_id = 140
and g.id_flex_code = 'CAT#'
and g.id_flex_num = (select category_flex_structure
from fa_system_controls)
and g.enabled_flag = 'Y'
and c.application_id = 140
and c.table_id = (select table_id
from fnd_tables
where table_name = 'FA_CATEGORIES_B'
and application_id = 140)
and c.column_name = g.application_column_name
and s.application_id = g.application_id
and s.id_flex_code = g.id_flex_code
and s.id_flex_num = g.id_flex_num
ORDER BY 1, 4;
fa_whatif_deprn_pkg.t_request_id.delete;
fa_whatif_deprn_pkg.t_book_type_code.delete;
fa_whatif_deprn_pkg.t_asset_id.delete;
fa_whatif_deprn_pkg.t_asset_number.delete;
fa_whatif_deprn_pkg.t_description.delete;
fa_whatif_deprn_pkg.t_tag_number.delete;
fa_whatif_deprn_pkg.t_serial_number.delete;
fa_whatif_deprn_pkg.t_period_name.delete;
fa_whatif_deprn_pkg.t_fiscal_year.delete;
fa_whatif_deprn_pkg.t_expense_acct.delete;
fa_whatif_deprn_pkg.t_location.delete;
fa_whatif_deprn_pkg.t_units.delete;
fa_whatif_deprn_pkg.t_employee_name.delete;
fa_whatif_deprn_pkg.t_employee_number.delete;
fa_whatif_deprn_pkg.t_asset_key.delete;
fa_whatif_deprn_pkg.t_current_cost.delete;
fa_whatif_deprn_pkg.t_current_prorate_conv.delete;
fa_whatif_deprn_pkg.t_current_method.delete;
fa_whatif_deprn_pkg.t_current_life.delete;
fa_whatif_deprn_pkg.t_current_basic_rate.delete;
fa_whatif_deprn_pkg.t_current_adjusted_rate.delete;
fa_whatif_deprn_pkg.t_current_salvage_value.delete;
fa_whatif_deprn_pkg.t_depreciation.delete;
fa_whatif_deprn_pkg.t_new_depreciation.delete;
fa_whatif_deprn_pkg.t_created_by.delete;
fa_whatif_deprn_pkg.t_creation_date.delete;
fa_whatif_deprn_pkg.t_last_update_date.delete;
fa_whatif_deprn_pkg.t_last_updated_by.delete;
fa_whatif_deprn_pkg.t_last_update_login.delete;
fa_whatif_deprn_pkg.t_date_placed_in_service.delete;
fa_whatif_deprn_pkg.t_category.delete;
fa_whatif_deprn_pkg.t_accumulated_deprn.delete;
fa_whatif_deprn_pkg.t_bonus_depreciation.delete;
fa_whatif_deprn_pkg.t_new_bonus_depreciation.delete;
fa_whatif_deprn_pkg.t_current_bonus_rule.delete;
fa_whatif_deprn_pkg.t_period_num.delete;
fa_whatif_deprn_pkg.t_currency_code.delete;
select amortize_flag into h_check from fa_book_controls
where book_type_code = X_book;
select location_flex_structure, category_flex_structure,
asset_key_flex_structure
into h_loc_struct, h_cat_struct, h_key_struct
from fa_system_controls;
select accounting_flex_structure into h_acct_struct
from fa_book_controls where book_type_code = X_book;
select cur.precision into h_precision
from fa_book_controls bc, gl_sets_of_books sob, fnd_currencies cur
where bc.book_type_code = X_book
--and sob.set_of_books_id = bc.set_of_books_id
and sob.set_of_books_id = FARX_C_WD.sob_id -- Enhancement bug 3037321
and sob.currency_code = cur.currency_code;
select fcr.last_update_login into h_login_id
from fnd_concurrent_requests fcr
where fcr.request_id = X_request_id;
fa_rx_shared_pkg.g_seg_table.delete;
fa_whatif_deprn_pkg.g_deprn.delete;
fa_whatif_deprn_pkg.g_deprn.delete;
ret := fa_whatif_deprn_pkg.whatif_insert_itf (
X_asset_id => X_assets(h_count),
X_book => X_book,
X_request_id => X_request_id,
X_num_pers => X_num_per,
X_acct_struct => h_acct_struct,
X_key_struct => h_key_struct,
X_cat_struct => h_cat_struct,
X_loc_struct => h_loc_struct,
X_precision => h_precision,
X_user_id => X_user_id,
X_login_id => h_login_id,
X_last_asset => (h_count = (X_num_assets - 1)),
retcode => retcode,
errbuf => errbuf);
fa_whatif_deprn_pkg.g_deprn.delete;
fa_whatif_deprn_pkg.g_deprn.delete;
select r.basic_rate
into h_basic_rate
from fa_methods m, fa_flat_rates r
where m.method_code = X_method
and m.method_id = r.method_id
and r.adjusted_rate = X_adjusted_rate and rownum < 2;
select currency_code
into h_currency
from gl_sets_of_books
where set_of_books_id = FARX_C_WD.sob_id;
-- insert the Currency_code - for Enhancement bug 3037321
insert into fa_whatif_itf (
request_id, asset_id, asset_number, description, tag_number,
serial_number, period_name, fiscal_year, expense_acct,
depreciation, new_depreciation, location, units, employee_name,
employee_number, asset_key,
current_cost, current_prorate_conv, current_method, current_life,
current_basic_rate, current_adjusted_rate, current_salvage_value,
bonus_depreciation, new_bonus_depreciation,
created_by, creation_date, last_update_date,
last_updated_by, last_update_login,category,date_placed_in_service,
accumulated_deprn,currency_code
) values (
X_request_id, NULL, NULL, NULL, NULL, NULL,
fa_whatif_deprn_pkg.g_deprn(h_count).period_name,
fa_whatif_deprn_pkg.g_deprn(h_count).fiscal_year, NULL,
fa_whatif_deprn_pkg.g_deprn(h_count).deprn,
fa_whatif_deprn_pkg.g_deprn(h_count).new_deprn,
NULL, NULL, NULL, NULL,
NULL, X_cost, X_prorate_conv, X_method,
X_life, h_basic_rate, X_adjusted_rate, h_sal,
fa_whatif_deprn_pkg.g_deprn(h_count).bonus_deprn,
fa_whatif_deprn_pkg.g_deprn(h_count).new_bonus_deprn,
X_user_id, sysdate, sysdate, X_user_id, h_login_id,
h_concat_str, X_dpis,
fa_whatif_deprn_pkg.g_deprn(h_count).new_rsv,h_currency);
fa_whatif_deprn_pkg.g_deprn.delete;
fa_whatif_deprn_pkg.g_deprn.delete;
select bk.asset_id, bk.deprn_method_code, ad.asset_number
from fa_books bk, fa_additions ad
where ad.asset_category_id = nvl(X_category_id,ad.asset_category_id)
and ad.description like nvl(X_description,ad.description)
and ad.asset_number >= nvl(X_begin_asset,ad.asset_number)
and ad.asset_number <= nvl(X_end_asset,ad.asset_number)
and ad.asset_type in ('CAPITALIZED', 'GROUP')
and bk.asset_id = ad.asset_id
and bk.book_type_code = X_book
and bk.production_capacity is null
and bk.depreciate_flag = 'YES'
and bk.transaction_header_id_out is null
and bk.period_counter_fully_retired is null
and bk.date_placed_in_service >=
nvl(X_begin_dpis,bk.date_placed_in_service)
and bk.date_placed_in_service <=
nvl(X_end_dpis,bk.date_placed_in_service)
and nvl(BK.Period_Counter_Fully_Reserved, -1)
= decode(X_rsv_flag, 'YES',
nvl(BK.Period_Counter_Fully_Reserved, -1),-1)
and bk.group_asset_id is null;
select 1
from fa_transaction_headers
where asset_id = c_asset_id
and book_type_code = c_book_type_code
and transaction_subtype = 'AMORTIZED';
select count(*) into h_check
from fa_deprn_detail
where asset_id = h_asset_id
and book_type_code = X_book
and deprn_source_code = 'B'
and not exists (select 1
from fa_deprn_detail dd1
where asset_id = h_asset_id
and book_type_code = X_book
and deprn_source_code = 'D'
and deprn_amount <> 0 ); -- bugfix 2223451 commented deprn_amount > 0;