FA Asset Book Details 11i

Description
Categories: Enginatics
Repository: Github
FA asset books with asset depreciation summary and financial transaction values.
Using parameters 'Show Calendar', 'Show Alternative Ledgers', 'Show Accounting Rules', 'Show Natural Accounts' shows the setup details of book controls.

Download Blitz Report™ – World’s fastest reporting and data upload for Oracle EBS

Contact us to schedule a demo or if you need help with the installation

with c_additions as(
select
fab.asset_id,
fab.asset_number,
(select fat.description from fa_additions_tl fat where fat.asset_id=fab.asset_id and fat.language=userenv('lang')) asset_description,
fab.tag_number,
fab.attribute_category_code asset_category_code,
fab.serial_number,
(select fakk.concatenated_segments from fa_asset_keywords_kfv fakk where fakk.code_combination_id=fab.asset_key_ccid) asset_key,
(select fab1.asset_number from fa_additions_b fab1 where fab1.asset_id=fab.parent_asset_id)parent_asset_number,
(select fat.description from fa_additions_tl fat where fat.asset_id=fab.parent_asset_id and fat.language=userenv('lang')) parent_description ,
fab.manufacturer_name,
fab.model_number,
fl.lease_number,
fl.description lease_description,
(select aps.vendor_name from po_vendors aps where fl.lessor_id=aps.vendor_id) lessor,
fab.in_use_flag,
fab.inventorial,
fab.asset_type,
fab.current_units,
fab.property_type_code,
fab.owned_leased,
fab.property_1245_1250_code,
fab.new_used,
fb.book_type_code,
fb.cost
from
fa_additions_b fab,
fa_books fb,
fa_leases fl
where
fab.asset_id=fb.asset_id and
nvl(fb.disabled_flag,'N')='N' and
fb.transaction_header_id_out is null and
fab.lease_id=fl.lease_id(+) and
('&show_additions'='Y' or '&show_dprn'='Y' or '&show_trx'='Y')
),
c_dprn as(
select
fds.book_type_code,
fds.asset_id,
fds.period_counter,
fdp.period_name deprn_period_name,
fdp.period_close_date deprn_period_close_date,
fds.deprn_amount,
fds.ytd_deprn,
fds.deprn_reserve,
fds.deprn_source_code
from
(select x.* from (select max(fds.period_counter) over (partition by fds.asset_id,fds.book_type_code) max_period_counter, fds.* from fa_deprn_summary fds) x where x.period_counter=x.max_period_counter) fds,
fa_deprn_periods fdp
where
fds.book_type_code=fdp.book_type_code(+) and
fds.period_counter+1=fdp.period_counter(+) and
'&show_dprn'='Y'
),
c_fin_trx as (
select
fb.asset_id,
fb.book_type_code,
(select fl.meaning from fa_lookups fl where fl.lookup_type='FAXOLTRX' and fl.lookup_code=fth.transaction_type_code) trx_transaction_type,
fdp.period_name trx_period_entered,
fcp.period_name trx_period_effective,
fb.cost trx_current_cost,
fth.transaction_date_entered trx_date_entered,
fdp.fiscal_year trx_fiscal_year,
fth.date_effective trx_date_effective,
ftr.transaction_type trx_reference_type,
ftr.trx_reference_id,
fb.transaction_header_id_in
from
fa_books fb,
fa_books fb0,
fa_transaction_headers fth,
fa_trx_references ftr,
fa_deprn_periods fdp,
fa_book_controls fbc,
fa_calendar_periods fcp
where
fb.transaction_header_id_in=fb0.transaction_header_id_out(+) and
(fb.cost<>fb0.cost or fb0.cost is null) and
fb.transaction_header_id_in=fth.transaction_header_id and
fth.trx_reference_id=ftr.trx_reference_id(+) and
fth.book_type_code=fdp.book_type_code and
fth.date_effective between fdp.period_open_date and nvl(fdp.period_close_date,sysdate) and
fb.book_type_code=fbc.book_type_code and
fbc.deprn_calendar=fcp.calendar_type and
fth.transaction_date_entered between fcp.start_date and fcp.end_date and
fb.book_type_code=fdp.book_type_code and
'&show_trx'='Y'
)
select --main SQL starts here
gl.name ledger,
fbc.book_type_code asset_book,
fbc.book_type_name description,
fbc.book_class class,
fbc.distribution_source_book associated_corporate_book,
(select fds.period_name from fa_deprn_periods fds where fds.period_counter=fbc.initial_period_counter and fds.book_type_code=fbc.book_type_code) initial_period_counter,
(select fds.period_name from fa_deprn_periods fds where fds.period_counter=fbc.last_mass_copy_period_counter and fds.book_type_code=fbc.book_type_code) last_mass_copy_period_counter ,
(select fds.period_name from fa_deprn_periods fds where fds.period_counter=fbc.last_period_counter and fds.book_type_code=fbc.book_type_code) last_period_counter,
&calendar_columns
&accounting_rules_columns
&natural_account_columns
&asset_number
&addition_columns
&dprn_columns
&trx_columns
haouv.name operating_unit,
(select fift.id_flex_structure_name from fnd_id_flex_structures_tl fift where gl.chart_of_accounts_id=fift.id_flex_num and fift.application_id=101 and fift.id_flex_code='GL#' and fift.language=userenv('lang')) chart_of_accounts,
fbc.org_id
from
fa_book_controls fbc,
gl_sets_of_books gl,
c_additions,
c_dprn,
c_fin_trx,
hr_all_organization_units_vl haouv
where
1=1 and
fbc.set_of_books_id=gl.set_of_books_id and
fbc.book_type_code=c_additions.book_type_code(+) and
c_additions.book_type_code=c_dprn.book_type_code(+) and
c_additions.asset_id=c_dprn.asset_id(+) and
c_additions.book_type_code=c_fin_trx.book_type_code(+) and
c_additions.asset_id=c_fin_trx.asset_id(+) and
fbc.org_id=haouv.organization_id(+)
order by
fbc.book_type_code
&order_columns
Parameter Name SQL text Validation
Ledger
gl.name=:ledger and
fbc.book_type_code in (select fbcs.book_type_code from fa_book_controls_sec fbcs)
LOV
Asset Book
fbc.book_type_code=:book_type_code
LOV
Show Calendar
fbc.date_ineffective inactive_on,
fbc.allow_purge_flag allow_purge,
(select fdp.period_name from fa_deprn_periods fdp where fdp.period_counter=fbc.last_purge_period_counter and fdp.book_type_code=fbc.book_type_code) purged_through,
gl.short_name ledger,
gl.description ledger_description,
fbc.gl_posting_allowed_flag allow_gl_posting,
fbc.deprn_calendar depreciation_calendar,
fbc.fiscal_year_name,
fbc.prorate_calendar,
(select fdp.period_name from fa_deprn_periods fdp where fdp.period_close_date is null and fdp.book_type_code=fbc.book_type_code) current_period,
fbc.current_fiscal_year,
decode(fbc.deprn_allocation_code,'E','Evenly','D','By Days',fbc.deprn_allocation_code) divide_depreciation,
fbc.depr_first_year_ret_flag depreciate_if_retired_first_yr,
fbc.last_deprn_run_date last_depreciation_run_date,
fbc.deprn_status last_depreciation_run_status,
fbc.deprn_request_id last_depreciation_request,
LOV
Show Accounting Rules
trunc(fbc.capital_gain_threshold/12) capital_gain_threshold_years,
mod(fbc.capital_gain_threshold,12) capital_gain_threshold_months,
fbc.amortize_flag allow_amortized_changes,
fbc.allow_mass_changes,
--revaluations
fbc.allow_reval_flag allow_revaluations,
fbc.reval_deprn_reserve_flag revalue_accumulated_dprn,
fbc.reval_ytd_deprn_flag revalue_ytd_depreciation,
fbc.retire_reval_reserve_flag retire_revaluation_reserve,
fbc.amortize_reval_reserve_flag amortize_revaluation_reserve,
fbc.default_reval_fully_rsvd_flag revalue_fully_reserved_assets,
fbc.default_life_extension_factor life_extension_factor,
fbc.default_max_fully_rsvd_revals maximum_revaluations,
fbc.default_life_extension_factor life_extension_ceiling,
--group dprn
fbc.allow_cip_member_flag allow_cip_member_in_grp_assets,
fbc.allow_cip_dep_group_flag allow_cip_dprn_in_grp_assets,
fbc.allow_member_tracking_flag allow_member_asset_track,
fbc.allow_interco_group_flag interco_member_asset_assign,
--other flags
fbc.intercompany_posting_flag create_intercomp_bal_entries,
fbc.allow_group_deprn_flag allow_group_depreciation,
fbc.allow_deprn_adjustments allow_reserve_adjustments,
fbc.allow_cost_ceiling allow_cost_ceilings,
fbc.itc_allowed_flag allow_invest_tax_credits,
fbc.allow_deprn_exp_ceiling allow_expense_ceilings,
fbc.allow_cip_assets_flag allow_cip_assets,
fbc.allow_backdated_transfers_flag allow_backdated_transfers,
fbc.allow_mass_copy,
fbc.copy_additions_flag copy_additions,
fbc.copy_adjustments_flag copy_adjustments,
fbc.copy_retirements_flag copy_retirements,
LOV
Show Natural Accounts
--retirment accounts
fbc.proceeds_of_sale_gain_acct proceeds_of_sale_gain,
fbc.proceeds_of_sale_loss_acct proceeds_of_sale_loss,
fbc.proceeds_of_sale_clearing_acct proceeds_of_sale_clearing,
fbc.cost_of_removal_gain_acct cost_of_removal_gain,
fbc.cost_of_removal_loss_acct cost_of_removal_loss,
fbc.cost_of_removal_clearing_acct cost_of_removal_clearing,
fbc.nbv_retired_gain_acct net_book_value_retired_gain,
fbc.nbv_retired_loss_acct net_book_value_retired_loss,
fbc.reval_rsv_retired_gain_acct reval_reserve_retired_gain,
fbc.reval_rsv_retired_loss_acct reval_reserve_retired_loss,
--
fbc.deferred_deprn_reserve_acct deferred_depreciation_reserve,
fbc.deferred_deprn_expense_acct deferred_depreciation_expense,
fbc.deprn_adjustment_acct depreciation_adjustment,
(select gcck.concatenated_segments from gl_code_combinations_kfv gcck where gcck.code_combination_id=fbc.flexbuilder_defaults_ccid) account_generator_defaults,
LOV
Show Asset Details
Y
LOV
Show Depreciation Summary
Y
LOV
Show Fin Transactions
Y
LOV
Organization
haouv.name=:org_name
LOV