DBA Data[Home] [Help]

PACKAGE BODY: APPS.FA_RETIREMENTS_PKG

Source


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