You are on page 1of 15

DROP VIEW APPS.XXFA_HFM_CUMULATIVE_VIEW; /* Formatted on 2012/11/09 14:28 (Formatter Plus v4.8.8) */ CREATE OR REPLACE FORCE VIEW apps.

xxfa_hfm_cumulative_view (ledger_id, scenario, YEAR, period, period_type, movement_type, company_code, account_code, account_type, analysis, responsibility_cente r, product_type, subscription_year, interco, currency_code, ledger_currency, ent_amnt, func_amnt, creation_date, last_update_date ) AS SELECT gld.ledger_id, 'A' scenario, glp.period_year YEAR, CASE WHEN glp.period_name NOT LIKE 'ADJ%' THEN TO_CHAR (TO_DATE (SUBSTR (glp.period_name, 1, 3), 'MON'), 'MM' ) WHEN glp.period_name LIKE 'ADJ%' THEN '13' END period, DECODE (glp.adjustment_period_flag, 'N', 'No', 'Y', 'Yes' ) period_type, DECODE (fak.segment1, 'STANDARD', 'Additions', 'ACQUISITION', 'AcqBS', 'TRANSFER IN', 'ICTrf', 'TRANSFER OUT', 'ICTrf' ) movement_type, gcc.segment1 company_code, gcc.segment3 account_code, gcc.account_type, gcc.segment4 analysis, gcc.segment2 responsibility_center, NVL ((SELECT fvnh.parent_flex_value FROM fnd_flex_value_norm_hierarchy fvnh, fnd_id_flex_structures fifs, fnd_id_flex_segments fifseg WHERE fvnh.flex_value_set_id = fifseg.flex_value_set_id AND fifseg.id_flex_code = 'GL#' AND fifseg.segment_num = 5 AND fifseg.id_flex_num = fifs.id_flex_num AND fifs.id_flex_structure_code = 'RE_PRIMARY_ACCOUNTING' AND fifs.id_flex_code = fifseg.id_flex_code

currency_code.actual_flag = 'A' gcc.asset_id = fth. 'STANDARD'. fa_transaction_headers fth.gl_sl_link_id = gir. gcc.ae_line_num ( xdl.enabled_flag = 'Y' gjh. gcc.accounting_line_code = 'FA_ADD_COST' OR xdl. gl_periods glp. gl_balances gb. 'TRANSFER OUT') gjh.reference_9)) func_amnt. SYSDATE creation_date.segment6.segment5 BETWEEN fvnh.ae_header_id xal.code_combination_id = gcc. fa_asset_keywords fak. fa_additions_b fa. gcc.segment7. gcc.je_batch_id xal.je_header_id gir.child_flex_value_low AND fvnh. SUM (TO_NUMBER (gir.je_header_id gir.segment7 interco.currency_code.je_source = 'Assets' gjh. .je_header_id = gll.account_type != 'E' gir. gcc. xla_distribution_links xdl. gl_ledgers gld gcc.account_type. gcc.code_combination_id gjh. gjh.segment1.gl_sl_link_id xal. gcc.segment1.reference_10 IS NULL gjh. gcc.je_header_id = gll.period_name gjh.currency_code ledger_currency. xla_ae_lines xal.segment4.je_line_num = gll. gl_je_headers gjh.ae_header_id = xdl. gld.je_line_num gjh.ae_line_num = xdl.period_name = glp.child_flex_value_high).asset_key_ccid = fak.code_combination_id fak. 'TRANSFER IN'.event_id fa. gjh.ledger_id = gld.period_name = glp. gl_import_references gir.segment5 ) product_type.status = 'P' gb.segment5.code_combination_id = gll.code_combination_id = gll.je_batch_id = gir.period_name gjh. SYSDATE last_update_date gl_je_lines gll.accounting_line_code = 'FA_ADJ_COST' ) fth.code_combination_id gb. gcc.currency_code fak.event_id = xdl. SUM (TO_NUMBER (gir. 'Adjustment') gjh.asset_id fa.segment1 IN ('ACQUISITION'.segment3.code_combination_id gb.segment2. gl_code_combinations gcc.segment6 subscription_year.reference_9)) ent_amnt.FROM WHERE AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND GROUP BY AND gcc.ledger_id gcc. gcc. gcc.je_category IN ('Addition'.currency_code = gb.

adjustment_period_flag UNION --Query for Reclass movement type SELECT gld.id_flex_code = fifseg.id_flex_code AND gcc. 'No'. 'A' scenario.period_name.segment2 responsibility_center.parent_flex_value FROM fnd_flex_value_norm_hierarchy fvnh. SYSDATE creation_date. gl_balances gb.id_flex_num = fifs. gld. gcc.id_flex_code = 'GL#' AND fifseg.id_flex_structure_code = 'RE_PRIMARY_ACCOUNTING' AND fifs. gcc.currency_code. gjh.segment_num = 5 AND fifseg. gl_je_headers gjh. 'N'.segment5 BETWEEN fvnh. CASE WHEN glp. fa_transaction_headers fth.reference_9). gl_import_references gir.reference_10) ) ) ent_amnt.period_year. gcc. 'MON'). 'MM' ) WHEN glp. -TO_NUMBER (gir.segment4 analysis. glp.period_year YEAR.segment1 company_code. gcc. gl_periods glp. gcc.currency_code ledger_currency.segment5 ) product_type.flex_value_set_id AND fifseg. xla_distribution_links xdl.id_flex_num AND fifs. 'Reclass' movement_type. xla_ae_lines xal. glp. glp.ledger_id. fnd_id_flex_structures fifs. SUM (NVL (TO_NUMBER (gir.child_flex_value_high). 'Y'.gld.segment6 subscription_year.ledger_id.child_flex_value_low AND fvnh. gld. 1. DECODE (glp. fnd_id_flex_segments fifseg WHERE fvnh.account_type.period_name.segment7 interco. NVL ((SELECT fvnh.segment3 account_code. gcc.adjustment_period_flag. -TO_NUMBER (gir.currency_code.reference_9). gcc. glp. SUM (NVL (TO_NUMBER (gir.reference_10) ) ) func_amnt. 3). gl_code_combinations gcc. .flex_value_set_id = fifseg. fa_additions_b fa. gcc.period_name NOT LIKE 'ADJ%' THEN TO_CHAR (TO_DATE (SUBSTR (glp. 'Yes' ) period_type.period_name LIKE 'ADJ%' THEN '13' END period. SYSDATE last_update_date FROM gl_je_lines gll.

'MM' ) WHEN glp.segment1 company_code.accounting_line_code = 'FA_RECLASS_SOURCE_COST' OR xdl.ledger_id.currency_code. DECODE (glp.accounting_line_code = 'FA_RECLASS_DEST_DEPRN_RESERVE' OR xdl. 'MON').period_year YEAR.ae_line_num -.je_header_id = gll.segment4.je_batch_id AND xal.period_name AND gjh. gld. 'N'.ledger_id AND gcc.event_id AND fa. 'Imprment' movement_type. gld.account_type.code_combination_id = gll. gcc. CASE WHEN glp.je_line_num = gll.je_header_id AND gir.segment5.ledger_id.AND xdl.segment1.currency_code UNION ---Query for Impairment SELECT gld.ACCOUNTING_LINE_CODE='FA_RECLASS_SOURCE_COST' AND ( xdl.je_category = 'Reclass' AND gjh. 3).ae_header_id = xdl. gcc. gcc.period_name.segment2.je_header_id AND gir.actual_flag = 'A' AND gcc.period_name NOT LIKE 'ADJ%' THEN TO_CHAR (TO_DATE (SUBSTR (glp.account_type != 'E' AND gjh. gcc. 'A' scenario.code_combination_id AND gb. 'Yes' ) period_type.event_id = xdl. gcc.gl_sl_link_id = gir.segment6.period_name = glp.accounting_line_code = 'FA_RECLASS_SOURCE_DEPRN_RESERV' ) AND fth. gcc.asset_id = fth.ae_header_id AND xal.period_year.period_name AND gjh.adjustment_period_flag. glp.gl_ledgers gld WHERE gcc.period_name = glp.segment3.code_combination_id = gcc. 'Y'.segment7. gjh. 1.status = 'P' AND gb.gl_sl_link_id AND xal.code_combination_id = gll. gcc. glp.ae_line_num = xdl. glp.asset_id AND gjh. 'No'.je_batch_id = gir.period_name LIKE 'ADJ%' THEN '13' END period. glp.code_combination_id AND gjh.je_header_id = gll.je_source = 'Assets' AND gjh.ledger_id = gld.adjustment_period_flag. gcc. .code_combination_id AND gb.period_name.enabled_flag = 'Y' AND gjh.currency_code GROUP BY gcc.je_line_num AND gjh.currency_code = gb.accounting_line_code = 'FA_RECLASS_DEST_COST' OR xdl.

ae_header_id AND xal. sum (xal.'Retirement'. gcc.period_name AND gjh.code_combination_id AND gb.parent_flex_value FROM fnd_flex_value_norm_hierarchy fvnh.user_je_category_name in ('Adjustment'.0))) func_amnt.accounted_dr)func_amnt .code_combination_id AND gjh.child_flex_value_low AND fvnh.je_line_num = gll.accou nted_cr-xal.currency_code.id_flex_code = fifseg.0))) ent_amnt.je_header_id = gll.id_flex_code AND gcc.accounting_line_code in ( 'FA_ADJ_IMP_ACC_IMP' .period_name AND gjh.nvl(xal.accounted_cr-xal.segment6 subscription_year. 0). gcc.code_combination_id AND gb. xla_distribution_links xdl.accounted_cr . fa_additions_b fa.je_batch_id = gir. SYSDATE last_update_date FROM gl_je_lines gll.code_combination_id = gll.'FA_IMP_ACC_IMP') AND fth.period_name = glp. gl_je_categories gjc WHERE gcc.period_name = glp.code_combination_id = gcc. 'IMPAIRMENT ') AND gjh.segment5 ) product_type.je_category_name AND gjc.code_combination_id = gll.ae_header_id = xdl.flex_value_set_id = fifseg.id_flex_num = fifs.je_source = 'Assets' AND gjh.gcc. xla_ae_lines xal.status = 'P' AND gb.segment4 analysis.je_line_num AND gjh.segment3 account_code. fa_transaction_headers fth. gl_import_references gir.accounted_dr.je_category=gjc.currency_code ledger_currency.nvl(xal. gld. -sum (xal.enabled_flag = 'Y' AND gjh. gl_je_headers gjh.je_header_id AND gir.segment7 interco. 'FA_RETIREMENT_ ACC_IMP' .accounted_cr .event_id AND fa.je_header_id = gll.segment5 BETWEEN fvnh.segment2 responsibility_center. fnd_id_flex_segments fifseg WHERE fvnh. gl_code_combinations gcc. SYSDATE creation_date. gl_balances gb. gl_ledgers gld. gcc.gl_sl_link_id AND xal. gcc.id_flex_num AND fifs.child_flex_value_high). gcc. 0).id_flex_code = 'GL#' AND fifseg.flex_value_set_id AND fifseg.account_type.ae_line_num = xdl.ae_line_num AND xdl.accounted_dr.ledger_id = gld.id_flex_structure_code = 'RE_PRIMARY_ACCOUNTING' AND fifs.je_batch_id AND xal. SUM((nvl(xal.asset_id AND gjh. gjh.accounted_dr)ent_amnt . gcc. NVL ((SELECT fvnh.event_id = xdl.ledger_id .asset_id = fth.gl_sl_link_id = gir.je_header_id AND gir. 'FA_RETIREMENT_ACC_IMP'.segment_num = 5 AND fifseg. gl_periods glp. SUM( (nvl(xal.actual_flag = 'A' AND gcc. fnd_id_flex_structures fifs.

reference_10).segment5.period_year YEAR. gld.AND gcc.account_type = 'A' AND gjh.NVL (TO_NUMBER (gir.retirement_type_code. CASE WHEN glp. glp.segment_num = 5 AND fifseg. gcc.id_flex_structure_code = 'RE_PRIMARY_ACCOUNTING' AND fifs.adjustment_period_flag.Retirement movement types SELECT gld.segment2. gcc.flex_value_set_id = fifseg. 'Disposal' movement_type. gcc. 'MM' ) WHEN glp. glp.currency_code.currency_code ledger_currency. gjh. fnd_id_flex_segments fifseg WHERE fvnh.parent_flex_value FROM fnd_flex_value_norm_hierarchy fvnh. 1.segment4.(SUM ( NVL (TO_NUMBER (gir.currency_code UNION --Query for getting Disposal . gcc. gcc. glp.period_name. -.NVL (TO_NUMBER (gir. gcc.segment5 ) product_type. .ledger_id.segment2 responsibility_center.reference_10).ledger_id. NVL ((SELECT fvnh. DECODE (glp.segment1 company_code.child_flex_value_low AND fvnh.segment5 BETWEEN fvnh.child_flex_value_high).account_type. 0) .account_type. gld. 0) .segment6 subscription_year. glp.period_name NOT LIKE 'ADJ%' THEN TO_CHAR (TO_DATE (SUBSTR (glp.period_name. 'A' scenario. gcc. gld.'Disposal'). gcc. gcc. 0) ) ) ent_amnt. 'No'.currency_code.(SUM ( NVL (TO_NUMBER (gir.segment3 account_code.id_flex_code AND gcc.adjustment_period_flag. 'MON').currency_code GROUP BY gcc.DECODE(fr.id_flex_code = fifseg. 'N'.'TRANSFER'.flex_value_set_id AND fifseg. gcc.segment3. .period_name LIKE 'ADJ%' THEN '13' END period.segment7 interco. 3).segment4 analysis.segment7. gcc.reference_9).reference_9).'ICTrf'.currency_code = gb. gcc. fnd_id_flex_structures fifs.id_flex_num = fifs.id_flex_num AND fifs.segment1. gjh.period_year. gcc. gcc. 0) . 'Y'.segment6. gcc. 'Yes' ) period_type.id_flex_code = 'GL#' AND fifseg.

currency_code = gb.account_type != 'E' --AND gir.enabled_flag = 'Y' AND gjh.je_header_id = gll. gld.segment4.je_header_id = gll.period_name AND gjh. gcc.code_combination_id = gcc.transaction_header_id_in --AND fcb.period_name = glp.ae_header_id AND xal.currency_code AND fa.je_header_id AND gir.code_combination_id AND gjh.segment5.code_combination_id = gll. fa_additions_b fa.asset_id --added today AND ( fr.accounting_line_code = 'FA_RETIREMENT_COST') AND fth.segment2.asset_id = fr.ae_line_num = xdl.event_id = xdl. gcc.ledger_id. gl_balances gb.code_combination_id AND gb.reference_9 is null AND gjh.segment3. gl_je_headers gjh. fa_transaction_headers fth.je_category = 'Retirement' AND gjh.retirement_type_code IS NULL ) AND gjh.application_id AND (xdl. gcc. gcc.period_name = glp. SYSDATE last_update_date FROM gl_je_lines gll.segment6.book_type_code AND fcb.application_id = xdl. gl_import_references gir. .je_batch_id AND xal.asset_id = fth.code_combination_id AND gb.ae_line_num AND xal.je_batch_id = gir.book_type_code = fr.je_source = 'Assets' AND gjh.account_type.fr. fa_retirements fr WHERE gcc. -.segment7.asset_id AND fth.asset_category_id = fcb. fa_category_books fcb.retirement_type_code. gl_periods glp.gl_sl_link_id AND xal. gcc.je_line_num = gll.code_combination_id = gll.actual_flag = 'A' AND gcc.je_line_num AND gjh.retirement_type_code NOT IN ('TRANSFER') OR fr.asset_cost_acct = gcc. xla_ae_lines xal. xla_distribution_links xdl. gl_ledgers gld.je_header_id AND gir.segment1.status = 'P' AND gb.ledger_id AND gcc.) ) func_amnt.book_type_code LIKE '%GBR%' GROUP BY gcc. gcc.gl_sl_link_id = gir.period_name AND gjh.transaction_header_id = fr. SYSDATE creation_date. gcc.segment3 AND fth. gl_code_combinations gcc.category_id AND fcb.event_id AND fa.ledger_id = gld.ae_header_id = xdl.

currency_code. 'TRANSFER'.currency_code ledger_currency. glp. 0) .child_flex_value_low AND fvnh.period_name NOT LIKE 'ADJ%' THEN TO_CHAR (TO_DATE (SUBSTR (glp. gld.period_year.period_name.id_flex_num AND fifs.account_type.segment5 BETWEEN fvnh.adjustment_period_flag. 'Disposal' ) movement_type. gcc. 'No'. glp. 0) ) ) func_amnt. (SUM ( NVL (TO_NUMBER (xdl.unrounded_accounted_cr). SYSDATE last_update_date FROM gl_je_lines gll.unrounded_accounted_dr).id_flex_num = fifs. gcc. 0) . gcc.segment5 ) product_type.segment3 account_code. gcc. 3). NVL ((SELECT fvnh. gjh. gl_code_combinations gcc.period_name LIKE 'ADJ%' THEN '13' END period. gl_import_references gir. gcc.child_flex_value_high). fnd_id_flex_structures fifs. gjh.segment7 interco.id_flex_structure_code = 'RE_PRIMARY_ACCOUNTING' AND fifs. 'ICTrf'.segment1 company_code. glp.segment4 analysis.unrounded_accounted_dr). gcc.segment_num = 5 AND fifseg.segment6 subscription_year. fnd_id_flex_segments fifseg WHERE fvnh. 'A' scenario.period_name.period_year YEAR. DECODE (glp. DECODE (fr.ledger_id. . 0) ) ) ent_amnt. 'Yes' ) period_type.NVL (TO_NUMBER (xdl. 1. -'Disposal' movement_type.id_flex_code AND gcc.id_flex_code = 'GL#' AND fifseg. gcc. 'MM' ) WHEN glp.NVL (TO_NUMBER (xdl.currency_code.unrounded_accounted_cr).parent_flex_value FROM fnd_flex_value_norm_hierarchy fvnh. 'MON'). gl_je_headers gjh. SYSDATE creation_date. 'N'. gld.adjustment_period_flag.flex_value_set_id = fifseg. gcc. 'Y'.flex_value_set_id AND fifseg. CASE WHEN glp. (SUM ( NVL (TO_NUMBER (xdl.retirement_type_code.id_flex_code = fifseg.currency_code UNION --Query for getting Retirements with Transfers SELECT gld.glp.segment2 responsibility_center.

segment5. 'ICTrf'.code_combination_id AND gb.asset_cost_acct = gcc.transaction_header_id_in AND fcb.period_name.segment3 ) AND fth.period_name AND gjh.book_type_code like '%GBR%' GROUP BY gcc.je_category = 'Retirement' AND gjh. glp.accounting_line_code = 'FA_RETIREMENT_RESERVE' ) AND fth.category_id AND ( fcb.je_line_num AND gjh.code_combination_id AND gb.retirement_type_code.reference_9 is null AND gjh.transaction_header_id = fr.currency_code AND fa.AND (fr.deprn_reserve_acct = gcc.gl_sl_link_id AND xal.segment3 OR fcb.segment1.book_type_code = fr.fr.segment7.segment3. gl_ledgers gld.ae_line_num = xdl.application_id AND ( xdl. 'TRANSFER'.je_header_id AND gir.account_type.code_combination_id = gcc.code_combination_id AND gjh. glp. gcc. fa_category_books fcb.code_combination_id = gll.xla_ae_lines xal. .period_name = glp. gcc.je_batch_id = gir.ae_line_num AND xal.je_header_id AND gir.event_id = xdl.event_id AND fa. xla_distribution_links xdl.ledger_id. DECODE (fr.AND fcb. gl_balances gb.je_header_id = gll. 'Disposal'). glp. gld. -.gl_sl_link_id = gir.status = 'P' AND gb.asset_id = fr. gl_periods glp. gcc.application_id = xdl.period_year.segment4. gcc.asset_id AND fth. fa_transaction_headers fth.je_batch_id AND xal.period_name = glp.currency_code = gb.je_header_id = gll. gcc.asset_category_id = fcb.ae_header_id AND xal.je_line_num = gll.account_type != 'E' --AND gir.asset_id --added today -.actual_flag = 'A' AND gcc.period_name AND gjh.segment2.code_combination_id = gll.retirement_type_code.segment6.retirement_ty pe_code IS NULL) AND gjh.ledger_id AND gcc.ledger_id = gld.retirement_type_code not in ('TRANSFER') or fr.asset_id = fth.ae_header_id = xdl. fa_retirements fr WHERE gcc.adjustment_period_flag.enabled_flag = 'Y' AND gjh. fa_additions_b fa.je_source = 'Assets' AND gjh.book_type_code -. gcc. gcc.accounting_line_code = 'FA_RETIREMENT_COST' OR xdl.

segment5 BETWEEN fvnh. gld.currency_code ledger_currency. gl_ledgers gld WHERE gcc.period_year YEAR. gcc. gcc.child_flex_value_low AND fvnh. gcc.segment_num = 5 AND fifseg. 'Yes' ) period_type. gl_code_combinations gcc.segment2 responsibility_center. xla_distribution_links xdl. 3).period_name.adjustment_period_flag.code_combination_id = gll. gl_import_references gir.period_name NOT LIKE 'ADJ%' THEN TO_CHAR (TO_DATE (SUBSTR (glp. gcc. gcc.segment1 company_code. -TO_NUMBER (gir. fa_additions_b fa.je_header_id . 'MM' ) WHEN glp. 'Y'. gcc.reference_9).id_flex_structure_code = 'RE_PRIMARY_ACCOUNTING' AND fifs.account_type. glp. gl_periods glp. gl_je_headers gjh. -TO_NUMBER (gir. gjh. SUM (NVL (TO_NUMBER (gir.je_header_id = gll.currency_code.segment5 ) product_type.id_flex_num = fifs. fnd_id_flex_structures fifs.id_flex_num AND fifs. 1.reference_10) ) ) func_amnt.period_name LIKE 'ADJ%' THEN '13' END period. 'No'. 'N'.id_flex_code AND gcc. CASE WHEN glp. gcc. fa_transaction_headers fth. SYSDATE creation_date. 'A' scenario. 'Reval' movement_type.parent_flex_value FROM fnd_flex_value_norm_hierarchy fvnh. 'MON').segment4 analysis.ledger_id.flex_value_set_id = fifseg. gcc.code_combination_id AND gjh. gl_balances gb.child_flex_value_high).id_flex_code = fifseg.currency_code UNION --Query for Reval movement type SELECT gld.gjh.reference_9).flex_value_set_id AND fifseg.id_flex_code = 'GL#' AND fifseg.segment7 interco.segment6 subscription_year. SUM (NVL (TO_NUMBER (gir. fnd_id_flex_segments fifseg WHERE fvnh. gld.reference_10) ) ) ent_amnt. xla_ae_lines xal. SYSDATE last_update_date FROM gl_je_lines gll. NVL ((SELECT fvnh.currency_code. DECODE (glp.segment3 account_code.

ledger_currency. gld.code_combination_id = gll. 'No'.code_combination_id gb.Depreciation movement types SELECT ledger_id.adjustment_period_flag. period_type. product_type.period_name LIKE 'ADJ%' THEN '13' END period.period_name.period .event_id fa.enabled_flag = 'Y' gjh. glp. gcc. 'N'.period_year YEAR.code_combination_id = gcc.je_batch_id = gir. gcc. gcc. movement_type. gcc.period_name.gl_sl_link_id xal.je_batch_id xal.period_name = glp.ae_line_num xdl.ae_header_id xal.currency_code = gb.je_category = 'Revaluation' gjh. gld. DECODE (glp. gcc. sum(ent_amnt) ent_amnt.currency_code gcc.period_name NOT LIKE 'ADJ%' THEN TO_CHAR (TO_DATE (SUBSTR (glp. scenario.segment2.segment3. gcc.segment6. SYSDATE last_update_date FROM ( SELECT gld. 'A' scenario. interco.currency_code UNION --Query for Charge .ledger_id.je_header_id gir. glp. analysis.je_header_id = gll. subscription_year.je_line_num = gll. 'MON' ). sum(func_amnt) func_amnt.period_name gjh.AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND AND GROUP BY gir.segment4.asset_id gjh. glp.code_combination_id gb.period_name = glp. .segment1.status = 'P' gb. gcc.asset_id = fth.currency_code.segment5. CASE WHEN glp. company_code. 'MM' ) WHEN glp. gjh.ae_header_id = xdl.ledger_id = gld.je_line_num gjh. YEAR.account_type.segment7.period_name gjh. responsibility_center.event_id = xdl. glp.ledger_id.ledger_id gcc.adjustment_period_flag. account_code. 3).accounting_line_code = 'RCT_REV_UNAPP_DEBIT' fth.gl_sl_link_id = gir.period_year. currency_code. SYSDATE creation_date. account_type.ae_line_num = xdl. 1.account_type != 'E' gjh.je_source = 'Assets' gjh.actual_flag = 'A' gcc.

id_flex_code AND gcc. 'FA_PER_DEPRN_RESERVE'.currency_code ledger_currency. 0).id_flex_num AND fifs. gcc. 'FA_PER_EXP_BAL'. gl_code_combinations gcc.je_batch_id AND xal.segment5 ) product_type. 'Charge' movement_type. xla_distribution_links xdl.accounting_line_code IN ('FA_ADD_BONUS_RESERVE'.je_header_id = gll.code_combination_id AND gjh.segment4 analysis.child_flex_value_hig h).segment_num = 5 AND fifseg.parent_flex_value FROM fnd_flex_value_norm_hierarchy fvnh.id_flex_code = fifseg. 'FA_ADJ_DEPRN_RESERVE_GRP'.ae_line_num = xdl. xla_ae_lines xal. gcc. 'FA_ADD_RESERVE'. gl_import_references gir.segment6 subscription_year. gl_balances gb.ae_line_num AND (xdl.segment5 BETWEEN fvnh.'Y'. SUM((nvl(xal.0))) e nt_amnt. 'FA_RETIREMENT_BONUS_DEPRN_RES'. gcc. fnd_id_flex_segments fifseg WHERE fvnh.account_type. 'FA_PER_BONUS_DEPRN_RESERVE'.accounted_dr. fa_additions_b fa.0))) func_amnt. 'FA_ADJ_DEPRN_RESERVE'.ae_header_id AND xal. gcc.id_flex_structure_code = 'RE_PRIMARY_ACCOUNTING' AND fifs.id_flex_code = 'GL#' AND fifseg.gl_sl_link_id AND xal. SYSDATE last_update_date FROM gl_je_lines gll. gcc.je_line_num = gll. 'Yes' ) period_type.gl_sl_link_id = gir.segment2 responsibility_center. gld. NVL ((SELECT fvnh. 'FA_ADJ_DEPRN_BONUS_RESERVE'. gl_periods glp. 'FA_ADJ_DEPRN_RESERVE_BAL'.id_flex_num = fifs.je_header_id AND gir. fa_deprn_summary fds. gcc. gcc.segment1 company_code.accounted_cr .child_flex_value_low AND fvnh.segment7 interco. . SYSDATE creation_date.segment3 account_code.nvl(xal. 0).je_batch_id = gir.accounted_dr.je_header_id = gll.nvl(xal. gcc.je_line_num AND gjh. gjh.currency_code. gl_je_headers gjh. SUM( (nvl(xal.je_header_id AND gir. 'FA_ADD_RESERVE_BAL'.ae_header_id = xdl.accounted_cr . 'FA_RETIREMENT_DEPRN_RESERVE'.code_combination_id = gll.flex_value_set_id = fifseg.flex_value_set_id AND fifseg. gl_ledgers gld WHERE gcc. fnd_id_flex_structures fifs.

'No'. gjh. 3). gcc.period_name = glp.segment4. glp.segment1.adjustment_period_flag.segment7.code_combination_id AND gb.segment5.adjustment_period_flag.period_name.segment4 analysis.ledger_id.code_combination_id = gll. gcc.je_category in ('Depreciation' .currency_code = gb.segment2 responsibility_center.account_type. gcc. 'MM' ) WHEN glp.event_id=xdl. DECODE (glp. glp.segment3.'FA_RETIREMENT_DEPRN_RSV_BAL'. gcc. 'Yes' ) period_type.event_id AND fa.status = 'P' AND gb.ledger_id AND gcc. 'A' scenario.period_name = glp. gcc. 'MON' ).currency_code.asset_id AND gjh. glp. 1.parent_flex_value FROM fnd_flex_value_norm_hierarchy fvnh.period_name AND gjh. NVL ((SELECT fvnh. gcc. 'Addition'.segment3 account_code.asset_id=fds.account_type in ( 'A') AND gjh.ledger_id = gld.ledger_id. 'Adjustmen t'.'Reclass') AND gjh. gcc.currency_code union SELECT gld.je_source = 'Assets' AND gjh. glp.period_year YEA R. gcc. 'FA_UNPL_RESERVE')) AND deprn_source_code = 'DEPRN' AND fds.segment1 company_code. gcc.period_name LIKE 'ADJ%' THEN '13' END period.period_year. gcc. .period_name AND gjh.enabled_flag = 'Y' AND gjh.segment6. gcc. 'Retirement'.code_combination_id AND gb. CASE WHEN glp.code_combination_id = gcc.period_name NOT LIKE 'ADJ%' THEN TO_CHAR (TO_DATE (SUBSTR (glp. 'FA_RETIREMENT_DEPRN_RSV_BAL'.actual_flag = 'A' AND gcc.segment2. 'Y'. 'Charge' movement_type. 'FA_RETIREMENT_DEPRN_RESERVE'.currency_code GROUP BY gld. gcc. 'N'.period_name. gcc.account_type. 'FA_RETIREMENT_BONUS_DEPRN_RES'. gld.

currency_code.child_flex_value_low AND fvnh. 'FA_ADD_RESERVE_BAL'.je_line_num = gll. 'FA_ADJ_DEPRN_RESERVE'. 'FA_ADJ_DEPRN_RESERVE_GRP'.je_line_num AND gjh. fa_transaction_headers fth. 'FA_ADD_RESERVE'. gjh. gcc.id_flex_code = fifseg.accounted_dr. gl_code_combinations gcc.id_flex_structure_code = 'RE_PRIMARY_ACCOUNTING' fifs. 'FA_ADJ_DEPRN_BONUS_RESERVE'.asset_id AND gjh.ae_line_num AND (xdl.ae_header_id AND xal.ae_header_id = xdl.event_id) AND fa. gl_balances gb.event_id = xdl.ae_line_num = xdl. SYSDATE last_update_date FROM gl_je_lines gll.segment5 ) product_type. 'FA_RETIREMENT_DEPRN_RSV_BAL'.je_batch_id = gir. SYSDATE creation_date. 'FA_PER_DEPRN_RESERVE'.accounting_line_code IN ('FA_ADD_BONUS_RESERVE'.segment6 subscription_year. 'FA_RETIREMENT_BONUS_DEPRN_RES'. SUM((nvl(xal.je_batch_id AND xal. 'FA_PER_BONUS_DEPRN_RESERVE'.flex_value_set_id fifseg. 'FA_ADJ_DEPRN_RESERVE_BAL'.WHERE AND AND AND AND AND AND h).asset_id = fth.currency_code ledger_currency. gl_import_references gir.segment_num = 5 fifseg. gl_ledgers gld WHERE gcc. 0).gl_sl_link_id AND xal. SUM ( (nvl(xal.child_flex_value_hig gcc.code_combination_id = gll.segment5 BETWEEN fvnh.id_flex_code = 'GL#' fifseg. 0).je_header_id = gll. gl_je_headers gjh.je_header_id AND gir.nvl(xal. gl_periods glp.id_flex_code gcc.gl_sl_link_id = gir. 'FA_RETIREMENT_BONUS_DEPRN_RES'.je_source = 'Assets' .0))) ent _amnt. fa_additions_b fa. fnd_id_flex_segments fifseg fvnh. 'FA_RETIREMENT_DEPRN_RSV_BAL'.je_header_id AND gir. 'FA_PER_EXP_BAL'.je_header_id = gll. gld.id_flex_num fifs. xla_ae_lines xal.id_flex_num = fifs. fnd_id_flex_structures fifs.0))) func_amnt. 'FA_UNPL_RESERVE')) AND( fth.code_combination_id AND gjh.accounted_cr .segment7 interco. gcc.accounted_cr .nvl(xal.flex_value_set_id = fifseg.accounted_dr. 'FA_RETIREMENT_DEPRN_RESERVE'. 'FA_RETIREMENT_DEPRN_RESERVE'. xla_distribution_links xdl.

period_name AND gjh. gcc.account_type. period_type. GRANT SELECT ON APPS.segment2.code_combination_id = gll.currency_code = gb. 'Adjustmen t'. gcc. analysis. glp.XXFA_HFM_CUMULATIVE_VIEW TO APPSRO.je_category in ('Depreciation' .segment4. GRANT SELECT ON APPS. gjh. subscription_year.status = 'P' AND gb.segment1. scenario. movement_type. YEAR. glp. gcc.period_name = glp.AND gjh. gcc.code_combination_id = gcc.currency_code) GROUP BY ledger_id.segment7. gld. responsibility_center. period. . gcc. 'Reclass') AND gjh.currency_code GROUP BY gld.segment6.code_combination_id AND gb. 'Retirement'.period_name.enabled_flag = 'Y' AND gjh.account_type in ( 'A') AND gjh.period_name = glp.XXFA_HFM_CUMULATIVE_VIEW TO XXODI. glp. gcc. company_code.ledger_id. currency_code.adjustment_period_flag. account_code. gcc. product_type.ledger_id AND gcc.period_name AND gjh. ledger_currency. interco. account_type.code_combination_id AND gb.segment5.actual_flag = 'A' AND gcc.segment3.period_year. gcc. 'Addition'.ledger_id = gld.currency_code.