DBA Data[Home] [Help]

PACKAGE BODY: APPS.FA_RETIREMENTS_PKG

Source


1 PACKAGE BODY FA_RETIREMENTS_PKG as
2 /* $Header: faxirtb.pls 120.6 2005/07/25 10:00:50 yyoon ship $ */
3   PROCEDURE Insert_Row(X_Rowid                   IN OUT NOCOPY VARCHAR2,
4                        X_Retirement_Id           IN OUT NOCOPY NUMBER,
5                        X_Book_Type_Code                 VARCHAR2,
6                        X_Asset_Id                       NUMBER,
7                        X_Transaction_Header_Id_In       NUMBER,
8                        X_Date_Retired                   DATE,
9                        X_Date_Effective                 DATE,
10                        X_Cost_Retired                   NUMBER,
11                        X_Status                         VARCHAR2,
12                        X_Last_Update_Date               DATE,
13                        X_Last_Updated_By                NUMBER,
14                        X_Ret_Prorate_Convention         VARCHAR2,
15                        X_Transaction_Header_Id_Out      NUMBER DEFAULT NULL,
16                        X_Units                          NUMBER DEFAULT NULL,
17                        X_Cost_Of_Removal                NUMBER DEFAULT NULL,
18                        X_Nbv_Retired                    NUMBER DEFAULT NULL,
19                        X_Gain_Loss_Amount               NUMBER DEFAULT NULL,
20                        X_Proceeds_Of_Sale               NUMBER DEFAULT NULL,
21                        X_Gain_Loss_Type_Code            VARCHAR2 DEFAULT NULL,
22                        X_Retirement_Type_Code           VARCHAR2 DEFAULT NULL,
23                        X_Itc_Recaptured                 NUMBER DEFAULT NULL,
24                        X_Itc_Recapture_Id               NUMBER DEFAULT NULL,
25                        X_Reference_Num                  VARCHAR2 DEFAULT NULL,
26                        X_Sold_To                        VARCHAR2 DEFAULT NULL,
27                        X_Trade_In_Asset_Id              NUMBER DEFAULT NULL,
28                        X_Stl_Method_Code                VARCHAR2 DEFAULT NULL,
29                        X_Stl_Life_In_Months             NUMBER DEFAULT NULL,
30                        X_Stl_Deprn_Amount               NUMBER DEFAULT NULL,
31                        X_Created_By                     NUMBER DEFAULT NULL,
32                        X_Creation_Date                  DATE DEFAULT NULL,
33                        X_Last_Update_Login              NUMBER DEFAULT NULL,
34                        X_Attribute1                     VARCHAR2 DEFAULT NULL,
35                        X_Attribute2                     VARCHAR2 DEFAULT NULL,
36                        X_Attribute3                     VARCHAR2 DEFAULT NULL,
37                        X_Attribute4                     VARCHAR2 DEFAULT NULL,
38                        X_Attribute5                     VARCHAR2 DEFAULT NULL,
39                        X_Attribute6                     VARCHAR2 DEFAULT NULL,
40                        X_Attribute7                     VARCHAR2 DEFAULT NULL,
41                        X_Attribute8                     VARCHAR2 DEFAULT NULL,
42                        X_Attribute9                     VARCHAR2 DEFAULT NULL,
43                        X_Attribute10                    VARCHAR2 DEFAULT NULL,
44                        X_Attribute11                    VARCHAR2 DEFAULT NULL,
45                        X_Attribute12                    VARCHAR2 DEFAULT NULL,
46                        X_Attribute13                    VARCHAR2 DEFAULT NULL,
47                        X_Attribute14                    VARCHAR2 DEFAULT NULL,
48                        X_Attribute15                    VARCHAR2 DEFAULT NULL,
49                        X_Attribute_Category_Code        VARCHAR2 DEFAULT NULL,
50                        X_Reval_Reserve_Retired          NUMBER DEFAULT NULL,
51                        X_Unrevalued_Cost_Retired        NUMBER DEFAULT NULL,
52                        X_Recognize_Gain_Loss            VARCHAR2 DEFAULT NULL,
53                        X_Recapture_Reserve_Flag         VARCHAR2 DEFAULT NULL,
54                        X_Limit_Proceeds_Flag            VARCHAR2 DEFAULT NULL,
55                        X_Terminal_Gain_Loss             VARCHAR2 DEFAULT NULL,
56                        X_Reserve_Retired                NUMBER DEFAULT NULL,
57                        X_Eofy_Reserve                   NUMBER DEFAULT NULL,
58                        X_Reduction_Rate                 NUMBER DEFAULT NULL,
59                        X_Recapture_Amount               NUMBER DEFAULT NULL,
60                        X_mrc_sob_type_code              VARCHAR2 DEFAULT 'P',
61                        X_Calling_Fn                     VARCHAR2,
62    			p_log_level_rec              IN FA_API_TYPES.log_level_rec_type default null) IS
63       CURSOR C_ret IS SELECT rowid FROM fa_retirements
64                  WHERE retirement_id = X_Retirement_Id;
65       CURSOR C_ret_mc IS SELECT rowid FROM fa_retirements_mrc_v
66                  WHERE retirement_id = X_Retirement_Id;
67 
68       CURSOR C2 IS SELECT fa_retirements_s.nextval FROM sys.dual;
69 
70    BEGIN
71 
72        if (X_mrc_sob_type_code = 'R') then
73 
74           INSERT INTO fa_retirements_mrc_v(
75               retirement_id,
76               book_type_code,
77               asset_id,
78               transaction_header_id_in,
79               date_retired,
80               date_effective,
81               cost_retired,
82               status,
83               last_update_date,
84               last_updated_by,
85               retirement_prorate_convention,
86               transaction_header_id_out,
87               units,
88               cost_of_removal,
89               nbv_retired,
90               gain_loss_amount,
91               proceeds_of_sale,
92               gain_loss_type_code,
93               retirement_type_code,
94               itc_recaptured,
95               itc_recapture_id,
96               reference_num,
97               sold_to,
98               trade_in_asset_id,
99               stl_method_code,
100               stl_life_in_months,
101               stl_deprn_amount,
102               created_by,
103               creation_date,
104               last_update_login,
105               attribute1,
106               attribute2,
107               attribute3,
108               attribute4,
109               attribute5,
110               attribute6,
111               attribute7,
112               attribute8,
113               attribute9,
114               attribute10,
115               attribute11,
116               attribute12,
117               attribute13,
118               attribute14,
119               attribute15,
120               attribute_category_code,
121               reval_reserve_retired,
122               unrevalued_cost_retired,
123               recognize_gain_loss,
124               recapture_reserve_flag,
125               limit_proceeds_flag,
126               terminal_gain_loss,
127               reserve_retired,
128               eofy_reserve,
129               reduction_rate,
130               recapture_amount
131              ) VALUES (
132               X_Retirement_Id,
133               X_Book_Type_Code,
134               X_Asset_Id,
135               X_Transaction_Header_Id_In,
136               X_Date_Retired,
137               X_Date_Effective,
138               X_Cost_Retired,
139               X_Status,
140               X_Last_Update_Date,
141               X_Last_Updated_By,
142               X_Ret_Prorate_Convention,
143               X_Transaction_Header_Id_Out,
144               X_Units,
145               X_Cost_Of_Removal,
146               X_Nbv_Retired,
147               X_Gain_Loss_Amount,
148               X_Proceeds_Of_Sale,
149               X_Gain_Loss_Type_Code,
150               X_Retirement_Type_Code,
151               X_Itc_Recaptured,
152               X_Itc_Recapture_Id,
153               X_Reference_Num,
154               X_Sold_To,
155               X_Trade_In_Asset_Id,
156               X_Stl_Method_Code,
157               X_Stl_Life_In_Months,
158               X_Stl_Deprn_Amount,
159               X_Created_By,
160               X_Creation_Date,
161               X_Last_Update_Login,
162               X_Attribute1,
163               X_Attribute2,
164               X_Attribute3,
165               X_Attribute4,
166               X_Attribute5,
167               X_Attribute6,
168               X_Attribute7,
169               X_Attribute8,
170               X_Attribute9,
171               X_Attribute10,
172               X_Attribute11,
173               X_Attribute12,
174               X_Attribute13,
175               X_Attribute14,
176               X_Attribute15,
177               X_Attribute_Category_Code,
178               X_Reval_Reserve_Retired,
179               X_Unrevalued_Cost_Retired,
180               X_Recognize_Gain_Loss,
181               X_Recapture_Reserve_Flag,
182               X_Limit_Proceeds_Flag,
183               X_Terminal_Gain_Loss,
184               X_Reserve_Retired,
185               X_Eofy_Reserve,
186               X_Reduction_Rate,
187               X_Recapture_Amount
188              );
189 
190           OPEN C_ret_mc;
191           FETCH C_ret_mc INTO X_Rowid;
192           if (C_ret_mc%NOTFOUND) then
193              CLOSE C_ret_mc;
194              Raise NO_DATA_FOUND;
195           end if;
196           CLOSE C_ret_mc;
197 
198        else
199 
200           if (X_Retirement_Id is NULL) then
201             OPEN C2;
202              FETCH C2 INTO X_Retirement_Id;
203             CLOSE C2;
204           end if;
205 
206           INSERT INTO fa_retirements(
207               retirement_id,
208               book_type_code,
209               asset_id,
210               transaction_header_id_in,
211               date_retired,
212               date_effective,
213               cost_retired,
214               status,
215               last_update_date,
216               last_updated_by,
217               retirement_prorate_convention,
218               transaction_header_id_out,
219               units,
220               cost_of_removal,
221               nbv_retired,
222               gain_loss_amount,
223               proceeds_of_sale,
224               gain_loss_type_code,
225               retirement_type_code,
226               itc_recaptured,
227               itc_recapture_id,
228               reference_num,
229               sold_to,
230               trade_in_asset_id,
231               stl_method_code,
232               stl_life_in_months,
233               stl_deprn_amount,
234               created_by,
235               creation_date,
236               last_update_login,
237               attribute1,
238               attribute2,
239               attribute3,
240               attribute4,
241               attribute5,
242               attribute6,
243               attribute7,
244               attribute8,
245               attribute9,
246               attribute10,
247               attribute11,
248               attribute12,
249               attribute13,
250               attribute14,
251               attribute15,
252               attribute_category_code,
253               reval_reserve_retired,
254               unrevalued_cost_retired,
255               recognize_gain_loss,
256               recapture_reserve_flag,
257               limit_proceeds_flag,
258               terminal_gain_loss,
259               reserve_retired,
260               eofy_reserve,
261               reduction_rate,
262               recapture_amount
263              ) VALUES (
264               X_Retirement_Id,
265               X_Book_Type_Code,
266               X_Asset_Id,
267               X_Transaction_Header_Id_In,
268               X_Date_Retired,
269               X_Date_Effective,
270               X_Cost_Retired,
271               X_Status,
272               X_Last_Update_Date,
273               X_Last_Updated_By,
274               X_Ret_Prorate_Convention,
275               X_Transaction_Header_Id_Out,
276               X_Units,
277               X_Cost_Of_Removal,
278               X_Nbv_Retired,
279               X_Gain_Loss_Amount,
280               X_Proceeds_Of_Sale,
281               X_Gain_Loss_Type_Code,
282               X_Retirement_Type_Code,
283               X_Itc_Recaptured,
284               X_Itc_Recapture_Id,
285               X_Reference_Num,
286               X_Sold_To,
287               X_Trade_In_Asset_Id,
288               X_Stl_Method_Code,
289               X_Stl_Life_In_Months,
290               X_Stl_Deprn_Amount,
291               X_Created_By,
292               X_Creation_Date,
293               X_Last_Update_Login,
294               X_Attribute1,
295               X_Attribute2,
296               X_Attribute3,
297               X_Attribute4,
298               X_Attribute5,
299               X_Attribute6,
300               X_Attribute7,
301               X_Attribute8,
302               X_Attribute9,
303               X_Attribute10,
304               X_Attribute11,
305               X_Attribute12,
306               X_Attribute13,
307               X_Attribute14,
308               X_Attribute15,
309               X_Attribute_Category_Code,
310               X_Reval_Reserve_Retired,
311               X_Unrevalued_Cost_Retired,
312               X_Recognize_Gain_Loss,
313               X_Recapture_Reserve_Flag,
314               X_Limit_Proceeds_Flag,
315               X_Terminal_Gain_Loss,
316               X_Reserve_Retired,
317               X_Eofy_Reserve,
318               X_Reduction_Rate,
319               X_Recapture_Amount
320              );
321 
322           OPEN C_ret;
323           FETCH C_ret INTO X_Rowid;
324           if (C_ret%NOTFOUND) then
325               CLOSE C_ret;
326               Raise NO_DATA_FOUND;
327           end if;
328           CLOSE C_ret;
329 
330        end if;  -- end mrc
331 
332   EXCEPTION
333      WHEN Others THEN
334           fa_srvr_msg.add_sql_error(
335                 CALLING_FN  => 'FA_RETIREMENTS_PKG.insert_row'
336                 ,p_log_level_rec => p_log_level_rec);
337           raise;
338   END Insert_Row;
339 
340 
341   PROCEDURE Lock_Row(X_Rowid                            VARCHAR2,
342                      X_Retirement_Id                    NUMBER,
343                      X_Book_Type_Code                   VARCHAR2,
344                      X_Asset_Id                         NUMBER,
345                      X_Transaction_Header_Id_In         NUMBER,
346                      X_Date_Retired                     DATE,
347                      X_Date_Effective                   DATE,
348                      X_Cost_Retired                     NUMBER,
349                      X_Status                           VARCHAR2,
350                      X_Ret_Prorate_Convention           VARCHAR2,
351                      X_Transaction_Header_Id_Out        NUMBER DEFAULT NULL,
352                      X_Units                            NUMBER DEFAULT NULL,
353                      X_Cost_Of_Removal                  NUMBER DEFAULT NULL,
354                      X_Nbv_Retired                      NUMBER DEFAULT NULL,
355                      X_Gain_Loss_Amount                 NUMBER DEFAULT NULL,
356                      X_Proceeds_Of_Sale                 NUMBER DEFAULT NULL,
357                      X_Gain_Loss_Type_Code              VARCHAR2 DEFAULT NULL,
358                      X_Retirement_Type_Code             VARCHAR2 DEFAULT NULL,
359                      X_Itc_Recaptured                   NUMBER DEFAULT NULL,
360                      X_Itc_Recapture_Id                 NUMBER DEFAULT NULL,
361                      X_Reference_Num                    VARCHAR2 DEFAULT NULL,
362                      X_Sold_To                          VARCHAR2 DEFAULT NULL,
363                      X_Trade_In_Asset_Id                NUMBER DEFAULT NULL,
364                      X_Stl_Method_Code                  VARCHAR2 DEFAULT NULL,
365                      X_Stl_Life_In_Months               NUMBER DEFAULT NULL,
366                      X_Stl_Deprn_Amount                 NUMBER DEFAULT NULL,
367                      X_Attribute1                       VARCHAR2 DEFAULT NULL,
368                      X_Attribute2                       VARCHAR2 DEFAULT NULL,
369                      X_Attribute3                       VARCHAR2 DEFAULT NULL,
370                      X_Attribute4                       VARCHAR2 DEFAULT NULL,
371                      X_Attribute5                       VARCHAR2 DEFAULT NULL,
372                      X_Attribute6                       VARCHAR2 DEFAULT NULL,
373                      X_Attribute7                       VARCHAR2 DEFAULT NULL,
374                      X_Attribute8                       VARCHAR2 DEFAULT NULL,
375                      X_Attribute9                       VARCHAR2 DEFAULT NULL,
376                      X_Attribute10                      VARCHAR2 DEFAULT NULL,
377                      X_Attribute11                      VARCHAR2 DEFAULT NULL,
378                      X_Attribute12                      VARCHAR2 DEFAULT NULL,
379                      X_Attribute13                      VARCHAR2 DEFAULT NULL,
380                      X_Attribute14                      VARCHAR2 DEFAULT NULL,
381                      X_Attribute15                      VARCHAR2 DEFAULT NULL,
382                      X_Attribute_Category_Code          VARCHAR2 DEFAULT NULL,
383                      X_Reval_Reserve_Retired            NUMBER DEFAULT NULL,
384                      X_Unrevalued_Cost_Retired          NUMBER DEFAULT NULL,
385                      X_Recognize_Gain_Loss              VARCHAR2 DEFAULT NULL,
386                      X_Recapture_Reserve_Flag           VARCHAR2 DEFAULT NULL,
387                      X_Limit_Proceeds_Flag              VARCHAR2 DEFAULT NULL,
388                      X_Terminal_Gain_Loss               VARCHAR2 DEFAULT NULL,
389                      X_Reserve_Retired                  NUMBER DEFAULT NULL,
390                      X_Eofy_Reserve                     NUMBER DEFAULT NULL,
391                      X_Reduction_Rate                   NUMBER DEFAULT NULL,
392                      X_Recapture_Amount                 NUMBER DEFAULT NULL,
393                      X_Calling_Fn                       VARCHAR2,
394 		     p_log_level_rec                 IN FA_API_TYPES.log_level_rec_type default null) IS
395     CURSOR C IS
396         SELECT     retirement_id,
397           book_type_code,
398           asset_id,
399           transaction_header_id_in,
400           date_retired,
401           date_effective,
402           cost_retired,
403           status,
404           last_update_date,
405           last_updated_by,
406           retirement_prorate_convention,
407           transaction_header_id_out,
408           units,
409           cost_of_removal,
410           nbv_retired,
411           gain_loss_amount,
412           proceeds_of_sale,
413           gain_loss_type_code,
414           retirement_type_code,
415           itc_recaptured,
416           itc_recapture_id,
417           reference_num,
418           sold_to,
419           trade_in_asset_id,
420           stl_method_code,
421           stl_life_in_months,
422           stl_deprn_amount,
423           created_by,
424           creation_date,
425           last_update_login,
426           attribute1,
427           attribute2,
428           attribute3,
429           attribute4,
430           attribute5,
431           attribute6,
432           attribute7,
433           attribute8,
434           attribute9,
435           attribute10,
436           attribute11,
437           attribute12,
438           attribute13,
439           attribute14,
440           attribute15,
441           attribute_category_code,
442           reval_reserve_retired,
443           unrevalued_cost_retired,
444           recognize_gain_loss,
445           recapture_reserve_flag,
446           limit_proceeds_flag,
447           terminal_gain_loss,
448           reserve_retired,
449           eofy_reserve,
450           reduction_rate,
451           recapture_amount
452         FROM   fa_retirements
453         WHERE  rowid = X_Rowid
454         FOR UPDATE of Retirement_Id NOWAIT;
455     Recinfo C%ROWTYPE;
456   BEGIN
457     OPEN C;
458     FETCH C INTO Recinfo;
459     if (C%NOTFOUND) then
460       CLOSE C;
461       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_DELETED');
462       APP_EXCEPTION.Raise_Exception;
463     end if;
464     CLOSE C;
465     if ((Recinfo.retirement_id =  X_Retirement_Id)
466            AND (Recinfo.book_type_code =  X_Book_Type_Code)
467            AND (Recinfo.asset_id =  X_Asset_Id)
468            AND (Recinfo.transaction_header_id_in =  X_Transaction_Header_Id_In)
469            AND (Recinfo.date_retired =  X_Date_Retired)
470            AND (Recinfo.date_effective =  X_Date_Effective)
471            AND (Recinfo.cost_retired =  X_Cost_Retired)
472            AND (Recinfo.status =  X_Status)
473            AND (Recinfo.retirement_prorate_convention =
474                          X_Ret_Prorate_Convention)
475            AND (   (Recinfo.transaction_header_id_out =
476                          X_Transaction_Header_Id_Out)
477                 OR (    (Recinfo.transaction_header_id_out IS NULL)
478                     AND (X_Transaction_Header_Id_Out IS NULL)))
479            AND (   (Recinfo.units =  X_Units)
480                 OR (    (Recinfo.units IS NULL)
481                     AND (X_Units IS NULL)))
482            AND (   (Recinfo.cost_of_removal =  X_Cost_Of_Removal)
483                 OR (    (Recinfo.cost_of_removal IS NULL)
484                     AND (X_Cost_Of_Removal IS NULL)))
485            AND (   (Recinfo.nbv_retired =  X_Nbv_Retired)
486                 OR (    (Recinfo.nbv_retired IS NULL)
487                     AND (X_Nbv_Retired IS NULL)))
488            AND (   (Recinfo.gain_loss_amount =  X_Gain_Loss_Amount)
489                 OR (    (Recinfo.gain_loss_amount IS NULL)
490                     AND (X_Gain_Loss_Amount IS NULL)))
491            AND (   (Recinfo.proceeds_of_sale =  X_Proceeds_Of_Sale)
492                 OR (    (Recinfo.proceeds_of_sale IS NULL)
493                     AND (X_Proceeds_Of_Sale IS NULL)))
494            AND (   (Recinfo.gain_loss_type_code =  X_Gain_Loss_Type_Code)
495                 OR (    (Recinfo.gain_loss_type_code IS NULL)
496                     AND (X_Gain_Loss_Type_Code IS NULL)))
497            AND (   (Recinfo.retirement_type_code =  X_Retirement_Type_Code)
498                 OR (    (Recinfo.retirement_type_code IS NULL)
499                     AND (X_Retirement_Type_Code IS NULL)))
500            AND (   (Recinfo.itc_recaptured =  X_Itc_Recaptured)
501                 OR (    (Recinfo.itc_recaptured IS NULL)
502                     AND (X_Itc_Recaptured IS NULL)))
503            AND (   (Recinfo.itc_recapture_id =  X_Itc_Recapture_Id)
504                 OR (    (Recinfo.itc_recapture_id IS NULL)
505                     AND (X_Itc_Recapture_Id IS NULL)))
506            AND (   (Recinfo.reference_num =  X_Reference_Num)
507                 OR (    (Recinfo.reference_num IS NULL)
508                     AND (X_Reference_Num IS NULL)))
509            AND (   (Recinfo.sold_to =  X_Sold_To)
510                 OR (    (Recinfo.sold_to IS NULL)
511                     AND (X_Sold_To IS NULL)))
512            AND (   (Recinfo.trade_in_asset_id =  X_Trade_In_Asset_Id)
513                 OR (    (Recinfo.trade_in_asset_id IS NULL)
514                     AND (X_Trade_In_Asset_Id IS NULL)))
515            AND (   (Recinfo.stl_method_code =  X_Stl_Method_Code)
516                 OR (    (Recinfo.stl_method_code IS NULL)
517                     AND (X_Stl_Method_Code IS NULL)))
518            AND (   (Recinfo.stl_life_in_months =  X_Stl_Life_In_Months)
519                 OR (    (Recinfo.stl_life_in_months IS NULL)
520                     AND (X_Stl_Life_In_Months IS NULL)))
521            AND (   (Recinfo.stl_deprn_amount =  X_Stl_Deprn_Amount)
522                 OR (    (Recinfo.stl_deprn_amount IS NULL)
523                     AND (X_Stl_Deprn_Amount IS NULL)))
524            AND (   (Recinfo.attribute1 =  X_Attribute1)
525                 OR (    (Recinfo.attribute1 IS NULL)
526                     AND (X_Attribute1 IS NULL)))
527            AND (   (Recinfo.attribute2 =  X_Attribute2)
528                 OR (    (Recinfo.attribute2 IS NULL)
529                     AND (X_Attribute2 IS NULL)))
530            AND (   (Recinfo.attribute3 =  X_Attribute3)
531                 OR (    (Recinfo.attribute3 IS NULL)
532                     AND (X_Attribute3 IS NULL)))
533            AND (   (Recinfo.attribute4 =  X_Attribute4)
534                 OR (    (Recinfo.attribute4 IS NULL)
535                     AND (X_Attribute4 IS NULL)))
536            AND (   (Recinfo.attribute5 =  X_Attribute5)
537                 OR (    (Recinfo.attribute5 IS NULL)
538                     AND (X_Attribute5 IS NULL)))
539            AND (   (Recinfo.attribute6 =  X_Attribute6)
540                 OR (    (Recinfo.attribute6 IS NULL)
541                     AND (X_Attribute6 IS NULL)))
542            AND (   (Recinfo.attribute7 =  X_Attribute7)
543                 OR (    (Recinfo.attribute7 IS NULL)
544                     AND (X_Attribute7 IS NULL)))
545            AND (   (Recinfo.attribute8 =  X_Attribute8)
546                 OR (    (Recinfo.attribute8 IS NULL)
547                     AND (X_Attribute8 IS NULL)))
548            AND (   (Recinfo.attribute9 =  X_Attribute9)
549                 OR (    (Recinfo.attribute9 IS NULL)
550                     AND (X_Attribute9 IS NULL)))
551            AND (   (Recinfo.attribute10 =  X_Attribute10)
552                 OR (    (Recinfo.attribute10 IS NULL)
553                     AND (X_Attribute10 IS NULL)))
554            AND (   (Recinfo.attribute11 =  X_Attribute11)
555                 OR (    (Recinfo.attribute11 IS NULL)
556                     AND (X_Attribute11 IS NULL)))
557            AND (   (Recinfo.attribute12 =  X_Attribute12)
558                 OR (    (Recinfo.attribute12 IS NULL)
559                     AND (X_Attribute12 IS NULL)))
560            AND (   (Recinfo.attribute13 =  X_Attribute13)
561                 OR (    (Recinfo.attribute13 IS NULL)
562                     AND (X_Attribute13 IS NULL)))
563            AND (   (Recinfo.attribute14 =  X_Attribute14)
564                 OR (    (Recinfo.attribute14 IS NULL)
565                     AND (X_Attribute14 IS NULL)))
566            AND (   (Recinfo.attribute15 =  X_Attribute15)
567                 OR (    (Recinfo.attribute15 IS NULL)
568                     AND (X_Attribute15 IS NULL)))
569            AND (   (Recinfo.attribute_category_code=X_Attribute_Category_Code)
570                 OR (    (Recinfo.attribute_category_code IS NULL)
571                     AND (X_Attribute_Category_Code IS NULL)))
572            AND (   (Recinfo.reval_reserve_retired =  X_Reval_Reserve_Retired)
573                 OR (    (Recinfo.reval_reserve_retired IS NULL)
574                     AND (X_Reval_Reserve_Retired IS NULL)))
575            AND (   (Recinfo.unrevalued_cost_retired =
576                     X_Unrevalued_Cost_Retired)
577                 OR (    (Recinfo.unrevalued_cost_retired IS NULL)
578                     AND (X_Unrevalued_Cost_Retired IS NULL)))
579            AND (   (Recinfo.recognize_gain_loss =
580                     X_Recognize_Gain_Loss)
581                 OR (    (Recinfo.recognize_gain_loss IS NULL)
582                     AND (X_Recognize_Gain_Loss IS NULL)))
583            AND (   (Recinfo.recapture_reserve_flag =
584                     X_Recapture_Reserve_Flag)
585                 OR (    (Recinfo.recapture_reserve_flag IS NULL)
586                     AND (X_Recapture_Reserve_Flag IS NULL)))
587            AND (   (Recinfo.limit_proceeds_flag =
588                     X_Limit_Proceeds_Flag)
589                 OR (    (Recinfo.limit_proceeds_flag IS NULL)
590                     AND (X_Limit_Proceeds_Flag IS NULL)))
591            AND (   (Recinfo.terminal_gain_loss =
592                     X_Terminal_Gain_Loss)
593                 OR (    (Recinfo.terminal_gain_loss IS NULL)
594                     AND (X_Terminal_Gain_Loss IS NULL)))
595            AND (   (Recinfo.reserve_retired =
596                     X_Reserve_Retired)
597                 OR (    (Recinfo.reserve_retired IS NULL)
598                     AND (X_Reserve_Retired IS NULL)))
599            AND (   (Recinfo.reduction_rate =
600                     X_Reduction_Rate)
601                 OR (    (Recinfo.reduction_rate IS NULL)
602                     AND (X_Reduction_Rate IS NULL)))
603            AND (   (Recinfo.eofy_reserve =
604                     X_Eofy_Reserve)
605                 OR (    (Recinfo.eofy_reserve IS NULL)
606                     AND (X_Eofy_Reserve IS NULL)))
607            AND (   (Recinfo.recapture_amount =
608                     X_Recapture_Amount)
609                 OR (    (Recinfo.recapture_amount IS NULL)
610                     AND (X_Recapture_Amount IS NULL)))) then
611       return;
612     else
613       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
614       APP_EXCEPTION.Raise_Exception;
615     end if;
616   END Lock_Row;
617 
618 
619 
620   PROCEDURE Update_Row(X_Rowid                          VARCHAR2,
621                        X_Retirement_Id                  NUMBER   DEFAULT NULL,
622                        X_Book_Type_Code                 VARCHAR2 DEFAULT NULL,
623                        X_Asset_Id                       NUMBER   DEFAULT NULL,
624                        X_Transaction_Header_Id_In       NUMBER   DEFAULT NULL,
625                        X_Date_Retired                   DATE     DEFAULT NULL,
626                        X_Date_Effective                 DATE     DEFAULT NULL,
627                        X_Cost_Retired                   NUMBER   DEFAULT NULL,
628                        X_Status                         VARCHAR2 DEFAULT NULL,
629                        X_Last_Update_Date               DATE     DEFAULT NULL,
630                        X_Last_Updated_By                NUMBER   DEFAULT NULL,
631                        X_Ret_Prorate_Convention         VARCHAR2 DEFAULT NULL,
632                        X_Transaction_Header_Id_Out      NUMBER   DEFAULT NULL,
633                        X_Units                          NUMBER   DEFAULT NULL,
634                        X_Cost_Of_Removal                NUMBER   DEFAULT NULL,
635                        X_Nbv_Retired                    NUMBER   DEFAULT NULL,
636                        X_Gain_Loss_Amount               NUMBER   DEFAULT NULL,
637                        X_Proceeds_Of_Sale               NUMBER   DEFAULT NULL,
638                        X_Gain_Loss_Type_Code            VARCHAR2 DEFAULT NULL,
639                        X_Retirement_Type_Code           VARCHAR2 DEFAULT NULL,
640                        X_Itc_Recaptured                 NUMBER   DEFAULT NULL,
641                        X_Itc_Recapture_Id               NUMBER   DEFAULT NULL,
642                        X_Reference_Num                  VARCHAR2 DEFAULT NULL,
643                        X_Sold_To                        VARCHAR2 DEFAULT NULL,
644                        X_Trade_In_Asset_Id              NUMBER   DEFAULT NULL,
645                        X_Stl_Method_Code                VARCHAR2 DEFAULT NULL,
646                        X_Stl_Life_In_Months             NUMBER   DEFAULT NULL,
647                        X_Stl_Deprn_Amount               NUMBER   DEFAULT NULL,
648                        X_Last_Update_Login              NUMBER   DEFAULT NULL,
649                        X_Attribute1                     VARCHAR2 DEFAULT NULL,
650                        X_Attribute2                     VARCHAR2 DEFAULT NULL,
651                        X_Attribute3                     VARCHAR2 DEFAULT NULL,
652                        X_Attribute4                     VARCHAR2 DEFAULT NULL,
653                        X_Attribute5                     VARCHAR2 DEFAULT NULL,
654                        X_Attribute6                     VARCHAR2 DEFAULT NULL,
655                        X_Attribute7                     VARCHAR2 DEFAULT NULL,
656                        X_Attribute8                     VARCHAR2 DEFAULT NULL,
657                        X_Attribute9                     VARCHAR2 DEFAULT NULL,
658                        X_Attribute10                    VARCHAR2 DEFAULT NULL,
659                        X_Attribute11                    VARCHAR2 DEFAULT NULL,
660                        X_Attribute12                    VARCHAR2 DEFAULT NULL,
661                        X_Attribute13                    VARCHAR2 DEFAULT NULL,
662                        X_Attribute14                    VARCHAR2 DEFAULT NULL,
663                        X_Attribute15                    VARCHAR2 DEFAULT NULL,
664                        X_Attribute_Category_Code        VARCHAR2 DEFAULT NULL,
665                        X_Reval_Reserve_Retired          NUMBER   DEFAULT NULL,
666                        X_Unrevalued_Cost_Retired        NUMBER   DEFAULT NULL,
667                        X_Recognize_Gain_Loss            VARCHAR2 DEFAULT NULL,
668                        X_Recapture_Reserve_Flag         VARCHAR2 DEFAULT NULL,
669                        X_Limit_Proceeds_Flag            VARCHAR2 DEFAULT NULL,
670                        X_Terminal_Gain_Loss             VARCHAR2 DEFAULT NULL,
671                        X_Reserve_Retired                NUMBER   DEFAULT NULL,
672                        X_Eofy_Reserve                   NUMBER   DEFAULT NULL,
673                        X_Reduction_Rate                 NUMBER   DEFAULT NULL,
674                        X_Recapture_Amount               NUMBER   DEFAULT NULL,
675                        X_mrc_sob_type_code              VARCHAR2 DEFAULT 'P',
676                        X_Calling_Fn                     VARCHAR2,
677 		       p_log_level_rec               IN FA_API_TYPES.log_level_rec_type default null) IS
678 
679     l_rowid        ROWID;
680 
681   BEGIN
682 
683     if (X_mrc_sob_type_code = 'R') then
684 
685        if (X_Rowid is null) then
686           select rowid
687           into   l_rowid
688           from   fa_retirements_mrc_v
689           where  retirement_id = X_Retirement_Id;
690        else
691           l_rowid := X_Rowid;
692        end if;
693 
694        UPDATE fa_retirements_mrc_v
695        SET
696           retirement_id                   =     decode(X_Retirement_Id,
697                                                        FND_API.G_MISS_NUM, NULL,
698                                                        NULL,       retirement_id,
699                                                        X_retirement_id),
700           book_type_code                  =     decode(X_Book_Type_Code,
701                                                        FND_API.G_MISS_CHAR, NULL,
702                                                        NULL,       book_type_code,
703                                                        X_book_type_code),
704           asset_id                        =     decode(X_Asset_Id,
705                                                        FND_API.G_MISS_NUM, NULL,
706                                                        NULL,       asset_id,
707                                                        X_asset_id),
708           transaction_header_id_in        =     decode(X_Transaction_Header_Id_In,
709                                                        FND_API.G_MISS_NUM, NULL,
710                                                        NULL,       transaction_header_id_in,
711                                                        X_transaction_header_id_in),
712           /* removed G_MISS_DATE comparison */
713           date_retired                    =     decode(X_Date_Retired,
714                                                        NULL,       date_retired,
715                                                        X_date_retired),
716           date_effective                  =     decode(X_Date_Effective,
717                                                        NULL,       date_effective,
718                                                        X_date_effective),
719 
720           cost_retired                    =     decode(X_Cost_Retired,
721                                                        FND_API.G_MISS_NUM, NULL,
722                                                        NULL,       cost_retired,
723                                                        X_cost_retired),
724           status                          =     decode(X_Status,
725                                                        FND_API.G_MISS_CHAR, NULL,
726                                                        NULL,       status,
727                                                        X_status),
728           /* removed G_MISS_DATE comparison */
729           last_update_date                =     decode(X_Last_Update_Date,
730                                                        NULL,       last_update_date,
731                                                        X_last_update_date),
732           last_updated_by                 =     decode(X_Last_Updated_By,
733                                                        FND_API.G_MISS_NUM, NULL,
734                                                        NULL,       last_updated_by,
735                                                        X_last_updated_by),
736           retirement_prorate_convention   =     decode(X_Ret_Prorate_Convention,
737                                                        FND_API.G_MISS_CHAR, NULL,
738                                                        NULL,       retirement_prorate_convention,
739                                                        X_ret_prorate_convention),
740           transaction_header_id_out       =     decode(X_Transaction_Header_Id_Out,
741                                                        FND_API.G_MISS_NUM, NULL,
742                                                        NULL,       transaction_header_id_out,
743                                                        X_transaction_header_id_out),
744           units                           =     decode(X_Units,
745                                                        FND_API.G_MISS_NUM, NULL,
746                                                        NULL,       units,
747                                                        X_units),
748           cost_of_removal                 =     decode(X_Cost_Of_Removal,
749                                                        FND_API.G_MISS_NUM, NULL,
750                                                        NULL,       cost_of_removal,
751                                                        X_cost_of_removal),
752           nbv_retired                     =     decode(X_Nbv_Retired,
753                                                        FND_API.G_MISS_NUM, NULL,
754                                                        NULL,       nbv_retired,
755                                                        X_nbv_retired),
756           gain_loss_amount                =     decode(X_Gain_Loss_Amount,
757                                                        FND_API.G_MISS_NUM, NULL,
758                                                        NULL,       gain_loss_amount,
759                                                        X_gain_loss_amount),
760           proceeds_of_sale                =     decode(X_Proceeds_Of_Sale,
761                                                        FND_API.G_MISS_NUM, NULL,
762                                                        NULL,       proceeds_of_sale,
763                                                        X_proceeds_of_sale),
764           gain_loss_type_code             =     decode(X_Gain_Loss_Type_Code,
765                                                        FND_API.G_MISS_CHAR, NULL,
766                                                        NULL,       gain_loss_type_code,
767                                                        X_gain_loss_type_code),
768           retirement_type_code            =     decode(X_Retirement_Type_Code,
769                                                        FND_API.G_MISS_CHAR, NULL,
770                                                        NULL,       retirement_type_code,
771                                                        X_retirement_type_code),
772           itc_recaptured                  =     decode(X_Itc_Recaptured,
773                                                        FND_API.G_MISS_NUM, NULL,
774                                                        NULL,       itc_recaptured,
775                                                        X_itc_recaptured),
776           itc_recapture_id                =     decode(X_Itc_Recapture_Id,
777                                                        FND_API.G_MISS_NUM, NULL,
778                                                        NULL,       itc_recapture_id,
779                                                        X_itc_recapture_id),
780           reference_num                   =     decode(X_Reference_Num,
781                                                        FND_API.G_MISS_CHAR, NULL,
782                                                        NULL,       reference_num,
783                                                        X_reference_num),
784           sold_to                         =     decode(X_Sold_To,
785                                                        FND_API.G_MISS_CHAR, NULL,
786                                                        NULL,       sold_to,
787                                                        X_sold_to),
788           trade_in_asset_id               =     decode(X_Trade_In_Asset_Id,
789                                                        FND_API.G_MISS_NUM, NULL,
790                                                        NULL,       trade_in_asset_id,
791                                                        X_trade_in_asset_id),
792           stl_method_code                 =     decode(X_Stl_Method_Code,
793                                                        FND_API.G_MISS_CHAR, NULL,
794                                                        NULL,       stl_method_code,
795                                                        X_stl_method_code),
796           stl_life_in_months              =     decode(X_Stl_Life_In_Months,
797                                                        FND_API.G_MISS_NUM, NULL,
798                                                        NULL,       stl_life_in_months,
799                                                        X_stl_life_in_months),
800           stl_deprn_amount                =     decode(X_Stl_Deprn_Amount,
801                                                        FND_API.G_MISS_NUM, NULL,
802                                                        NULL,       stl_deprn_amount,
803                                                        X_stl_deprn_amount),
804           last_update_login               =     decode(X_Last_Update_Login,
805                                                        FND_API.G_MISS_NUM, NULL,
806                                                        NULL,       last_update_login,
807                                                        X_last_update_login),
808           attribute1                      =     decode(X_Attribute1,
809                                                        FND_API.G_MISS_CHAR, NULL,
810                                                        NULL,       attribute1,
811                                                        X_attribute1),
812           attribute2                      =     decode(X_Attribute2,
813                                                        FND_API.G_MISS_CHAR, NULL,
814                                                        NULL,       attribute2,
815                                                        X_attribute2),
816           attribute3                      =     decode(X_Attribute3,
817                                                        FND_API.G_MISS_CHAR, NULL,
818                                                        NULL,       attribute3,
819                                                        X_attribute3),
820           attribute4                      =     decode(X_Attribute4,
821                                                        FND_API.G_MISS_CHAR, NULL,
822                                                        NULL,       attribute4,
823                                                        X_attribute4),
824           attribute5                      =     decode(X_Attribute5,
825                                                        FND_API.G_MISS_CHAR, NULL,
826                                                        NULL,       attribute5,
827                                                        X_attribute5),
828           attribute6                      =     decode(X_Attribute6,
829                                                        FND_API.G_MISS_CHAR, NULL,
830                                                        NULL,       attribute6,
831                                                        X_attribute6),
832           attribute7                      =     decode(X_Attribute7,
833                                                        FND_API.G_MISS_CHAR, NULL,
834                                                        NULL,       attribute7,
835                                                        X_attribute7),
836           attribute8                      =     decode(X_Attribute8,
837                                                        FND_API.G_MISS_CHAR, NULL,
838                                                        NULL,       attribute8,
839                                                        X_attribute8),
840           attribute9                      =     decode(X_Attribute9,
841                                                        FND_API.G_MISS_CHAR, NULL,
842                                                        NULL,       attribute9,
843                                                        X_attribute9),
844           attribute10                     =     decode(X_Attribute10,
845                                                        FND_API.G_MISS_CHAR, NULL,
846                                                        NULL,       attribute10,
847                                                        X_attribute10),
848           attribute11                     =     decode(X_Attribute11,
849                                                        FND_API.G_MISS_CHAR, NULL,
850                                                        NULL,       attribute11,
851                                                        X_attribute11),
852           attribute12                     =     decode(X_Attribute12,
853                                                        FND_API.G_MISS_CHAR, NULL,
854                                                        NULL,       attribute12,
855                                                        X_attribute12),
856           attribute13                     =     decode(X_Attribute13,
857                                                        FND_API.G_MISS_CHAR, NULL,
858                                                        NULL,       attribute13,
859                                                        X_attribute13),
860           attribute14                     =     decode(X_Attribute14,
861                                                        FND_API.G_MISS_CHAR, NULL,
862                                                        NULL,       attribute14,
863                                                        X_attribute14),
864           attribute15                     =     decode(X_Attribute15,
865                                                        FND_API.G_MISS_CHAR, NULL,
866                                                        NULL,       attribute15,
867                                                        X_attribute15),
868           attribute_category_code         =     decode(X_Attribute_Category_Code,
869                                                        FND_API.G_MISS_CHAR, NULL,
870                                                        NULL,       attribute_category_code,
871                                                        X_attribute_category_code),
872           reval_reserve_retired           =     decode(X_Reval_Reserve_Retired,
873                                                        FND_API.G_MISS_NUM, NULL,
874                                                        NULL,       reval_reserve_retired,
875                                                        X_reval_reserve_retired),
876           unrevalued_cost_retired         =     decode(X_Unrevalued_Cost_Retired,
877                                                        FND_API.G_MISS_NUM, NULL,
878                                                        NULL,       unrevalued_cost_retired,
879                                                        X_unrevalued_cost_retired),
880           recognize_gain_loss             =     decode(X_Recognize_Gain_Loss,
881                                                        FND_API.G_MISS_CHAR, NULL,
882                                                        NULL,       recognize_gain_loss,
883                                                        X_Recognize_Gain_Loss),
884           recapture_reserve_flag          =     decode(X_Recapture_Reserve_Flag,
885                                                        FND_API.G_MISS_CHAR, NULL,
886                                                        NULL,       recapture_reserve_flag,
887                                                        X_Recapture_Reserve_Flag),
888           limit_proceeds_flag             =     decode(X_Limit_Proceeds_Flag,
889                                                        FND_API.G_MISS_CHAR, NULL,
890                                                        NULL,       limit_proceeds_flag,
891                                                        X_Limit_Proceeds_Flag),
892           terminal_gain_loss              =     decode(X_Terminal_Gain_Loss,
893                                                        FND_API.G_MISS_CHAR, NULL,
894                                                        NULL,       terminal_gain_loss,
895                                                        X_Terminal_Gain_Loss),
896           reserve_retired                 =     decode(X_Reserve_Retired,
897                                                        FND_API.G_MISS_NUM, NULL,
898                                                        NULL,       reserve_retired,
899                                                        X_Reserve_Retired),
900           reduction_rate                  =     decode(X_Reduction_Rate,
901                                                        FND_API.G_MISS_NUM, NULL,
902                                                        NULL,       reduction_rate,
903                                                        X_Reduction_Rate),
904           eofy_reserve                    =     decode(X_Eofy_Reserve,
905                                                        FND_API.G_MISS_NUM, NULL,
906                                                        NULL,       eofy_reserve,
907                                                        X_Eofy_Reserve),
908           recapture_amount                =     decode(X_Recapture_Amount,
909                                                        FND_API.G_MISS_NUM, NULL,
910                                                        NULL,       recapture_amount,
911                                                        X_Recapture_Amount)
912        WHERE rowid = l_rowid;
913     else
914 
915        if (X_Rowid is null) then
916           select rowid
917           into   l_rowid
918           from   fa_retirements
919           where  retirement_id = X_Retirement_Id;
920        else
921           l_rowid := X_Rowid;
922        end if;
923 
924        UPDATE fa_retirements
925        SET
926           retirement_id                   =     decode(X_Retirement_Id,
927                                                        FND_API.G_MISS_NUM, NULL,
928                                                        NULL,       retirement_id,
929                                                        X_retirement_id),
930           book_type_code                  =     decode(X_Book_Type_Code,
931                                                        FND_API.G_MISS_CHAR, NULL,
932                                                        NULL,       book_type_code,
933                                                        X_book_type_code),
934           asset_id                        =     decode(X_Asset_Id,
935                                                        FND_API.G_MISS_NUM, NULL,
936                                                        NULL,       asset_id,
937                                                        X_asset_id),
938           transaction_header_id_in        =     decode(X_Transaction_Header_Id_In,
939                                                        FND_API.G_MISS_NUM, NULL,
940                                                        NULL,       transaction_header_id_in,
941                                                        X_transaction_header_id_in),
942           /* removed G_MISS_DATE comparison */
943           date_retired                    =     decode(X_Date_Retired,
944                                                        NULL,       date_retired,
945                                                        X_date_retired),
946           /* removed G_MISS_DATE comparison */
947           date_effective                  =     decode(X_Date_Effective,
948                                                        NULL, date_effective,
949                                                        X_Date_Effective),
950           cost_retired                    =     decode(X_Cost_Retired,
951                                                        FND_API.G_MISS_NUM, NULL,
952                                                        NULL,       cost_retired,
953                                                        X_cost_retired),
954           status                          =     decode(X_Status,
955                                                        FND_API.G_MISS_CHAR, NULL,
956                                                        NULL,       status,
957                                                        X_status),
958           /* removed G_MISS_DATE comparison */
959           last_update_date                =     decode(X_Last_Update_Date,
960                                                        NULL,       last_update_date,
961                                                        X_last_update_date),
962           last_updated_by                 =     decode(X_Last_Updated_By,
963                                                        FND_API.G_MISS_NUM, NULL,
964                                                        NULL,       last_updated_by,
965                                                        X_last_updated_by),
966           retirement_prorate_convention   =     decode(X_Ret_Prorate_Convention,
967                                                        FND_API.G_MISS_CHAR, NULL,
968                                                        NULL,       retirement_prorate_convention,
969                                                        X_ret_prorate_convention),
970           transaction_header_id_out       =     decode(X_Transaction_Header_Id_Out,
971                                                        FND_API.G_MISS_NUM, NULL,
972                                                        NULL,       transaction_header_id_out,
973                                                        X_transaction_header_id_out),
974           units                           =     decode(X_Units,
975                                                        FND_API.G_MISS_NUM, NULL,
976                                                        NULL,       units,
977                                                        X_units),
978           cost_of_removal                 =     decode(X_Cost_Of_Removal,
979                                                        FND_API.G_MISS_NUM, NULL,
980                                                        NULL,       cost_of_removal,
981                                                        X_cost_of_removal),
982           nbv_retired                     =     decode(X_Nbv_Retired,
983                                                        FND_API.G_MISS_NUM, NULL,
984                                                        NULL,       nbv_retired,
985                                                        X_nbv_retired),
986           gain_loss_amount                =     decode(X_Gain_Loss_Amount,
987                                                        FND_API.G_MISS_NUM, NULL,
988                                                        NULL,       gain_loss_amount,
989                                                        X_gain_loss_amount),
990           proceeds_of_sale                =     decode(X_Proceeds_Of_Sale,
991                                                        FND_API.G_MISS_NUM, NULL,
992                                                        NULL,       proceeds_of_sale,
993                                                        X_proceeds_of_sale),
994           gain_loss_type_code             =     decode(X_Gain_Loss_Type_Code,
995                                                        FND_API.G_MISS_CHAR, NULL,
996                                                        NULL,       gain_loss_type_code,
997                                                        X_gain_loss_type_code),
998           retirement_type_code            =     decode(X_Retirement_Type_Code,
999                                                        FND_API.G_MISS_CHAR, NULL,
1000                                                        NULL,       retirement_type_code,
1001                                                        X_retirement_type_code),
1002           itc_recaptured                  =     decode(X_Itc_Recaptured,
1003                                                        FND_API.G_MISS_NUM, NULL,
1004                                                        NULL,       itc_recaptured,
1005                                                        X_itc_recaptured),
1006           itc_recapture_id                =     decode(X_Itc_Recapture_Id,
1007                                                        FND_API.G_MISS_NUM, NULL,
1008                                                        NULL,       itc_recapture_id,
1009                                                        X_itc_recapture_id),
1010           reference_num                   =     decode(X_Reference_Num,
1011                                                        FND_API.G_MISS_CHAR, NULL,
1012                                                        NULL,       reference_num,
1013                                                        X_reference_num),
1014           sold_to                         =     decode(X_Sold_To,
1015                                                        FND_API.G_MISS_CHAR, NULL,
1016                                                        NULL,       sold_to,
1017                                                        X_sold_to),
1018           trade_in_asset_id               =     decode(X_Trade_In_Asset_Id,
1019                                                        FND_API.G_MISS_NUM, NULL,
1020                                                        NULL,       trade_in_asset_id,
1021                                                        X_trade_in_asset_id),
1022           stl_method_code                 =     decode(X_Stl_Method_Code,
1023                                                        FND_API.G_MISS_CHAR, NULL,
1024                                                        NULL,       stl_method_code,
1025                                                        X_stl_method_code),
1026           stl_life_in_months              =     decode(X_Stl_Life_In_Months,
1027                                                        FND_API.G_MISS_NUM, NULL,
1028                                                        NULL,       stl_life_in_months,
1029                                                        X_stl_life_in_months),
1030           stl_deprn_amount                =     decode(X_Stl_Deprn_Amount,
1031                                                        FND_API.G_MISS_NUM, NULL,
1032                                                        NULL,       stl_deprn_amount,
1033                                                        X_stl_deprn_amount),
1034           last_update_login               =     decode(X_Last_Update_Login,
1035                                                        FND_API.G_MISS_NUM, NULL,
1036                                                        NULL,       last_update_login,
1037                                                        X_last_update_login),
1038           attribute1                      =     decode(X_Attribute1,
1039                                                        FND_API.G_MISS_CHAR, NULL,
1040                                                        NULL,       attribute1,
1041                                                        X_attribute1),
1042           attribute2                      =     decode(X_Attribute2,
1043                                                        FND_API.G_MISS_CHAR, NULL,
1044                                                        NULL,       attribute2,
1045                                                        X_attribute2),
1046           attribute3                      =     decode(X_Attribute3,
1047                                                        FND_API.G_MISS_CHAR, NULL,
1048                                                        NULL,       attribute3,
1049                                                        X_attribute3),
1050           attribute4                      =     decode(X_Attribute4,
1051                                                        FND_API.G_MISS_CHAR, NULL,
1052                                                        NULL,       attribute4,
1053                                                        X_attribute4),
1054           attribute5                      =     decode(X_Attribute5,
1055                                                        FND_API.G_MISS_CHAR, NULL,
1056                                                        NULL,       attribute5,
1057                                                        X_attribute5),
1058           attribute6                      =     decode(X_Attribute6,
1059                                                        FND_API.G_MISS_CHAR, NULL,
1060                                                        NULL,       attribute6,
1061                                                        X_attribute6),
1062           attribute7                      =     decode(X_Attribute7,
1063                                                        FND_API.G_MISS_CHAR, NULL,
1064                                                        NULL,       attribute7,
1065                                                        X_attribute7),
1066           attribute8                      =     decode(X_Attribute8,
1067                                                        FND_API.G_MISS_CHAR, NULL,
1068                                                        NULL,       attribute8,
1069                                                        X_attribute8),
1070           attribute9                      =     decode(X_Attribute9,
1071                                                        FND_API.G_MISS_CHAR, NULL,
1072                                                        NULL,       attribute9,
1073                                                        X_attribute9),
1074           attribute10                     =     decode(X_Attribute10,
1075                                                        FND_API.G_MISS_CHAR, NULL,
1076                                                        NULL,       attribute10,
1077                                                        X_attribute10),
1078           attribute11                     =     decode(X_Attribute11,
1079                                                        FND_API.G_MISS_CHAR, NULL,
1080                                                        NULL,       attribute11,
1081                                                        X_attribute11),
1082           attribute12                     =     decode(X_Attribute12,
1083                                                        FND_API.G_MISS_CHAR, NULL,
1084                                                        NULL,       attribute12,
1085                                                        X_attribute12),
1086           attribute13                     =     decode(X_Attribute13,
1087                                                        FND_API.G_MISS_CHAR, NULL,
1088                                                        NULL,       attribute13,
1089                                                        X_attribute13),
1090           attribute14                     =     decode(X_Attribute14,
1091                                                        FND_API.G_MISS_CHAR, NULL,
1092                                                        NULL,       attribute14,
1093                                                        X_attribute14),
1094           attribute15                     =     decode(X_Attribute15,
1095                                                        FND_API.G_MISS_CHAR, NULL,
1096                                                        NULL,       attribute15,
1097                                                        X_attribute15),
1098           attribute_category_code         =     decode(X_Attribute_Category_Code,
1099                                                        FND_API.G_MISS_CHAR, NULL,
1100                                                        NULL,       attribute_category_code,
1101                                                        X_attribute_category_code),
1102           reval_reserve_retired           =     decode(X_Reval_Reserve_Retired,
1103                                                        FND_API.G_MISS_NUM, NULL,
1104                                                        NULL,       reval_reserve_retired,
1105                                                        X_reval_reserve_retired),
1106           unrevalued_cost_retired         =     decode(X_Unrevalued_Cost_Retired,
1107                                                        FND_API.G_MISS_NUM, NULL,
1108                                                        NULL,       unrevalued_cost_retired,
1109                                                        X_unrevalued_cost_retired),
1110           recognize_gain_loss             =     decode(X_Recognize_Gain_Loss,
1111                                                        FND_API.G_MISS_CHAR, NULL,
1112                                                        NULL,       recognize_gain_loss,
1113                                                        X_Recognize_Gain_Loss),
1114           recapture_reserve_flag          =     decode(X_Recapture_Reserve_Flag,
1115                                                        FND_API.G_MISS_CHAR, NULL,
1116                                                        NULL,       recapture_reserve_flag,
1117                                                        X_Recapture_Reserve_Flag),
1118           limit_proceeds_flag             =     decode(X_Limit_Proceeds_Flag,
1119                                                        FND_API.G_MISS_CHAR, NULL,
1120                                                        NULL,       limit_proceeds_flag,
1121                                                        X_Limit_Proceeds_Flag),
1122           terminal_gain_loss              =     decode(X_Terminal_Gain_Loss,
1123                                                        FND_API.G_MISS_CHAR, NULL,
1124                                                        NULL,       terminal_gain_loss,
1125                                                        X_Terminal_Gain_Loss),
1126           reserve_retired                 =     decode(X_Reserve_Retired,
1127                                                        FND_API.G_MISS_NUM, NULL,
1128                                                        NULL,       reserve_retired,
1129                                                        X_Reserve_Retired),
1130           reduction_rate                  =     decode(X_Reduction_Rate,
1131                                                        FND_API.G_MISS_NUM, NULL,
1132                                                        NULL,       reduction_rate,
1133                                                        X_Reduction_Rate),
1134           eofy_reserve                    =     decode(X_Eofy_Reserve,
1135                                                        FND_API.G_MISS_NUM, NULL,
1136                                                        NULL,       eofy_reserve,
1137                                                        X_Eofy_Reserve),
1138           recapture_amount                =     decode(X_Recapture_Amount,
1139                                                        FND_API.G_MISS_NUM, NULL,
1140                                                        NULL,       recapture_amount,
1141                                                        X_Recapture_Amount)
1142        WHERE rowid = l_rowid;
1143     end if;
1144 
1145 
1146     if (SQL%NOTFOUND) then
1147       Raise NO_DATA_FOUND;
1148     end if;
1149   EXCEPTION
1150     WHEN Others THEN
1151          fa_srvr_msg.add_sql_error(
1152                 CALLING_FN  => 'FA_RETIREMENTS_PKG.UPDATE_ROW'
1153                 ,p_log_level_rec => p_log_level_rec);
1154          raise;
1155   END Update_Row;
1156 
1157   --
1158 
1159   PROCEDURE Delete_Row(X_Rowid VARCHAR2,
1160                        X_mrc_sob_type_code  VARCHAR2 DEFAULT 'P',
1161                        X_Calling_Fn     VARCHAR2,
1162 			p_log_level_rec  IN FA_API_TYPES.log_level_rec_type default null) IS
1163 
1164   BEGIN
1165 
1166     if (X_mrc_sob_type_code = 'R') then
1167        DELETE FROM fa_retirements_mrc_v
1168        WHERE rowid = X_Rowid;
1169     else
1170        DELETE FROM fa_retirements
1171        WHERE rowid = X_Rowid;
1172     end if;
1173 
1174     if (SQL%NOTFOUND) then
1175       Raise NO_DATA_FOUND;
1176     end if;
1177   EXCEPTION
1178       WHEN Others THEN
1179            fa_srvr_msg.add_sql_error(
1180                 CALLING_FN  => 'FA_RETIREMENTS_PKG.DELETE_ROW'
1181                 ,p_log_level_rec => p_log_level_rec);
1182            raise;
1183   END Delete_Row;
1184 --
1185 END FA_RETIREMENTS_PKG;