7: G_API_VERSION CONSTANT number := 1.0;
8:
9: g_log_level_rec fa_api_types.log_level_rec_type;
10:
11: g_release number := fa_cache_pkg.fazarel_release;
12:
13: -- l_calling_fn VARCHAR2(100) := 'FA_RETIREMENT_PUB';
14:
15: g_retirement VARCHAR2(30) := 'RETIREMENT';
214: l_inv_tbl FA_API_TYPES.inv_tbl_type;
215: l_period_rec FA_API_TYPES.period_rec_type;
216:
217: -- used for loop through tax books
218: l_tax_book_tbl FA_CACHE_PKG.fazctbk_tbl_type;
219: l_tax_index number;
220:
221: -- used for tax books when doing cip-in-tax or autocopy
222: lv_trans_rec FA_API_TYPES.trans_rec_type;
291: raise FND_API.G_EXC_ERROR;
292: end if;
293: end if;
294:
295: g_release := fa_cache_pkg.fazarel_release;
296:
297: -- ****************************************************
298: -- ** API compatibility check and initialization
299: -- ****************************************************
345:
346: if l_asset_hdr_rec.book_type_code is not null then
347:
348: -- call the cache for the primary transaction book
349: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => g_log_level_rec) then
350: raise FND_API.G_EXC_UNEXPECTED_ERROR;
351: end if;
352:
353: -- ***************************
368: g_msg_name := 'error msg name-after trx_app';
369: raise FND_API.G_EXC_ERROR;
370: end if;
371:
372: -- l_book_class := fa_cache_pkg.fazcbc_record.book_class;
373: -- l_set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
374: -- l_distribution_source_book := fa_cache_pkg.fazcbc_record.distribution_source_book;
375: -- l_mc_source_flag := fa_cache_pkg.fazcbc_record.mc_source_flag;
376:
369: raise FND_API.G_EXC_ERROR;
370: end if;
371:
372: -- l_book_class := fa_cache_pkg.fazcbc_record.book_class;
373: -- l_set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
374: -- l_distribution_source_book := fa_cache_pkg.fazcbc_record.distribution_source_book;
375: -- l_mc_source_flag := fa_cache_pkg.fazcbc_record.mc_source_flag;
376:
377: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
370: end if;
371:
372: -- l_book_class := fa_cache_pkg.fazcbc_record.book_class;
373: -- l_set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
374: -- l_distribution_source_book := fa_cache_pkg.fazcbc_record.distribution_source_book;
375: -- l_mc_source_flag := fa_cache_pkg.fazcbc_record.mc_source_flag;
376:
377: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
378:
371:
372: -- l_book_class := fa_cache_pkg.fazcbc_record.book_class;
373: -- l_set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
374: -- l_distribution_source_book := fa_cache_pkg.fazcbc_record.distribution_source_book;
375: -- l_mc_source_flag := fa_cache_pkg.fazcbc_record.mc_source_flag;
376:
377: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
378:
379: -- get the book type code P,R or N
373: -- l_set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
374: -- l_distribution_source_book := fa_cache_pkg.fazcbc_record.distribution_source_book;
375: -- l_mc_source_flag := fa_cache_pkg.fazcbc_record.mc_source_flag;
376:
377: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
378:
379: -- get the book type code P,R or N
380: if not fa_cache_pkg.fazcsob
381: (x_set_of_books_id => l_asset_hdr_rec.set_of_books_id
376:
377: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
378:
379: -- get the book type code P,R or N
380: if not fa_cache_pkg.fazcsob
381: (x_set_of_books_id => l_asset_hdr_rec.set_of_books_id
382: ,x_mrc_sob_type_code => l_reporting_flag, p_log_level_rec => g_log_level_rec)
383: then
384: raise FND_API.G_EXC_UNEXPECTED_ERROR;
456: raise FND_API.G_EXC_UNEXPECTED_ERROR;
457: end if;
458:
459: --Added for IFRS
460: if (not fa_cache_pkg.fazccmt(l_asset_fin_rec.deprn_method_code,
461: l_asset_fin_rec.life_in_months, p_log_level_rec => g_log_level_rec)) then
462: if (g_log_level_rec.statement_level) then
463: fa_debug_pkg.add(l_calling_fn, 'Error calling', 'fa_cache_pkg.fazccmt', p_log_level_rec => g_log_level_rec);
464: end if;
459: --Added for IFRS
460: if (not fa_cache_pkg.fazccmt(l_asset_fin_rec.deprn_method_code,
461: l_asset_fin_rec.life_in_months, p_log_level_rec => g_log_level_rec)) then
462: if (g_log_level_rec.statement_level) then
463: fa_debug_pkg.add(l_calling_fn, 'Error calling', 'fa_cache_pkg.fazccmt', p_log_level_rec => g_log_level_rec);
464: end if;
465:
466: raise FND_API.G_EXC_UNEXPECTED_ERROR;
467: end if;
745:
746: -- FYI: We don't allow unit retirements for TAX book
747: -- probably because TAX book does not have its own distributions
748: -- in DH table.
749: if fa_cache_pkg.fazcbc_record.book_class = 'TAX'
750: and l_asset_retire_rec.units_retired is not null then
751: g_msg_name := 'FA_RET_NO_PART_UNIT_IN_TAX';
752: -- ? can not find this message name in msg table
753: raise FND_API.G_EXC_ERROR;
971:
972: /* if book is a corporate book, process cip assets and autocopy */
973:
974: -- start processing tax books for cip-in-tax and autocopy
975: if (fa_cache_pkg.fazcbc_record.book_class = 'CORPORATE') then
976:
977: lv_trans_rec := l_trans_rec;
978: lv_asset_hdr_rec := l_asset_hdr_rec;
979: g_inv_trans_rec.invoice_transaction_id := to_number(null);
987: element => 'Asset type',
988: value => l_asset_type_rec.asset_type, p_log_level_rec => g_log_level_rec);
989: end if;
990:
991: if not fa_cache_pkg.fazctbk
992: (x_corp_book => l_asset_hdr_rec.book_type_code
993: ,x_asset_type => l_asset_type_rec.asset_type
994: ,x_tax_book_tbl => l_tax_book_tbl, p_log_level_rec => g_log_level_rec) then
995: raise FND_API.G_EXC_UNEXPECTED_ERROR;
1021:
1022: else
1023:
1024: -- cache the book information for the tax book
1025: if not fa_cache_pkg.fazcbc(x_book => l_tax_book_tbl(l_tax_index),
1026: p_log_level_rec => g_log_level_rec) then
1027: raise FND_API.G_EXC_UNEXPECTED_ERROR;
1028: end if;
1029:
1235: l_subcomp_tbl FA_API_TYPES.subcomp_tbl_type;
1236: l_inv_tbl FA_API_TYPES.inv_tbl_type;
1237: l_period_rec FA_API_TYPES.period_rec_type;
1238:
1239: l_sob_tbl FA_CACHE_PKG.fazcrsob_sob_tbl_type;
1240:
1241: lv_asset_hdr_rec FA_API_TYPES.asset_hdr_rec_type;
1242:
1243: -- local individual variables
1288: -- *********************************
1289: -- populate rec_types that were not provided by users
1290:
1291: -- call the cache for the primary transaction book
1292: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => p_log_level_rec) then
1293: raise FND_API.G_EXC_UNEXPECTED_ERROR;
1294: end if;
1295:
1296: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
1292: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => p_log_level_rec) then
1293: raise FND_API.G_EXC_UNEXPECTED_ERROR;
1294: end if;
1295:
1296: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
1297:
1298: -- pop asset_fin_rec
1299: -- get fa_books row where transaction_header_id_out is null
1300: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'pop asset_fin_rec', '', p_log_level_rec => p_log_level_rec); end if;
1420: -- BUG# 3575340
1421: -- need to prevent the backdate of a retirement not only
1422: -- on the retire date but also the prorate date
1423:
1424: l_prorate_calendar := fa_cache_pkg.fazcbc_record.prorate_calendar;
1425: l_fiscal_year_name := fa_cache_pkg.fazcbc_record.fiscal_year_name;
1426:
1427: if p_log_level_rec.statement_level then
1428: fa_debug_pkg.add
1421: -- need to prevent the backdate of a retirement not only
1422: -- on the retire date but also the prorate date
1423:
1424: l_prorate_calendar := fa_cache_pkg.fazcbc_record.prorate_calendar;
1425: l_fiscal_year_name := fa_cache_pkg.fazcbc_record.fiscal_year_name;
1426:
1427: if p_log_level_rec.statement_level then
1428: fa_debug_pkg.add
1429: (fname => l_calling_fn,
1426:
1427: if p_log_level_rec.statement_level then
1428: fa_debug_pkg.add
1429: (fname => l_calling_fn,
1430: element => 'fa_cache_pkg.fazcbc_record.prorate_calendar',
1431: value => fa_cache_pkg.fazcbc_record.prorate_calendar, p_log_level_rec => p_log_level_rec);
1432: fa_debug_pkg.add
1433: (fname => l_calling_fn,
1434: element => 'l_asset_retire_rec.retirement_prorate_convention',
1427: if p_log_level_rec.statement_level then
1428: fa_debug_pkg.add
1429: (fname => l_calling_fn,
1430: element => 'fa_cache_pkg.fazcbc_record.prorate_calendar',
1431: value => fa_cache_pkg.fazcbc_record.prorate_calendar, p_log_level_rec => p_log_level_rec);
1432: fa_debug_pkg.add
1433: (fname => l_calling_fn,
1434: element => 'l_asset_retire_rec.retirement_prorate_convention',
1435: value => l_asset_retire_rec.retirement_prorate_convention, p_log_level_rec => p_log_level_rec);
1436: end if;
1437:
1438: /* Bug#4663092: Moved Book-specific validation/calculation to do_all_books_retirement function. */
1439: if (l_asset_retire_rec.retirement_prorate_convention is null)
1440: or (fa_cache_pkg.fazcbc_record.book_class = 'TAX'
1441: and l_asset_type_rec.asset_type = 'CIP') then /* Modified for Bug 12603145 */
1442:
1443: SELECT retirement_prorate_convention,
1444: use_stl_retirements_flag,
1475:
1476: end if;
1477:
1478:
1479: if not fa_cache_pkg.fazccvt
1480: (x_prorate_convention_code => l_asset_retire_rec.retirement_prorate_convention,
1481: x_fiscal_year_name => l_fiscal_year_name, p_log_level_rec => p_log_level_rec) then
1482: raise FND_API.G_EXC_ERROR;
1483: end if;
1481: x_fiscal_year_name => l_fiscal_year_name, p_log_level_rec => p_log_level_rec) then
1482: raise FND_API.G_EXC_ERROR;
1483: end if;
1484:
1485: if not fa_cache_pkg.fazcdp
1486: (x_book_type_code => l_asset_hdr_rec.book_type_code, p_log_level_rec => p_log_level_rec) then
1487: raise FND_API.G_EXC_ERROR;
1488: end if;
1489:
1507: and transaction_type_code in ('REVALUATION');
1508:
1509: -- added this for bug 3684222
1510: if (l_ret_prorate_date < l_latest_reval_date and
1511: l_ret_prorate_date < fa_cache_pkg.fazcdp_record.calendar_period_open_date) then
1512: g_msg_name := 'FA_SHARED_OTHER_TRX_FOLLOW';
1513: raise FND_API.G_EXC_ERROR;
1514: end if;
1515:
1515:
1516:
1517: end if; -- date_retired
1518:
1519: if (not fa_cache_pkg.fazccmt(l_asset_fin_rec.deprn_method_code,
1520: l_asset_fin_rec.life_in_months, p_log_level_rec => p_log_level_rec)) then
1521: if (p_log_level_rec.statement_level) then
1522: fa_debug_pkg.add(l_calling_fn, 'Error calling', 'fa_cache_pkg.fazccmt', p_log_level_rec => p_log_level_rec);
1523: end if;
1518:
1519: if (not fa_cache_pkg.fazccmt(l_asset_fin_rec.deprn_method_code,
1520: l_asset_fin_rec.life_in_months, p_log_level_rec => p_log_level_rec)) then
1521: if (p_log_level_rec.statement_level) then
1522: fa_debug_pkg.add(l_calling_fn, 'Error calling', 'fa_cache_pkg.fazccmt', p_log_level_rec => p_log_level_rec);
1523: end if;
1524:
1525: raise FND_API.G_EXC_UNEXPECTED_ERROR;
1526: end if;
1541: -- Bug3254818: Lift this ristriction for FLAT method type
1542: --
1543: -- check if date_retired is valid
1544: if (l_asset_retire_rec.date_retired is not null) and
1545: (fa_cache_pkg.fazccmt_record.rate_source_rule <> fa_std_types.FAD_RSR_FLAT) then
1546:
1547: if l_asset_retire_rec.date_retired < l_period_rec.calendar_period_open_date
1548: and nvl(l_asset_fin_rec.period_counter_fully_reserved,99)
1549: <> nvl(l_asset_fin_rec.period_counter_life_complete,99)
1579: end if;
1580:
1581: end if; -- units_retired
1582:
1583: if (fa_cache_pkg.fazcbc_record.book_class = 'TAX'
1584: and l_asset_retire_rec.units_retired is not null) then
1585:
1586: -- In tax book, treat unit retirement as cost retirement
1587: l_asset_retire_rec.cost_retired
1670: fa_debug_pkg.add(l_calling_fn, 'do_all_books_retirement: retirement_id: ', l_asset_retire_rec.retirement_id, p_log_level_rec => p_log_level_rec);
1671: fa_debug_pkg.add(l_calling_fn, 'do_all_books_retirement: transaction_header_id: ', l_trans_rec.transaction_header_id, p_log_level_rec => p_log_level_rec);
1672: end if;
1673:
1674: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => p_log_level_rec) then
1675: fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
1676: return FALSE;
1677: end if;
1678:
1677: end if;
1678:
1679: -- MRC LOOP
1680: -- if this is a primary book, process reporting books(sobs)
1681: if fa_cache_pkg.fazcbc_record.mc_source_flag = 'Y' then
1682:
1683: g_primary_set_of_books_id := l_asset_hdr_rec.set_of_books_id;
1684:
1685: -- call the sob cache to get the table of sob_ids
1682:
1683: g_primary_set_of_books_id := l_asset_hdr_rec.set_of_books_id;
1684:
1685: -- call the sob cache to get the table of sob_ids
1686: if not FA_CACHE_PKG.fazcrsob
1687: (x_book_type_code => l_asset_hdr_rec.book_type_code,
1688: x_sob_tbl => l_sob_tbl, p_log_level_rec => p_log_level_rec) then
1689: raise FND_API.G_EXC_UNEXPECTED_ERROR;
1690: end if;
1694: for l_sob_index in 1..l_sob_tbl.count loop
1695:
1696: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'in sob_id loop', '', p_log_level_rec => p_log_level_rec); end if;
1697:
1698: if not fa_cache_pkg.fazcbcs(x_book => l_asset_hdr_rec.book_type_code,
1699: x_set_of_books_id => l_sob_tbl(l_sob_index),--l_asset_hdr_rec.set_of_books_id, Secondary Changes. Reporting SOB can be different from Primary
1700: p_log_level_rec => p_log_level_rec) then
1701: fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
1702: return FALSE;
1971: l_asset_fin_rec.cost <> 0 then
1972:
1973: l_asset_retire_mrc_rec.cost_retired := l_asset_fin_mrc_rec.cost;
1974: --bug 5453230
1975: if fa_cache_pkg.fazcbc_record.book_class = 'CORPORATE' then
1976: l_asset_retire_rec.units_retired := l_asset_desc_rec.current_units;
1977: l_asset_retire_mrc_rec.units_retired := l_asset_desc_rec.current_units;
1978: end if;
1979:
2086: -- is handling all MRC part of adjustments table
2087: if (l_asset_dist_tbl.count > 0 )
2088: and
2089: (l_asset_hdr_rec.set_of_books_id
2090: = fa_cache_pkg.fazcbc_record.set_of_books_id)
2091: and
2092: (fa_cache_pkg.fazcbc_record.book_class='CORPORATE') then
2093:
2094: -- Call distribution API to process partial-unit retirement.
2088: and
2089: (l_asset_hdr_rec.set_of_books_id
2090: = fa_cache_pkg.fazcbc_record.set_of_books_id)
2091: and
2092: (fa_cache_pkg.fazcbc_record.book_class='CORPORATE') then
2093:
2094: -- Call distribution API to process partial-unit retirement.
2095: -- do_distribution will handle TH, DH, AD and AH tables for TRANSFER OUT transaction
2096: -- and call 'fautfr' function in it.
2143: -- fix for Bug 4966209
2144: -- call book cache to reset with right book
2145:
2146: -- call the cache for the book
2147: if not fa_cache_pkg.fazcbc(X_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => p_log_level_rec) then
2148: raise FND_API.G_EXC_UNEXPECTED_ERROR;
2149: end if;
2150:
2151: --
2466:
2467: -- In case of TAX book, units_retired must always be NULL
2468: -- so that Calculate Gain/Loss program will not lead to
2469: -- distribution logic.
2470: if fa_cache_pkg.fazcbc_record.book_class='TAX' then
2471: l_asset_retire_rec.units_retired := NULL;
2472: else
2473: l_asset_retire_rec.units_retired := l_asset_desc_rec.current_units;
2474: end if;
2558: l_cost_new := l_asset_fin_rec.cost - l_asset_retire_rec.cost_retired;
2559: l_unrevalued_cost_new := l_asset_fin_rec.unrevalued_cost * l_fraction_remaining;
2560: l_eofy_reserve_new := l_asset_fin_rec.eofy_reserve * l_fraction_remaining;
2561:
2562: if (fa_cache_pkg.fazcbc_record.retire_reval_reserve_flag='YES') and
2563: (l_asset_fin_rec.Reval_Amortization_Basis is not null) then
2564: l_reval_amort_basis_new := l_asset_fin_rec.Reval_Amortization_Basis * l_fraction_remaining;
2565: else
2566: l_reval_amort_basis_new := l_asset_fin_rec.Reval_Amortization_Basis;
2768: fa_debug_pkg.add(l_calling_fn, 'l_asset_deprn_rec.deprn_reserve',
2769: l_asset_deprn_rec.deprn_reserve, p_log_level_rec => p_log_level_rec);
2770: fa_debug_pkg.add(l_calling_fn, 'l_asset_fin_rec.tracking_method',
2771: l_asset_fin_rec.tracking_method, p_log_level_rec => p_log_level_rec);
2772: fa_debug_pkg.add(l_calling_fn, 'fa_cache_pkg.fazcdrd_record.rule_name',
2773: fa_cache_pkg.fazcdrd_record.rule_name, p_log_level_rec => p_log_level_rec);
2774: fa_debug_pkg.add(l_calling_fn, 'l_asset_fin_rec.group_asset_id',
2775: l_asset_fin_rec.group_asset_id, p_log_level_rec => p_log_level_rec);
2776: end if;
2769: l_asset_deprn_rec.deprn_reserve, p_log_level_rec => p_log_level_rec);
2770: fa_debug_pkg.add(l_calling_fn, 'l_asset_fin_rec.tracking_method',
2771: l_asset_fin_rec.tracking_method, p_log_level_rec => p_log_level_rec);
2772: fa_debug_pkg.add(l_calling_fn, 'fa_cache_pkg.fazcdrd_record.rule_name',
2773: fa_cache_pkg.fazcdrd_record.rule_name, p_log_level_rec => p_log_level_rec);
2774: fa_debug_pkg.add(l_calling_fn, 'l_asset_fin_rec.group_asset_id',
2775: l_asset_fin_rec.group_asset_id, p_log_level_rec => p_log_level_rec);
2776: end if;
2777:
2963: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'retirement_id: ', l_asset_retire_rec.retirement_id, p_log_level_rec => p_log_level_rec); end if;
2964: px_asset_retire_rec := l_asset_retire_rec;
2965:
2966: -- Bug:5930979:Japan Tax Reform Project (Start)
2967: if nvl(fa_cache_pkg.fazccmt_record.GUARANTEE_RATE_METHOD_FLAG,'NO') = 'YES' then
2968:
2969: SELECT nvl(rate_in_use,0)
2970: INTO l_rate_in_use
2971: FROM fa_books
2988: fa_conventions conv
2989: where conv.prorate_convention_code = l_asset_retire_rec.retirement_prorate_convention
2990: and conv.start_date <= l_asset_retire_rec.date_retired
2991: and conv.end_date >= l_asset_retire_rec.date_retired
2992: and cp.calendar_type = fa_cache_pkg.fazcbc_record.prorate_calendar
2993: and conv.prorate_date >= cp.start_date
2994: and conv.prorate_date <= cp.end_date;
2995:
2996: Select decode (count(*),0,l_asset_fin_rec.period_counter_fully_extended,null)
3231: , p_log_level_rec => p_log_level_rec
3232: );
3233:
3234: -- Bug:5930979:Japan Tax Reform Project (Start)
3235: if nvl(fa_cache_pkg.fazccmt_record.GUARANTEE_RATE_METHOD_FLAG,'NO') = 'YES' then
3236:
3237: UPDATE fa_books
3238: SET rate_in_use = l_rate_in_use
3239: WHERE asset_id = l_asset_hdr_rec.asset_id
3244: -- Bug:5930979:Japan Tax Reform Project (End)
3245:
3246: -- Full retirement does not update DH table at all
3247: -- since DH table only has distribtuions only for corporate book
3248: if fa_cache_pkg.fazcbc_record.book_class = 'CORPORATE' and
3249: l_trans_rec.transaction_type_code = 'FULL RETIREMENT' then
3250:
3251: -- full retirement
3252: for dh_rec in dh_cursor(l_asset_hdr_rec.asset_id,
3399: l_inv_tbl FA_API_TYPES.inv_tbl_type;
3400: l_period_rec FA_API_TYPES.period_rec_type;
3401:
3402: -- used to loop through tax books
3403: l_tax_book_tbl FA_CACHE_PKG.fazctbk_tbl_type;
3404: l_tax_index number; -- index for tax loop
3405:
3406: l_reporting_flag varchar2(1);
3407:
3423: raise FND_API.G_EXC_ERROR;
3424: end if;
3425: end if;
3426:
3427: g_release := fa_cache_pkg.fazarel_release;
3428:
3429: -- initialize message list if p_init_msg_list is set to TRUE.
3430: if (FND_API.to_boolean(p_init_msg_list) ) then
3431: -- initialize error message stack.
3477:
3478: if l_asset_hdr_rec.book_type_code is not null then
3479:
3480: -- call the cache for the primary transaction book
3481: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => g_log_level_rec) then
3482: raise FND_API.G_EXC_UNEXPECTED_ERROR;
3483: end if;
3484:
3485: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
3481: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => g_log_level_rec) then
3482: raise FND_API.G_EXC_UNEXPECTED_ERROR;
3483: end if;
3484:
3485: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
3486: lv_asset_hdr_rec := l_asset_hdr_rec;
3487:
3488: -- get the book type code P,R or N
3489: if not fa_cache_pkg.fazcsob
3485: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
3486: lv_asset_hdr_rec := l_asset_hdr_rec;
3487:
3488: -- get the book type code P,R or N
3489: if not fa_cache_pkg.fazcsob
3490: (x_set_of_books_id => l_asset_hdr_rec.set_of_books_id
3491: ,x_mrc_sob_type_code => l_reporting_flag, p_log_level_rec => g_log_level_rec)
3492: then
3493: raise FND_API.G_EXC_UNEXPECTED_ERROR;
3562:
3563: /* if book is a corporate book, process cip assets and autocopy */
3564:
3565: -- start processing tax books for cip-in-tax and autocopy
3566: if (fa_cache_pkg.fazcbc_record.book_class = 'CORPORATE') then
3567:
3568: lv_trans_rec := l_trans_rec;
3569:
3570: if (l_asset_type_rec.asset_type = 'CIP'
3569:
3570: if (l_asset_type_rec.asset_type = 'CIP'
3571: or l_asset_type_rec.asset_type = 'CAPITALIZED') then
3572:
3573: if not fa_cache_pkg.fazctbk
3574: (x_corp_book => l_asset_hdr_rec.book_type_code
3575: ,x_asset_type => l_asset_type_rec.asset_type
3576: ,x_tax_book_tbl => l_tax_book_tbl, p_log_level_rec => g_log_level_rec) then
3577: raise FND_API.G_EXC_UNEXPECTED_ERROR;
3590:
3591: else
3592:
3593: -- cache the book information for the tax book
3594: if not fa_cache_pkg.fazcbc(x_book => l_tax_book_tbl(l_tax_index),
3595: p_log_level_rec => g_log_level_rec) then
3596: raise FND_API.G_EXC_UNEXPECTED_ERROR;
3597: end if;
3598:
3770: l_asset_hdr_rec.asset_id := l_asset_retire_rec.detail_info.asset_id;
3771: l_asset_hdr_rec.book_type_code := l_asset_retire_rec.detail_info.book_type_code;
3772:
3773: -- call the cache for the primary transaction book
3774: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => p_log_level_rec) then
3775: raise FND_API.G_EXC_UNEXPECTED_ERROR;
3776: end if;
3777:
3778: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
3774: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => p_log_level_rec) then
3775: raise FND_API.G_EXC_UNEXPECTED_ERROR;
3776: end if;
3777:
3778: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
3779:
3780:
3781: -- pop current period_rec info
3782: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'pop period_rec', '', p_log_level_rec => p_log_level_rec); end if;
3828: ) then
3829: raise FND_API.G_EXC_UNEXPECTED_ERROR;
3830: end if;
3831:
3832: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => p_log_level_rec) then
3833: fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
3834: return FALSE;
3835: end if;
3836:
3835: end if;
3836:
3837: -- MRC LOOP
3838: -- if this is a primary book, process reporting books(sobs)
3839: if fa_cache_pkg.fazcbc_record.mc_source_flag = 'Y' then
3840:
3841: -- loop thourgh reporting set of books
3842: for sob_rec in sob_cursor(l_asset_hdr_rec.book_type_code
3843: ,l_asset_hdr_rec.set_of_books_id) loop
3845: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'in sob_id loop', '', p_log_level_rec => p_log_level_rec); end if;
3846:
3847: l_asset_hdr_rec.set_of_books_id := sob_rec.sob_id;
3848:
3849: if not fa_cache_pkg.fazcbcs(x_book => l_asset_hdr_rec.book_type_code,
3850: x_set_of_books_id => sob_rec.sob_id,--l_asset_hdr_rec.set_of_books_id, Secondary Changes , Reporting Book sob can be different from Primary
3851: p_log_level_rec => p_log_level_rec) then
3852: fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
3853: return FALSE;
4201: if p_log_level_rec.statement_level then
4202: fa_debug_pkg.add(l_calling_fn, 'Asset_Id:', l_asset_hdr_rec.Asset_Id, p_log_level_rec => p_log_level_rec);
4203: fa_debug_pkg.add(l_calling_fn, 'Book_Type_Code:', l_asset_hdr_rec.Book_Type_Code, p_log_level_rec => p_log_level_rec);
4204: fa_debug_pkg.add(l_calling_fn, 'p_mrc_sob_type_code:', p_mrc_sob_type_code, p_log_level_rec => p_log_level_rec);
4205: fa_debug_pkg.add(l_calling_fn, 'book class:', fa_cache_pkg.fazcbc_record.book_class, p_log_level_rec => p_log_level_rec);
4206: end if;
4207:
4208: if (p_mrc_sob_type_code <> 'R') then
4209:
4206: end if;
4207:
4208: if (p_mrc_sob_type_code <> 'R') then
4209:
4210: if (fa_cache_pkg.fazcbc_record.book_class = 'CORPORATE') then
4211: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'before get_transfer_id', '', p_log_level_rec => p_log_level_rec); end if;
4212:
4213: l_partial_unit_ret_flag := 'N';
4214:
4361: X_Calling_Fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
4362:
4363: if (p_mrc_sob_type_code <> 'R') then
4364:
4365: if (fa_cache_pkg.fazcbc_record.book_class = 'CORPORATE') then
4366: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'FA_DISTRIBUTION_HISTORY_PKG.REACTIVATE_ROW', '', p_log_level_rec => p_log_level_rec); end if;
4367: FA_DISTRIBUTION_HISTORY_PKG.REACTIVATE_ROW
4368: (X_Asset_Id => l_asset_hdr_rec.asset_id,
4369: X_Book_Type_Code=> l_asset_hdr_rec.book_type_code,
4462: l_inv_tbl FA_API_TYPES.inv_tbl_type;
4463: l_period_rec FA_API_TYPES.period_rec_type;
4464:
4465: -- used for loop through tax books
4466: l_tax_book_tbl FA_CACHE_PKG.fazctbk_tbl_type;
4467: l_tax_index number;
4468:
4469: cursor tde_cursor is
4470: select max(th.transaction_date_entered)
4511: raise FND_API.G_EXC_ERROR;
4512: end if;
4513: end if;
4514:
4515: g_release := fa_cache_pkg.fazarel_release;
4516:
4517:
4518: -- initialize message list if p_init_msg_list is set to TRUE.
4519: if (FND_API.to_boolean(p_init_msg_list) ) then
4558: fa_debug_pkg.add(l_calling_fn, 'book_type_code:', l_asset_hdr_rec.book_type_code, p_log_level_rec => g_log_level_rec);
4559: fa_debug_pkg.add(l_calling_fn, 'fa_ret retirement_id:', l_asset_retire_rec.retirement_id, p_log_level_rec => g_log_level_rec);
4560: end if;
4561:
4562: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => g_log_level_rec) then
4563: raise FND_API.G_EXC_UNEXPECTED_ERROR;
4564: end if;
4565:
4566: /*Bug# 8527619 */
4634:
4635: if l_asset_hdr_rec.book_type_code is not null then
4636:
4637: -- call the cache for the primary transaction book
4638: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => g_log_level_rec) then
4639: raise FND_API.G_EXC_UNEXPECTED_ERROR;
4640: end if;
4641:
4642: -- l_book_class := fa_cache_pkg.fazcbc_record.book_class;
4638: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => g_log_level_rec) then
4639: raise FND_API.G_EXC_UNEXPECTED_ERROR;
4640: end if;
4641:
4642: -- l_book_class := fa_cache_pkg.fazcbc_record.book_class;
4643: -- l_set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
4644: -- l_distribution_source_book := fa_cache_pkg.fazcbc_record.distribution_source_book;
4645: -- l_mc_source_flag := fa_cache_pkg.fazcbc_record.mc_source_flag;
4646:
4639: raise FND_API.G_EXC_UNEXPECTED_ERROR;
4640: end if;
4641:
4642: -- l_book_class := fa_cache_pkg.fazcbc_record.book_class;
4643: -- l_set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
4644: -- l_distribution_source_book := fa_cache_pkg.fazcbc_record.distribution_source_book;
4645: -- l_mc_source_flag := fa_cache_pkg.fazcbc_record.mc_source_flag;
4646:
4647: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
4640: end if;
4641:
4642: -- l_book_class := fa_cache_pkg.fazcbc_record.book_class;
4643: -- l_set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
4644: -- l_distribution_source_book := fa_cache_pkg.fazcbc_record.distribution_source_book;
4645: -- l_mc_source_flag := fa_cache_pkg.fazcbc_record.mc_source_flag;
4646:
4647: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
4648:
4641:
4642: -- l_book_class := fa_cache_pkg.fazcbc_record.book_class;
4643: -- l_set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
4644: -- l_distribution_source_book := fa_cache_pkg.fazcbc_record.distribution_source_book;
4645: -- l_mc_source_flag := fa_cache_pkg.fazcbc_record.mc_source_flag;
4646:
4647: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
4648:
4649: -- get the book type code P,R or N
4643: -- l_set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
4644: -- l_distribution_source_book := fa_cache_pkg.fazcbc_record.distribution_source_book;
4645: -- l_mc_source_flag := fa_cache_pkg.fazcbc_record.mc_source_flag;
4646:
4647: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
4648:
4649: -- get the book type code P,R or N
4650: if not fa_cache_pkg.fazcsob
4651: (x_set_of_books_id => l_asset_hdr_rec.set_of_books_id
4646:
4647: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
4648:
4649: -- get the book type code P,R or N
4650: if not fa_cache_pkg.fazcsob
4651: (x_set_of_books_id => l_asset_hdr_rec.set_of_books_id
4652: ,x_mrc_sob_type_code => l_reporting_flag, p_log_level_rec => g_log_level_rec)
4653: then
4654: raise FND_API.G_EXC_UNEXPECTED_ERROR;
4789:
4790: /* if book is a corporate book, process cip assets and autocopy */
4791:
4792: -- start processing tax books for cip-in-tax and autocopy
4793: if (fa_cache_pkg.fazcbc_record.book_class = 'CORPORATE') then
4794:
4795: lv_trans_rec := l_trans_rec;
4796: lv_asset_hdr_rec := l_asset_hdr_rec;
4797: lv_asset_retire_rec := l_asset_retire_rec;
4800: or l_asset_type_rec.asset_type = 'CAPITALIZED') then
4801:
4802: if g_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'Asset type: ', l_asset_type_rec.asset_type, p_log_level_rec => g_log_level_rec); end if;
4803:
4804: if not fa_cache_pkg.fazctbk
4805: (x_corp_book => l_asset_hdr_rec.book_type_code
4806: ,x_asset_type => l_asset_type_rec.asset_type
4807: ,x_tax_book_tbl => l_tax_book_tbl, p_log_level_rec => g_log_level_rec) then
4808: raise FND_API.G_EXC_UNEXPECTED_ERROR;
4827:
4828: else
4829:
4830: -- cache the book information for the tax book
4831: if not fa_cache_pkg.fazcbc(x_book => l_tax_book_tbl(l_tax_index),
4832: p_log_level_rec => g_log_level_rec) then
4833: raise FND_API.G_EXC_UNEXPECTED_ERROR;
4834: end if;
4835:
5040: -- *********************************
5041: -- populate rec_types that were not provided by users
5042:
5043: -- call the cache for the primary transaction book
5044: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => p_log_level_rec) then
5045: raise FND_API.G_EXC_UNEXPECTED_ERROR;
5046: end if;
5047:
5048: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
5044: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => p_log_level_rec) then
5045: raise FND_API.G_EXC_UNEXPECTED_ERROR;
5046: end if;
5047:
5048: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
5049:
5050: -- pop current period_rec info
5051: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'pop period_rec', '', p_log_level_rec => p_log_level_rec); end if;
5052: if not FA_UTIL_PVT.get_period_rec
5149: raise FND_API.G_EXC_UNEXPECTED_ERROR;
5150: end if;
5151:
5152:
5153: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => p_log_level_rec) then
5154: fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
5155: return FALSE;
5156: end if;
5157:
5156: end if;
5157:
5158: -- MRC LOOP
5159: -- if this is a primary book, process reporting books(sobs)
5160: if fa_cache_pkg.fazcbc_record.mc_source_flag = 'Y' then
5161:
5162: -- loop thourgh reporting set of books
5163: for sob_rec in sob_cursor(l_asset_hdr_rec.book_type_code
5164: ,l_asset_hdr_rec.set_of_books_id) loop
5166: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'in sob_id loop', '', p_log_level_rec => p_log_level_rec); end if;
5167:
5168: l_asset_hdr_rec.set_of_books_id := sob_rec.sob_id;
5169:
5170: if not fa_cache_pkg.fazcbcs(x_book => l_asset_hdr_rec.book_type_code,
5171: x_set_of_books_id => sob_rec.sob_id,--l_asset_hdr_rec.set_of_books_id,Secondary Chnages Reporting SOB can be different from Primary
5172: p_log_level_rec => p_log_level_rec) then
5173: fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
5174: return FALSE;
5180: -- if l_inv_trans_rec.transaction_type is null then
5181:
5182: /******* routine to get existing rates when invoice trx is involved
5183: -- if (l_inv_rec.source_transaction_header_id is not null)
5184: and (fa_cache_pkg.fazcbc_record.book_class = 'TAX') then
5185:
5186: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'calling get_existing_rate', '', p_log_level_rec => p_log_level_rec); end if;
5187:
5188: -- get the exchange rate from the corporate transaction
5201:
5202: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'calling get_trx_rate', '', p_log_level_rec => p_log_level_rec); end if;
5203:
5204: if not FA_MC_UTIL_PVT.get_trx_rate
5205: (p_prim_set_of_books_id => fa_cache_pkg.fazcbc_record.set_of_books_id,
5206: p_reporting_set_of_books_id => sob_rec.sob_id,
5207: px_exchange_date => l_exchange_date,
5208: p_book_type_code => l_asset_hdr_rec.book_type_code,
5209: px_rate => l_rate
5413: -- is handling all MRC part of adjustments table
5414: if (l_asset_dist_tbl.count > 0 )
5415: and
5416: (l_asset_hdr_rec.set_of_books_id
5417: = fa_cache_pkg.fazcbc_record.set_of_books_id)
5418: and
5419: (fa_cache_pkg.fazcbc_record.book_class='CORPORATE') then
5420:
5421: -- Call distribution API to process partial-unit reinstatement.
5415: and
5416: (l_asset_hdr_rec.set_of_books_id
5417: = fa_cache_pkg.fazcbc_record.set_of_books_id)
5418: and
5419: (fa_cache_pkg.fazcbc_record.book_class='CORPORATE') then
5420:
5421: -- Call distribution API to process partial-unit reinstatement.
5422: -- do_distribution will handle TH, DH, AD and AH tables for TRANSFER OUT transaction
5423: -- and call 'fautfr' function in it.
5904: l_inv_tbl FA_API_TYPES.inv_tbl_type;
5905: l_period_rec FA_API_TYPES.period_rec_type;
5906:
5907: -- used to loop through tax books
5908: l_tax_book_tbl FA_CACHE_PKG.fazctbk_tbl_type;
5909: l_tax_index number; -- index for tax loop
5910:
5911: l_reporting_flag varchar2(1);
5912:
5928: raise FND_API.G_EXC_ERROR;
5929: end if;
5930: end if;
5931:
5932: g_release := fa_cache_pkg.fazarel_release;
5933:
5934: -- initialize message list if p_init_msg_list is set to TRUE.
5935: if (FND_API.to_boolean(p_init_msg_list) ) then
5936: -- initialize error message stack.
5973:
5974: if l_asset_hdr_rec.book_type_code is not null then
5975:
5976: -- call the cache for the primary transaction book
5977: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => g_log_level_rec) then
5978: raise FND_API.G_EXC_UNEXPECTED_ERROR;
5979: end if;
5980:
5981: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
5977: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => g_log_level_rec) then
5978: raise FND_API.G_EXC_UNEXPECTED_ERROR;
5979: end if;
5980:
5981: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
5982: lv_asset_hdr_rec := l_asset_hdr_rec;
5983:
5984: -- get the book type code P,R or N
5985: if not fa_cache_pkg.fazcsob
5981: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
5982: lv_asset_hdr_rec := l_asset_hdr_rec;
5983:
5984: -- get the book type code P,R or N
5985: if not fa_cache_pkg.fazcsob
5986: (x_set_of_books_id => l_asset_hdr_rec.set_of_books_id
5987: ,x_mrc_sob_type_code => l_reporting_flag, p_log_level_rec => g_log_level_rec)
5988: then
5989: raise FND_API.G_EXC_UNEXPECTED_ERROR;
6049:
6050: /* if book is a corporate book, process cip assets and autocopy */
6051:
6052: -- start processing tax books for cip-in-tax and autocopy
6053: if (fa_cache_pkg.fazcbc_record.book_class = 'CORPORATE') then
6054:
6055: lv_trans_rec := l_trans_rec;
6056:
6057: if (l_asset_type_rec.asset_type = 'CIP'
6058: or l_asset_type_rec.asset_type = 'CAPITALIZED') then
6059:
6060: if g_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'Asset type: ', l_asset_type_rec.asset_type, p_log_level_rec => g_log_level_rec); end if;
6061:
6062: if not fa_cache_pkg.fazctbk
6063: (x_corp_book => l_asset_hdr_rec.book_type_code
6064: ,x_asset_type => l_asset_type_rec.asset_type
6065: ,x_tax_book_tbl => l_tax_book_tbl, p_log_level_rec => g_log_level_rec) then
6066: raise FND_API.G_EXC_UNEXPECTED_ERROR;
6084:
6085: else
6086:
6087: -- cache the book information for the tax book
6088: if not fa_cache_pkg.fazcbc(x_book => l_tax_book_tbl(l_tax_index),
6089: p_log_level_rec => g_log_level_rec) then
6090: raise FND_API.G_EXC_UNEXPECTED_ERROR;
6091: end if;
6092:
6264: l_asset_hdr_rec.asset_id := l_asset_retire_rec.detail_info.asset_id;
6265: l_asset_hdr_rec.book_type_code := l_asset_retire_rec.detail_info.book_type_code;
6266:
6267: -- call the cache for the primary transaction book
6268: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => p_log_level_rec) then
6269: raise FND_API.G_EXC_UNEXPECTED_ERROR;
6270: end if;
6271:
6272: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
6268: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => p_log_level_rec) then
6269: raise FND_API.G_EXC_UNEXPECTED_ERROR;
6270: end if;
6271:
6272: l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
6273:
6274: -- pop current period_rec info
6275: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'pop period_rec', '', p_log_level_rec => p_log_level_rec); end if;
6276: if not FA_UTIL_PVT.get_period_rec
6320: ) then
6321: raise FND_API.G_EXC_UNEXPECTED_ERROR;
6322: end if;
6323:
6324: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => p_log_level_rec) then
6325: fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
6326: return FALSE;
6327: end if;
6328:
6327: end if;
6328:
6329: -- MRC LOOP
6330: -- if this is a primary book, process reporting books(sobs)
6331: if fa_cache_pkg.fazcbc_record.mc_source_flag = 'Y' then
6332:
6333: -- loop thourgh reporting set of books
6334: for sob_rec in sob_cursor(l_asset_hdr_rec.book_type_code
6335: ,l_asset_hdr_rec.set_of_books_id) loop
6336:
6337: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'in sob_id loop', '', p_log_level_rec => p_log_level_rec); end if;
6338:
6339: l_asset_hdr_rec.set_of_books_id := sob_rec.sob_id;
6340: if not fa_cache_pkg.fazcbcs(x_book => l_asset_hdr_rec.book_type_code,
6341: x_set_of_books_id => sob_rec.sob_id,--l_asset_hdr_rec.set_of_books_id, Secondary changes Reporting SOB can be different from Primary
6342: p_log_level_rec => p_log_level_rec) then
6343: fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
6344: return FALSE;
6920: -- Instead retirement of CIP on TAX book can be copied through CORP book only.
6921: if l_validation_type = g_retirement then
6922:
6923: -- call the cache for the transaction book
6924: if not fa_cache_pkg.fazcbc(x_book => l_asset_hdr_rec.book_type_code, p_log_level_rec => p_log_level_rec) then
6925: raise FND_API.G_EXC_UNEXPECTED_ERROR;
6926: end if;
6927:
6928: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'check to make sure that the transaction is not for CIP on TAX book', '', p_log_level_rec => p_log_level_rec); end if;
6925: raise FND_API.G_EXC_UNEXPECTED_ERROR;
6926: end if;
6927:
6928: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'check to make sure that the transaction is not for CIP on TAX book', '', p_log_level_rec => p_log_level_rec); end if;
6929: if fa_cache_pkg.fazcbc_record.book_class = 'TAX'
6930: and l_asset_type_rec.asset_type = 'CIP' then
6931:
6932: -- we do not support this transaction
6933: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'Error: You can not perform this transaction on CIP asset.', '', p_log_level_rec => p_log_level_rec); end if;
6941: ,g_undo_retirement
6942: ,g_undo_reinstatement) then
6943:
6944: -- call the cache for the transaction book
6945: if not fa_cache_pkg.fazcbc(x_book => lv_asset_retire_rec.detail_info.book_type_code, p_log_level_rec => p_log_level_rec) then
6946: g_msg_name := null;
6947: g_token1 := null;
6948: raise FND_API.G_EXC_UNEXPECTED_ERROR;
6949: end if;
6947: g_token1 := null;
6948: raise FND_API.G_EXC_UNEXPECTED_ERROR;
6949: end if;
6950:
6951: if fa_cache_pkg.fazcbc_record.book_class = 'TAX'
6952: and l_asset_type_rec.asset_type = 'CIP' then
6953:
6954: -- we do not support this transaction
6955: if p_log_level_rec.statement_level then fa_debug_pkg.add(l_calling_fn, 'Error: You can not perform this transaction on CIP asset.', '', p_log_level_rec => p_log_level_rec); end if;
7135: and l_asset_retire_rec.date_retired is not null then
7136:
7137: -- validate retirement_prorate_convention if it is not null
7138: if l_asset_retire_rec.retirement_prorate_convention is not null then
7139: if not fa_cache_pkg.fazccvt
7140: (x_prorate_convention_code => l_asset_retire_rec.retirement_prorate_convention,
7141: x_fiscal_year_name => fa_cache_pkg.fazcbc_record.fiscal_year_name, p_log_level_rec => p_log_level_rec) then
7142: g_msg_name := 'FA_RET_CANT_GET_RET_PRO_DATE';
7143: g_token1 := null;
7137: -- validate retirement_prorate_convention if it is not null
7138: if l_asset_retire_rec.retirement_prorate_convention is not null then
7139: if not fa_cache_pkg.fazccvt
7140: (x_prorate_convention_code => l_asset_retire_rec.retirement_prorate_convention,
7141: x_fiscal_year_name => fa_cache_pkg.fazcbc_record.fiscal_year_name, p_log_level_rec => p_log_level_rec) then
7142: g_msg_name := 'FA_RET_CANT_GET_RET_PRO_DATE';
7143: g_token1 := null;
7144:
7145: raise FND_API.G_EXC_ERROR;
7343: raise FND_API.G_EXC_ERROR;
7344: end if;
7345: end if;
7346: /*bug#16426081 starts*/
7347: if ( nvl(fa_cache_pkg.fazcdrd_record.rule_name,'ZZ') = 'YEAR END BALANCE WITH POSITIVE REDUCTION AMOUNT' and
7348: nvl(l_asset_fin_rec.tracking_method, 'NO TRACK') = 'CALCULATE' and
7349: nvl(l_asset_fin_rec.member_rollup_flag, 'N') = 'Y' and
7350: fa_cache_pkg.fazccmt_record.deprn_basis_rule = 'NBV' and
7351: l_asset_retire_rec.cost_retired <> l_asset_fin_rec.cost
7346: /*bug#16426081 starts*/
7347: if ( nvl(fa_cache_pkg.fazcdrd_record.rule_name,'ZZ') = 'YEAR END BALANCE WITH POSITIVE REDUCTION AMOUNT' and
7348: nvl(l_asset_fin_rec.tracking_method, 'NO TRACK') = 'CALCULATE' and
7349: nvl(l_asset_fin_rec.member_rollup_flag, 'N') = 'Y' and
7350: fa_cache_pkg.fazccmt_record.deprn_basis_rule = 'NBV' and
7351: l_asset_retire_rec.cost_retired <> l_asset_fin_rec.cost
7352: ) then
7353: g_msg_name := 'FA_CCA_NO_PART_RET';
7354: raise FND_API.G_EXC_ERROR;
7394: raise FND_API.G_EXC_ERROR;
7395: end if;
7396: end if;
7397: /* Bug 8633654 */
7398: if (not fa_cache_pkg.fazccmt(l_asset_fin_rec.deprn_method_code,
7399: l_asset_fin_rec.life_in_months
7400: ,p_log_level_rec => p_log_level_rec)) then
7401: if (p_log_level_rec.statement_level) then
7402: fa_debug_pkg.add(l_calling_fn, 'Error calling', 'fa_cache_pkg.fazccmt'
7398: if (not fa_cache_pkg.fazccmt(l_asset_fin_rec.deprn_method_code,
7399: l_asset_fin_rec.life_in_months
7400: ,p_log_level_rec => p_log_level_rec)) then
7401: if (p_log_level_rec.statement_level) then
7402: fa_debug_pkg.add(l_calling_fn, 'Error calling', 'fa_cache_pkg.fazccmt'
7403: ,p_log_level_rec => p_log_level_rec);
7404: end if;
7405:
7406: raise FND_API.G_EXC_UNEXPECTED_ERROR;
7405:
7406: raise FND_API.G_EXC_UNEXPECTED_ERROR;
7407: end if;
7408:
7409: if ( nvl(fa_cache_pkg.fazcdrd_record.rule_name,'ZZ') = 'ENERGY PERIOD END BALANCE' and
7410: nvl(l_asset_fin_rec.tracking_method, 'NO TRACK') = 'ALLOCATE') then
7411: if not FA_ASSET_VAL_PVT.validate_mbr_reins_possible
7412: (p_asset_retire_rec =>l_asset_retire_rec,
7413: p_asset_fin_rec => l_asset_fin_rec,