[Home] [Help]
PACKAGE BODY: APPS.FA_CIP_PUB
Source
1 PACKAGE BODY FA_CIP_PUB as
2 /* $Header: FAPCIPB.pls 120.22.12020000.2 2012/11/30 13:40:33 spooyath ship $ */
3
4 --*********************** Global constants ******************************--
5
6 G_PKG_NAME CONSTANT varchar2(30) := 'FA_CIP_PUB';
7 G_API_NAME CONSTANT varchar2(30) := 'Capitalization/Reverse API';
8 G_API_VERSION CONSTANT number := 1.0;
9
10 g_log_level_rec fa_api_types.log_level_rec_type;
11
12 --*********************** Private functions ******************************--
13
14 FUNCTION do_cap_rev
15 (p_api_version IN NUMBER,
16 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
17 p_commit IN VARCHAR2 := FND_API.G_FALSE,
18 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
19 p_calling_fn IN VARCHAR2,
20 x_return_status OUT NOCOPY VARCHAR2,
21 x_msg_count OUT NOCOPY NUMBER,
22 x_msg_data OUT NOCOPY VARCHAR2,
23
24 px_trans_rec IN OUT NOCOPY FA_API_TYPES.trans_rec_type,
25 px_asset_hdr_rec IN OUT NOCOPY FA_API_TYPES.asset_hdr_rec_type,
26 px_asset_fin_rec IN OUT NOCOPY FA_API_TYPES.asset_fin_rec_type,
27 p_cap_rev IN VARCHAR2
28 , p_log_level_rec IN FA_API_TYPES.log_level_rec_type) RETURN BOOLEAN;
29
30 -- private declaration for books (mrc) wrapper
31
32 FUNCTION do_all_books
33 (px_trans_rec IN OUT NOCOPY FA_API_TYPES.trans_rec_type,
34 px_asset_hdr_rec IN OUT NOCOPY FA_API_TYPES.asset_hdr_rec_type,
35 p_asset_desc_rec IN FA_API_TYPES.asset_desc_rec_type,
36 px_asset_type_rec IN OUT NOCOPY FA_API_TYPES.asset_type_rec_type,
37 p_asset_cat_rec IN FA_API_TYPES.asset_cat_rec_type,
38 px_asset_fin_rec IN OUT NOCOPY FA_API_TYPES.asset_fin_rec_type
39 , p_log_level_rec IN FA_API_TYPES.log_level_rec_type) RETURN BOOLEAN;
40
41 --*********************** Public procedures ******************************--
42
43 PROCEDURE do_capitalization
44 (p_api_version IN NUMBER,
45 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
46 p_commit IN VARCHAR2 := FND_API.G_FALSE,
47 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
48 p_calling_fn IN VARCHAR2,
49 x_return_status OUT NOCOPY VARCHAR2,
50 x_msg_count OUT NOCOPY NUMBER,
51 x_msg_data OUT NOCOPY VARCHAR2,
52
53 px_trans_rec IN OUT NOCOPY FA_API_TYPES.trans_rec_type,
54 px_asset_hdr_rec IN OUT NOCOPY FA_API_TYPES.asset_hdr_rec_type,
55 px_asset_fin_rec IN OUT NOCOPY FA_API_TYPES.asset_fin_rec_type) IS
56
57 l_cap_rev VARCHAR2(10) := 'CAPITALIZE';
58 l_calling_fn VARCHAR2(30) := 'fa_cip_pub.do_capitalization';
59 cap_err EXCEPTION;
60
61 BEGIN
62
63 if (not g_log_level_rec.initialized) then
64 if (NOT fa_util_pub.get_log_level_rec (
65 x_log_level_rec => g_log_level_rec
66 )) then
67 raise cap_err;
68 end if;
69 end if;
70
71 px_trans_rec.transaction_type_code := 'CAPITALIZE';
72
73 if not do_cap_rev (
74 p_api_version => p_api_version,
75 p_init_msg_list => p_init_msg_list,
76 p_commit => p_commit,
77 p_validation_level => p_validation_level,
78 p_calling_fn => p_calling_fn,
79 x_return_status => x_return_status,
80 x_msg_count => x_msg_count,
81 x_msg_data => x_msg_data,
82 px_trans_rec => px_trans_rec,
83 px_asset_hdr_rec => px_asset_hdr_rec,
84 px_asset_fin_rec => px_asset_fin_rec,
85 p_cap_rev => l_cap_rev,
86 p_log_level_rec => g_log_level_rec
87 ) then
88 raise cap_err;
89 end if;
90
91 -- commit if p_commit is TRUE.
92 if (fnd_api.to_boolean (p_commit)) then
93 COMMIT WORK;
94 end if;
95
96 x_return_status := FND_API.G_RET_STS_SUCCESS;
97
98 return;
99
100 EXCEPTION
101
102 WHEN CAP_ERR THEN
103
104 fa_srvr_msg.add_message(calling_fn => l_calling_fn, p_log_level_rec => g_log_level_rec);
105
106 -- do not retrieve / clear messaging when this is being called
107 -- from cip-in-taxapi allow calling program to dump them
108 -- if (nvl(p_calling_fn, 'N') <> 'fa_ciptax_api_pkg.cip_adj') then
109 FA_DEBUG_PKG.dump_debug_messages(max_mesgs => 0, p_log_level_rec => g_log_level_rec);
110 FND_MSG_PUB.count_and_get (
111 p_count => x_msg_count,
112 p_data => x_msg_data
113 );
114 -- end if;
115
116 x_return_status := FND_API.G_RET_STS_ERROR;
117
118 return;
119
120 WHEN OTHERS THEN
121
122 fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn, p_log_level_rec => g_log_level_rec);
123
124 -- do not retrieve / clear messaging when this is being called
125 -- from cip-in-taxapi allow calling program to dump them
126 -- if (nvl(p_calling_fn, 'N') <> 'fa_ciptax_api_pkg.cip_adj') then
127 FA_DEBUG_PKG.dump_debug_messages(max_mesgs => 0, p_log_level_rec => g_log_level_rec);
128 FND_MSG_PUB.count_and_get (
129 p_count => x_msg_count,
130 p_data => x_msg_data
131 );
132 -- end if;
133
134 x_return_status := FND_API.G_RET_STS_ERROR;
135
136 return;
137
138 END do_capitalization;
139
140 PROCEDURE do_reverse
141 (p_api_version IN NUMBER,
142 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
143 p_commit IN VARCHAR2 := FND_API.G_FALSE,
144 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
145 p_calling_fn IN VARCHAR2,
146 x_return_status OUT NOCOPY VARCHAR2,
147 x_msg_count OUT NOCOPY NUMBER,
148 x_msg_data OUT NOCOPY VARCHAR2,
149
150 px_trans_rec IN OUT NOCOPY FA_API_TYPES.trans_rec_type,
151 px_asset_hdr_rec IN OUT NOCOPY FA_API_TYPES.asset_hdr_rec_type,
152 px_asset_fin_rec IN OUT NOCOPY FA_API_TYPES.asset_fin_rec_type) IS
153
154 l_cap_rev VARCHAR2(10) := 'REVERSE';
155 l_calling_fn VARCHAR2(30) := 'fa_cip_pub.do_reverse';
156 rev_err EXCEPTION;
157
158 BEGIN
159
160 if (not g_log_level_rec.initialized) then
161 if (NOT fa_util_pub.get_log_level_rec (
162 x_log_level_rec => g_log_level_rec
163 )) then
164 raise rev_err;
165 end if;
166 end if;
167
168 px_trans_rec.transaction_type_code := 'REVERSE';
169
170 if not do_cap_rev (
171 p_api_version => p_api_version,
172 p_init_msg_list => p_init_msg_list,
173 p_commit => p_commit,
174 p_validation_level => p_validation_level,
175 p_calling_fn => p_calling_fn,
176 x_return_status => x_return_status,
177 x_msg_count => x_msg_count,
178 x_msg_data => x_msg_data,
179 px_trans_rec => px_trans_rec,
180 px_asset_hdr_rec => px_asset_hdr_rec,
181 px_asset_fin_rec => px_asset_fin_rec,
182 p_cap_rev => l_cap_rev,
183 p_log_level_rec => g_log_level_rec
184 ) then
185 raise rev_err;
186 end if;
187
188 -- commit if p_commit is TRUE.
189 if (fnd_api.to_boolean (p_commit)) then
190 COMMIT WORK;
191 end if;
192
193 x_return_status := FND_API.G_RET_STS_SUCCESS;
194
195 return;
196
197
198 EXCEPTION
199
200 WHEN REV_ERR THEN
201
202 fa_srvr_msg.add_message(calling_fn => l_calling_fn, p_log_level_rec => g_log_level_rec);
203
204 -- do not retrieve / clear messaging when this is being called
205 -- from cip-in-taxapi allow calling program to dump them
206 -- if (nvl(p_calling_fn, 'N') <> 'fa_ciptax_api_pkg.cip_adj') then
207 FA_DEBUG_PKG.dump_debug_messages(max_mesgs => 0, p_log_level_rec => g_log_level_rec);
208 FND_MSG_PUB.count_and_get (
209 p_count => x_msg_count,
210 p_data => x_msg_data
211 );
212 -- end if;
213
214 x_return_status := FND_API.G_RET_STS_ERROR;
215
216 return;
217
218 WHEN OTHERS THEN
219
220 fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn, p_log_level_rec => g_log_level_rec);
221
222 -- do not retrieve / clear messaging when this is being called
223 -- from cip-in-taxapi allow calling program to dump them
224 -- if (nvl(p_calling_fn, 'X') <> 'fa_ciptax_api_pkg.cip_adj') then
225 FA_DEBUG_PKG.dump_debug_messages(max_mesgs => 0, p_log_level_rec => g_log_level_rec);
226 FND_MSG_PUB.count_and_get (
227 p_count => x_msg_count,
228 p_data => x_msg_data
229 );
230 -- end if;
231
232 x_return_status := FND_API.G_RET_STS_ERROR;
233
234 return;
235
236 END do_reverse;
237
238 --*********************** Private procedures ******************************--
239
240 FUNCTION do_cap_rev
241 (p_api_version IN NUMBER,
242 p_init_msg_list IN VARCHAR2 := FND_API.G_FALSE,
243 p_commit IN VARCHAR2 := FND_API.G_FALSE,
244 p_validation_level IN NUMBER := FND_API.G_VALID_LEVEL_FULL,
245 p_calling_fn IN VARCHAR2,
246 x_return_status OUT NOCOPY VARCHAR2,
247 x_msg_count OUT NOCOPY NUMBER,
248 x_msg_data OUT NOCOPY VARCHAR2,
249
250 px_trans_rec IN OUT NOCOPY FA_API_TYPES.trans_rec_type,
251 px_asset_hdr_rec IN OUT NOCOPY FA_API_TYPES.asset_hdr_rec_type,
252 px_asset_fin_rec IN OUT NOCOPY FA_API_TYPES.asset_fin_rec_type,
253 p_cap_rev IN VARCHAR2
254 , p_log_level_rec IN FA_API_TYPES.log_level_rec_type) RETURN BOOLEAN IS
255
256 l_reporting_flag VARCHAR2(1);
257 l_count NUMBER := 0;
258
259 l_asset_desc_rec FA_API_TYPES.asset_desc_rec_type;
260 l_asset_type_rec FA_API_TYPES.asset_type_rec_type;
261 l_asset_cat_rec FA_API_TYPES.asset_cat_rec_type;
262
263 -- Bug 8252607/5475276 Cursor to get the book_type_code
264 CURSOR c_corp_book( p_asset_id number ) IS
265 SELECT bc.book_type_code
266 FROM fa_books bks,
267 fa_book_controls bc
268 WHERE bks.book_type_code = bc.distribution_source_book
269 AND bks.book_type_code = bc.book_type_code
270 AND bks.asset_id = p_asset_id
271 AND bks.transaction_header_id_out is null;
272
273 -- used for tax books when doing cip-in-tax or autocopy
274 l_trans_rec FA_API_TYPES.trans_rec_type;
275 l_asset_hdr_rec FA_API_TYPES.asset_hdr_rec_type;
276 l_asset_fin_rec FA_API_TYPES.asset_fin_rec_type;
277 l_tax_book_tbl FA_CACHE_PKG.fazctbk_tbl_type;
278 l_tax_index NUMBER; -- index for tax loop
279
280 l_calling_fn VARCHAR2(30) := 'fa_cip_pub.do_cap_rev';
281 cap_rev_err EXCEPTION;
282
283 --Added following variables for bugfix# 5155488
284 l_period_of_addition_flag varchar2(1);
285 l_dist_trans_rec FA_API_TYPES.trans_rec_type;
286 l_asset_hierarchy_rec FA_API_TYPES.asset_hierarchy_rec_type;
287 l_asset_deprn_rec FA_API_TYPES.asset_deprn_rec_type;
288 l_asset_dist_rec FA_API_TYPES.asset_dist_rec_type;
289 l_asset_dist_tbl FA_API_TYPES.asset_dist_tbl_type;
290 l_inv_tbl FA_API_TYPES.inv_tbl_type;
291 l_return_status VARCHAR2(1);
292 l_mesg_count number := 0;
293 l_mesg_len number;
294 l_mesg varchar2(4000);
295 l_corp_thid number;
296
297
298 BEGIN
299
300 savepoint do_cap_rev;
301
302 if (not g_log_level_rec.initialized) then
303 if (NOT fa_util_pub.get_log_level_rec (
304 x_log_level_rec => g_log_level_rec
305 )) then
306 raise cap_rev_err;
307 end if;
308 end if;
309
310 -- Initialize message list if p_init_msg_list is set to TRUE.
311 if (fnd_api.to_boolean(p_init_msg_list)) then
312 -- initialize error message stack.
313 fa_srvr_msg.init_server_message;
314
315 -- initialize debug message stack.
316 fa_debug_pkg.initialize;
317 end if;
318
319 -- Check version of the API
320 -- Standard call to check for API call compatibility.
321 if NOT fnd_api.compatible_api_call (
322 G_API_VERSION,
323 p_api_version,
324 G_API_NAME,
325 G_PKG_NAME
326 ) then
327 x_return_status := FND_API.G_RET_STS_ERROR;
328 raise cap_rev_err;
329 end if;
330
331 -- Bug 8252607/5475276 Get the book_type_code if it is not supplied.
332 if (px_asset_hdr_rec.book_type_code is null) then
333 open c_corp_book( px_asset_hdr_rec.asset_id );
334 fetch c_corp_book into px_asset_hdr_rec.book_type_code;
335 close c_corp_book;
336
337 if px_asset_hdr_rec.book_type_code is null then
338 fa_srvr_msg.add_message
339 (calling_fn => l_calling_fn,
340 name => 'FA_EXP_GET_ASSET_INFO', p_log_level_rec => p_log_level_rec);
341 raise cap_rev_err;
342 end if;
343 end if;
344
345 -- call the cache for the primary transaction book
346 if NOT fa_cache_pkg.fazcbc(X_book => px_asset_hdr_rec.book_type_code, p_log_level_rec => p_log_level_rec) then
347 raise cap_rev_err;
348 end if;
349
350 -- commenting this out until after complete uptake of apis
351 -- (in this case from cap form and massadd) at which point
352 -- the interim fa_ciptax_api_pkg will be obsolete and this
353 -- package will and must only be called for corporate book
354 -- (the if condition for book class for the cip-tax loop
355 -- will also become obsolete)
356 --
357 -- if (fa_cache_pkg.fazcbc_record.book_class <> 'CORPORATE') then
358 -- fa_srvr_msg.add_message
359 -- (calling_fn => l_calling_fn,
360 -- name => '**FA_NO_DIR_CAP_TAX***');
361 -- raise cap_rev_err;
362 -- end if;
363
364 px_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
365 -- verify the asset exist in the book already
366 if not FA_ASSET_VAL_PVT.validate_asset_book
367 (p_transaction_type_code => 'CAPITALIZATION',
368 p_book_type_code => px_asset_hdr_rec.book_type_code,
369 p_asset_id => px_asset_hdr_rec.asset_id,
370 p_calling_fn => 'fa_adjustment_pub.do_adjustment'
371 , p_log_level_rec => p_log_level_rec) then
372 raise cap_rev_err;
373 end if;
374
375
376 -- get the current info for the primary book
377
378 if (p_log_level_rec.statement_level) then
379 fa_debug_pkg.add(l_calling_fn,
380 'in main, sobid', px_asset_hdr_rec.set_of_books_id, p_log_level_rec => p_log_level_rec);
381 end if;
382
383 -- Account for transaction submitted from a responsibility
384 -- that is not tied to a SOB_ID by getting the value from
385 -- the book struct
386
387 -- Get the book type code P,R or N
388 if not fa_cache_pkg.fazcsob
389 (X_set_of_books_id => px_asset_hdr_rec.set_of_books_id,
390 X_mrc_sob_type_code => l_reporting_flag
391 , p_log_level_rec => p_log_level_rec) then
392 raise cap_rev_err;
393 end if;
394
395 -- Error out if the program is submitted from the Reporting Responsibility
396 -- No transaction permitted directly on reporting books.
397
398 IF l_reporting_flag = 'R' THEN
399 fa_srvr_msg.add_message
400 (calling_fn => l_calling_fn,
401 name => 'MRC_OSP_INVALID_BOOK_TYPE', p_log_level_rec => p_log_level_rec);
402 raise cap_rev_err;
403 END IF;
404
405 -- end initial MRC validation
406
407
408 -- set trx type
409 if p_cap_rev = 'CAPITALIZE' then
410 px_trans_rec.transaction_type_code := 'ADDITION';
411
412 elsif p_cap_rev = 'REVERSE' then
413 px_trans_rec.transaction_type_code := 'CIP REVERSE';
414 else
415 fa_srvr_msg.add_message
416 (calling_fn => l_calling_fn,
417 name => '***INVALID_TRX_TYPE***',
418 p_log_level_rec => p_log_level_rec);
419 raise cap_rev_err;
420 end if;
421
422
423 -- load the needed structs
424 if not FA_UTIL_PVT.get_asset_desc_rec
425 (p_asset_hdr_rec => px_asset_hdr_rec,
426 px_asset_desc_rec => l_asset_desc_rec
427 , p_log_level_rec => p_log_level_rec) then
428 raise cap_rev_err;
429 end if;
430
431 if not FA_UTIL_PVT.get_asset_cat_rec
432 (p_asset_hdr_rec => px_asset_hdr_rec,
433 px_asset_cat_rec => l_asset_cat_rec,
434 p_date_effective => null
435 , p_log_level_rec => p_log_level_rec) then
436 raise cap_rev_err;
437 end if;
438
439 if not FA_UTIL_PVT.get_asset_type_rec
440 (p_asset_hdr_rec => px_asset_hdr_rec,
441 px_asset_type_rec => l_asset_type_rec,
442 p_date_effective => null
443 , p_log_level_rec => p_log_level_rec) then
444 raise cap_rev_err;
445 end if;
446
447 -- remove after api update
448 -- verify the transaction / asset type combi is valid for corp books
449
450 if (fa_cache_pkg.fazcbc_record.book_class = 'CORPORATE') then
451
452 if (((l_asset_type_rec.asset_type = 'CIP') and
453 (px_trans_rec.transaction_type_code = 'CIP REVERSE')) or
454 ((l_asset_type_rec.asset_type = 'CAPITALIZED') and
455 (px_trans_rec.transaction_type_code = 'ADDITION')) or
456 (l_asset_type_rec.asset_type = 'EXPENSED')) then
457
458 fa_srvr_msg.add_message
459 (calling_fn => l_calling_fn,
460 name => '***INVALID_COMBO***',
461 p_log_level_rec => p_log_level_rec);
462 raise cap_rev_err;
463
464 end if;
465
466 end if;
467
468 if not do_all_books
469 (px_trans_rec => px_trans_rec,
470 px_asset_hdr_rec => px_asset_hdr_rec ,
471 p_asset_desc_rec => l_asset_desc_rec ,
472 px_asset_type_rec => l_asset_type_rec,
473 p_asset_cat_rec => l_asset_cat_rec ,
474 px_asset_fin_rec => px_asset_fin_rec ,
475 p_log_level_rec => p_log_level_rec
476 )then
477 raise cap_rev_err;
478 end if;
479
480
481 -- remove the if condition after api update as this will always be corp book
482 -- If book is a corporate book, process cip assets and autocopy
483
484 if (fa_cache_pkg.fazcbc_record.book_class = 'CORPORATE') then
485
486 -- null out the deprn_adj table as we do not want to autocopy
487 -- any deprn info to tax books
488 -- still need to DO THIS!!!
489
490 l_trans_rec := px_trans_rec;
491 l_asset_hdr_rec := px_asset_hdr_rec;
492
493
494 -- ideally we may want to revisit this and get the CAP version
495 -- of the cache when in period of addition and changing to
496 -- capitalization, calling the additions api or for reversals
497 -- deleting the asset from tax books in period of addition
498 -- if allow cip assets is not enabled.
499
500 if not fa_cache_pkg.fazctbk
501 (x_corp_book => px_asset_hdr_rec.book_type_code,
502 x_asset_type => 'CIP',
503 x_tax_book_tbl => l_tax_book_tbl, p_log_level_rec => p_log_level_rec) then
504 raise cap_rev_err;
505 end if;
506
507 for l_tax_index in 1..l_tax_book_tbl.count loop
508
509 l_asset_fin_rec := null;
510
511 if (p_log_level_rec.statement_level) then
512 fa_debug_pkg.add(l_calling_fn,
513 'in do_cap_rev processing tax book', l_tax_book_tbl(l_tax_index));
514 end if;
515
516 -- verify that the asset exists in the tax book
517 -- if not just bypass it without failing
518
519 if not (FA_ASSET_VAL_PVT.validate_asset_book
520 (p_transaction_type_code => 'CAPITALIZATION',
521 p_book_type_code => l_tax_book_tbl(l_tax_index),
522 p_asset_id => px_asset_hdr_rec.asset_id,
523 p_calling_fn => 'fa_adjustment_pub.do_adjustment',
524 p_log_level_rec => p_log_level_rec)) then
525 --null;
526 -- bugfix# 5155488
527 if not (FA_ASSET_VAL_PVT.validate_period_of_addition
528 (p_asset_id => px_asset_hdr_rec.asset_id,
529 p_book => px_asset_hdr_rec.book_type_code,
530 px_period_of_addition => l_period_of_addition_flag, p_log_level_rec => p_log_level_rec)) then
531 raise cap_rev_err;
532 end if;
533
534 if(nvl(l_period_of_addition_flag,'N') = 'Y') then
535
536 select transaction_header_id
537 into l_corp_thid
538 from fa_transaction_headers
539 where asset_id=px_asset_hdr_rec.asset_id
540 and book_type_code=px_asset_hdr_rec.book_type_code
541 and transaction_type_code='CIP ADDITION';
542
543 l_asset_hdr_rec.asset_id := px_asset_hdr_rec.asset_id;
544 l_asset_hdr_rec.book_type_code := l_tax_book_tbl(l_tax_index);
545 l_trans_rec.source_transaction_header_id := l_corp_thid;
546 l_trans_rec.calling_interface := 'FAXASSET';
547 l_trans_rec.mass_reference_id := px_trans_rec.mass_reference_id;
548 l_trans_rec.transaction_header_id := null;
549
550 select cost,
551 date_placed_in_service,
552 group_asset_id,
553 salvage_type,
554 percent_salvage_value,
555 salvage_value
556 into l_asset_fin_rec.cost,
557 l_asset_fin_rec.date_placed_in_service,
558 l_asset_fin_rec.group_asset_id,
559 l_asset_fin_rec.salvage_type,
560 l_asset_fin_rec.percent_salvage_value,
561 l_asset_fin_rec.salvage_value
562 from fa_books
563 where asset_id = px_asset_hdr_rec.asset_id
564 and book_type_code = fa_cache_pkg.fazcbc_record.distribution_source_book
565 and transaction_header_id_in = l_corp_thid;
566
567 if (nvl(fa_cache_pkg.fazcbc_record.copy_group_assignment_flag, 'N') = 'N') then
568 l_asset_fin_rec.group_asset_id := null;
569 end if;
570
571 if (nvl(fa_cache_pkg.fazcbc_record.copy_salvage_value_flag, 'NO') = 'NO') then
572 l_asset_fin_rec.salvage_type := null;
573 l_asset_fin_rec.percent_salvage_value := null;
574 l_asset_fin_rec.salvage_value := null;
575 end if;
576
577 FA_ADDITION_PUB.do_addition
578 ( p_api_version => 1.0,
579 p_init_msg_list => FND_API.G_FALSE,
580 p_commit => FND_API.G_FALSE,
581 p_validation_level => FND_API.G_VALID_LEVEL_FULL,
582 x_return_status => l_return_status,
583 x_msg_count => l_mesg_count,
584 x_msg_data => l_mesg,
585 p_calling_fn => null,
586 px_trans_rec => l_trans_rec,
587 px_dist_trans_rec => l_dist_trans_rec,
588 px_asset_hdr_rec => l_asset_hdr_rec,
589 px_asset_desc_rec => l_asset_desc_rec,
590 px_asset_type_rec => l_asset_type_rec,
591 px_asset_cat_rec => l_asset_cat_rec,
592 px_asset_hierarchy_rec => l_asset_hierarchy_rec,
593 px_asset_fin_rec => l_asset_fin_rec,
594 px_asset_deprn_rec => l_asset_deprn_rec,
595 px_asset_dist_tbl => l_asset_dist_tbl,
596 px_inv_tbl => l_inv_tbl
597 );
598
599 if (l_return_status <> FND_API.G_RET_STS_SUCCESS) then
600 raise cap_rev_err;
601 end if;
602
603 end if;
604 -- end bugfix# 5155488
605 else
606
607 -- cache the book information for the tax book
608 if (NOT fa_cache_pkg.fazcbc(X_book => l_tax_book_tbl(l_tax_index),
609 p_log_level_rec => p_log_level_rec)) then
610 raise cap_rev_err;
611 end if;
612
613 -- NOTE!!!!
614 -- May need to set the transaction date, trx_type, subtype here as well
615 -- based on the open period and settings for each tax book in the loop
616
617 l_asset_hdr_rec.book_type_code := l_tax_book_tbl(l_tax_index);
618 l_asset_hdr_rec.set_of_books_id := fa_cache_pkg.fazcbc_record.set_of_books_id;
619
620 l_trans_rec.source_transaction_header_id := px_trans_rec.transaction_header_id;
621 l_trans_rec.mass_reference_id := px_trans_rec.mass_reference_id;
622 l_trans_rec.transaction_header_id := null;
623
624 -- BUG# 2623092
625 -- need to reset trx_type here in order to process tax book
626 -- in period of addition
627
628 if p_cap_rev = 'CAPITALIZE' then
629 l_trans_rec.transaction_type_code := 'ADDITION';
630 elsif p_cap_rev = 'REVERSE' then
631 l_trans_rec.transaction_type_code := 'CIP REVERSE';
632 end if;
633 l_asset_fin_rec.date_placed_in_service := px_asset_fin_rec.date_placed_in_service;
634
635 -- set the gl sob info for the primary tax book
636
637 if not do_all_books
638 (px_trans_rec => l_trans_rec, -- tax
639 px_asset_hdr_rec => l_asset_hdr_rec, -- tax
640 p_asset_desc_rec => l_asset_desc_rec,
641 px_asset_type_rec => l_asset_type_rec,
642 p_asset_cat_rec => l_asset_cat_rec,
643 px_asset_fin_rec => l_asset_fin_rec,
644 p_log_level_rec => p_log_level_rec
645 ) then
646 raise cap_rev_err;
647 end if;
648
649 end if; -- exists in tax book
650
651 end loop; -- tax books
652
653 end if; -- corporate book
654
655 x_return_status := FND_API.G_RET_STS_SUCCESS;
656
657 return TRUE;
658
659 EXCEPTION
660
661 when cap_rev_err then
662 ROLLBACK TO do_cap_rev;
663
664 fa_srvr_msg.add_message(calling_fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
665
666 x_return_status := FND_API.G_RET_STS_ERROR;
667
668 return FALSE;
669
670 when others then
671 ROLLBACK TO do_cap_rev;
672
673 fa_srvr_msg.add_sql_error(calling_fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
674
675 x_return_status := FND_API.G_RET_STS_ERROR;
676
677 return FALSE;
678
679 END do_cap_rev;
680
681 -------------------------------------------------------------------------------
682
683 FUNCTION do_all_books
684 (px_trans_rec IN OUT NOCOPY FA_API_TYPES.trans_rec_type,
685 px_asset_hdr_rec IN OUT NOCOPY FA_API_TYPES.asset_hdr_rec_type,
686 p_asset_desc_rec IN FA_API_TYPES.asset_desc_rec_type,
687 px_asset_type_rec IN OUT NOCOPY FA_API_TYPES.asset_type_rec_type,
688 p_asset_cat_rec IN FA_API_TYPES.asset_cat_rec_type,
689 px_asset_fin_rec IN OUT NOCOPY FA_API_TYPES.asset_fin_rec_type
690 , p_log_level_rec IN FA_API_TYPES.log_level_rec_type) RETURN BOOLEAN IS
691
692 -- used for calling private api for reporting books
693 l_asset_hdr_rec FA_API_TYPES.asset_hdr_rec_type;
694 l_asset_fin_rec FA_API_TYPES.asset_fin_rec_type;
695 l_asset_fin_rec_old FA_API_TYPES.asset_fin_rec_type;
696
697 -- used for retrieving "new" structs from private api calls
698 l_reporting_flag varchar2(1);
699 l_period_rec FA_API_TYPES.period_rec_type;
700 l_sob_tbl FA_CACHE_PKG.fazcrsob_sob_tbl_type;
701
702 -- used for get_rate
703 l_exchange_date date;
704 l_rate number;
705 l_result_code varchar2(15);
706 l_exchange_rate number;
707 l_avg_rate number;
708
709 l_complete varchar2(1);
710 l_result_code1 varchar2(15);
711
712 l_transaction_date date;
713 l_date_placed_in_service date;
714
715 -- used for new group code
716 l_group_trans_rec fa_api_types.trans_rec_type;
717 l_group_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
718 l_group_asset_desc_rec fa_api_types.asset_desc_rec_type;
719 l_group_asset_type_rec fa_api_types.asset_type_rec_type;
720 l_group_asset_cat_rec fa_api_types.asset_cat_rec_type;
721 l_group_asset_fin_rec_old fa_api_types.asset_fin_rec_type;
722 l_group_asset_fin_rec_adj fa_api_types.asset_fin_rec_type;
723 l_group_asset_fin_rec_new fa_api_types.asset_fin_rec_type;
724 l_group_asset_deprn_rec_old fa_api_types.asset_deprn_rec_type;
725 l_group_asset_deprn_rec_adj fa_api_types.asset_deprn_rec_type;
726 l_group_asset_deprn_rec_new fa_api_types.asset_deprn_rec_type;
727 l_inv_trans_rec fa_api_types.inv_trans_rec_type;
728 l_group_reclass_options_rec fa_api_types.group_reclass_options_rec_type;
729
730 l_calling_fn varchar2(30) := 'fa_cip_pub.do_all_books';
731 cap_rev_err EXCEPTION;
732
733 BEGIN
734
735 -- call the category cache used for faxinajc calls
736 if not fa_cache_pkg.fazccb
737 (X_book => px_asset_hdr_rec.book_type_code,
738 X_cat_id => p_asset_cat_rec.category_id, p_log_level_rec => p_log_level_rec) then
739 raise cap_rev_err;
740 end if;
741
742 -- call transaction approval
743 if not FA_TRX_APPROVAL_PKG.faxcat
744 (X_book => px_asset_hdr_rec.book_type_code,
745 X_asset_id => px_asset_hdr_rec.asset_id,
746 X_trx_type => px_trans_rec.transaction_type_code,
747 X_trx_date => px_trans_rec.transaction_date_entered,
748 X_init_message_flag => 'NO'
749 , p_log_level_rec => p_log_level_rec) then
750 raise cap_rev_err;
751 end if;
752
753 -- load the period struct for current period info
754 if not FA_UTIL_PVT.get_period_rec
755 (p_book => px_asset_hdr_rec.book_type_code,
756 p_effective_date => NULL,
757 x_period_rec => l_period_rec
758 , p_log_level_rec => p_log_level_rec) then
759 raise cap_rev_err;
760 end if;
761
762 -- check if this is the period of addition - use absolute mode for adjustments
763 if not FA_ASSET_VAL_PVT.validate_period_of_addition
764 (p_asset_id => px_asset_hdr_rec.asset_id,
765 p_book => px_asset_hdr_rec.book_type_code,
766 p_mode => 'ABSOLUTE',
767 px_period_of_addition => px_asset_hdr_rec.period_of_addition, p_log_level_rec => p_log_level_rec) then
768 raise cap_rev_err;
769 end if;
770
771 -- Bugfix #4730248
772 if(px_asset_fin_rec.date_placed_in_service is null) then
773 if (fa_cache_pkg.fazcbc_record.book_class = 'CORPORATE') then
774 l_date_placed_in_service := greatest(l_period_rec.calendar_period_open_date,
775 least(sysdate,l_period_rec.calendar_period_close_date));
776
777 px_asset_fin_rec.date_placed_in_service :=
778 to_date(to_char(l_date_placed_in_service,'DD/MM/YYYY'),'DD/MM/YYYY');
779 end if;
780 end if;
781 -- End Bugfix
782
783 -- Default transaction_date_entered
784 if ((px_trans_rec.transaction_date_entered is null) and
785 (px_asset_fin_rec.date_placed_in_service is null)) then
786
787 if (fa_cache_pkg.fazcbc_record.book_class = 'CORPORATE') then
788 -- Default to last day of the period
789 l_transaction_date := greatest(l_period_rec.calendar_period_open_date,
790 least(sysdate,l_period_rec.calendar_period_close_date));
791 px_trans_rec.transaction_date_entered :=
792 to_date(to_char(l_transaction_date,'DD/MM/YYYY'),'DD/MM/YYYY');
793 end if;
794
795 elsif ((px_trans_rec.transaction_date_entered is null) and
796 (px_asset_fin_rec.date_placed_in_service is not null)) then
797 px_trans_rec.transaction_date_entered :=
798 px_asset_fin_rec.date_placed_in_service;
799 end if;
800
801
802 -- remove any time stamps from both dates:
803 px_trans_rec.transaction_date_entered :=
804 to_date(to_char(px_trans_rec.transaction_date_entered,'DD/MM/YYYY'),'DD/MM/YYYY');
805
806 px_asset_fin_rec.date_placed_in_service :=
807 to_date(to_char(px_asset_fin_rec.date_placed_in_service,'DD/MM/YYYY'),'DD/MM/YYYY');
808
809
810 -- defaulting within calc engine has been removed for group
811 -- explicitly overirde the related fields here
812 -- NOTE: not overiding salvage /limit info here
813 --
814
815
816 if not fa_cache_pkg.fazccbd (X_book => px_asset_hdr_rec.book_type_code,
817 X_cat_id => p_asset_cat_rec.category_id,
818 X_jdpis => to_number(to_char(px_asset_fin_rec.date_placed_in_service, 'J')),
819 p_log_level_rec => p_log_level_rec) then
820 raise cap_rev_err;
821 end if;
822
823
824 px_asset_fin_rec.deprn_method_code := fa_cache_pkg.fazccbd_record.deprn_method;
825 px_asset_fin_rec.life_in_months := fa_cache_pkg.fazccbd_record.life_in_months;
826 px_asset_fin_rec.basic_rate := fa_cache_pkg.fazccbd_record.basic_rate;
827 px_asset_fin_rec.adjusted_rate := fa_cache_pkg.fazccbd_record.adjusted_rate;
828 px_asset_fin_rec.prorate_convention_code := fa_cache_pkg.fazccbd_record.prorate_convention_code;
829 px_asset_fin_rec.depreciate_flag := fa_cache_pkg.fazccbd_record.depreciate_flag;
830 px_asset_fin_rec.bonus_rule := fa_cache_pkg.fazccbd_record.bonus_rule;
831 px_asset_fin_rec.ceiling_name := fa_cache_pkg.fazccbd_record.ceiling_name;
832 px_asset_fin_rec.production_capacity := fa_cache_pkg.fazccbd_record.production_capacity;
833 px_asset_fin_rec.unit_of_measure := fa_cache_pkg.fazccbd_record.unit_of_measure;
834
835 -- call the sob cache to get the table of sob_ids
836 if not FA_CACHE_PKG.fazcrsob
837 (x_book_type_code => px_asset_hdr_rec.book_type_code,
838 x_sob_tbl => l_sob_tbl, p_log_level_rec => p_log_level_rec) then
839 raise cap_rev_err;
840 end if;
841
842 -- set up the local asset_header and sob_id
843 l_asset_hdr_rec := px_asset_hdr_rec;
844
845
846 -- loop through each book starting with the primary and
847 -- call the private API for each
848
849 FOR l_sob_index in 0..l_sob_tbl.count LOOP
850
851 --clear out the fin rec
852 l_asset_fin_rec := NULL;
853 l_asset_fin_rec.date_placed_in_service := px_asset_fin_rec.date_placed_in_service;
854 -- BUG 4553782
855 l_asset_fin_rec.deprn_method_code := px_asset_fin_rec.deprn_method_code;
856 l_asset_fin_rec.life_in_months := px_asset_fin_rec.life_in_months;
857 l_asset_fin_rec.basic_rate := px_asset_fin_rec.basic_rate;
858 l_asset_fin_rec.adjusted_rate := px_asset_fin_rec.adjusted_rate;
859 l_asset_fin_rec.prorate_convention_code := px_asset_fin_rec.prorate_convention_code;
860 l_asset_fin_rec.depreciate_flag := px_asset_fin_rec.depreciate_flag;
861 l_asset_fin_rec.bonus_rule := px_asset_fin_rec.bonus_rule;
862 l_asset_fin_rec.ceiling_name := px_asset_fin_rec.ceiling_name;
863 l_asset_fin_rec.production_capacity := px_asset_fin_rec.production_capacity;
864 l_asset_fin_rec.unit_of_measure := px_asset_fin_rec.unit_of_measure;
865 -- END BUG
866 if (l_sob_index = 0) then
867 l_reporting_flag := 'P';
868 px_trans_rec.transaction_date_entered := px_asset_fin_rec.date_placed_in_service;
869 else
870 l_reporting_flag := 'R';
871 l_asset_hdr_rec.set_of_books_id := l_sob_tbl(l_sob_index);
872 end if;
873
874
875 -- call the cache to set the sob_id used for rounding and other lower
876 -- level code for each book.
877 if NOT fa_cache_pkg.fazcbcs(X_book => px_asset_hdr_rec.book_type_code,
878 X_set_of_books_id => l_asset_hdr_rec.set_of_books_id,
879 p_log_level_rec => p_log_level_rec) then
880 raise cap_rev_err;
881 end if;
882
883 -- load the old structs
884 if not FA_UTIL_PVT.get_asset_fin_rec
885 (p_asset_hdr_rec => l_asset_hdr_rec,
886 px_asset_fin_rec => l_asset_fin_rec_old,
887 p_transaction_header_id => NULL,
888 p_mrc_sob_type_code => l_reporting_flag
889 , p_log_level_rec => p_log_level_rec) then
890 raise cap_rev_err;
891 end if;
892
893 --HH Validate disabled_flag
894 if not FA_ASSET_VAL_PVT.validate_disabled_flag
895 (p_group_asset_id => px_asset_hdr_rec.asset_id,
896 p_book_type_code => px_asset_hdr_rec.book_type_code,
897 p_old_flag => l_asset_fin_rec_old.disabled_flag,
898 p_new_flag => l_asset_fin_rec_old.disabled_flag
899 , p_log_level_rec => p_log_level_rec) then
900 raise cap_rev_err;
901 end if; --End HH
902
903 -- main private api
904 if not fa_cip_pvt.do_cap_rev
905 (px_trans_rec => px_trans_rec,
906 p_asset_hdr_rec => l_asset_hdr_rec,
907 p_asset_desc_rec => p_asset_desc_rec,
908 p_asset_cat_rec => p_asset_cat_rec,
909 px_asset_type_rec => px_asset_type_rec,
910 p_asset_fin_rec_old => l_asset_fin_rec_old,
911 px_asset_fin_rec => l_asset_fin_rec,
912 p_period_rec => l_period_rec,
913 p_mrc_sob_type_code => l_reporting_flag
914 , p_log_level_rec => p_log_level_rec) then
915 raise cap_rev_err;
916 end if;
917
918 if (l_sob_index <> 0) then
919
920 if px_asset_hdr_rec.period_of_addition = 'N' then
921 if (px_asset_fin_rec.cost <> 0) then
922 l_avg_rate := l_asset_fin_rec_old.cost /
923 px_asset_fin_rec.cost;
924 else
925 select br1.avg_exchange_rate
926 into l_avg_rate
927 from fa_mc_books_rates br1
928 where br1.asset_id = l_asset_hdr_rec.asset_id
929 and br1.book_type_code = l_asset_hdr_rec.book_type_code
930 and br1.set_of_books_id = l_asset_hdr_rec.set_of_books_id
931 and br1.transaction_header_id =
932 (select max(br2.transaction_header_id)
933 from fa_mc_books_rates br2
934 where br2.asset_id = l_asset_hdr_rec.asset_id
935 and br2.book_type_code = l_asset_hdr_rec.book_type_code
936 and br2.set_of_books_id = l_asset_hdr_rec.set_of_books_id);
937 end if;
938
939 l_exchange_rate := l_avg_rate;
940
941 -- insert the books_rates record
942
943 MC_FA_UTILITIES_PKG.insert_books_rates
944 (p_set_of_books_id => l_asset_hdr_rec.set_of_books_id,
945 p_asset_id => l_asset_hdr_rec.asset_id,
946 p_book_type_code => l_asset_hdr_rec.book_type_code,
947 p_transaction_header_id => px_trans_rec.transaction_header_id,
948 p_invoice_transaction_id => null,
949 p_exchange_date => px_trans_rec.transaction_date_entered, -- ??? dpis
950 p_cost => 0,
951 p_exchange_rate => l_exchange_rate,
952 p_avg_exchange_rate => l_avg_rate,
953 p_last_updated_by => px_trans_rec.who_info.last_updated_by,
954 p_last_update_date => px_trans_rec.who_info.last_update_date,
955 p_last_update_login => px_trans_rec.who_info.last_update_login,
956 p_complete => 'Y',
957 p_trigger => 'l_calling_fn',
958 p_currency_code => l_asset_hdr_rec.set_of_books_id,
959 p_log_level_rec => p_log_level_rec);
960
961 end if; -- period of addition
962
963 end if; -- reporting book
964
965
966 -- GROUP API CALL
967 -- this will be called once passing both primary and reporting info
968 -- to adjust primary and reporting books for the group
969
970 if (l_asset_fin_rec_old.group_asset_id is not null) then
971
972 -- set up the group recs
973 l_group_asset_hdr_rec := l_asset_hdr_rec;
974 l_group_asset_hdr_rec.asset_id := l_asset_fin_rec_old.group_asset_id;
975 l_group_trans_rec := px_trans_rec; -- will set the amort start date
976
977 if (l_reporting_flag <> 'R') then
978
979 if not FA_UTIL_PVT.get_asset_desc_rec
980 (p_asset_hdr_rec => l_group_asset_hdr_rec,
981 px_asset_desc_rec => l_group_asset_desc_rec
982 , p_log_level_rec => p_log_level_rec) then
983 raise cap_rev_err;
984 end if;
985
986 if not FA_UTIL_PVT.get_asset_cat_rec
987 (p_asset_hdr_rec => l_group_asset_hdr_rec,
988 px_asset_cat_rec => l_group_asset_cat_rec,
989 p_date_effective => null
990 , p_log_level_rec => p_log_level_rec) then
991 raise cap_rev_err;
992 end if;
993
994 if not FA_UTIL_PVT.get_asset_type_rec
995 (p_asset_hdr_rec => l_group_asset_hdr_rec,
996 px_asset_type_rec => l_group_asset_type_rec,
997 p_date_effective => null
998 , p_log_level_rec => p_log_level_rec) then
999 raise cap_rev_err;
1000 end if;
1001
1002 if not FA_ASSET_VAL_PVT.validate_period_of_addition
1003 (p_asset_id => l_group_asset_hdr_rec.asset_id,
1004 p_book => l_group_asset_hdr_rec.book_type_code,
1005 p_mode => 'ABSOLUTE',
1006 px_period_of_addition => l_group_asset_hdr_rec.period_of_addition, p_log_level_rec => p_log_level_rec) then
1007 raise cap_rev_err;
1008 end if;
1009
1010 l_group_trans_rec.transaction_type_code := 'GROUP ADJUSTMENT';
1011 l_group_trans_rec.member_transaction_header_id := px_trans_rec.transaction_header_id;
1012
1013 if (NOT fa_trx_approval_pkg.faxcat
1014 (X_book => l_group_asset_hdr_rec.book_type_code,
1015 X_asset_id => l_group_asset_hdr_rec.asset_id,
1016 X_trx_type => l_group_trans_rec.transaction_type_code,
1017 X_trx_date => l_group_trans_rec.transaction_date_entered,
1018 X_init_message_flag => 'NO', p_log_level_rec => p_log_level_rec)) then
1019 raise cap_rev_err;
1020 end if;
1021
1022 -- use dpis as amort start
1023 l_group_trans_rec.transaction_subtype := 'AMORTIZED';
1024 l_group_trans_rec.amortization_start_date := l_asset_fin_rec.date_placed_in_service;
1025
1026 select fa_transaction_headers_s.nextval
1027 into l_group_trans_rec.transaction_header_id
1028 from dual;
1029
1030 -- Bug 15877517 : Reinitialize who_info as well
1031 l_group_trans_rec.who_info.creation_date := sysdate;
1032 l_group_trans_rec.who_info.last_update_date := sysdate;
1033
1034 end if;
1035
1036 -- load the old structs
1037 if not FA_UTIL_PVT.get_asset_fin_rec
1038 (p_asset_hdr_rec => l_group_asset_hdr_rec,
1039 px_asset_fin_rec => l_group_asset_fin_rec_old,
1040 p_transaction_header_id => NULL,
1041 p_mrc_sob_type_code => l_reporting_flag
1042 , p_log_level_rec => p_log_level_rec) then raise cap_rev_err;
1043 end if;
1044
1045 --HH Validate disabled_flag
1046 --No trx on a disabled group.
1047 if not FA_ASSET_VAL_PVT.validate_disabled_flag
1048 (p_group_asset_id => l_group_asset_hdr_rec.asset_id,
1049 p_book_type_code => l_group_asset_hdr_rec.book_type_code,
1050 p_old_flag => l_group_asset_fin_rec_old.disabled_flag,
1051 p_new_flag => l_group_asset_fin_rec_old.disabled_flag
1052 , p_log_level_rec => p_log_level_rec) then
1053 raise cap_rev_err;
1054 end if; --End HH
1055
1056 if not FA_UTIL_PVT.get_asset_deprn_rec
1057 (p_asset_hdr_rec => l_group_asset_hdr_rec ,
1058 px_asset_deprn_rec => l_group_asset_deprn_rec_old,
1059 p_period_counter => NULL,
1060 p_mrc_sob_type_code => l_reporting_flag
1061 , p_log_level_rec => p_log_level_rec) then raise cap_rev_err;
1062 end if;
1063
1064 -- need to account for portion of cip_cost that may already have been
1065 -- in group's basis:
1066
1067 if (px_asset_type_rec.asset_type = 'CAPITALIZED') then -- originally cip
1068 l_group_asset_fin_rec_adj.cip_cost := -l_asset_fin_rec_old.cip_cost;
1069 l_group_asset_fin_rec_adj.cost := l_asset_fin_rec_old.cip_cost;
1070 l_group_trans_rec.transaction_key := 'MC';
1071 l_group_asset_fin_rec_adj.salvage_value := nvl(l_asset_fin_rec_old.salvage_value,0);--bug# 4129999
1072 else
1073 l_group_asset_fin_rec_adj.cip_cost := l_asset_fin_rec_old.cip_cost;
1074 l_group_asset_fin_rec_adj.cost := -l_asset_fin_rec_old.cip_cost;
1075 l_group_trans_rec.transaction_key := 'MV';
1076 end if;
1077
1078 if not FA_ADJUSTMENT_PVT.do_adjustment
1079 (px_trans_rec => l_group_trans_rec,
1080 px_asset_hdr_rec => l_group_asset_hdr_rec,
1081 p_asset_desc_rec => l_group_asset_desc_rec,
1082 p_asset_type_rec => l_group_asset_type_rec,
1083 p_asset_cat_rec => l_group_asset_cat_rec,
1084 p_asset_fin_rec_old => l_group_asset_fin_rec_old,
1085 p_asset_fin_rec_adj => l_group_asset_fin_rec_adj,
1086 x_asset_fin_rec_new => l_group_asset_fin_rec_new,
1087 p_inv_trans_rec => l_inv_trans_rec,
1088 p_asset_deprn_rec_old => l_group_asset_deprn_rec_old,
1089 p_asset_deprn_rec_adj => l_group_asset_deprn_rec_adj,
1090 x_asset_deprn_rec_new => l_group_asset_deprn_rec_new,
1091 p_period_rec => l_period_rec,
1092 p_mrc_sob_type_code => l_reporting_flag,
1093 p_group_reclass_options_rec =>l_group_reclass_options_rec,
1094 p_calling_fn => 'fa_addition_pub.do_addition'
1095 , p_log_level_rec => p_log_level_rec)then
1096 raise cap_rev_err;
1097 end if; -- do_adjustment
1098 end if; -- group asset id not null
1099
1100 end loop;
1101
1102 return true;
1103
1104 EXCEPTION
1105
1106 WHEN CAP_REV_ERR THEN
1107 fa_srvr_msg.add_message(calling_fn => l_calling_fn, p_log_level_rec => p_log_level_rec);
1108 return FALSE;
1109
1110 WHEN OTHERS THEN
1111 fa_srvr_msg.add_sql_error(CALLING_FN => l_calling_fn, p_log_level_rec => p_log_level_rec);
1112 return FALSE;
1113
1114 END do_all_books;
1115
1116 -----------------------------------------------------------------------------
1117
1118 END FA_CIP_PUB;