[Home] [Help]
PACKAGE BODY: APPS.FA_CUA_MASS_UPDATE1_PKG
Source
1 PACKAGE BODY FA_CUA_MASS_UPDATE1_PKG as
2 /* $Header: FACMUP1MB.pls 120.6 2009/08/20 14:18:04 bridgway ship $*/
3
4 g_log_level_rec fa_api_types.log_level_rec_type;
5
6 ----------------------------------------------------------------
7 PROCEDURE CALC_LIFE_ENDDATE( x_prorate_date DATE,
8 x_end_date IN OUT NOCOPY DATE,
9 x_prorate_convention_code IN VARCHAR2,
10 x_life IN NUMBER,
11 x_err_code IN OUT NOCOPY VARCHAR2,
12 x_err_stage IN OUT NOCOPY VARCHAR2,
13 x_err_stack IN OUT NOCOPY VARCHAR2 , p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) IS
14 /*
15 CURSOR C IS
16 select conv.prorate_date
17 from fa_conventions conv
18 where conv.prorate_convention_code = x_prorate_convention_code
19 and add_months(x_prorate_date,x_life)
20 between conv.start_date and conv.end_date;
21 */
22 CURSOR C IS
23 select add_months(x_prorate_date,x_life)
24 from dual;
25
26 BEGIN
27 open c;
28 fetch c into x_end_date;
29 close c;
30 END;
31
32
33 ----------------------------------------------------------------
34 FUNCTION GET_END_DATE(x_book_type_code VARCHAR2,
35 x_prorate_date DATE,
36 x_life NUMBER, p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) return date is
37 /** commneted for bugfix 1055453 */
38 /* this cursor displays life_end_date incorrectly ( to the last period_date defined )
39 if the life fell beyond existing calendar periods
40 CURSOR C IS
41 select max(cp.end_date)
42 from fa_calendar_periods cp,
43 fa_calendar_types ct,
44 fa_book_controls bc
45 where bc.book_type_code = X_book_type_code and
46 bc.date_ineffective is null and
47 ct.calendar_type = bc.prorate_calendar and
48 cp.calendar_type = ct.calendar_type and
49 cp.end_date <= add_months(x_prorate_date,x_life);
50
51 */
52
53 -- added the following cursor for bugfix 1055453
54 CURSOR C IS
55 select add_months(x_prorate_date,x_life)
56 from dual;
57
58 l_end_date date;
59 Begin
60 open c;
61 fetch c into l_end_date;
62 close c;
63
64 return l_end_date;
65 End;
66
67 ----------------------------------------------------------------
68 PROCEDURE CALC_LIFE(X_book_type_code VARCHAR2,
69 x_prorate_date DATE,
70 x_end_date DATE,
71 x_deprn_method IN VARCHAR2,
72 x_life IN OUT NOCOPY number,
73 x_err_code in out nocopy varchar2 ,
74 x_err_stage in out nocopy varchar2 ,
75 x_err_stack in out nocopy varchar2 , p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) IS
76 -- bugfix 1210531
77 -- to improve peroformance do not use this cursor
78
79 CURSOR GET_LIFE IS
80 select /*+ ordered */ round
81 (nvl(sum
82 (decode (bc.deprn_allocation_code,'E',
83 1/ct.number_per_fiscal_year,
84 (cp.end_date + 1 - cp.start_date) /
85 (fy.end_date + 1 - fy.start_date))),0) * 12, 0)
86 from fa_calendar_periods cp,
87 fa_calendar_types ct,
88 fa_book_controls bc,
89 fa_fiscal_year fy
90 where bc.book_type_code = X_book_type_code and
91 bc.date_ineffective is null and
92 ct.calendar_type = bc.prorate_calendar and
93 ct.fiscal_year_name = bc.fiscal_year_name
94 and cp.calendar_type = ct.calendar_type and
95 ( (cp.start_date >= x_prorate_date and
96 cp.end_date <= x_end_date)
97 or
98 (cp.start_date <= x_prorate_date
99 and cp.end_date >= x_prorate_date
100 and cp.start_date <= x_end_date
101 and cp.end_date <= x_end_date))
102 and fy.fiscal_year_name = bc.fiscal_year_name
103 and fy.start_date <= cp.start_date
104 and fy.end_date >= cp.end_date;
105
106 CURSOR GET_RSR IS
107 select rate_source_rule
108 from fa_methods
109 where method_code = x_deprn_method;
110
111 l_rsr varchar2(20);
112
113 CURSOR CHECK_METHOD_EXISTS IS
114 select 'X'
115 from fa_methods
116 where method_code = x_deprn_method
117 and nvl(life_in_months,0) = x_life;
118
119 l_dummy varchar2(1);
120 l_old_stack varchar2(600);
121 l_rowid rowid;
122 l_method_id number;
123
124 BEGIN
125
126
127 x_err_code :='0';
128 l_old_stack := x_err_stack ;
129 x_err_stack := x_err_stack||'CALC_LIFE';
130
131 -- Return Life as Zero if either of the dates is null. Therefore not possible to do calcs
132 if (x_prorate_date is null) or (x_end_date is null) then
133 x_life :=0;
134 return;
135 end if;
136
137 -- bugfix 1210531
138 -- instead of the cursor use months_between logic
139 /*
140 OPEN GET_LIFE;
141
142 FETCH GET_LIFE INTO x_life;
143 if GET_LIFE%NOTFOUND THEN
144 x_life :=1;
145 end if;
146 CLOSE GET_LIFE;
147 */
148
149 x_life := ceil(months_between(x_end_date, x_prorate_date));
150 if nvl(x_life, 0) < 0 then
151 x_life:= 1;
152 end if;
153
154
155 -- If Calendars are not setup OR some other problem then return life = 1 month
156 select decode(x_life,null,1,0,1,x_life)
157 into x_life
158 from dual;
159
160 OPEN GET_RSR;
161 FETCH GET_RSR INTO l_rsr;
162 CLOSE GET_RSR;
163
164 OPEN CHECK_METHOD_EXISTS;
165 FETCH CHECK_METHOD_EXISTS into l_dummy;
166 IF CHECK_METHOD_EXISTS%NOTFOUND THEN
167 if l_rsr = 'TABLE' then
168 x_err_code := 'FA_REVAL_NO_METH_LIFE';
169 return;
170 else
171 FA_METHODS_PKG.Insert_Row(
172 X_Rowid => l_rowid,
173 X_Method_Id => l_method_id,
174 X_Method_Code => x_deprn_method,
175 X_Life_In_Months => x_life,
176 X_Depreciate_Lastyear_Flag => 'YES',
177 X_STL_Method_Flag => 'YES',
178 X_Rate_Source_Rule => 'CALCULATED',
179 X_Deprn_Basis_Rule => 'COST',
180 X_Prorate_Periods_Per_Year => NULL,
181 X_Name => 'Straight-Line',
182 X_Last_Update_Date => sysdate,
183 X_Last_Updated_By => FND_GLOBAL.LOGIN_ID,
184 X_Created_By => FND_GLOBAL.LOGIN_ID,
185 X_Creation_Date => sysdate,
186 X_Last_Update_Login => FND_GLOBAL.LOGIN_ID,
187 X_Attribute1 => null,
188 X_Attribute2 => null,
189 X_Attribute3 => null,
190 X_Attribute4 => null,
191 X_Attribute5 => null,
192 X_Attribute6 => null,
193 X_Attribute7 => null,
194 X_Attribute8 => null,
195 X_Attribute9 => null,
196 X_Attribute10 => null,
197 X_Attribute11 => null,
198 X_Attribute12 => null,
199 X_Attribute13 => null,
200 X_Attribute14 => null,
201 X_Attribute15 => null,
202 X_Attribute_Category_Code => null,
203 X_Calling_Fn => 'CALC_LIFE', p_log_level_rec => p_log_level_rec);
204
205 end if;
206
207 CLOSE CHECK_METHOD_EXISTS;
208
209 end if;
210
211 x_err_stack := l_old_stack ;
212
213 END ;
214
215
216 ----------------------------------------------------------------
217 PROCEDURE Val_Reclass(X_Old_Cat_Id NUMBER,
218 X_New_Cat_Id NUMBER,
219 X_Asset_Id NUMBER,
220 X_Asset_Type VARCHAR2,
221 X_Old_Cap_Flag VARCHAR2,
222 X_Old_Cat_Type VARCHAR2,
223 x_new_cap_flag VARCHAR2,
224 X_New_Cat_Type IN OUT NOCOPY VARCHAR2,
225 X_Lease_Id NUMBER,
226 x_err_code in out nocopy varchar2 ,
227 x_err_stage in out nocopy varchar2 ,
228 x_err_stack in out nocopy varchar2 , p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) IS
229
230 ll_corp_book varchar2(30);
231 ll_count number;
232 ll_mesg varchar2(50);
233 l_old_stack varchar2(600);
234
235 BEGIN
236 x_err_code := '0';
237 l_old_stack := x_err_stack ;
238 x_err_stack := x_err_stack||'->Updating Asset Catgeory';
239
240 -- find corporate book
241 x_err_stage := 'find corporate book';
242
243 select bc.book_type_code into ll_corp_book
244 from fa_books bk, fa_book_controls bc
245 where bc.book_class = 'CORPORATE'
246 and bk.asset_id = X_Asset_Id
247 and bk.book_type_code = bc.book_type_code
248 and bk.date_ineffective is null;
249
250 -- validate new category
251 x_err_stage := 'validate new category';
252
253 if X_ASSET_TYPE = 'CIP' then
254 -- check that CIP accounts are set up
255 select count(*)
256 into ll_count
257 from fa_category_books
258 where category_id = X_new_cat_ID
259 and book_type_code = ll_corp_book
260 and cip_cost_acct is not null
261 and cip_clearing_acct is not null;
262 --
263 if ll_count = 0 then
264 x_err_code := 'FA_SHARED_NO_CIP_ACCOUNTS';
265 return;
266 end if;
267 end if;
268
269 -- check if cat is set up in this book
270 select count(*)
271 into ll_count
272 from fa_category_books
273 where book_type_code = ll_corp_book and
274 category_id = X_new_cat_ID;
275 --
276 if ll_count = 0 then
277 x_err_code := 'FA_BOOK_CAT_NOT_SET_UP';
278 return;
279 end if;
280
281 -- both categories must be capitalized or expensed types
282 --
283 if X_Old_Cap_Flag = 'YES' then
284 if x_new_cap_flag = 'NO' then
285 x_err_code := 'FA_ADD_RECLS_TO_CAP_ASSET';
286 return;
287 end if;
288 elsif X_Old_Cap_Flag = 'NO' then
289 if x_new_cap_flag = 'YES' then
290 x_err_code := 'FA_ADD_RECLS_TO_EXPENSE';
291 return;
292 end if;
293 end if;
294 -- also check lease stuff
295 if X_Old_Cat_Type = 'LEASE' and X_New_Cat_Type <> 'LEASE' then
296 select count(*) into ll_count
297 from fa_additions
298 where lease_id = X_Lease_Id
299 and asset_category_id in
300 (select category_id from fa_categories
301 where category_type = 'LEASEHOLD IMPROVEMENT');
302 --
303 if ll_count > 0 then
304 x_err_code := 'FA_ADD_DELETE_LHOLD_BEFORE_RCL';
305 return;
306 end if;
307 --
308 select count(*) into ll_count
309 from fa_leases
310 where lease_id = X_Lease_Id;
311 --
312 if ll_count > 0 then
313 x_err_code := 'FA_ADD_DELETE_LEASE_BEFORE_RCL';
314 return;
315 end if;
316 end if;
317 --
318 -- no pending retirements
319
320 x_err_stage := 'no pending retirements';
321
322 select count(*)
323 into ll_count
324 from fa_retirements
325 where asset_id = X_Asset_Id
326 and status in ('PENDING', 'REINSTATE', 'PARTIAL');
327 --
328 if ll_count > 0 then
329 x_err_code := 'FA_RET_PENDING_RETIREMENTS';
330 return;
331 end if;
332 --
333
334 x_err_stack := l_old_stack;
335
336 EXCEPTION
337 WHEN others THEN
338 x_err_code := substr(sqlcode, 1, 240);
339 return;
340
341 END Val_Reclass;
342
343 ----------------------------------------------------------------
344 Procedure update_category
345 (x_asset_id in number,
346 x_old_cat_id in number,
347 x_new_cat_id in number,
348 x_err_code in out nocopy varchar2 ,
349 x_err_stage in out nocopy varchar2 ,
350 x_err_stack in out nocopy varchar2 , p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) IS
351
352 --l_status Boolean := TRUE;
353 l_old_stack varchar2(600);
354 --l_thid number;
355 --l_new_capitalize_flag varchar2(10);
356 --l_new_Category_Type varchar2(30);
357 --l_cat_flex_struct NUMBER;
358 --l_cat_segs FA_RX_SHARED_PKG.Seg_Array;
359 --l_asset_rec fa_additions_v%rowtype;
360
361 --l_return_status BOOLEAN;
362 --l_return_status2 BOOLEAN;
363 --l_return_status3 BOOLEAN;
364
365 l_api_version CONSTANT number := 1.0;
366 l_msg_list VARCHAR2(5) := FND_API.G_FALSE;
367 l_commit_flag VARCHAR2(5) := FND_API.G_FALSE;
368 l_validation_level VARCHAR2(5) := FND_API.G_VALID_LEVEL_FULL;
369 l_debug_flag VARCHAR2(5) := FND_API.G_FALSE;
370 l_calling_fn VARCHAR2(20) := 'update_category';
371
372 l_trans_rec FA_API_TYPES.trans_rec_type;
373 l_asset_hdr_rec FA_API_TYPES.asset_hdr_rec_type;
374 l_asset_cat_rec_new FA_API_TYPES.asset_cat_rec_type;
375 l_recl_opt_rec FA_API_TYPES.reclass_options_rec_type;
376 l_count NUMBER;
377 l_return_status VARCHAR2(100);
378 l_msg_count NUMBER := 0;
379 l_msg_data VARCHAR2(4000);
380
381 Begin
382
383 x_err_code := '0';
384 l_old_stack := x_err_stack ;
385 x_err_stack := x_err_stack||'->Updating Asset Catgeory';
386
387 select bc.book_type_code
388 into l_asset_hdr_rec.book_type_code
389 from fa_books bk,
390 fa_book_controls bc
391 where bk.asset_id = x_asset_id
392 and bk.book_type_code = bc.book_type_code
393 and bk.transaction_header_id_out is null
394 and bc.book_class = 'CORPORATE';
395
396 l_asset_hdr_rec.asset_id := x_asset_id;
397 l_asset_cat_rec_new.category_id := x_new_cat_id;
398 x_err_stage := 'Performing the Recalssification';
399
400 -- BMR: validation is removed because most of the variables wer based
401 -- on selects not need for api call
402
403 FA_RECLASS_PUB.do_reclass (
404 p_api_version => l_api_version,
405 p_init_msg_list => l_msg_list,
406 p_commit => l_commit_flag,
407 p_validation_level => l_validation_level,
408 p_calling_fn => l_calling_fn,
409 x_return_status => l_return_status,
410 x_msg_count => l_msg_count,
411 x_msg_data => l_msg_data,
412 -- api parameters
413 px_trans_rec => l_trans_rec,
414 px_asset_hdr_rec => l_asset_hdr_rec,
415 px_asset_cat_rec_new => l_asset_cat_rec_new,
416 p_recl_opt_rec => l_recl_opt_rec );
417
418 if not(l_return_status <> 'S') then
419 x_err_code := substr(fnd_msg_pub.get(fnd_msg_pub.G_FIRST, fnd_api.G_TRUE), 1, 512);
420 end if;
421
422 x_err_stack := l_old_stack;
423
424 Exception
425 When others then
426 x_err_code := substr(sqlcode,1, 240);
427 rollback;
428 return;
429
430 End;
431
432
433 ---------------------------------------------------------------
434 PROCEDURE do_transfer(
435 p_asset_id in number,
436 p_book_type_code in varchar2,
437 p_new_hr_dist_set_id in number,
438 p_transaction_date in date,
439 x_err_code out nocopy varchar2 , p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) IS
440
441 CURSOR GET_DIST_HIST IS
442 SELECT
443 DH.ROWID,
444 DH.DISTRIBUTION_ID,
445 DH.CODE_COMBINATION_ID,
446 DH.UNITS_ASSIGNED,
447 DH.LOCATION_ID,
448 DH.DATE_EFFECTIVE,
449 DH.ASSIGNED_TO,
450 DH.TRANSACTION_HEADER_ID_IN
451 FROM
452 FA_DISTRIBUTION_HISTORY DH,
453 FA_BOOK_CONTROLS BC
454 WHERE
455 DH.ASSET_ID = p_asset_id AND
456 DH.BOOK_TYPE_CODE = BC.DISTRIBUTION_SOURCE_BOOK AND
457 BC.BOOK_TYPE_CODE = p_book_type_code AND
458 DH.DATE_INEFFECTIVE IS NULL AND
459 DH.RETIREMENT_ID IS NULL;
460
461 CURSOR get_hr_dist( p_txn_units in number ) is
462 SELECT
463 (DH.DISTRIBUTION_LINE_PERCENTAGE/100)* p_txn_units new_units,
464 DH.CODE_COMBINATION_ID expense_ccid,
465 DH.LOCATION_ID,
466 DH.ASSIGNED_TO
467 FROM
468 FA_HIERARCHY_DISTRIBUTIONS DH,
469 FA_ADDITIONS A
470 WHERE
471 A.ASSET_ID = p_asset_id AND
472 DH.DIST_SET_ID = p_new_hr_dist_set_id;
473
474
475 l_return_status varchar2(1);
476 l_msg_count number:= 0;
477 l_msg_data varchar2(4000);
478
479 l_trans_rec fa_api_types.trans_rec_type;
480 l_asset_hdr_rec fa_api_types.asset_hdr_rec_type;
481
482 l_asset_dist_tbl fa_api_types.asset_dist_tbl_type;
483 i binary_integer;
484 tfr_error EXCEPTION;
485 Begin
486
487 l_asset_hdr_rec.asset_id := p_asset_id;
488 l_asset_hdr_rec.book_type_code := p_book_type_code;
489
490 l_trans_rec.transaction_date_entered := p_transaction_date;
491
492 -- source distribution
493 for dist_hist_rec in get_dist_hist loop
494 l_asset_dist_tbl.delete;
495 i := 0;
496 i := i+1;
497 l_asset_dist_tbl(i).distribution_id := dist_hist_rec.distribution_id;
498 l_asset_dist_tbl(i).transaction_units := dist_hist_rec.units_assigned * -1;
499
500
501 -- destination distribution
502 for dist_set_rec in get_hr_dist(dist_hist_rec.units_assigned) loop
503 i := i+1;
504 l_asset_dist_tbl(i).distribution_id := NULL;
505 l_asset_dist_tbl(i).transaction_units := dist_set_rec.new_units;
506 l_asset_dist_tbl(i).assigned_to := dist_set_rec.assigned_to;
507 l_asset_dist_tbl(i).expense_ccid := dist_set_rec.expense_ccid;
508 l_asset_dist_tbl(i).location_ccid := dist_set_rec.location_id;
509 end loop;
510
511 l_msg_count := null;
512 l_msg_data := null;
513 l_return_status := null;
514 FA_TRANSFER_PUB.do_transfer(
515 p_api_version => 1.0,
516 p_init_msg_list => FND_API.G_FALSE,
517 p_commit => FND_API.G_FALSE,
518 p_validation_level => FND_API.G_VALID_LEVEL_FULL,
519 p_calling_fn => NULL,
520 x_return_status => l_return_status,
521 x_msg_count => l_msg_count,
522 x_msg_data => l_msg_data,
523 px_trans_rec => l_trans_rec,
524 px_asset_hdr_rec => l_asset_hdr_rec,
525 px_asset_dist_tbl => l_asset_dist_tbl);
526
527 if (l_return_status <> FND_API.G_RET_STS_SUCCESS) then
528 x_err_code := substr(fnd_msg_pub.get(fnd_msg_pub.G_FIRST, fnd_api.G_TRUE), 1, 512);
529 return;
530 end if;
531 end loop;
532
533 End;
534
535
536 -- ------------------------------------------
537 PROCEDURE do_adjustment( px_trans_rec IN OUT NOCOPY FA_API_TYPES.trans_rec_type,
538 px_asset_hdr_rec IN OUT NOCOPY FA_API_TYPES.asset_hdr_rec_type,
539 x_new_life IN NUMBER,
540 p_amortize_flag IN VARCHAR2,
541 x_err_code OUT NOCOPY VARCHAR2 , p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) IS
542
543 l_asset_fin_rec_adj FA_API_TYPES.asset_fin_rec_type;
544 l_asset_fin_rec_new FA_API_TYPES.asset_fin_rec_type;
545 l_asset_fin_mrc_tbl_new FA_API_TYPES.asset_fin_tbl_type;
546 l_inv_trans_rec FA_API_TYPES.inv_trans_rec_type;
547 l_inv_tbl FA_API_TYPES.inv_tbl_type;
548 l_asset_deprn_rec_adj FA_API_TYPES.asset_deprn_rec_type;
549 l_asset_deprn_rec_new FA_API_TYPES.asset_deprn_rec_type;
550 l_asset_deprn_mrc_tbl_new FA_API_TYPES.asset_deprn_tbl_type;
551 l_inv_rec FA_API_TYPES.inv_rec_type;
552 l_asset_deprn_rec FA_API_TYPES.asset_deprn_rec_type;
553 l_group_reclass_options_rec FA_API_TYPES.group_reclass_options_rec_type;
554
555 l_return_status VARCHAR2(1);
556 l_mesg_count number := 0;
557 l_mesg_len number;
558 l_mesg varchar2(4000);
559
560 Cursor C_books is
561 select basic_rate,
562 adjusted_rate,
563 production_capacity,
564 deprn_method_code
565 from fa_books
566 where asset_id = px_asset_hdr_rec.asset_id
567 and book_type_code = px_asset_hdr_rec.book_type_code
568 and date_ineffective is null;
569
570 BEGIN
571
572
573 if p_amortize_flag = 'NO' then
574 px_trans_rec.amortization_start_date := null;
575 px_trans_rec.transaction_subtype := 'EXPENSED';
576 else
577 px_trans_rec.transaction_subtype := 'AMORTIZED';
578 end if;
579
580 l_asset_fin_rec_adj.life_in_months := x_new_life;
581
582 FA_ADJUSTMENT_PUB.do_adjustment
583 (p_api_version => 1.0,
584 p_init_msg_list => FND_API.G_FALSE,
585 p_commit => FND_API.G_FALSE,
586 p_validation_level => FND_API.G_VALID_LEVEL_FULL,
587 x_return_status => l_return_status,
588 x_msg_count => l_mesg_count,
589 x_msg_data => l_mesg,
590 p_calling_fn => 'fa_cua_mass_update1_pkg.do_adjustment',
591 px_trans_rec => px_trans_rec,
592 px_asset_hdr_rec => px_asset_hdr_rec,
593 p_asset_fin_rec_adj => l_asset_fin_rec_adj,
594 x_asset_fin_rec_new => l_asset_fin_rec_new,
595 x_asset_fin_mrc_tbl_new => l_asset_fin_mrc_tbl_new,
596 px_inv_trans_rec => l_inv_trans_rec,
597 px_inv_tbl => l_inv_tbl,
598 p_asset_deprn_rec_adj => l_asset_deprn_rec_adj,
599 x_asset_deprn_rec_new => l_asset_deprn_rec_new,
600 x_asset_deprn_mrc_tbl_new => l_asset_deprn_mrc_tbl_new,
601 p_group_reclass_options_rec => l_group_reclass_options_rec);
602
603
604
605 if (l_return_status <> FND_API.G_RET_STS_SUCCESS) then
606 x_err_code := substr(fnd_msg_pub.get(fnd_msg_pub.G_FIRST, fnd_api.G_TRUE), 1, 512);
607 return;
608 end if;
609
610 EXCEPTION
611 when others then
612 x_err_code := substr(sqlerrm, 1, 200);
613 return;
614
615 END do_adjustment;
616
617 -- -------------------------------------------------------------
618 -- Process_Conc
619 -- Called by the concurrent program to process batches. This
620 -- procedure serves as a wrapper to the Process procedure.
621 -- -------------------------------------------------------------
622
623 PROCEDURE Proc_Conc( ERRBUF OUT NOCOPY VARCHAR2,
624 RETCODE OUT NOCOPY VARCHAR2,
625 x_from_batch_number IN NUMBER,
626 x_to_batch_number IN NUMBER) IS
627
628 l_dummy varchar2(1);
629 l_request_id number;
630 l_ret_value number;
631
632 CURSOR l_batch_csr IS
633 SELECT batch_id,
634 decode(amortize_flag,'Y','YES','NO') amortize_flag,
635 amortization_date,
636 transaction_name,
637 attribute_category,
638 attribute1,
639 attribute2,
640 attribute3,
641 attribute4,
642 attribute5,
643 attribute6,
644 attribute7,
645 attribute8,
646 attribute9,
647 attribute10,
648 attribute11,
649 attribute12,
650 attribute13,
651 attribute14,
652 attribute15
653 FROM fa_mass_update_batch_headers
654 WHERE status_code in ('IP','P','PP','R')
655 AND batch_number >= nvl(X_from_Batch_number,batch_number)
656 AND batch_number <= nvl(X_to_batch_number,batch_number)
657 order by creation_date;
658 --FOR UPDATE NOWAIT;
659
660 l_trans_rec FA_API_TYPES.trans_rec_type;
661
662 BEGIN
663
664 retcode := '0';
665 BEGIN
666
667 l_trans_rec.mass_reference_id := fnd_global.conc_request_id;
668 l_trans_rec.who_info.last_update_date := sysdate;
669 l_trans_rec.who_info.last_updated_by := fnd_global.user_id;
670 l_trans_rec.who_info.created_by := l_trans_rec.who_info.last_updated_by;
671 l_trans_rec.who_info.creation_date := sysdate;
672 l_trans_rec.who_info.last_update_login := fnd_global.login_id;
673
674
675 FOR l_batch_rec IN l_batch_csr LOOP
676
677 update fa_mass_update_batch_headers
678 set status_code = 'IP'
679 where batch_id = l_batch_rec.batch_id;
680
681 -- assign attribute values to global_variables
682 fa_cua_asset_apis.g_process_batch := 'Y';
683 fa_cua_asset_apis.g_transaction_name := l_batch_rec.transaction_name;
684 fa_cua_asset_apis.g_attribute_category := l_batch_rec.attribute_category;
685 fa_cua_asset_apis.g_attribute1 := l_batch_rec.attribute1;
686 fa_cua_asset_apis.g_attribute2 := l_batch_rec.attribute2;
687 fa_cua_asset_apis.g_attribute3 := l_batch_rec.attribute3;
688 fa_cua_asset_apis.g_attribute4 := l_batch_rec.attribute4;
689 fa_cua_asset_apis.g_attribute5 := l_batch_rec.attribute5;
690 fa_cua_asset_apis.g_attribute6 := l_batch_rec.attribute6;
691 fa_cua_asset_apis.g_attribute7 := l_batch_rec.attribute7;
692 fa_cua_asset_apis.g_attribute8 := l_batch_rec.attribute8;
693 fa_cua_asset_apis.g_attribute9 := l_batch_rec.attribute9;
694 fa_cua_asset_apis.g_attribute10 := l_batch_rec.attribute10;
695 fa_cua_asset_apis.g_attribute11 := l_batch_rec.attribute11;
696 fa_cua_asset_apis.g_attribute12 := l_batch_rec.attribute12;
697 fa_cua_asset_apis.g_attribute13 := l_batch_rec.attribute13;
698 fa_cua_asset_apis.g_attribute14 := l_batch_rec.attribute14;
699 fa_cua_asset_apis.g_attribute15 := l_batch_rec.attribute15;
700
701 l_trans_rec.transaction_name := l_batch_rec.transaction_name;
702 l_trans_rec.desc_flex.attribute_category_code := l_batch_rec.attribute_category;
703 l_trans_rec.desc_flex.attribute1 := l_batch_rec.attribute1;
704 l_trans_rec.desc_flex.attribute2 := l_batch_rec.attribute2;
705 l_trans_rec.desc_flex.attribute3 := l_batch_rec.attribute3;
706 l_trans_rec.desc_flex.attribute4 := l_batch_rec.attribute4;
707 l_trans_rec.desc_flex.attribute5 := l_batch_rec.attribute5;
708 l_trans_rec.desc_flex.attribute6 := l_batch_rec.attribute6;
709 l_trans_rec.desc_flex.attribute7 := l_batch_rec.attribute7;
710 l_trans_rec.desc_flex.attribute8 := l_batch_rec.attribute8;
711 l_trans_rec.desc_flex.attribute9 := l_batch_rec.attribute9;
712 l_trans_rec.desc_flex.attribute10 := l_batch_rec.attribute10;
713 l_trans_rec.desc_flex.attribute11 := l_batch_rec.attribute11;
714 l_trans_rec.desc_flex.attribute12 := l_batch_rec.attribute12;
715 l_trans_rec.desc_flex.attribute13 := l_batch_rec.attribute13;
716 l_trans_rec.desc_flex.attribute14 := l_batch_rec.attribute14;
717 l_trans_rec.desc_flex.attribute15 := l_batch_rec.attribute15;
718 l_trans_rec.amortization_start_date := l_batch_rec.amortization_date;
719
720 process_batch( px_trans_rec => l_trans_rec,
721 p_batch_id => l_batch_rec.batch_id,
722 p_amortize_flag => l_batch_rec.amortize_flag,
723 p_log_level_rec => g_log_level_rec);
724
725
726 -- check if there are any line unprocessed or Rejected
727 l_dummy := 'N';
728
729 Begin
730 select 'Y'
731 into l_dummy
732 from fa_mass_update_batch_details
733 where batch_id = l_batch_rec.batch_id
734 and status_code in ('P','R')
735 and rownum = 1;
736 Exception
737 When others then
738 null;
739 End ;
740
741 if l_dummy = 'Y' then
742
743 update fa_mass_update_batch_headers
744 set status_code = 'R' -- Rejected Processed
745 , concurrent_request_id = l_Request_ID
746 , last_updated_by = fnd_global.login_id
747 , last_update_date = sysdate
748 , last_update_login = fnd_global.login_id
749 where batch_id = l_batch_rec.batch_id;
750 else
751 update fa_mass_update_batch_headers
752 set status_code = 'CP' -- Completetly Processed
753 , concurrent_request_id = l_Request_ID
754 , last_updated_by = fnd_global.login_id
755 , last_update_date = sysdate
756 , last_update_login = fnd_global.login_id
757 where batch_id = l_batch_rec.batch_id;
758 end if;
759 END LOOP;
760 commit;
761
762 EXCEPTION
763 WHEN OTHERS THEN
764 RETCODE := '2';
765 ERRBUF := SQLERRM;
766 END;
767
768
769
770 if RETCODE = '0' then
771 l_ret_value := fnd_request.submit_request('CUA','CUAMUPR',null,null,FALSE, l_request_id);
772 if (l_ret_value = 0) then
773 ERRBUF := 'Failed to Submit Mass Update report';
774 else
775 commit;
776 end if;
777 end if;
778
779
780 END Proc_Conc;
781
782
783 -- -------------------------------------------------------------
784 -- Process
785 -- This procedure can be called online using the Mass Update
786 -- Batches form or as a concurrent program.
787 --
788 -- Commit is performed once all the Asset records are processed
789 -- in a batch.
790 -- If even one asset record is rejected then the Batch Status is
791 -- Set to Rejected and changes for accepted assets is rolled back
792 -- as if they had not been processed at all
793 -- -------------------------------------------------------------
794
795 PROCEDURE process_batch( px_trans_rec IN OUT NOCOPY FA_API_TYPES.trans_rec_type,
796 p_batch_id IN NUMBER ,
797 p_amortize_flag IN VARCHAR2 , p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) IS
798 l_asset_id number;
799 l_book varchar2(30);
800 l_dummy varchar2(1);
801 l_status boolean;
802
803 l_transaction_date date;
804
805 l_err_code varchar2(600);
806 l_err_stage varchar2(600);
807 l_err_stack varchar2(600);
808 l_error_flag varchar2(1) := 'N'; -- Flag to indicate if any asset record has errored.
809 h_mesg_str varchar2(2000);
810
811 -- -----------------------
812 -- Cursor declarations
813 -- -----------------------
814
815 CURSOR l_get_books is
816 SELECT distinct book_type_code
817 from fa_mass_update_batch_details
818 WHERE batch_id = p_Batch_ID
819 and status_code in ('P','R')
820 and apply_flag = 'Y';
821
822 CURSOR l_get_assets_csr is
823 SELECT distinct asset_id
824 from fa_mass_update_batch_details
825 WHERE batch_id = p_Batch_ID
826 and book_type_code = l_book
827 and status_code in ('P','R')
828 and apply_flag = 'Y';
829
830
831 l_message_name varchar2(240);
832
833
834 -- We create a new record type to store the error information
835 -- for each batch line that fails to validate. A PL/SQL table
836 -- will be used to store all the failed lines. We need to do
837 -- this because we want to process all the lines even if an
838 -- error has occured in one of the lines
839 --
840 TYPE ErrorRecTyp IS RECORD(
841 attribute_name VARCHAR2(30),
842 rejection_reason VARCHAR2(250) );
843
844 TYPE ErrorTabTyp IS TABLE OF ErrorRecTyp
845 INDEX BY BINARY_INTEGER;
846
847 l_Error_Tab ErrorTabTyp; -- error table
848 l_return_status BOOLEAN;
849
850 error_exp exception;
851 l_attribute_name varchar2(30);
852 BEGIN
853
854 fnd_message.set_name('OFA','FA_LIFE_CHANGE_EXCEPTION');
855 fnd_message.set_token('AMORT_DATE',to_char(px_trans_rec.amortization_start_date,'DD/MM/YYYY'));
856 h_mesg_str := fnd_message.get;
857 fa_rx_conc_mesg_pkg.out(h_mesg_str);
858
859 FOR l_get_book_rec IN l_get_books LOOP
860
861 l_book := l_get_book_rec.book_type_code;
862
863 select greatest(calendar_period_open_date,
864 least(sysdate, calendar_period_close_date))
865 into l_transaction_date
866 from fa_deprn_periods
867 where book_type_code = l_book
868 and period_close_date is null;
869
870 FOR l_asset_rec IN l_get_assets_csr LOOP
871 l_asset_id := l_asset_rec.asset_id;
872
873 l_err_code := '0';
874
875 /* moved this update here for bugfix 1389275 */
876 -- Changes the status of the Asset detail records to In Process
877 update fa_mass_update_batch_details
878 set status_code = 'IP'
879 where batch_id = p_batch_id
880 and asset_id = l_asset_id
881 and book_type_code = l_book;
882
883 if not FA_TRX_APPROVAL_PKG.faxcat(
884 X_book => l_book,
885 X_asset_id => l_asset_id,
886 X_trx_type => 'RECLASS',
887 X_trx_date => l_transaction_date,
888 X_init_message_flag=> 'YES', p_log_level_rec => p_log_level_rec) then
889
890 l_err_code := substr(fnd_msg_pub.get(fnd_msg_pub.G_FIRST, fnd_api.G_TRUE), 1, 512);
891
892 if nvl(l_err_code, '0') = '0' then
893 -- check_pending_batches procedure returned false;
894 l_err_code := 'CUA_PENDING_BOOK';
895 end if;
896
897 else
898 px_trans_rec.transaction_date_entered:= l_transaction_date;
899 process_asset( px_trans_rec => px_trans_rec,
900 p_batch_id => p_batch_id,
901 p_asset_id => l_asset_id,
902 p_book => l_book,
903 p_amortize_flag => p_amortize_flag,
904 x_err_code => l_err_code,
905 x_err_attr_name => l_attribute_name ,
906 p_log_level_rec => p_log_level_rec);
907
908 if l_err_code <> '0' then
909 l_error_flag := 'Y';
910
911 if ( (substrb(l_err_code, 1,3) = 'FA_') OR
912 (substrb(l_err_code, 1,3) = 'CUA')) then
913
914 if (substrb(l_err_code, 1,3) = 'FA_') then
915 fnd_message.set_name ('OFA',l_err_code);
916 l_message_name := substrb(fnd_message.get,1,240);
917 end if;
918
919 if (substrb(l_err_code, 1,3) = 'CUA') then
920 fnd_message.set_name ('CUA',l_err_code);
921 l_message_name := substrb(fnd_message.get,1,240);
922 end if;
923 else
924 if substr(l_err_code,1,1) = '-' then
925 l_message_name := substrb(sqlerrm(l_err_code),1,240);
926 else
927 l_message_name := l_err_code;
928 end if;
929 end if;
930
931 -- Populate Table with rejection reasons
932 l_error_tab(l_asset_id).attribute_name:= l_attribute_name;
933 l_error_tab(l_asset_id).rejection_reason := l_message_name;
934 end if;
935 end if;
936
937 END LOOP;
938 END LOOP;
939
940 if l_error_flag = 'Y' then
941 rollback;
942
943 FOR l_get_book_rec IN l_get_books LOOP
944 l_book := l_get_book_rec.book_type_code;
945
946 FOR l_asset_rec IN l_get_assets_csr LOOP
947 l_asset_id := l_asset_rec.asset_id;
948
949 if l_error_tab.exists(l_asset_id) then
950 update fa_mass_update_batch_details
951 set rejection_reason = l_error_tab(l_asset_id).rejection_reason,
952 concurrent_request_id = px_trans_rec.mass_reference_id,
953 status_code = 'R',
954 last_updated_by = px_trans_rec.who_info.last_updated_by,
955 last_update_date = px_trans_rec.who_info.last_update_date,
956 last_update_login = px_trans_rec.who_info.last_update_login
957 where asset_id = l_asset_id
958 and book_type_code = l_book
959 and batch_id = p_batch_id
960 and attribute_name = nvl(l_attribute_name, attribute_name)
961 and status_code in ('P','R') -- since rollback will revert the update to 'IP'
962 and nvl(apply_flag,'N') = 'Y';
963 end if;
964
965 END LOOP;
966 END LOOP;
967
968 else -- No Asset record failed. Therefore update the status to Accepted for all records
969 update fa_mass_update_batch_details
970 set rejection_reason = null,
971 concurrent_request_id = px_trans_rec.mass_reference_id,
972 status_code = 'A',
973 last_updated_by = px_trans_rec.who_info.last_updated_by,
974 last_update_date = px_trans_rec.who_info.last_update_date,
975 last_update_login = px_trans_rec.who_info.last_update_login
976 where batch_id = p_batch_id
977 and status_code = 'IP' -- changed to 'IP'from ( 'P', 'R')- bugfix 1389275
978 and nvl(apply_flag,'N') = 'Y';
979 end if;
980
981 End;
982
983
984 PROCEDURE process_asset( px_trans_rec IN OUT NOCOPY FA_API_TYPES.trans_rec_type,
985 p_batch_id IN NUMBER,
986 p_asset_id IN NUMBER,
987 p_book IN VARCHAR2,
988 p_amortize_flag IN VARCHAR2,
989 x_err_code OUT NOCOPY VARCHAR2,
990 x_err_attr_name OUT NOCOPY VARCHAR2 , p_log_level_rec IN FA_API_TYPES.log_level_rec_type default null) IS
991
992 l_asset_id number;
993 l_new_life number;
994 l_old_life number;
995 l_amortization_date date;
996 prior_date_effective DATE;
997 check_prior_addition number;
998 check_flag varchar2(2);
999 l_dummy varchar2(1);
1000 l_amortize_flag varchar2(3) ;
1001
1002 CURSOR l_get_Lines_csr IS
1003 SELECT attribute_name,
1004 attribute_old_id,
1005 attribute_new_id,
1006 derived_from_entity_id,
1007 derived_from_entity,
1008 status_code
1009 FROM fa_mass_update_batch_details
1010 WHERE batch_id = p_batch_id
1011 and asset_id = p_asset_id
1012 and book_type_code = p_book
1013 AND apply_flag = 'Y'
1014 AND STATUS_CODE in ('IP', 'P', 'R') -- added 'IP' as part of 138927
1015 order by decode(attribute_name,
1016 'LIFE_END_DATE',1,
1017 'SERIAL_NUMBER',2,
1018 'ASSET_KEY',3,
1019 'LEASE_NUMBER',4,
1020 'DISTRIBUTION',5,
1021 'CATEGORY',6)
1022 FOR UPDATE NOWAIT;
1023
1024 h_status boolean;
1025
1026 -- api variables
1027 l_return_status VARCHAR2(100);
1028 l_msg_count NUMBER:= 0;
1029 l_msg_data VARCHAR2(4000);
1030 l_api_version CONSTANT number := 1.0;
1031 l_msg_list VARCHAR2(5) := FND_API.G_FALSE;
1032 l_commit_flag VARCHAR2(5) := FND_API.G_FALSE;
1033 l_validation_level NUMBER := FND_API.G_VALID_LEVEL_FULL;
1034 l_calling_fn VARCHAR2(20) := 'ASSET HIERARACHY';
1035
1036 l_asset_hdr_rec FA_API_TYPES.asset_hdr_rec_type;
1037 l_asset_cat_rec_new FA_API_TYPES.asset_cat_rec_type;
1038 l_recl_opt_rec FA_API_TYPES.reclass_options_rec_type;
1039
1040 l_asset_desc_rec FA_API_TYPES.asset_desc_rec_type;
1041 l_asset_type_rec FA_API_TYPES.asset_type_rec_type;
1042 l_asset_cat_rec FA_API_TYPES.asset_cat_rec_type;
1043 l_asset_dist_tbl FA_API_TYPES.asset_dist_tbl_type;
1044
1045 -- Adjustment parameters
1046 l_asset_fin_rec_adj FA_API_TYPES.asset_fin_rec_type;
1047 l_asset_fin_rec_new FA_API_TYPES.asset_fin_rec_type;
1048 l_asset_fin_mrc_tbl_new FA_API_TYPES.asset_fin_tbl_type;
1049 l_inv_trans_rec FA_API_TYPES.inv_trans_rec_type;
1050 l_inv_tbl FA_API_TYPES.inv_tbl_type;
1051 l_asset_deprn_rec_adj FA_API_TYPES.asset_deprn_rec_type;
1052 l_asset_deprn_rec_new FA_API_TYPES.asset_deprn_rec_type;
1053 l_asset_deprn_mrc_tbl_new FA_API_TYPES.asset_deprn_tbl_type;
1054 l_inv_rec FA_API_TYPES.inv_rec_type;
1055 l_group_reclass_options_rec FA_API_TYPES.group_reclass_options_rec_type;
1056
1057 l_request_id number(15);
1058
1059 l_update_attribute varchar2(1):= 'N';
1060
1061 l_err_stage varchar2(600);
1062 l_err_stack varchar2(600);
1063 Begin
1064
1065
1066 x_err_code := '0';
1067 -- Intialize Header variables
1068 l_asset_desc_rec := null;
1069 l_asset_hdr_rec := null;
1070 l_asset_hdr_rec.asset_id := p_asset_id;
1071 l_asset_hdr_rec.book_type_code := p_book;
1072 px_trans_rec.calling_interface := 'ASSET_HIERARCHY';
1073
1074 FOR l_get_lines_rec in l_get_lines_csr LOOP
1075
1076 -- cleanup for each loop
1077 fa_cua_asset_apis.g_derive_from_entity := null;
1078 fa_cua_asset_apis.g_derive_from_entity_value := null;
1079 l_update_attribute := 'N';
1080
1081 if l_get_lines_rec.attribute_name = 'CATEGORY' then
1082 if (l_get_lines_rec.attribute_old_id <> l_get_lines_rec.attribute_new_id)
1083 and (l_get_lines_rec.attribute_new_id is not null) then
1084
1085 update_category( p_asset_id,
1086 to_number(l_get_lines_rec.attribute_old_id) ,
1087 to_number(l_get_lines_rec.attribute_new_id),
1088 x_err_code,l_err_stage,l_err_stack, p_log_level_rec);
1089 if x_err_code <> '0' then
1090 x_err_attr_name := l_get_lines_rec.attribute_name;
1091 return;
1092 end if;
1093
1094 end if;
1095 end if;
1096
1097 if l_get_lines_rec.attribute_name = 'LEASE_NUMBER' then
1098 if (l_get_lines_rec.attribute_old_id <> l_get_lines_rec.attribute_new_id) or
1099 (l_get_lines_rec.attribute_old_id is null) then
1100
1101 l_asset_desc_rec.lease_id := to_number(l_get_lines_rec.attribute_new_id);
1102 l_update_attribute := 'Y';
1103
1104 end if;
1105 end if;
1106
1107 if l_get_lines_rec.attribute_name = 'SERIAL_NUMBER' then
1108 if (l_get_lines_rec.attribute_old_id <> l_get_lines_rec.attribute_new_id) or
1109 (l_get_lines_rec.attribute_old_id is null) then
1110
1111 l_asset_desc_rec.serial_number := l_get_lines_rec.attribute_new_id;
1112 l_update_attribute := 'Y';
1113
1114 end if;
1115 end if;
1116
1117 if l_get_lines_rec.attribute_name = 'ASSET_KEY' then
1118 if (l_get_lines_rec.attribute_old_id <> l_get_lines_rec.attribute_new_id) or
1119 (l_get_lines_rec.attribute_old_id is null) then
1120
1121 l_asset_desc_rec.asset_key_ccid := to_number(l_get_lines_rec.attribute_new_id);
1122 l_update_attribute := 'Y';
1123
1124 end if;
1125 end if;
1126
1127
1128 if l_update_attribute = 'Y' then
1129 FA_ASSET_DESC_PUB.update_desc(
1130 p_api_version => l_api_version,
1131 p_init_msg_list => l_msg_list,
1132 p_commit => l_commit_flag,
1133 p_validation_level => l_validation_level,
1134 x_return_status => l_return_status,
1135 x_msg_count => l_msg_count,
1136 x_msg_data => l_msg_data,
1137 p_calling_fn => 'fa_cua_mass_update1_pkg.process_asset_batch',
1138 px_trans_rec => px_trans_rec,
1139 px_asset_hdr_rec => l_asset_hdr_rec,
1140 px_asset_desc_rec_new => l_asset_desc_rec,
1141 px_asset_cat_rec_new => l_asset_cat_rec);
1142
1143 if ( l_return_status <> FND_API.G_RET_STS_SUCCESS) then
1144 x_err_code := substr(fnd_msg_pub.get(fnd_msg_pub.G_FIRST, fnd_api.G_TRUE), 1, 512);
1145 x_err_attr_name := l_get_lines_rec.attribute_name;
1146 return;
1147 end if;
1148 end if;
1149
1150 if l_get_lines_rec.attribute_name = 'DISTRIBUTION' then
1151 if ( l_get_lines_rec.attribute_old_id <> l_get_lines_rec.attribute_new_id) or
1152 ( (l_get_lines_rec.attribute_old_id is null)
1153 and (l_get_lines_rec.attribute_new_id is not null) ) then
1154
1155 do_transfer(
1156 p_asset_id => p_asset_id,
1157 p_book_type_code => p_book,
1158 p_new_hr_dist_set_id => to_number(l_get_lines_rec.attribute_new_id),
1159 p_transaction_date => nvl(px_trans_rec.amortization_start_date,
1160 px_trans_rec.transaction_date_entered ),
1161 x_err_code => x_err_code ,
1162 p_log_level_rec => p_log_level_rec);
1163 if x_err_code <> '0' then
1164 x_err_attr_name := l_get_lines_rec.attribute_name;
1165 return;
1166 end if;
1167 end if;
1168 end if;
1169
1170 --
1171 if l_get_lines_rec.attribute_name = 'LIFE_END_DATE' then
1172 if (l_get_lines_rec.attribute_old_id <> l_get_lines_rec.attribute_new_id) or
1173 (l_get_lines_rec.attribute_old_id is null) then
1174 l_new_life := to_number(l_get_lines_rec.attribute_new_id);
1175 l_old_life := to_number(l_get_lines_rec.attribute_old_id);
1176
1177 l_amortization_date := px_trans_rec.amortization_start_date;
1178
1179 -- If Asset has not started depreciating and user is trying to make an Amortized
1180 -- Adjustment, it would fail. Also check if there are no Amortized Changes.
1181 -- Therefore proactively set the Adjustment to Expensed
1182 -- so that the Life Change can go through.
1183
1184 -- assign Life Derivation info to global variables. The global variables
1185 -- are refernced from DB trigger on FA_TRANSACTION_HEADERS to populate
1186 -- FA_LIFE_DERIVATION_INFO;
1187
1188 fa_cua_asset_apis.g_derive_from_entity := l_get_lines_rec.derived_from_entity;
1189 fa_cua_asset_apis.g_derive_from_entity_value := l_get_lines_rec.derived_from_entity_id;
1190
1191 do_adjustment ( px_trans_rec => px_trans_rec,
1192 px_asset_hdr_rec => l_asset_hdr_rec,
1193 x_new_life => l_new_life,
1194 p_amortize_flag => p_amortize_flag,
1195 x_err_code => x_err_code ,
1196 p_log_level_rec => p_log_level_rec);
1197 if x_err_code <> '0' then
1198 x_err_attr_name := l_get_lines_rec.attribute_name;
1199 return ;
1200 end if;
1201 end if;
1202 end if;
1203
1204 -- Now restore to Pending/Rejected
1205 update fa_mass_update_batch_details
1206 set status_code = l_get_lines_rec.status_code
1207 where batch_id = p_batch_id
1208 and asset_id = p_asset_id
1209 and book_type_code = p_book;
1210
1211 END LOOP;
1212
1213 Exception
1214 when OTHERS then
1215 x_err_code := substr(sqlerrm, 1, 240);
1216 End process_asset;
1217
1218
1219
1220 END FA_CUA_MASS_UPDATE1_PKG;