DBA Data[Home] [Help]

PACKAGE BODY: APPS.FA_ASSET_INVOICES_PKG

Source


1 PACKAGE BODY FA_ASSET_INVOICES_PKG as
2 /* $Header: faxiaib.pls 120.7 2005/07/25 09:59:12 yyoon ship $ */
3 
4   PROCEDURE Insert_Row(X_Rowid                   IN OUT NOCOPY VARCHAR2,
5                        X_Asset_Id                       NUMBER,
6                        X_Po_Vendor_Id                   NUMBER DEFAULT NULL,
7                        X_Asset_Invoice_Id        IN OUT NOCOPY NUMBER,
8                        X_Fixed_Assets_Cost              NUMBER DEFAULT NULL,
9                        X_Date_Effective                 DATE,
10                        X_Date_Ineffective               DATE DEFAULT NULL,
11                        X_Invoice_Transaction_Id_In      NUMBER DEFAULT NULL,
12                        X_Invoice_Transaction_Id_Out     NUMBER DEFAULT NULL,
13                        X_Deleted_Flag                   VARCHAR2,
14                        X_Po_Number                      VARCHAR2 DEFAULT NULL,
15                        X_Invoice_Number                 VARCHAR2 DEFAULT NULL,
16                        X_Payables_Batch_Name            VARCHAR2 DEFAULT NULL,
17                        X_Payables_Code_Combination_Id   NUMBER DEFAULT NULL,
18                        X_Feeder_System_Name             VARCHAR2 DEFAULT NULL,
19                        X_Create_Batch_Date              DATE DEFAULT NULL,
20                        X_Create_Batch_Id                NUMBER DEFAULT NULL,
21                        X_Invoice_Date                   DATE DEFAULT NULL,
22                        X_Payables_Cost                  NUMBER DEFAULT NULL,
23                        X_Post_Batch_Id                  NUMBER DEFAULT NULL,
24                        X_Invoice_Id                     NUMBER DEFAULT NULL,
25                        X_Ap_Distribution_Line_Number    NUMBER DEFAULT NULL,
26                        X_Payables_Units                 NUMBER DEFAULT NULL,
27                        X_Split_Merged_Code              VARCHAR2 DEFAULT NULL,
28                        X_Description                    VARCHAR2 DEFAULT NULL,
29                        X_Parent_Mass_Addition_Id        VARCHAR2 DEFAULT NULL,
30                        X_Last_Update_Date               DATE,
31                        X_Last_Updated_By                NUMBER,
32                        X_Created_By                     NUMBER DEFAULT NULL,
33                        X_Creation_Date                  DATE DEFAULT NULL,
34                        X_Last_Update_Login              NUMBER DEFAULT NULL,
35                        X_Attribute1                     VARCHAR2 DEFAULT NULL,
36                        X_Attribute2                     VARCHAR2 DEFAULT NULL,
37                        X_Attribute3                     VARCHAR2 DEFAULT NULL,
38                        X_Attribute4                     VARCHAR2 DEFAULT NULL,
39                        X_Attribute5                     VARCHAR2 DEFAULT NULL,
40                        X_Attribute6                     VARCHAR2 DEFAULT NULL,
41                        X_Attribute7                     VARCHAR2 DEFAULT NULL,
42                        X_Attribute8                     VARCHAR2 DEFAULT NULL,
43                        X_Attribute9                     VARCHAR2 DEFAULT NULL,
44                        X_Attribute10                    VARCHAR2 DEFAULT NULL,
45                        X_Attribute11                    VARCHAR2 DEFAULT NULL,
46                        X_Attribute12                    VARCHAR2 DEFAULT NULL,
47                        X_Attribute13                    VARCHAR2 DEFAULT NULL,
48                        X_Attribute14                    VARCHAR2 DEFAULT NULL,
49                        X_Attribute15                    VARCHAR2 DEFAULT NULL,
50                        X_Attribute_Category_Code        VARCHAR2 DEFAULT NULL,
51                        X_Unrevalued_Cost                NUMBER DEFAULT NULL,
52                        X_Merged_Code                    VARCHAR2 DEFAULT NULL,
53                        X_Split_Code                     VARCHAR2 DEFAULT NULL,
54                        X_Merge_Parent_Mass_Add_Id       NUMBER DEFAULT NULL,
55                        X_Split_Parent_Mass_Add_Id       NUMBER DEFAULT NULL,
56                        X_Project_Asset_Line_Id          NUMBER DEFAULT NULL,
57                        X_Project_Id                     NUMBER DEFAULT NULL,
58                        X_Task_Id                        NUMBER DEFAULT NULL,
59                        X_Material_Indicator_Flag        VARCHAR2 DEFAULT NULL,
60                        X_source_line_id          IN OUT NOCOPY NUMBER,
61                        X_prior_source_line_id           NUMBER DEFAULT NULL,
62                        X_depreciate_in_group_flag       VARCHAR2 DEFAULT NULL,
63                        X_invoice_distribution_id        NUMBER DEFAULT NULL,
64                        X_invoice_line_number            NUMBER DEFAULT NULL,
65                        X_po_distribution_id             NUMBER DEFAULT NULL,
66                        X_exchange_rate                  NUMBER DEFAULT NULL,
67                        X_mrc_sob_type_code              VARCHAR2 DEFAULT 'P',
68                        X_Calling_Fn                     VARCHAR2,
69                p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type default null) IS
70     CURSOR C_ai IS SELECT rowid FROM fa_asset_invoices
71                  WHERE source_line_id = X_source_line_id;
72 
73     CURSOR C_ai_mc IS SELECT rowid FROM fa_asset_invoices_mrc_v
74                  WHERE source_line_id = X_source_line_id;
75 
76     CURSOR C2 IS SELECT fa_mass_additions_s.nextval FROM sys.dual;
77 
78     CURSOR C3 is select FA_ASSET_INVOICES_S.NEXTVAL from sys.dual;
79 
80    BEGIN
81 
82       if (X_mrc_sob_type_code = 'R') then
83 
84          INSERT INTO fa_asset_invoices_mrc_v(
85               asset_id,
86               po_vendor_id,
87               asset_invoice_id,
88               fixed_assets_cost,
89               date_effective,
90               date_ineffective,
91               invoice_transaction_id_in,
92               invoice_transaction_id_out,
93               deleted_flag,
94               po_number,
95               invoice_number,
96               payables_batch_name,
97               payables_code_combination_id,
98               feeder_system_name,
99               create_batch_date,
100               create_batch_id,
101               invoice_date,
102               payables_cost,
103               post_batch_id,
104               invoice_id,
105               ap_distribution_line_number,
106               payables_units,
107               split_merged_code,
108               description,
109               parent_mass_addition_id,
110               last_update_date,
111               last_updated_by,
112               created_by,
113               creation_date,
114               last_update_login,
115               attribute1,
116               attribute2,
117               attribute3,
118               attribute4,
119               attribute5,
120               attribute6,
121               attribute7,
122               attribute8,
123               attribute9,
124               attribute10,
125               attribute11,
126               attribute12,
127               attribute13,
128               attribute14,
129               attribute15,
130               attribute_category_code,
131               unrevalued_cost,
132               merged_code,
133               split_code,
134               merge_parent_mass_additions_id,
135               split_parent_mass_additions_id,
136               project_asset_line_id,
137               project_id,
138               task_id,
139               source_line_id,
140               prior_source_line_id,
141               depreciate_in_group_flag,
142               material_indicator_flag,
143               invoice_distribution_id,
144               invoice_line_number,
145               po_distribution_id,
146               exchange_rate
147              ) VALUES (
148               X_Asset_Id,
149               X_Po_Vendor_Id,
150               X_Asset_Invoice_Id,
151               X_Fixed_Assets_Cost,
152               X_Date_Effective,
153               X_Date_Ineffective,
154               X_Invoice_Transaction_Id_In,
155               X_Invoice_Transaction_Id_Out,
156               X_Deleted_Flag,
157               X_Po_Number,
158               X_Invoice_Number,
159               X_Payables_Batch_Name,
160               X_Payables_Code_Combination_Id,
161               X_Feeder_System_Name,
162               X_Create_Batch_Date,
163               X_Create_Batch_Id,
164               X_Invoice_Date,
165               X_Payables_Cost,
166               X_Post_Batch_Id,
167               X_Invoice_Id,
168               X_Ap_Distribution_Line_Number,
169               X_Payables_Units,
170               X_Split_Merged_Code,
171               X_Description,
172               X_Parent_Mass_Addition_Id,
173               X_Last_Update_Date,
174               X_Last_Updated_By,
175               X_Created_By,
176               X_Creation_Date,
177               X_Last_Update_Login,
178               X_Attribute1,
179               X_Attribute2,
180               X_Attribute3,
181               X_Attribute4,
182               X_Attribute5,
183               X_Attribute6,
184               X_Attribute7,
185               X_Attribute8,
186               X_Attribute9,
187               X_Attribute10,
188               X_Attribute11,
189               X_Attribute12,
190               X_Attribute13,
191               X_Attribute14,
192               X_Attribute15,
193               X_Attribute_Category_Code,
194               X_Unrevalued_Cost,
195               X_Merged_Code,
196               X_Split_Code,
197               X_Merge_Parent_Mass_Add_Id,
198               X_Split_Parent_Mass_Add_Id,
199               X_Project_Asset_Line_Id,
200               X_Project_Id,
201               X_Task_Id,
202               X_source_line_id,
203               X_prior_source_line_id,
204               X_depreciate_in_group_flag,
205               X_material_indicator_flag,
206               X_invoice_distribution_id,
207               X_invoice_line_number,
208               X_po_distribution_id,
209               X_exchange_rate
210              );
211 
212           OPEN C_ai_mc;
213           FETCH C_ai_mc INTO X_Rowid;
214           if (C_ai_mc%NOTFOUND) then
215              CLOSE C_ai_mc;
216              Raise NO_DATA_FOUND;
217           end if;
218           CLOSE C_ai_mc;
219 
220 
221       else
222 
223          if (X_Asset_Invoice_Id is NULL) then
224            OPEN C2;
225            FETCH C2 INTO X_Asset_Invoice_Id;
226            CLOSE C2;
227          end if;
228 
229          if (X_Source_Line_Id is NULL) then
230             OPEN C3;
231             FETCH C3 INTO X_Source_Line_Id;
232             CLOSE C3;
233          end if;
234 
235 
236          INSERT INTO fa_asset_invoices(
237               asset_id,
238               po_vendor_id,
239               asset_invoice_id,
240               fixed_assets_cost,
241               date_effective,
242               date_ineffective,
243               invoice_transaction_id_in,
244               invoice_transaction_id_out,
245               deleted_flag,
246               po_number,
247               invoice_number,
248               payables_batch_name,
249               payables_code_combination_id,
250               feeder_system_name,
251               create_batch_date,
252               create_batch_id,
253               invoice_date,
254               payables_cost,
255               post_batch_id,
256               invoice_id,
257               ap_distribution_line_number,
258               payables_units,
259               split_merged_code,
260               description,
261               parent_mass_addition_id,
262               last_update_date,
263               last_updated_by,
264               created_by,
265               creation_date,
266               last_update_login,
267               attribute1,
268               attribute2,
269               attribute3,
270               attribute4,
271               attribute5,
272               attribute6,
273               attribute7,
274               attribute8,
275               attribute9,
276               attribute10,
277               attribute11,
278               attribute12,
279               attribute13,
280               attribute14,
281               attribute15,
282               attribute_category_code,
283               unrevalued_cost,
284               merged_code,
285               split_code,
286               merge_parent_mass_additions_id,
287               split_parent_mass_additions_id,
288               project_asset_line_id,
289               project_id,
290               task_id,
291               source_line_id,
292               prior_source_line_id,
293               depreciate_in_group_flag,
294               material_indicator_flag,
295               invoice_distribution_id,
296               invoice_line_number,
297               po_distribution_id
298              ) VALUES (
299               X_Asset_Id,
300               X_Po_Vendor_Id,
301               X_Asset_Invoice_Id,
302               X_Fixed_Assets_Cost,
303               X_Date_Effective,
304               X_Date_Ineffective,
305               X_Invoice_Transaction_Id_In,
306               X_Invoice_Transaction_Id_Out,
307               X_Deleted_Flag,
308               X_Po_Number,
309               X_Invoice_Number,
310               X_Payables_Batch_Name,
311               X_Payables_Code_Combination_Id,
312               X_Feeder_System_Name,
313               X_Create_Batch_Date,
314               X_Create_Batch_Id,
315               X_Invoice_Date,
316               X_Payables_Cost,
317               X_Post_Batch_Id,
318               X_Invoice_Id,
319               X_Ap_Distribution_Line_Number,
320               X_Payables_Units,
321               X_Split_Merged_Code,
322               X_Description,
323               X_Parent_Mass_Addition_Id,
324               X_Last_Update_Date,
325               X_Last_Updated_By,
326               X_Created_By,
327               X_Creation_Date,
328               X_Last_Update_Login,
329               X_Attribute1,
330               X_Attribute2,
331               X_Attribute3,
332               X_Attribute4,
333               X_Attribute5,
334               X_Attribute6,
335               X_Attribute7,
336               X_Attribute8,
337               X_Attribute9,
338               X_Attribute10,
339               X_Attribute11,
340               X_Attribute12,
341               X_Attribute13,
342               X_Attribute14,
343               X_Attribute15,
344               X_Attribute_Category_Code,
345               X_Unrevalued_Cost,
346               X_Merged_Code,
347               X_Split_Code,
348               X_Merge_Parent_Mass_Add_Id,
349               X_Split_Parent_Mass_Add_Id,
350               X_Project_Asset_Line_Id,
351               X_Project_Id,
352               X_Task_Id,
353               X_source_line_id,
354               X_prior_source_line_id,
355               X_depreciate_in_group_flag,
356               X_material_indicator_flag,
357               X_invoice_distribution_id,
358               X_invoice_line_number,
359               X_po_distribution_id
360              );
361 
362           OPEN C_ai;
363           FETCH C_ai INTO X_Rowid;
364           if (C_ai%NOTFOUND) then
365              CLOSE C_ai;
366              Raise NO_DATA_FOUND;
367           end if;
368           CLOSE C_ai;
369 
370       end if;
371 
372   exception
373     when others then
374          FA_SRVR_MSG.Add_SQL_Error(Calling_fn =>
375                          'fa_asset_invoices_pkg.insert_row'
376                          ,p_log_level_rec => p_log_level_rec);
377          raise;
378   END Insert_Row;
379 
380 
381   PROCEDURE Lock_Row(X_Rowid                            VARCHAR2,
382                      X_Asset_Id                         NUMBER,
383                      X_Po_Vendor_Id                     NUMBER DEFAULT NULL,
384                      X_Asset_Invoice_Id                 NUMBER DEFAULT NULL,
385                      X_Fixed_Assets_Cost                NUMBER DEFAULT NULL,
386                      X_Date_Effective                   DATE,
390                      X_Deleted_Flag                     VARCHAR2,
387                      X_Date_Ineffective                 DATE DEFAULT NULL,
388                      X_Invoice_Transaction_Id_In        NUMBER DEFAULT NULL,
389                      X_Invoice_Transaction_Id_Out       NUMBER DEFAULT NULL,
391                      X_Po_Number                        VARCHAR2 DEFAULT NULL,
392                      X_Invoice_Number                   VARCHAR2 DEFAULT NULL,
393                      X_Payables_Batch_Name              VARCHAR2 DEFAULT NULL,
394                      X_Payables_Code_Combination_Id     NUMBER DEFAULT NULL,
395                      X_Feeder_System_Name               VARCHAR2 DEFAULT NULL,
396                      X_Create_Batch_Date                DATE DEFAULT NULL,
397                      X_Create_Batch_Id                  NUMBER DEFAULT NULL,
398                      X_Invoice_Date                     DATE DEFAULT NULL,
399                      X_Payables_Cost                    NUMBER DEFAULT NULL,
400                      X_Post_Batch_Id                    NUMBER DEFAULT NULL,
401                      X_Invoice_Id                       NUMBER DEFAULT NULL,
402                      X_Ap_Distribution_Line_Number      NUMBER DEFAULT NULL,
403                      X_Payables_Units                   NUMBER DEFAULT NULL,
404                      X_Split_Merged_Code                VARCHAR2 DEFAULT NULL,
405                      X_Description                      VARCHAR2 DEFAULT NULL,
406                      X_Parent_Mass_Addition_Id          VARCHAR2 DEFAULT NULL,
407                      X_Attribute1                       VARCHAR2 DEFAULT NULL,
408                      X_Attribute2                       VARCHAR2 DEFAULT NULL,
409                      X_Attribute3                       VARCHAR2 DEFAULT NULL,
410                      X_Attribute4                       VARCHAR2 DEFAULT NULL,
411                      X_Attribute5                       VARCHAR2 DEFAULT NULL,
412                      X_Attribute6                       VARCHAR2 DEFAULT NULL,
413                      X_Attribute7                       VARCHAR2 DEFAULT NULL,
414                      X_Attribute8                       VARCHAR2 DEFAULT NULL,
415                      X_Attribute9                       VARCHAR2 DEFAULT NULL,
416                      X_Attribute10                      VARCHAR2 DEFAULT NULL,
417                      X_Attribute11                      VARCHAR2 DEFAULT NULL,
418                      X_Attribute12                      VARCHAR2 DEFAULT NULL,
419                      X_Attribute13                      VARCHAR2 DEFAULT NULL,
420                      X_Attribute14                      VARCHAR2 DEFAULT NULL,
421                      X_Attribute15                      VARCHAR2 DEFAULT NULL,
422                      X_Attribute_Category_Code          VARCHAR2 DEFAULT NULL,
423                      X_Unrevalued_Cost                  NUMBER DEFAULT NULL,
424                      X_Merged_Code                      VARCHAR2 DEFAULT NULL,
425                      X_Split_Code                       VARCHAR2 DEFAULT NULL,
426                      X_Merge_Parent_Mass_Add_Id         NUMBER DEFAULT NULL,
427                      X_Split_Parent_Mass_Add_Id         NUMBER DEFAULT NULL,
428                      X_Project_Asset_Line_Id            NUMBER DEFAULT NULL,
429                      X_Project_Id                       NUMBER DEFAULT NULL,
430                      X_Task_Id                          NUMBER DEFAULT NULL,
431                      X_Calling_Fn                       VARCHAR2,
432               p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type default null) IS
433     CURSOR C IS
434         SELECT     asset_id,
435           po_vendor_id,
436           asset_invoice_id,
437           fixed_assets_cost,
438           date_effective,
439           date_ineffective,
440           invoice_transaction_id_in,
441           invoice_transaction_id_out,
442           deleted_flag,
443           po_number,
444           invoice_number,
445           payables_batch_name,
446           payables_code_combination_id,
447           feeder_system_name,
448           create_batch_date,
449           create_batch_id,
450           invoice_date,
451           payables_cost,
452           post_batch_id,
453           invoice_id,
454           ap_distribution_line_number,
455           payables_units,
456           split_merged_code,
457           description,
458           parent_mass_addition_id,
459           last_update_date,
460           last_updated_by,
461           created_by,
462           creation_date,
463           last_update_login,
464           attribute1,
465           attribute2,
466           attribute3,
467           attribute4,
468           attribute5,
469           attribute6,
470           attribute7,
471           attribute8,
472           attribute9,
473           attribute10,
474           attribute11,
475           attribute12,
476           attribute13,
477           attribute14,
478           attribute15,
479           attribute_category_code,
480           unrevalued_cost,
481           merged_code,
482           split_code,
483           merge_parent_mass_additions_id,
484           split_parent_mass_additions_id,
485           project_asset_line_id,
486           project_id,
487           task_id
488         FROM   fa_asset_invoices
489         WHERE  rowid = X_Rowid
490         FOR UPDATE of Asset_Invoice_Id NOWAIT;
491     Recinfo C%ROWTYPE;
492 
493 
494   BEGIN
495     OPEN C;
496     FETCH C INTO Recinfo;
497     if (C%NOTFOUND) then
501     end if;
498       CLOSE C;
499       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_DELETED');
500       APP_EXCEPTION.Raise_Exception;
502     CLOSE C;
503     if (
504 
505                (Recinfo.asset_id =  X_Asset_Id)
506            AND (   (Recinfo.po_vendor_id =  X_Po_Vendor_Id)
507                 OR (    (Recinfo.po_vendor_id IS NULL)
508                     AND (X_Po_Vendor_Id IS NULL)))
509            AND (   (Recinfo.asset_invoice_id =  X_Asset_Invoice_Id)
510                 OR (    (Recinfo.asset_invoice_id IS NULL)
511                     AND (X_Asset_Invoice_Id IS NULL)))
512            AND (   (Recinfo.fixed_assets_cost =  X_Fixed_Assets_Cost)
513                 OR (    (Recinfo.fixed_assets_cost IS NULL)
514                     AND (X_Fixed_Assets_Cost IS NULL)))
515            AND (Recinfo.date_effective =  X_Date_Effective)
516            AND (   (Recinfo.date_ineffective =  X_Date_Ineffective)
517                 OR (    (Recinfo.date_ineffective IS NULL)
518                     AND (X_Date_Ineffective IS NULL)))
519            AND (   (Recinfo.invoice_transaction_id_in =
520                          X_Invoice_Transaction_Id_In)
521                 OR (    (Recinfo.invoice_transaction_id_in IS NULL)
522                     AND (X_Invoice_Transaction_Id_In IS NULL)))
523            AND (   (Recinfo.invoice_transaction_id_out =
524                               X_Invoice_Transaction_Id_Out)
525                 OR (    (Recinfo.invoice_transaction_id_out IS NULL)
526                     AND (X_Invoice_Transaction_Id_Out IS NULL)))
527            AND (Recinfo.deleted_flag =  X_Deleted_Flag)
528            AND (   (Recinfo.po_number =  X_Po_Number)
529                 OR (    (Recinfo.po_number IS NULL)
530                     AND (X_Po_Number IS NULL)))
531            AND (   (Recinfo.invoice_number =  X_Invoice_Number)
532                 OR (    (Recinfo.invoice_number IS NULL)
533                     AND (X_Invoice_Number IS NULL)))
534            AND (   (Recinfo.payables_batch_name =  X_Payables_Batch_Name)
535                 OR (    (Recinfo.payables_batch_name IS NULL)
536                     AND (X_Payables_Batch_Name IS NULL)))
537            AND (   (Recinfo.payables_code_combination_id =
538                          X_Payables_Code_Combination_Id)
539                 OR (    (Recinfo.payables_code_combination_id IS NULL)
540                     AND (X_Payables_Code_Combination_Id IS NULL)))
541            AND (   (Recinfo.feeder_system_name =  X_Feeder_System_Name)
542                 OR (    (Recinfo.feeder_system_name IS NULL)
543                     AND (X_Feeder_System_Name IS NULL)))
544            AND (   (Recinfo.create_batch_date =  X_Create_Batch_Date)
545                 OR (    (Recinfo.create_batch_date IS NULL)
546                     AND (X_Create_Batch_Date IS NULL)))
547            AND (   (Recinfo.create_batch_id =  X_Create_Batch_Id)
548                 OR (    (Recinfo.create_batch_id IS NULL)
549                     AND (X_Create_Batch_Id IS NULL)))
550            AND (   (Recinfo.invoice_date =  X_Invoice_Date)
551                 OR (    (Recinfo.invoice_date IS NULL)
552                     AND (X_Invoice_Date IS NULL)))
553            AND (   (Recinfo.payables_cost =  X_Payables_Cost)
554                 OR (    (Recinfo.payables_cost IS NULL)
555                     AND (X_Payables_Cost IS NULL)))
556            AND (   (Recinfo.post_batch_id =  X_Post_Batch_Id)
557                 OR (    (Recinfo.post_batch_id IS NULL)
558                     AND (X_Post_Batch_Id IS NULL)))
559            AND (   (Recinfo.invoice_id =  X_Invoice_Id)
560                 OR (    (Recinfo.invoice_id IS NULL)
561                     AND (X_Invoice_Id IS NULL)))
562            AND (   (Recinfo.ap_distribution_line_number =
563                               X_Ap_Distribution_Line_Number)
564                 OR (    (Recinfo.ap_distribution_line_number IS NULL)
565                     AND (X_Ap_Distribution_Line_Number IS NULL)))
566            AND (   (Recinfo.payables_units =  X_Payables_Units)
567                 OR (    (Recinfo.payables_units IS NULL)
568                     AND (X_Payables_Units IS NULL)))
569            AND (   (Recinfo.split_merged_code =  X_Split_Merged_Code)
570                 OR (    (Recinfo.split_merged_code IS NULL)
571                     AND (X_Split_Merged_Code IS NULL)))
572            AND (   (Recinfo.description =  X_Description)
573                 OR (    (Recinfo.description IS NULL)
574                     AND (X_Description IS NULL)))
575            AND (   (Recinfo.parent_mass_addition_id =
576                          X_Parent_Mass_Addition_Id)
577                 OR (    (Recinfo.parent_mass_addition_id IS NULL)
578                     AND (X_Parent_Mass_Addition_Id IS NULL)))
579            AND (   (Recinfo.attribute1 =  X_Attribute1)
580                 OR (    (Recinfo.attribute1 IS NULL)
581                     AND (X_Attribute1 IS NULL)))
582            AND (   (Recinfo.attribute2 =  X_Attribute2)
583                 OR (    (Recinfo.attribute2 IS NULL)
584                     AND (X_Attribute2 IS NULL)))
585            AND (   (Recinfo.attribute3 =  X_Attribute3)
586                 OR (    (Recinfo.attribute3 IS NULL)
587                     AND (X_Attribute3 IS NULL)))
588            AND (   (Recinfo.attribute4 =  X_Attribute4)
589                 OR (    (Recinfo.attribute4 IS NULL)
590                     AND (X_Attribute4 IS NULL)))
591            AND (   (Recinfo.attribute5 =  X_Attribute5)
592                 OR (    (Recinfo.attribute5 IS NULL)
593                     AND (X_Attribute5 IS NULL)))
594            AND (   (Recinfo.attribute6 =  X_Attribute6)
595                 OR (    (Recinfo.attribute6 IS NULL)
599                     AND (X_Attribute7 IS NULL)))
596                     AND (X_Attribute6 IS NULL)))
597            AND (   (Recinfo.attribute7 =  X_Attribute7)
598                 OR (    (Recinfo.attribute7 IS NULL)
600            AND (   (Recinfo.attribute8 =  X_Attribute8)
601                 OR (    (Recinfo.attribute8 IS NULL)
602                     AND (X_Attribute8 IS NULL)))
603            AND (   (Recinfo.attribute9 =  X_Attribute9)
604                 OR (    (Recinfo.attribute9 IS NULL)
605                     AND (X_Attribute9 IS NULL)))
606            AND (   (Recinfo.attribute10 =  X_Attribute10)
607                 OR (    (Recinfo.attribute10 IS NULL)
608                     AND (X_Attribute10 IS NULL)))
609            AND (   (Recinfo.attribute11 =  X_Attribute11)
610                 OR (    (Recinfo.attribute11 IS NULL)
611                     AND (X_Attribute11 IS NULL)))
612            AND (   (Recinfo.attribute12 =  X_Attribute12)
613                 OR (    (Recinfo.attribute12 IS NULL)
614                     AND (X_Attribute12 IS NULL)))
615            AND (   (Recinfo.attribute13 =  X_Attribute13)
616                 OR (    (Recinfo.attribute13 IS NULL)
617                     AND (X_Attribute13 IS NULL)))
618            AND (   (Recinfo.attribute14 =  X_Attribute14)
619                 OR (    (Recinfo.attribute14 IS NULL)
620                     AND (X_Attribute14 IS NULL)))
621            AND (   (Recinfo.attribute15 =  X_Attribute15)
622                 OR (    (Recinfo.attribute15 IS NULL)
623                     AND (X_Attribute15 IS NULL)))
624            AND (   (Recinfo.attribute_category_code =
625                          X_Attribute_Category_Code)
626                 OR (    (Recinfo.attribute_category_code IS NULL)
627                     AND (X_Attribute_Category_Code IS NULL)))
628            AND (   (Recinfo.unrevalued_cost =  X_Unrevalued_Cost)
629                 OR (    (Recinfo.unrevalued_cost IS NULL)
630                     AND (X_Unrevalued_Cost IS NULL)))
631            AND (   (Recinfo.merged_code =  X_Merged_Code)
632                 OR (    (Recinfo.merged_code IS NULL)
633                     AND (X_Merged_Code IS NULL)))
634            AND (   (Recinfo.split_code =  X_Split_Code)
635                 OR (    (Recinfo.split_code IS NULL)
636                     AND (X_Split_Code IS NULL)))
637            AND (   (Recinfo.merge_parent_mass_additions_id =
638                     X_Merge_Parent_Mass_Add_Id)
639                 OR (    (Recinfo.merge_parent_mass_additions_id IS NULL)
640                     AND (X_Merge_Parent_Mass_Add_Id IS NULL)))
641            AND (   (Recinfo.split_parent_mass_additions_id =
642                          X_Split_Parent_Mass_Add_Id)
643                 OR (    (Recinfo.split_parent_mass_additions_id IS NULL)
644                     AND (X_Split_Parent_Mass_Add_Id IS NULL)))
645            AND (   (Recinfo.project_asset_line_id =
646                                         X_Project_Asset_Line_Id)
647                 OR (    (Recinfo.project_asset_line_id IS NULL)
648                     AND (X_Project_Asset_Line_Id IS NULL)))
649            AND (   (Recinfo.project_id =
650                                         X_Project_Id)
651                 OR (    (Recinfo.project_id IS NULL)
652                     AND (X_Project_Id IS NULL)))
653            AND (   (Recinfo.Task_Id =
654                                         X_Task_Id)
655                 OR (    (Recinfo.Task_Id IS NULL)
656                     AND (X_Task_Id IS NULL)))) then
657       return;
658     else
659       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
660       APP_EXCEPTION.Raise_Exception;
661     end if;
662   END Lock_Row;
663 
664 
665 
666   PROCEDURE Update_Row(X_Rowid                          VARCHAR2 DEFAULT NULL,
667                        X_Source_Line_Id                 NUMBER   DEFAULT NULL,
668                        X_Asset_Id                       NUMBER   DEFAULT NULL,
669                        X_Po_Vendor_Id                   NUMBER   DEFAULT NULL,
670                        X_Asset_Invoice_Id               NUMBER   DEFAULT NULL,
671                        X_Fixed_Assets_Cost              NUMBER   DEFAULT NULL,
672                        X_Date_Effective                 DATE     DEFAULT NULL,
673                        X_Date_Ineffective               DATE     DEFAULT NULL,
674                        X_Invoice_Transaction_Id_In      NUMBER   DEFAULT NULL,
675                        X_Invoice_Transaction_Id_Out     NUMBER   DEFAULT NULL,
676                        X_Deleted_Flag                   VARCHAR2 DEFAULT NULL,
677                        X_Po_Number                      VARCHAR2 DEFAULT NULL,
678                        X_Invoice_Number                 VARCHAR2 DEFAULT NULL,
679                        X_Payables_Batch_Name            VARCHAR2 DEFAULT NULL,
680                        X_Payables_Code_Combination_Id   NUMBER   DEFAULT NULL,
681                        X_Feeder_System_Name             VARCHAR2 DEFAULT NULL,
682                        X_Create_Batch_Date              DATE     DEFAULT NULL,
683                        X_Create_Batch_Id                NUMBER   DEFAULT NULL,
684                        X_Invoice_Date                   DATE     DEFAULT NULL,
685                        X_Payables_Cost                  NUMBER   DEFAULT NULL,
686                        X_Post_Batch_Id                  NUMBER   DEFAULT NULL,
687                        X_Invoice_Id                     NUMBER   DEFAULT NULL,
688                        X_Ap_Distribution_Line_Number    NUMBER   DEFAULT NULL,
689                        X_Payables_Units                 NUMBER   DEFAULT NULL,
690                        X_Split_Merged_Code              VARCHAR2 DEFAULT NULL,
694                        X_Last_Updated_By                NUMBER   DEFAULT NULL,
691                        X_Description                    VARCHAR2 DEFAULT NULL,
692                        X_Parent_Mass_Addition_Id        VARCHAR2 DEFAULT NULL,
693                        X_Last_Update_Date               DATE     DEFAULT NULL,
695                        X_Last_Update_Login              NUMBER   DEFAULT NULL,
696                        X_Attribute1                     VARCHAR2 DEFAULT NULL,
697                        X_Attribute2                     VARCHAR2 DEFAULT NULL,
698                        X_Attribute3                     VARCHAR2 DEFAULT NULL,
699                        X_Attribute4                     VARCHAR2 DEFAULT NULL,
700                        X_Attribute5                     VARCHAR2 DEFAULT NULL,
701                        X_Attribute6                     VARCHAR2 DEFAULT NULL,
702                        X_Attribute7                     VARCHAR2 DEFAULT NULL,
703                        X_Attribute8                     VARCHAR2 DEFAULT NULL,
704                        X_Attribute9                     VARCHAR2 DEFAULT NULL,
705                        X_Attribute10                    VARCHAR2 DEFAULT NULL,
706                        X_Attribute11                    VARCHAR2 DEFAULT NULL,
707                        X_Attribute12                    VARCHAR2 DEFAULT NULL,
708                        X_Attribute13                    VARCHAR2 DEFAULT NULL,
709                        X_Attribute14                    VARCHAR2 DEFAULT NULL,
710                        X_Attribute15                    VARCHAR2 DEFAULT NULL,
711                        X_Attribute_Category_Code        VARCHAR2 DEFAULT NULL,
712                        X_Unrevalued_Cost                NUMBER   DEFAULT NULL,
713                        X_Merged_Code                    VARCHAR2 DEFAULT NULL,
714                        X_Split_Code                     VARCHAR2 DEFAULT NULL,
715                        X_Merge_Parent_Mass_Add_Id       NUMBER   DEFAULT NULL,
716                        X_Split_Parent_Mass_Add_Id       NUMBER   DEFAULT NULL,
717                        X_Project_Asset_Line_Id          NUMBER   DEFAULT NULL,
718                        X_Project_Id                     NUMBER   DEFAULT NULL,
719                        X_Task_Id                        NUMBER   DEFAULT NULL,
720                        X_Material_Indicator_Flag        VARCHAR2 DEFAULT NULL,
721                        X_depreciate_in_group_flag       VARCHAR2 DEFAULT NULL,
722                        X_invoice_distribution_id        NUMBER   DEFAULT NULL,
723                        X_invoice_line_number            NUMBER   DEFAULT NULL,
724                        X_po_distribution_id             NUMBER   DEFAULT NULL,
725                        X_exchange_rate                  NUMBER   DEFAULT NULL,
726                        X_mrc_sob_type_code              VARCHAR2 DEFAULT 'P',
727                        X_Calling_Fn                     VARCHAR2,
728              p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type default null) IS
729 
730       l_rowid         ROWID;
731 
732    BEGIN
733 
734       if (X_mrc_sob_type_code = 'R') then
735 
736          if (X_Rowid is NULL) then
737             select rowid
738             into   l_rowid
739             from   fa_asset_invoices_mrc_v
740             where  source_line_id = X_Source_Line_Id;
741          else
742             l_rowid := X_Rowid;
743          end if;
744 
745          UPDATE fa_asset_invoices_mrc_v
746          SET
747             asset_id                 = decode(X_Asset_Id,
748                                               FND_API.G_MISS_NUM, NULL,
749                                               NULL,       asset_id,
750                                               X_asset_id),
751             po_vendor_id             = decode(X_Po_Vendor_Id,
752                                               FND_API.G_MISS_NUM, NULL,
753                                               NULL,       po_vendor_id,
754                                               X_po_vendor_id),
755             asset_invoice_id         = decode(X_Asset_Invoice_Id,
756                                               FND_API.G_MISS_NUM, NULL,
757                                               NULL,       asset_invoice_id,
758                                               X_asset_invoice_id),
759             fixed_assets_cost        = decode(X_Fixed_Assets_Cost,
760                                               FND_API.G_MISS_NUM, NULL,
761                                               NULL,       fixed_assets_cost,
762                                               X_fixed_assets_cost),
763             date_effective           = decode(X_Date_Effective,
764                                               NULL,       date_effective,
765                                               X_date_effective),
766             date_ineffective         = decode(X_Date_Ineffective,
767                                               NULL,       date_ineffective,
768                                               X_date_ineffective),
769             invoice_transaction_id_in
770                                      = decode(X_Invoice_Transaction_Id_In,
771                                               FND_API.G_MISS_NUM, NULL,
772                                               NULL, invoice_transaction_id_in,
773                                               X_invoice_transaction_id_in),
774             invoice_transaction_id_out
775                                      = decode(X_Invoice_Transaction_Id_Out,
776                                               FND_API.G_MISS_NUM, NULL,
777                                               NULL, invoice_transaction_id_out,
778                                               X_invoice_transaction_id_out),
782                                               X_deleted_flag),
779             deleted_flag             = decode(X_Deleted_Flag,
780                                               FND_API.G_MISS_CHAR, NULL,
781                                               NULL,       deleted_flag,
783             po_number                = decode(X_Po_Number,
784                                               FND_API.G_MISS_CHAR, NULL,
785                                               NULL,       po_number,
786                                               X_po_number),
787             invoice_number           = decode(X_Invoice_Number,
788                                               FND_API.G_MISS_CHAR, NULL,
789                                               NULL,       invoice_number,
790                                                         X_invoice_number),
791             payables_batch_name      = decode(X_Payables_Batch_Name,
792                                               FND_API.G_MISS_CHAR, NULL,
793                                               NULL,       payables_batch_name,
794                                               X_payables_batch_name),
795             payables_code_combination_id
796                                      = decode(X_Payables_Code_Combination_Id,
797                                               FND_API.G_MISS_NUM, NULL,
798                                               NULL,
799                                                  payables_code_combination_id,
800                                               X_payables_code_combination_id),
801             feeder_system_name       = decode(X_Feeder_System_Name,
802                                               FND_API.G_MISS_CHAR, NULL,
803                                               NULL,       feeder_system_name,
804                                               X_feeder_system_name),
805             create_batch_date        = decode(X_Create_Batch_Date,
806                                               NULL,       create_batch_date,
807                                               X_create_batch_date),
808             create_batch_id          = decode(X_Create_Batch_Id,
809                                               FND_API.G_MISS_NUM, NULL,
810                                               NULL,       create_batch_id,
811                                               X_create_batch_id),
812             invoice_date             = decode(X_Invoice_Date,
813                                               NULL,       invoice_date,
814                                               X_invoice_date),
815             payables_cost            = decode(X_Payables_Cost,
816                                               FND_API.G_MISS_NUM, NULL,
817                                               NULL,       payables_cost,
818                                               X_payables_cost),
819             post_batch_id            = decode(X_Post_Batch_Id,
820                                               FND_API.G_MISS_NUM, NULL,
821                                               NULL,       post_batch_id,
822                                               X_post_batch_id),
823             invoice_id               = decode(X_Invoice_Id,
824                                               FND_API.G_MISS_NUM, NULL,
825                                               NULL,       invoice_id,
826                                                         X_invoice_id),
827             ap_distribution_line_number
828                                      = decode(X_Ap_Distribution_Line_Number,
829                                               FND_API.G_MISS_NUM, NULL,
830                                               NULL, ap_distribution_line_number,
831                                               X_ap_distribution_line_number),
832             payables_units           = decode(X_Payables_Units,
833                                               FND_API.G_MISS_NUM, NULL,
834                                               NULL,       payables_units,
835                                               X_payables_units),
836             split_merged_code        = decode(X_Split_Merged_Code,
837                                               FND_API.G_MISS_CHAR, NULL,
838                                               NULL,       split_merged_code,
839                                               X_split_merged_code),
840             description              = decode(X_Description,
841                                               FND_API.G_MISS_CHAR, NULL,
842                                               NULL,       description,
843                                               X_description),
844             parent_mass_addition_id  = decode(X_Parent_Mass_Addition_Id,
845                                               FND_API.G_MISS_CHAR, NULL,
846                                               NULL, parent_mass_addition_id,
847                                               X_parent_mass_addition_id),
848             last_update_date         = decode(X_Last_Update_Date,
849                                               NULL,       last_update_date,
850                                               X_last_update_date),
851             last_updated_by          = decode(X_Last_Updated_By,
852                                               FND_API.G_MISS_NUM, NULL,
853                                               NULL,       last_updated_by,
854                                               X_last_updated_by),
855             last_update_login        = decode(X_Last_Update_Login,
856                                               FND_API.G_MISS_NUM, NULL,
857                                               NULL,       last_update_login,
858                                               X_last_update_login),
859             attribute1               = decode(X_Attribute1,
860                                               FND_API.G_MISS_CHAR, NULL,
864                                               FND_API.G_MISS_CHAR, NULL,
861                                               NULL,       attribute1,
862                                               X_attribute1),
863             attribute2               = decode(X_Attribute2,
865                                               NULL,       attribute2,
866                                               X_attribute2),
867             attribute3               = decode(X_Attribute3,
868                                               FND_API.G_MISS_CHAR, NULL,
869                                               NULL,       attribute3,
870                                               X_attribute3),
871             attribute4               = decode(X_Attribute4,
872                                               FND_API.G_MISS_CHAR, NULL,
873                                               NULL,       attribute4,
874                                               X_attribute4),
875             attribute5               = decode(X_Attribute5,
876                                               FND_API.G_MISS_CHAR, NULL,
877                                               NULL,       attribute5,
878                                               X_attribute5),
879             attribute6               = decode(X_Attribute6,
880                                               FND_API.G_MISS_CHAR, NULL,
881                                               NULL,       attribute6,
882                                               X_attribute6),
883             attribute7               = decode(X_Attribute7,
884                                               FND_API.G_MISS_CHAR, NULL,
885                                               NULL,       attribute7,
886                                               X_attribute7),
887             attribute8               = decode(X_Attribute8,
888                                               FND_API.G_MISS_CHAR, NULL,
889                                               NULL,       attribute8,
890                                               X_attribute8),
891             attribute9               = decode(X_Attribute9,
892                                               FND_API.G_MISS_CHAR, NULL,
893                                               NULL,       attribute9,
894                                               X_attribute9),
895             attribute10              = decode(X_Attribute10,
896                                               FND_API.G_MISS_CHAR, NULL,
897                                               NULL,       attribute10,
898                                               X_attribute10),
899             attribute11              = decode(X_Attribute11,
900                                              FND_API.G_MISS_CHAR, NULL,
901                                              NULL,       attribute11,
902                                              X_attribute11),
903             attribute12              = decode(X_Attribute12,
904                                               FND_API.G_MISS_CHAR, NULL,
905                                               NULL,       attribute12,
906                                               X_attribute12),
907             attribute13              = decode(X_Attribute13,
908                                               FND_API.G_MISS_CHAR, NULL,
909                                               NULL,       attribute13,
910                                               X_attribute13),
911             attribute14              = decode(X_Attribute14,
912                                               FND_API.G_MISS_CHAR, NULL,
913                                               NULL,       attribute14,
914                                               X_attribute14),
915             attribute15              = decode(X_attribute15,
916                                               FND_API.G_MISS_CHAR, NULL,
917                                               NULL, attribute15,
918                                               X_attribute15),
919             attribute_category_code  = decode(X_Attribute_Category_Code,
920                                               FND_API.G_MISS_CHAR, NULL,
921                                               NULL, attribute_category_code,
922                                               X_attribute_category_code),
923             unrevalued_cost          = decode(X_Unrevalued_Cost,
924                                               FND_API.G_MISS_NUM, NULL,
925                                               NULL,       unrevalued_cost,
926                                               X_unrevalued_cost),
927             merged_code              = decode(X_Merged_Code,
928                                               FND_API.G_MISS_CHAR, NULL,
929                                               NULL,       merged_code,
930                                               X_merged_code),
931             split_code               = decode(X_Split_Code,
932                                               FND_API.G_MISS_CHAR, NULL,
933                                               NULL,       split_code,
934                                               X_split_code),
935             merge_parent_mass_additions_id
936                                      = decode(X_Merge_Parent_Mass_Add_Id,
937                                               FND_API.G_MISS_NUM, NULL,
938                                               NULL,
939                                                  merge_parent_mass_additions_id,
940                                               X_merge_parent_mass_add_id),
941             split_parent_mass_additions_id
942                                      = decode(X_Split_Parent_Mass_Add_Id,
943                                               FND_API.G_MISS_NUM, NULL,
947             project_asset_line_id    = decode(X_Project_Asset_Line_Id,
944                                               NULL,
945                                                  split_parent_mass_additions_id,
946                                               X_split_parent_mass_add_id),
948                                               FND_API.G_MISS_NUM, NULL,
949                                               NULL, project_asset_line_id,
950                                               X_project_asset_line_id),
951             project_id               = decode(X_Project_Id,
952                                               FND_API.G_MISS_NUM, NULL,
953                                               NULL,       project_id,
954                                               X_project_id),
955             task_id                  = decode(X_Task_Id,
956                                               FND_API.G_MISS_NUM, NULL,
957                                               NULL,       task_id,
958                                               X_task_id),
959             exchange_rate            = decode(X_Exchange_Rate,
960                                               FND_API.G_MISS_NUM, NULL,
961                                               NULL,       exchange_rate,
962                                               X_exchange_rate),
963             depreciate_in_group_flag = decode(X_depreciate_in_group_flag,
964                                               FND_API.G_MISS_CHAR, NULL,
965                                               NULL,       depreciate_in_group_flag,
966                                               X_depreciate_in_group_flag),
967             material_indicator_flag  = decode(X_material_indicator_flag,
968                                               FND_API.G_MISS_CHAR, NULL,
969                                               NULL,       material_indicator_flag,
970                                               X_material_indicator_flag),
971             invoice_distribution_id  = decode(X_invoice_distribution_id,
972                                               FND_API.G_MISS_NUM, NULL,
973                                               NULL,       invoice_distribution_id,
974                                               X_invoice_distribution_id),
975             invoice_line_number      = decode(X_invoice_line_number,
976                                               FND_API.G_MISS_NUM, NULL,
977                                               NULL,       invoice_line_number,
978                                               X_invoice_line_number),
979             po_distribution_id       = decode(X_po_distribution_id,
980                                               FND_API.G_MISS_NUM, NULL,
981                                               NULL,       po_distribution_id,
982                                               X_po_distribution_id)
983          WHERE rowid = l_rowid;
984 
985        if (SQL%NOTFOUND) then
986          Raise NO_DATA_FOUND;
987        end if;
988 
989     else
990 
991        if (X_Rowid is NULL) then
992           select rowid
993             into   l_rowid
994             from   fa_asset_invoices
995            where  source_line_id = X_Source_Line_Id;
996        else
997           l_rowid := X_Rowid;
998        end if;
999 
1000        UPDATE fa_asset_invoices
1001        SET  asset_id                 = decode(X_Asset_Id,
1002                                               FND_API.G_MISS_NUM, NULL,
1003                                               NULL,       asset_id,
1004                                               X_asset_id),
1005             po_vendor_id             = decode(X_Po_Vendor_Id,
1006                                               FND_API.G_MISS_NUM, NULL,
1007                                               NULL,       po_vendor_id,
1008                                               X_po_vendor_id),
1009             asset_invoice_id         = decode(X_Asset_Invoice_Id,
1010                                               FND_API.G_MISS_NUM, NULL,
1011                                               NULL,       asset_invoice_id,
1012                                               X_asset_invoice_id),
1013             fixed_assets_cost        = decode(X_Fixed_Assets_Cost,
1014                                               FND_API.G_MISS_NUM, NULL,
1015                                               NULL,       fixed_assets_cost,
1016                                               X_fixed_assets_cost),
1017             date_effective           = decode(X_Date_Effective,
1018                                               NULL,       date_effective,
1019                                               X_date_effective),
1020             date_ineffective         = decode(X_Date_Ineffective,
1021                                               NULL,       date_ineffective,
1022                                               X_date_ineffective),
1023             invoice_transaction_id_in
1024                                      = decode(X_Invoice_Transaction_Id_In,
1025                                               FND_API.G_MISS_NUM, NULL,
1026                                               NULL, invoice_transaction_id_in,
1027                                               X_invoice_transaction_id_in),
1028             invoice_transaction_id_out
1029                                      = decode(X_Invoice_Transaction_Id_Out,
1030                                               FND_API.G_MISS_NUM, NULL,
1031                                               NULL, invoice_transaction_id_out,
1032                                               X_invoice_transaction_id_out),
1033             deleted_flag             = decode(X_Deleted_Flag,
1037             po_number                = decode(X_Po_Number,
1034                                               FND_API.G_MISS_CHAR, NULL,
1035                                               NULL,       deleted_flag,
1036                                               X_deleted_flag),
1038                                               FND_API.G_MISS_CHAR, NULL,
1039                                               NULL,       po_number,
1040                                               X_po_number),
1041             invoice_number           = decode(X_Invoice_Number,
1042                                               FND_API.G_MISS_CHAR, NULL,
1043                                               NULL,       invoice_number,
1044                                               X_invoice_number),
1045             payables_batch_name      = decode(X_Payables_Batch_Name,
1046                                               FND_API.G_MISS_CHAR, NULL,
1047                                               NULL,       payables_batch_name,
1048                                               X_payables_batch_name),
1049             payables_code_combination_id
1050                                      = decode(X_Payables_Code_Combination_Id,
1051                                               FND_API.G_MISS_NUM, NULL,
1052                                               NULL,
1053                                                  payables_code_combination_id,
1054                                               X_payables_code_combination_id),
1055             feeder_system_name       = decode(X_Feeder_System_Name,
1056                                               FND_API.G_MISS_CHAR, NULL,
1057                                               NULL, feeder_system_name,
1058                                               X_feeder_system_name),
1059             create_batch_date        = decode(X_Create_Batch_Date,
1060                                               NULL,       create_batch_date,
1061                                               X_create_batch_date),
1062             create_batch_id          = decode(X_Create_Batch_Id,
1063                                               FND_API.G_MISS_NUM, NULL,
1064                                               NULL,       create_batch_id,
1065                                               X_create_batch_id),
1066             invoice_date             = decode(X_Invoice_Date,
1067                                               NULL,       invoice_date,
1068                                               X_invoice_date),
1069             payables_cost            = decode(X_Payables_Cost,
1070                                               FND_API.G_MISS_NUM, NULL,
1071                                               NULL,       payables_cost,
1072                                               X_payables_cost),
1073             post_batch_id            = decode(X_Post_Batch_Id,
1074                                               FND_API.G_MISS_NUM, NULL,
1075                                               NULL,       post_batch_id,
1076                                               X_post_batch_id),
1077             invoice_id               = decode(X_Invoice_Id,
1078                                               FND_API.G_MISS_NUM, NULL,
1079                                               NULL,       invoice_id,
1080                                               X_invoice_id),
1081             ap_distribution_line_number
1082                                      = decode(X_Ap_Distribution_Line_Number,
1083                                               FND_API.G_MISS_NUM, NULL,
1084                                               NULL, ap_distribution_line_number,
1085                                               X_ap_distribution_line_number),
1086             payables_units           = decode(X_Payables_Units,
1087                                               FND_API.G_MISS_NUM, NULL,
1088                                               NULL, payables_units,
1089                                               X_payables_units),
1090             split_merged_code        = decode(X_Split_Merged_Code,
1091                                               FND_API.G_MISS_CHAR, NULL,
1092                                               NULL,       split_merged_code,
1093                                               X_split_merged_code),
1094             description              = decode(X_Description,
1095                                               FND_API.G_MISS_CHAR, NULL,
1096                                               NULL,       description,
1097                                               X_description),
1098             parent_mass_addition_id  = decode(X_Parent_Mass_Addition_Id,
1099                                               FND_API.G_MISS_CHAR, NULL,
1100                                               NULL, parent_mass_addition_id,
1101                                               X_parent_mass_addition_id),
1102             last_update_date         = decode(X_Last_Update_Date,
1103                                               NULL,       last_update_date,
1104                                               X_last_update_date),
1105             last_updated_by          = decode(X_Last_Updated_By,
1106                                               FND_API.G_MISS_NUM, NULL,
1107                                               NULL,       last_updated_by,
1108                                               X_last_updated_by),
1109             last_update_login        = decode(X_Last_Update_Login,
1110                                               FND_API.G_MISS_NUM, NULL,
1111                                               NULL,       last_update_login,
1112                                               X_last_update_login),
1116                                               X_attribute1),
1113             attribute1               = decode(X_Attribute1,
1114                                               FND_API.G_MISS_CHAR, NULL,
1115                                               NULL,       attribute1,
1117             attribute2               = decode(X_Attribute2,
1118                                               FND_API.G_MISS_CHAR, NULL,
1119                                               NULL,       attribute2,
1120                                               X_attribute2),
1121             attribute3               = decode(X_Attribute3,
1122                                               FND_API.G_MISS_CHAR, NULL,
1123                                               NULL,       attribute3,
1124                                               X_attribute3),
1125             attribute4               = decode(X_Attribute4,
1126                                               FND_API.G_MISS_CHAR, NULL,
1127                                               NULL,       attribute4,
1128                                               X_attribute4),
1129             attribute5               = decode(X_Attribute5,
1130                                               FND_API.G_MISS_CHAR, NULL,
1131                                               NULL,       attribute5,
1132                                               X_attribute5),
1133             attribute6               = decode(X_Attribute6,
1134                                               FND_API.G_MISS_CHAR, NULL,
1135                                               NULL,       attribute6,
1136                                               X_attribute6),
1137             attribute7               = decode(X_Attribute7,
1138                                               FND_API.G_MISS_CHAR, NULL,
1139                                               NULL,       attribute7,
1140                                               X_attribute7),
1141             attribute8               = decode(X_Attribute8,
1142                                               FND_API.G_MISS_CHAR, NULL,
1143                                               NULL,       attribute8,
1144                                               X_attribute8),
1145             attribute9               = decode(X_Attribute9,
1146                                               FND_API.G_MISS_CHAR, NULL,
1147                                               NULL,       attribute9,
1148                                               X_attribute9),
1149             attribute10              = decode(X_Attribute10,
1150                                               FND_API.G_MISS_CHAR, NULL,
1151                                               NULL,       attribute10,
1152                                               X_attribute10),
1153             attribute11              = decode(X_Attribute11,
1154                                               FND_API.G_MISS_CHAR, NULL,
1155                                               NULL,       attribute11,
1156                                               X_attribute11),
1157             attribute12              = decode(X_Attribute12,
1158                                               FND_API.G_MISS_CHAR, NULL,
1159                                               NULL,       attribute12,
1160                                               X_attribute12),
1161             attribute13              = decode(X_Attribute13,
1162                                               FND_API.G_MISS_CHAR, NULL,
1163                                               NULL,       attribute13,
1164                                               X_attribute13),
1165             attribute14              = decode(X_Attribute14,
1166                                               FND_API.G_MISS_CHAR, NULL,
1167                                               NULL,       attribute14,
1168                                               X_attribute14),
1169             attribute15              = decode(X_attribute15,
1170                                               FND_API.G_MISS_CHAR, NULL,
1171                                               NULL, attribute15,
1172                                               X_attribute15),
1173             attribute_category_code  = decode(X_Attribute_Category_Code,
1174                                               FND_API.G_MISS_CHAR, NULL,
1175                                               NULL, attribute_category_code,
1176                                               X_attribute_category_code),
1177             unrevalued_cost          = decode(X_Unrevalued_Cost,
1178                                               FND_API.G_MISS_NUM, NULL,
1179                                               NULL,       unrevalued_cost,
1180                                               X_unrevalued_cost),
1181             merged_code              = decode(X_Merged_Code,
1182                                               FND_API.G_MISS_CHAR, NULL,
1183                                               NULL,       merged_code,
1184                                               X_merged_code),
1185             split_code               = decode(X_Split_Code,
1186                                               FND_API.G_MISS_CHAR, NULL,
1187                                               NULL,       split_code,
1188                                               X_split_code),
1189             merge_parent_mass_additions_id
1190                                      = decode(X_Merge_Parent_Mass_Add_Id,
1191                                               FND_API.G_MISS_NUM, NULL,
1192                                               NULL,
1193                                                  merge_parent_mass_additions_id,
1194                                               X_merge_parent_mass_add_id),
1195             split_parent_mass_additions_id
1196                                      = decode(X_Split_Parent_Mass_Add_Id,
1197                                               FND_API.G_MISS_NUM, NULL,
1198                                               NULL,
1199                                                  split_parent_mass_additions_id,
1200                                               X_split_parent_mass_add_id),
1201             project_asset_line_id    = decode(X_Project_Asset_Line_Id,
1202                                               FND_API.G_MISS_NUM, NULL,
1203                                               NULL,       project_asset_line_id,
1204                                               X_project_asset_line_id),
1205             project_id               = decode(X_Project_Id,
1206                                               FND_API.G_MISS_NUM, NULL,
1207                                               NULL,       project_id,
1208                                               X_project_id),
1209             task_id                  = decode(X_Task_Id,
1210                                               FND_API.G_MISS_NUM, NULL,
1211                                               NULL,       task_id,
1212                                               X_task_id),
1216                                               X_depreciate_in_group_flag),
1213             depreciate_in_group_flag = decode(X_depreciate_in_group_flag,
1214                                               FND_API.G_MISS_CHAR, NULL,
1215                                               NULL,       depreciate_in_group_flag,
1217             material_indicator_flag  = decode(X_material_indicator_flag,
1218                                               FND_API.G_MISS_CHAR, NULL,
1219                                               NULL,       material_indicator_flag,
1220                                               X_material_indicator_flag),
1221             invoice_distribution_id  = decode(X_invoice_distribution_id,
1222                                               FND_API.G_MISS_NUM, NULL,
1223                                               NULL,       invoice_distribution_id,
1224                                               X_invoice_distribution_id),
1225             invoice_line_number      = decode(X_invoice_line_number,
1226                                               FND_API.G_MISS_NUM, NULL,
1227                                               NULL,       invoice_line_number,
1228                                               X_invoice_line_number),
1229             po_distribution_id       = decode(X_po_distribution_id,
1230                                               FND_API.G_MISS_NUM, NULL,
1231                                               NULL,       po_distribution_id,
1232                                               X_po_distribution_id)
1233          WHERE rowid = l_rowid;
1234 
1235      if (SQL%NOTFOUND) then
1236        Raise NO_DATA_FOUND;
1237      end if;
1238   end if;
1239 
1240 
1241   exception
1242     when others then
1243          FA_SRVR_MSG.Add_SQL_Error(Calling_fn =>
1244                          'fa_asset_invoices_pkg.update_row'
1245                          ,p_log_level_rec => p_log_level_rec);
1246          raise;
1247   END Update_Row;
1248 
1249   PROCEDURE Delete_Row(X_Rowid              VARCHAR2 DEFAULT NULL,
1250                        X_Asset_Id           NUMBER DEFAULT NULL,
1251                        X_mrc_sob_type_code  VARCHAR2 DEFAULT 'P',
1252                        X_Calling_Fn         VARCHAR2,
1253              p_log_level_rec        IN     FA_API_TYPES.log_level_rec_type default null) IS
1254 
1255    BEGIN
1256 
1257       if (X_mrc_sob_type_code = 'R') then
1258          if X_Rowid is not null then
1259             DELETE FROM fa_asset_invoices_mrc_v
1260             WHERE rowid = X_Rowid;
1261          elsif X_Asset_Id is not null then
1262             DELETE FROM fa_asset_invoices_mrc_v
1263             WHERE asset_id = X_Asset_Id;
1264          else
1265             -- error message here
1266             null;
1267          end if;
1268       else
1269          if X_Rowid is not null then
1270             DELETE FROM fa_asset_invoices
1271             WHERE rowid = X_Rowid;
1272          elsif X_Asset_Id is not null then
1273             DELETE FROM fa_asset_invoices
1274             WHERE asset_id = X_Asset_Id;
1275          else
1276             -- error message here
1277             null;
1278          end if;
1279       end if;
1280 
1281     if (SQL%NOTFOUND) then
1282       Raise NO_DATA_FOUND;
1283     end if;
1284 
1285   exception
1286     when no_data_found then
1287          null;
1288     when others then
1289          fa_srvr_msg.add_sql_error(
1290                   CALLING_FN => 'fa_asset_invoices_pkg.delete_row'
1291                   ,p_log_level_rec => p_log_level_rec);
1292          raise;
1293   END Delete_Row;
1294 
1295 END FA_ASSET_INVOICES_PKG;