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