DBA Data[Home] [Help]

PACKAGE BODY: APPS.AP_RECURRING_PAYMENTS_PKG

Source


1 PACKAGE BODY AP_RECURRING_PAYMENTS_PKG AS
2 /* $Header: apircupb.pls 120.9 2010/12/20 12:21:30 sbonala ship $ */
3 
4   PROCEDURE Insert_Row(X_Rowid                   IN OUT NOCOPY VARCHAR2,
5                        X_Recurring_Payment_Id    IN OUT NOCOPY NUMBER,
6                        X_Last_Update_Date               DATE,
7                        X_Last_Updated_By                NUMBER,
8                        X_Creation_Date                  DATE,
9                        X_Created_By                     NUMBER,
10                        X_Vendor_Id                      NUMBER,
11                        X_Recurring_Pay_Num              VARCHAR2,
12                        X_Vendor_Site_Id                 NUMBER,
13                        X_Rec_Pay_Period_Type            VARCHAR2,
14                        X_Num_Of_Periods                 NUMBER,
15                        X_First_Period                   VARCHAR2,
16                        X_First_Period_Num               NUMBER,
17                        X_Authorized_Total               NUMBER,
18                        X_Control_Amount                 NUMBER,
19                        X_Distribution_Set_Id            NUMBER    DEFAULT NULL,
20                        X_Terms_Id                       NUMBER,
21                        X_Set_Of_Books_Id                NUMBER,
22                        X_Amount_Applicable_To_Disc      NUMBER,
23                        X_Rem_Periods                    NUMBER   DEFAULT NULL,
24                        X_Accounting_Date                DATE     DEFAULT NULL,
25                        X_Released_Amount                NUMBER   DEFAULT NULL,
26                        X_Batch_Id                       NUMBER   DEFAULT NULL,
27                        X_Accts_Pay_Code_Comb            NUMBER   DEFAULT NULL,
28                        X_Invoice_Currency_Code          VARCHAR2,
29                        X_Payment_Currency_Code          VARCHAR2,
30                        X_Pay_Group_Lookup_Code          VARCHAR2 DEFAULT NULL,
31                        X_Tax_Amount                     NUMBER   DEFAULT NULL,
32                        X_Exchange_Rate                  NUMBER   DEFAULT NULL,
33                        X_Next_Period                    VARCHAR2 DEFAULT NULL,
34                        X_Next_Payment                   NUMBER   DEFAULT NULL,
35                        X_Increment_Percent              NUMBER   DEFAULT NULL,
36                        X_Num_Of_Periods_Rem             NUMBER   DEFAULT NULL,
37                        X_Special_Payment_Amount1        NUMBER   DEFAULT NULL,
38                        X_Special_Period_Name1           VARCHAR2 DEFAULT NULL,
39                        X_Special_Payment_Amount2        NUMBER   DEFAULT NULL,
40                        X_Special_Period_Name2           VARCHAR2 DEFAULT NULL,
41                        X_Description                    VARCHAR2 DEFAULT NULL,
42                        X_Paid_Flag1                     VARCHAR2 DEFAULT NULL,
43                        X_Paid_Flag2                     VARCHAR2 DEFAULT NULL,
44                        X_Hold_Lookup_Code               VARCHAR2 DEFAULT NULL,
45                        X_Hold_Reason                    VARCHAR2 DEFAULT NULL,
46                        X_Approved_By                    NUMBER   DEFAULT NULL,
47                        X_Expiry_Date                    DATE     DEFAULT NULL,
48                        X_Attribute_Category             VARCHAR2 DEFAULT NULL,
49                        X_Attribute1                     VARCHAR2 DEFAULT NULL,
50                        X_Attribute2                     VARCHAR2 DEFAULT NULL,
51                        X_Attribute3                     VARCHAR2 DEFAULT NULL,
52                        X_Attribute4                     VARCHAR2 DEFAULT NULL,
53                        X_Attribute5                     VARCHAR2 DEFAULT NULL,
54                        X_Exchange_Rate_Type             VARCHAR2 DEFAULT NULL,
55                        X_Payment_Cross_Rate             NUMBER,
56                        X_Exchange_Date                  DATE     DEFAULT NULL,
57                        X_Last_Update_Login              NUMBER   DEFAULT NULL,
58                        X_Tax_Name                       VARCHAR2 DEFAULT NULL,
59                        X_Attribute11                    VARCHAR2 DEFAULT NULL,
60                        X_Attribute12                    VARCHAR2 DEFAULT NULL,
61                        X_Attribute13                    VARCHAR2 DEFAULT NULL,
62                        X_Attribute14                    VARCHAR2 DEFAULT NULL,
63                        X_Attribute6                     VARCHAR2 DEFAULT NULL,
64                        X_Attribute7                     VARCHAR2 DEFAULT NULL,
65                        X_Attribute8                     VARCHAR2 DEFAULT NULL,
66                        X_Attribute9                     VARCHAR2 DEFAULT NULL,
67                        X_Attribute10                    VARCHAR2 DEFAULT NULL,
68                        X_Attribute15                    VARCHAR2 DEFAULT NULL,
69                        X_Exclusive_Payment_Flag         VARCHAR2 DEFAULT NULL,
70                        X_Awt_Group_Id                   NUMBER   DEFAULT NULL,
71                        X_Pay_Awt_Group_Id               NUMBER   DEFAULT NULL,--bug6639866
72                        X_Org_Id                         NUMBER   DEFAULT MO_GLOBAL.GET_CURRENT_ORG_ID,
73                        X_Po_Header_Id                   NUMBER   DEFAULT NULL,
74                        X_Po_Line_Id                     NUMBER   DEFAULT NULL,
75                        X_Line_Location_Id               NUMBER   DEFAULT NULL,
76                        X_External_Bank_Account_Id       NUMBER   DEFAULT NULL,
77                        X_calling_sequence         IN    VARCHAR2,
78                        X_Approval_Required_Flag         VARCHAR2,
79                     -- Removed for bug 4277744
80                     -- X_USSGL_Txn_Code                 VARCHAR2 DEFAULT NULL,
81                        X_Requester_id                   NUMBER   DEFAULT NULL,
82                        X_Po_Release_Id                  NUMBER   DEFAULT NULL,
83                        X_Item_Description               VARCHAR2 DEFAULT NULL,
84                        X_Manufacturer                   VARCHAR2 DEFAULT NULL,
85                        X_Model_Number                   VARCHAR2 DEFAULT NULL,
86 		       X_Tax_Control_Amount		NUMBER   DEFAULT NULL,
87 		       X_Taxation_Country		VARCHAR2 DEFAULT NULL,
88 		       X_Product_Fisc_Class		VARCHAR2 DEFAULT NULL,
89 		       X_User_Defined_Fisc_Class	VARCHAR2 DEFAULT NULL,
90 		       X_Trx_Bus_Category		VARCHAR2 DEFAULT NULL,
91 		       X_Primary_Intended_Use		VARCHAR2 DEFAULT NULL,
92 		       X_Legal_Entity_Id		NUMBER   DEFAULT NULL,
93                        x_PAYMENT_METHOD_CODE            varchar2 default null,
94                        x_PAYMENT_REASON_CODE            varchar2 default null,
95                        x_remittance_message1            varchar2 default null,
96                        x_remittance_message2            varchar2 default null,
97                        x_remittance_message3            varchar2 default null,
98                        x_bank_charge_bearer             varchar2 default null,
99                        x_settlement_priority            varchar2 default null,
100                        x_payment_reason_comments        varchar2 default null,
101                        x_delivery_channel_code          varchar2 default null,
102                        X_First_Amount                   NUMBER,  -- 2794958 (2774932)
103 		       X_REMIT_TO_SUPPLIER_NAME         VARCHAR2 DEFAULT NULL,
104 		       X_REMIT_TO_SUPPLIER_ID           NUMBER DEFAULT NULL,
105 		       X_REMIT_TO_SUPPLIER_SITE         VARCHAR2 DEFAULT NULL,
106 		       X_REMIT_TO_SUPPLIER_SITE_ID      NUMBER DEFAULT NULL,
107 		       X_RELATIONSHIP_ID                NUMBER DEFAULT NULL,
108 		       X_PRODUCT_TYPE			VARCHAR2 DEFAULT NULL, --Bug#8640313
109 		       X_PRODUCT_CATEGORY		VARCHAR2 DEFAULT NULL  --Bug#8640313
110   ) IS
111     CURSOR C IS SELECT rowid FROM AP_RECURRING_PAYMENTS
112                  WHERE recurring_payment_id = X_Recurring_Payment_Id;
113       CURSOR C2 IS SELECT ap_recurring_payments_s.nextval FROM sys.dual;
114     current_calling_sequence VARCHAR2(2000);
115     debug_info               VARCHAR2(100);
116 
117    BEGIN
118       -- Update the calling sequence
119       --
120       current_calling_sequence :=
121         'AP_RECURRING_PAYMENTS_PKG.INSERT_ROW<-'||X_calling_sequence;
122 
123       if (X_Recurring_Payment_Id is NULL) then
124     debug_info := 'Open cursor C2';
125         OPEN C2;
126     debug_info := 'Fetch cursor C2';
127         FETCH C2 INTO X_Recurring_Payment_Id;
128     debug_info := 'Close cursor C2';
129         CLOSE C2;
130       end if;
131 
132        debug_info := 'Insert into AP_RECURRING_PAYMENTS';
133        INSERT INTO AP_RECURRING_PAYMENTS(
134               recurring_payment_id,
135               last_update_date,
136               last_updated_by,
137               creation_date,
138               created_by,
139               vendor_id,
140               recurring_pay_num,
141               vendor_site_id,
142               rec_pay_period_type,
143               num_of_periods,
144               first_period,
145               first_period_num,
146               authorized_total,
147               control_amount,
148               distribution_set_id,
149               terms_id,
150               set_of_books_id,
151               amount_applicable_to_discount,
152               rem_periods,
153               accounting_date,
154               released_amount,
155               batch_id,
156               accts_pay_code_combination_id,
157               invoice_currency_code,
158               payment_currency_code,
159               pay_group_lookup_code,
160               tax_amount,
161               exchange_rate,
162               next_period,
163               next_payment,
164               increment_percent,
165               num_of_periods_rem,
166               special_payment_amount1,
167               special_period_name1,
168               special_payment_amount2,
169               special_period_name2,
170               description,
171               paid_flag1,
172               paid_flag2,
173               hold_lookup_code,
174               hold_reason,
175               approved_by,
176               expiry_date,
177               attribute_category,
178               attribute1,
179               attribute2,
180               attribute3,
181               attribute4,
182               attribute5,
183               exchange_rate_type,
184               payment_cross_rate,
185               exchange_date,
186               last_update_login,
187               tax_name,
188               attribute11,
189               attribute12,
190               attribute13,
191               attribute14,
192               attribute6,
193               attribute7,
194               attribute8,
195               attribute9,
196               attribute10,
197               attribute15,
198               exclusive_payment_flag,
199               awt_group_id,
200               pay_awt_group_id,--bug6639866
201               po_header_id,
202               po_line_id,
203               External_Bank_Account_Id,
204               line_location_id,
205               Approval_Required_Flag,
206            -- Removed for bug 4277744
207            -- USSGL_Transaction_code,
208               org_id,
209               Requester_id,
210               Po_Release_Id,
211               Item_Description,
212               Manufacturer,
213               Model_Number,
214 	      Tax_Control_Amount,
215 	      Taxation_Country,
216 	      Product_Fisc_Classification,
217 	      User_Defined_Fisc_Class,
218 	      Trx_Business_Category,
219 	      Primary_Intended_Use,
220 	      Legal_Entity_Id,
221               PAYMENT_METHOD_CODE,
222               PAYMENT_REASON_CODE,
223               REMITTANCE_MESSAGE1,
224               REMITTANCE_MESSAGE2,
225               REMITTANCE_MESSAGE3,
226               bank_charge_bearer,
227               settlement_priority,
228               payment_reason_comments,
229               delivery_channel_code,
230               first_amount, -- 2794958 (2774932)
231 	      REMIT_TO_SUPPLIER_NAME,
232 	      REMIT_TO_SUPPLIER_ID,
233 	      REMIT_TO_SUPPLIER_SITE,
234 	      REMIT_TO_SUPPLIER_SITE_ID,
235 	      RELATIONSHIP_ID,
236 	      PRODUCT_TYPE,   --Bug#8640313
237 	      PRODUCT_CATEGORY) --Bug#8640313
238        VALUES (
239               X_Recurring_Payment_Id,
240               X_Last_Update_Date,
241               X_Last_Updated_By,
242               X_Creation_Date,
243               X_Created_By,
244               X_Vendor_Id,
245               X_Recurring_Pay_Num,
246               X_Vendor_Site_Id,
247               X_Rec_Pay_Period_Type,
248               X_Num_Of_Periods,
249               X_First_Period,
250               X_First_Period_Num,
251               X_Authorized_Total,
252               X_Control_Amount,
253               X_Distribution_Set_Id,
254               X_Terms_Id,
255               X_Set_Of_Books_Id,
256               X_Amount_Applicable_To_Disc,
257               X_Rem_Periods,
258               X_Accounting_Date,
259               X_Released_Amount,
260               X_Batch_Id,
261               X_Accts_Pay_Code_Comb,
262               X_Invoice_Currency_Code,
263               X_Payment_Currency_Code,
264               X_Pay_Group_Lookup_Code,
265               X_Tax_Amount,
266               X_Exchange_Rate,
267               X_Next_Period,
268               X_Next_Payment,
269               X_Increment_Percent,
270               X_Num_Of_Periods_Rem,
271               X_Special_Payment_Amount1,
272               X_Special_Period_Name1,
273               X_Special_Payment_Amount2,
274               X_Special_Period_Name2,
275               X_Description,
276               X_Paid_Flag1,
277               X_Paid_Flag2,
278               X_Hold_Lookup_Code,
279               X_Hold_Reason,
280               X_Approved_By,
281               X_Expiry_Date,
282               X_Attribute_Category,
283               X_Attribute1,
284               X_Attribute2,
285               X_Attribute3,
286               X_Attribute4,
287               X_Attribute5,
288               X_Exchange_Rate_Type,
289               X_Payment_Cross_Rate,
290               X_Exchange_Date,
291               X_Last_Update_Login,
292               X_Tax_Name,
293               X_Attribute11,
294               X_Attribute12,
295               X_Attribute13,
296               X_Attribute14,
297               X_Attribute6,
298               X_Attribute7,
299               X_Attribute8,
300               X_Attribute9,
301               X_Attribute10,
302               X_Attribute15,
303               X_Exclusive_Payment_Flag,
304               X_Awt_Group_Id,
305               X_Pay_Awt_Group_Id,--bug6639866
306               X_Po_Header_Id,
307               X_Po_Line_Id,
308               X_External_Bank_Account_Id,
309               X_Line_Location_Id,
310               X_Approval_Required_Flag,
311            -- X_USSGL_Txn_Code,  - Bug 4277744
312               X_Org_Id,
313               X_Requester_id,
314               X_Po_Release_Id,
315               X_Item_Description,
316               X_Manufacturer,
317               X_Model_Number,
318 	      X_Tax_Control_Amount,
319 	      X_Taxation_Country,
320 	      X_Product_Fisc_Class,
321 	      X_User_Defined_Fisc_Class,
322 	      X_Trx_Bus_Category,
323 	      X_Primary_Intended_Use,
324 	      X_Legal_Entity_Id,
325               x_PAYMENT_METHOD_CODE,
326               x_PAYMENT_REASON_CODE,
327               X_REMITTANCE_MESSAGE1,
328               X_REMITTANCE_MESSAGE2,
329               X_REMITTANCE_MESSAGE3,
330               x_bank_charge_bearer,
331               x_settlement_priority,
332               x_payment_reason_comments,
333               x_delivery_channel_code,
334               X_First_Amount, -- 2794958 (2774932)
335 	      X_REMIT_TO_SUPPLIER_NAME,
336               X_REMIT_TO_SUPPLIER_ID,
337               X_REMIT_TO_SUPPLIER_SITE,
338               X_REMIT_TO_SUPPLIER_SITE_ID,
339               X_RELATIONSHIP_ID,
340 	      X_PRODUCT_TYPE,     --Bug#8640313
341 	      X_PRODUCT_CATEGORY  --Bug#8640313
342              );
343 
344     debug_info := 'Open cursor C';
345     OPEN C;
346     debug_info := 'Fetch cursor C';
347     FETCH C INTO X_Rowid;
348     if (C%NOTFOUND) then
349       debug_info := 'Close cursor C - ROW NOTFOUND';
350       CLOSE C;
351       Raise NO_DATA_FOUND;
352     end if;
353     debug_info := 'Close cursor C';
354     CLOSE C;
355 
356     EXCEPTION
357       WHEN OTHERS THEN
358         if (SQLCODE <> -20001) then
359           FND_MESSAGE.SET_NAME('SQLAP', 'AP_DEBUG');
360           FND_MESSAGE.SET_TOKEN('ERROR', SQLERRM);
361           FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE', current_calling_sequence);
362           FND_MESSAGE.SET_TOKEN('PARAMETERS', 'Rowid = '||X_Rowid
363                           ||', Recurring_payment_id = '||TO_CHAR(X_Recurring_Payment_Id)
364                                        );
365           FND_MESSAGE.SET_TOKEN('DEBUG_INFO', debug_info);
366         end if;
367         APP_EXCEPTION.RAISE_EXCEPTION;
368 
369 
370   END Insert_Row;
371 
372 
373   PROCEDURE Lock_Row(X_Rowid                            VARCHAR2,
374                      X_Recurring_Payment_Id             NUMBER,
375                      X_Vendor_Id                        NUMBER,
376                      X_Recurring_Pay_Num                VARCHAR2,
377                      X_Vendor_Site_Id                   NUMBER,
378                      X_Rec_Pay_Period_Type              VARCHAR2,
379                      X_Num_Of_Periods                   NUMBER,
380                      X_First_Period                     VARCHAR2,
381                      X_First_Period_Num                 NUMBER,
382                      X_Authorized_Total                 NUMBER,
383                      X_Control_Amount                   NUMBER,
384                      X_Distribution_Set_Id              NUMBER,
385                      X_Terms_Id                         NUMBER,
386                      X_Set_Of_Books_Id                  NUMBER,
387                      X_Amount_Applicable_To_Disc        NUMBER,
388                      X_Rem_Periods                      NUMBER   DEFAULT NULL,
389                      X_Accounting_Date                  DATE     DEFAULT NULL,
390                      X_Released_Amount                  NUMBER   DEFAULT NULL,
391                      X_Batch_Id                         NUMBER   DEFAULT NULL,
392                      X_Accts_Pay_Code_Comb              NUMBER   DEFAULT NULL,
393                      X_Invoice_Currency_Code            VARCHAR2,
394                      X_Payment_Currency_Code            VARCHAR2,
395                      X_Pay_Group_Lookup_Code            VARCHAR2 DEFAULT NULL,
396                      X_Tax_Amount                       NUMBER   DEFAULT NULL,
397                      X_Exchange_Rate                    NUMBER   DEFAULT NULL,
398                      X_Next_Period                      VARCHAR2 DEFAULT NULL,
399                      X_Next_Payment                     NUMBER   DEFAULT NULL,
400                      X_Increment_Percent                NUMBER   DEFAULT NULL,
401                      X_Num_Of_Periods_Rem               NUMBER   DEFAULT NULL,
402                      X_Special_Payment_Amount1          NUMBER   DEFAULT NULL,
403                      X_Special_Period_Name1             VARCHAR2 DEFAULT NULL,
404                      X_Special_Payment_Amount2          NUMBER   DEFAULT NULL,
405                      X_Special_Period_Name2             VARCHAR2 DEFAULT NULL,
406                      X_Description                      VARCHAR2 DEFAULT NULL,
407                      X_Paid_Flag1                       VARCHAR2 DEFAULT NULL,
408                      X_Paid_Flag2                       VARCHAR2 DEFAULT NULL,
409                      X_Hold_Lookup_Code                 VARCHAR2 DEFAULT NULL,
410                      X_Hold_Reason                      VARCHAR2 DEFAULT NULL,
411                      X_Approved_By                      NUMBER   DEFAULT NULL,
412                      X_Expiry_Date                      DATE     DEFAULT NULL,
413                      X_Attribute_Category               VARCHAR2 DEFAULT NULL,
414                      X_Attribute1                       VARCHAR2 DEFAULT NULL,
415                      X_Attribute2                       VARCHAR2 DEFAULT NULL,
416                      X_Attribute3                       VARCHAR2 DEFAULT NULL,
417                      X_Attribute4                       VARCHAR2 DEFAULT NULL,
418                      X_Attribute5                       VARCHAR2 DEFAULT NULL,
419                      X_Exchange_Rate_Type               VARCHAR2 DEFAULT NULL,
420                      X_Payment_Cross_Rate               NUMBER,
421                      X_Exchange_Date                    DATE     DEFAULT NULL,
422                      X_Tax_Name                         VARCHAR2 DEFAULT NULL,
423                      X_Attribute11                      VARCHAR2 DEFAULT NULL,
424                      X_Attribute12                      VARCHAR2 DEFAULT NULL,
425                      X_Attribute13                      VARCHAR2 DEFAULT NULL,
426                      X_Attribute14                      VARCHAR2 DEFAULT NULL,
427                      X_Attribute6                       VARCHAR2 DEFAULT NULL,
428                      X_Attribute7                       VARCHAR2 DEFAULT NULL,
429                      X_Attribute8                       VARCHAR2 DEFAULT NULL,
430                      X_Attribute9                       VARCHAR2 DEFAULT NULL,
431                      X_Attribute10                      VARCHAR2 DEFAULT NULL,
432                      X_Attribute15                      VARCHAR2 DEFAULT NULL,
433                      X_Exclusive_Payment_Flag           VARCHAR2 DEFAULT NULL,
434                      X_Awt_Group_Id                     NUMBER   DEFAULT NULL,
438                      X_Po_Line_Id                       NUMBER   DEFAULT NULL,
435                      X_Pay_Awt_Group_Id                     NUMBER   DEFAULT NULL,--bug6639866
436                      X_Org_Id                           NUMBER   DEFAULT MO_GLOBAL.GET_CURRENT_ORG_ID,
437                      X_Po_Header_Id                     NUMBER   DEFAULT NULL,
439                      X_Line_Location_Id                 NUMBER   DEFAULT NULL,
440                      X_External_Bank_Account_Id         NUMBER   DEFAULT NULL,
441                      X_calling_sequence              IN VARCHAR2,
442                      X_Approval_Required_Flag           VARCHAR2,
443                   -- Removed for bug 4277744
444                   -- X_USSGL_Txn_Code                   VARCHAR2 DEFAULT NULL,
445                      X_Requester_id                     NUMBER   DEFAULT NULL,
446                      X_Po_Release_Id                    NUMBER   DEFAULT NULL,
447                      X_Item_Description                 VARCHAR2 DEFAULT NULL,
448                      X_Manufacturer                     VARCHAR2 DEFAULT NULL,
449                      X_Model_Number                     VARCHAR2 DEFAULT NULL,
450 		     X_Tax_Control_Amount		NUMBER   DEFAULT NULL,
451 		     X_Taxation_Country			VARCHAR2 DEFAULT NULL,
452 		     X_Product_Fisc_Class		VARCHAR2 DEFAULT NULL,
453 		     X_User_Defined_Fisc_Class		VARCHAR2 DEFAULT NULL,
454 		     X_Trx_Bus_Category			VARCHAR2 DEFAULT NULL,
455 		     X_Primary_Intended_Use		VARCHAR2 DEFAULT NULL,
456 		     X_Legal_Entity_Id			NUMBER   DEFAULT NULL,
457                      x_PAYMENT_METHOD_CODE              varchar2 default null,
458                      x_PAYMENT_REASON_CODE              varchar2 default null,
459                      x_remittance_message1              varchar2 default null,
460                      x_remittance_message2              varchar2 default null,
461                      x_remittance_message3              varchar2 default null,
462                      x_bank_charge_bearer               varchar2 default null,
463                      x_settlement_priority              varchar2 default null,
464                      x_payment_reason_comments          varchar2 default null,
465                      x_delivery_channel_code            varchar2 default null,
466                      X_First_Amount                     NUMBER,  -- 2794958 (2774932)
467 		     X_REMIT_TO_SUPPLIER_NAME         VARCHAR2 DEFAULT NULL,
468 		     X_REMIT_TO_SUPPLIER_ID           NUMBER DEFAULT NULL,
469 		     X_REMIT_TO_SUPPLIER_SITE         VARCHAR2 DEFAULT NULL,
470 		     X_REMIT_TO_SUPPLIER_SITE_ID      NUMBER DEFAULT NULL,
471 		     X_RELATIONSHIP_ID                NUMBER DEFAULT NULL,
472 		     X_PRODUCT_TYPE		      VARCHAR2 DEFAULT NULL, --Bug#8640313
473 		     X_PRODUCT_CATEGORY		      VARCHAR2 DEFAULT NULL  --Bug#8640313
474   ) IS
475     CURSOR C IS
476         SELECT *
477         FROM   AP_RECURRING_PAYMENTS
478         WHERE  rowid = X_Rowid
479         FOR UPDATE of Recurring_Payment_Id NOWAIT;
480     Recinfo C%ROWTYPE;
481     current_calling_sequence VARCHAR2(2000);
482     debug_info               VARCHAR2(100);
483 
484   BEGIN
485     -- Update the calling sequence
486     --
487     current_calling_sequence :=
488         'AP_RECURRING_PAYMENTS_PKG.LOCK_ROW<-'||X_calling_sequence;
489 
490     debug_info := 'Open cursor C';
491     OPEN C;
492     debug_info := 'Fetch cursor C';
493     FETCH C INTO Recinfo;
494     if (C%NOTFOUND) then
495       debug_info := 'Close cursor C - ROW NOTFOUND';
496       CLOSE C;
497       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_DELETED');
498       APP_EXCEPTION.Raise_Exception;
499     end if;
500     debug_info := 'Close cursor C';
501     CLOSE C;
502 
503     IF (
504                (Recinfo.recurring_payment_id =  X_Recurring_Payment_Id)
505            AND (Recinfo.vendor_id =  X_Vendor_Id)
506            AND (Recinfo.recurring_pay_num =  X_Recurring_Pay_Num)
507            AND (Recinfo.vendor_site_id =  X_Vendor_Site_Id)
508            AND (Recinfo.rec_pay_period_type =  X_Rec_Pay_Period_Type)
509            AND (Recinfo.num_of_periods =  X_Num_Of_Periods)
510            AND (Recinfo.first_period =  X_First_Period)
511            AND (Recinfo.first_period_num =  X_First_Period_Num)
512            AND (Recinfo.authorized_total =  X_Authorized_Total)
513            AND (Recinfo.control_amount =  X_Control_Amount)
514            AND (   (Recinfo.distribution_set_id =  X_distribution_set_id)
515                 OR (    (Recinfo.distribution_set_id IS NULL)
516                     AND (X_distribution_set_id IS NULL)))
517            AND (Recinfo.terms_id =  X_Terms_Id)
518            AND (Recinfo.set_of_books_id =  X_Set_Of_Books_Id)
519            AND (Recinfo.amount_applicable_to_discount =  X_Amount_Applicable_To_Disc)
520            AND (   (Recinfo.rem_periods =  X_Rem_Periods)
521                 OR (    (Recinfo.rem_periods IS NULL)
522                     AND (X_Rem_Periods IS NULL)))
523            AND (   (Recinfo.accounting_date =  X_Accounting_Date)
524                 OR (    (Recinfo.accounting_date IS NULL)
525                     AND (X_Accounting_Date IS NULL)))
526            AND (   (Recinfo.released_amount =  X_Released_Amount)
527                 OR (    (Recinfo.released_amount IS NULL)
528                     AND (X_Released_Amount IS NULL)))
529            AND (   (Recinfo.batch_id =  X_Batch_Id)
530                 OR (    (Recinfo.batch_id IS NULL)
531                     AND (X_Batch_Id IS NULL)))
532            AND (   (Recinfo.accts_pay_code_combination_id =  X_Accts_Pay_Code_Comb)
533                 OR (    (Recinfo.accts_pay_code_combination_id IS NULL)
534                     AND (X_Accts_Pay_Code_Comb IS NULL)))
538                 OR (    (Recinfo.pay_group_lookup_code IS NULL)
535            AND (Recinfo.invoice_currency_code =  X_Invoice_Currency_Code)
536            AND (Recinfo.payment_currency_code =  X_Payment_Currency_Code)
537            AND (   (Recinfo.pay_group_lookup_code =  X_Pay_Group_Lookup_Code)
539                     AND (X_Pay_Group_Lookup_Code IS NULL)))
540            AND (   (Recinfo.tax_amount =  X_Tax_Amount)
541                 OR (    (Recinfo.tax_amount IS NULL)
542                     AND (X_Tax_Amount IS NULL)))
543            AND (   (Recinfo.exchange_rate =  X_Exchange_Rate)
544                 OR (    (Recinfo.exchange_rate IS NULL)
545                     AND (X_Exchange_Rate IS NULL)))
546            AND (   (Recinfo.next_period =  X_Next_Period)
547                 OR (    (Recinfo.next_period IS NULL)
548                     AND (X_Next_Period IS NULL)))
549            AND (   (Recinfo.next_payment =  X_Next_Payment)
550                 OR (    (Recinfo.next_payment IS NULL)
551                     AND (X_Next_Payment IS NULL)))
552            AND (   (Recinfo.increment_percent =  X_Increment_Percent)
553                 OR (    (Recinfo.increment_percent IS NULL)
554                     AND (X_Increment_Percent IS NULL)))
555            AND (   (Recinfo.num_of_periods_rem =  X_Num_Of_Periods_Rem)
556                 OR (    (Recinfo.num_of_periods_rem IS NULL)
557                     AND (X_Num_Of_Periods_Rem IS NULL)))
558            AND (   (Recinfo.special_payment_amount1 =  X_Special_Payment_Amount1)
559                 OR (    (Recinfo.special_payment_amount1 IS NULL)
560                     AND (X_Special_Payment_Amount1 IS NULL)))
561            AND (   (Recinfo.special_period_name1 =  X_Special_Period_Name1)
562                 OR (    (Recinfo.special_period_name1 IS NULL)
563                     AND (X_Special_Period_Name1 IS NULL)))
564            AND (   (Recinfo.special_payment_amount2 =  X_Special_Payment_Amount2)
565                 OR (    (Recinfo.special_payment_amount2 IS NULL)
566                     AND (X_Special_Payment_Amount2 IS NULL)))
567            AND (   (Recinfo.special_period_name2 =  X_Special_Period_Name2)
568                 OR (    (Recinfo.special_period_name2 IS NULL)
569                     AND (X_Special_Period_Name2 IS NULL)))
570            AND (   (Recinfo.Taxation_Country =  X_Taxation_Country)
571                 OR (    (Recinfo.Taxation_Country IS NULL)
572                     AND (X_Taxation_Country IS NULL)))
573            AND (   (Recinfo.Tax_Control_Amount =  X_Tax_Control_Amount)
574                 OR (    (Recinfo.Tax_Control_Amount IS NULL)
575                     AND (X_Tax_Control_Amount IS NULL)))
576            AND (   (Recinfo.Product_Fisc_Classification =  X_Product_Fisc_Class)
577                 OR (    (Recinfo.Product_Fisc_Classification IS NULL)
578                     AND (X_Product_Fisc_Class IS NULL)))
579            AND (   (Recinfo.User_Defined_Fisc_Class =  X_User_Defined_Fisc_Class)
580                 OR (    (Recinfo.User_Defined_Fisc_Class IS NULL)
581                     AND (X_User_Defined_Fisc_Class IS NULL)))
582            AND (   (Recinfo.Trx_Business_Category =  X_Trx_Bus_Category)
583                 OR (    (Recinfo.Trx_Business_Category IS NULL)
584                     AND (X_Trx_Bus_Category IS NULL)))
585            AND (   (Recinfo.Primary_Intended_Use =  X_Primary_Intended_Use)
586                 OR (    (Recinfo.Primary_Intended_Use IS NULL)
587                     AND (X_Primary_Intended_Use IS NULL)))
588            AND (   (Recinfo.Legal_Entity_Id =  X_Legal_Entity_Id)
589                 OR (    (Recinfo.Legal_Entity_Id IS NULL)
590                     AND (X_Legal_Entity_Id IS NULL)))
591 	   AND  (   (Recinfo.REMIT_TO_SUPPLIER_NAME = X_REMIT_TO_SUPPLIER_NAME)
592                 OR (    (Recinfo.REMIT_TO_SUPPLIER_NAME IS NULL)
593 		    AND (X_REMIT_TO_SUPPLIER_NAME IS NULL)))
594 
595            AND  (   (Recinfo.REMIT_TO_SUPPLIER_ID = X_REMIT_TO_SUPPLIER_ID)
596                 OR (    (Recinfo.REMIT_TO_SUPPLIER_ID IS NULL)
597 		    AND (X_REMIT_TO_SUPPLIER_ID IS NULL)))
598 
599            AND  (   (Recinfo.REMIT_TO_SUPPLIER_SITE = X_REMIT_TO_SUPPLIER_SITE)
600                 OR (    (Recinfo.REMIT_TO_SUPPLIER_SITE IS NULL)
601 		    AND (X_REMIT_TO_SUPPLIER_SITE IS NULL)))
602 
603            AND  (   (Recinfo.REMIT_TO_SUPPLIER_SITE_ID = X_REMIT_TO_SUPPLIER_SITE_ID)
604                 OR (    (Recinfo.REMIT_TO_SUPPLIER_SITE_ID IS NULL)
605 		    AND (X_REMIT_TO_SUPPLIER_SITE_ID IS NULL)))
606 
607            AND  (   (Recinfo.RELATIONSHIP_ID = X_RELATIONSHIP_ID)
608                 OR (    (Recinfo.RELATIONSHIP_ID IS NULL)
609 		    AND (X_RELATIONSHIP_ID IS NULL))))
610                --Start bug#8640313
611             AND  (   (Recinfo.PRODUCT_TYPE = X_PRODUCT_TYPE)
612                 OR (    (Recinfo.PRODUCT_TYPE IS NULL)
613 		    AND (X_PRODUCT_TYPE IS NULL)))
614 
615             AND  (   (Recinfo.PRODUCT_CATEGORY = X_PRODUCT_CATEGORY)
616                 OR (    (Recinfo.PRODUCT_CATEGORY IS NULL)
617 		    AND (X_PRODUCT_CATEGORY IS NULL)))	then
618 
619 		    --End bug#8640313
620 
621       null;
622     else
623       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
624       APP_EXCEPTION.Raise_Exception;
625     end if;
626 
627     if(
628      (  (Recinfo.description =  X_Description)
629                 OR (    (Recinfo.description IS NULL)
630                     AND (X_Description IS NULL)))
631            AND (   (Recinfo.paid_flag1 =  X_Paid_Flag1)
632                 OR (    (Recinfo.paid_flag1 IS NULL)
633                     AND (X_Paid_Flag1 IS NULL)))
634            AND (   (Recinfo.paid_flag2 =  X_Paid_Flag2)
635                 OR (    (Recinfo.paid_flag2 IS NULL)
636                     AND (X_Paid_Flag2 IS NULL)))
637            AND (   (Recinfo.hold_lookup_code =  X_Hold_Lookup_Code)
638                 OR (    (Recinfo.hold_lookup_code IS NULL)
639                     AND (X_Hold_Lookup_Code IS NULL)))
640            AND (   (Recinfo.hold_reason =  X_Hold_Reason)
641                 OR (    (Recinfo.hold_reason IS NULL)
642                     AND (X_Hold_Reason IS NULL)))
643            AND (   (Recinfo.approved_by =  X_Approved_By)
644                 OR (    (Recinfo.approved_by IS NULL)
645                     AND (X_Approved_By IS NULL)))
646            AND (   (Recinfo.expiry_date =  X_Expiry_Date)
647                 OR (    (Recinfo.expiry_date IS NULL)
648                     AND (X_Expiry_Date IS NULL)))
649            AND (   (Recinfo.attribute_category =  X_Attribute_Category)
650                 OR (    (Recinfo.attribute_category IS NULL)
651                     AND (X_Attribute_Category IS NULL)))
652            AND (   (Recinfo.attribute1 =  X_Attribute1)
653                 OR (    (Recinfo.attribute1 IS NULL)
654                     AND (X_Attribute1 IS NULL)))
655            AND (   (Recinfo.attribute2 =  X_Attribute2)
656                 OR (    (Recinfo.attribute2 IS NULL)
657                     AND (X_Attribute2 IS NULL)))
658            AND (   (Recinfo.attribute3 =  X_Attribute3)
659                 OR (    (Recinfo.attribute3 IS NULL)
660                     AND (X_Attribute3 IS NULL)))
661            AND (   (Recinfo.attribute4 =  X_Attribute4)
662                 OR (    (Recinfo.attribute4 IS NULL)
663                     AND (X_Attribute4 IS NULL)))
664            AND (   (Recinfo.attribute5 =  X_Attribute5)
665                 OR (    (Recinfo.attribute5 IS NULL)
666                     AND (X_Attribute5 IS NULL)))
667            AND (   (Recinfo.exchange_rate_type =  X_Exchange_Rate_Type)
668                 OR (    (Recinfo.exchange_rate_type IS NULL)
669                     AND (X_Exchange_Rate_Type IS NULL)))
670            AND (Recinfo.payment_cross_rate =  X_Payment_Cross_Rate)
671            AND (   (Recinfo.exchange_date =  X_Exchange_Date)
672                 OR (    (Recinfo.exchange_date IS NULL)
673                     AND (X_Exchange_Date IS NULL)))
674            AND (   (Recinfo.tax_name =  X_Tax_Name)
675                 OR (    (Recinfo.tax_name IS NULL)
676                     AND (X_Tax_Name IS NULL)))
677            AND (   (Recinfo.attribute11 =  X_Attribute11)
678                 OR (    (Recinfo.attribute11 IS NULL)
679                     AND (X_Attribute11 IS NULL)))
680            AND (   (Recinfo.attribute12 =  X_Attribute12)
681                 OR (    (Recinfo.attribute12 IS NULL)
682                     AND (X_Attribute12 IS NULL)))
683            AND (   (Recinfo.attribute13 =  X_Attribute13)
684                 OR (    (Recinfo.attribute13 IS NULL)
685                     AND (X_Attribute13 IS NULL)))
686            AND (   (Recinfo.attribute14 =  X_Attribute14)
687                 OR (    (Recinfo.attribute14 IS NULL)
688                     AND (X_Attribute14 IS NULL)))
689            AND (   (Recinfo.attribute6 =  X_Attribute6)
690                 OR (    (Recinfo.attribute6 IS NULL)
691                     AND (X_Attribute6 IS NULL)))
692            AND (   (Recinfo.attribute7 =  X_Attribute7)
693                 OR (    (Recinfo.attribute7 IS NULL)
694                     AND (X_Attribute7 IS NULL)))
695            AND (   (Recinfo.attribute8 =  X_Attribute8)
696                 OR (    (Recinfo.attribute8 IS NULL)
697                     AND (X_Attribute8 IS NULL)))
698            AND (   (Recinfo.attribute9 =  X_Attribute9)
699                 OR (    (Recinfo.attribute9 IS NULL)
700                     AND (X_Attribute9 IS NULL)))
701            AND (   (Recinfo.attribute10 =  X_Attribute10)
702                 OR (    (Recinfo.attribute10 IS NULL)
703                     AND (X_Attribute10 IS NULL)))
704            AND (   (Recinfo.attribute15 =  X_Attribute15)
705                 OR (    (Recinfo.attribute15 IS NULL)
706                     AND (X_Attribute15 IS NULL)))
707            AND (   (Recinfo.exclusive_payment_flag =  X_Exclusive_Payment_Flag)
708                 OR (    (Recinfo.exclusive_payment_flag IS NULL)
709                     AND (X_Exclusive_Payment_Flag IS NULL)))
710            AND (   (Recinfo.awt_group_id =  X_Awt_Group_Id)
711                 OR (    (Recinfo.awt_group_id IS NULL)
712                     AND (X_Awt_Group_Id IS NULL)))
713             AND (   (Recinfo.pay_awt_group_id =  X_Pay_Awt_Group_Id)
714                 OR (    (Recinfo.pay_awt_group_id IS NULL)
715                     AND (X_Pay_Awt_Group_Id IS NULL)))    --bug6639866
716            AND (   (Recinfo.po_header_id =  X_po_header_id)
717                 OR (    (Recinfo.po_header_id IS NULL)
718                     AND (X_po_header_id IS NULL)))
722            AND (   (Recinfo.External_Bank_Account_Id =  X_External_Bank_Account_Id)
719            AND (   (Recinfo.po_line_id =  X_po_line_id)
720                 OR (    (Recinfo.po_line_id IS NULL)
721                     AND (X_po_line_id IS NULL)))
723                  OR (    (Recinfo.External_Bank_Account_Id IS NULL)
724                     AND (X_External_Bank_Account_Id IS NULL)))
725            AND (   (Recinfo.line_location_id =  X_line_location_id)
726                 OR (    (Recinfo.line_location_id IS NULL)
727                     AND (X_line_location_id IS NULL)))
728            AND (   (Recinfo.Approval_Required_Flag =  X_Approval_Required_Flag)
729                 OR (    (Recinfo.Approval_Required_Flag IS NULL)
730                     AND (X_Approval_Required_Flag IS NULL)))
731         -- Removed for bug 4277744
732         -- AND (   (Recinfo.USSGL_Transaction_Code = X_USSGL_Txn_Code)
733         --      OR (    (Recinfo.USSGL_Transaction_Code IS NULL)
734         --          AND (X_USSGL_Txn_Code IS NULL)))
735            AND (   (Recinfo.Org_Id = X_Org_Id)
736                 OR (    (Recinfo.Org_Id IS NULL)
737                     AND (X_Org_Id IS NULL)))
738            AND (   (Recinfo.Requester_Id = X_Requester_Id)
739                 OR (    (Recinfo.Requester_Id IS NULL)
740                     AND (X_Requester_Id IS NULL)))
741            AND (   (Recinfo.Po_Release_Id = X_Po_Release_Id)
742                 OR (    (Recinfo.Po_Release_Id IS NULL)
743                     AND (X_Po_Release_Id IS NULL)))
744            AND (   (Recinfo.Item_Description = X_Item_Description)
745                 OR (    (Recinfo.Item_Description IS NULL)
746                     AND (X_Item_Description IS NULL)))
747            AND (   (Recinfo.Manufacturer = X_Manufacturer)
748                 OR (    (Recinfo.Manufacturer IS NULL)
749                     AND (X_Manufacturer IS NULL)))
750            AND (   (Recinfo.Model_Number = X_Model_Number)
751                 OR (    (Recinfo.Model_Number IS NULL)
752                     AND (X_Model_Number IS NULL)))
753       AND ((Recinfo.PAYMENT_METHOD_CODE = X_PAYMENT_METHOD_CODE)
754            OR ((Recinfo.PAYMENT_METHOD_CODE is null)
755                AND (X_PAYMENT_METHOD_CODE is null)))
756       AND ((Recinfo.PAYMENT_REASON_CODE = X_PAYMENT_REASON_CODE)
757            OR ((Recinfo.PAYMENT_REASON_CODE is null)
758                AND (X_PAYMENT_REASON_CODE is null)))
759       AND ((Recinfo.REMITTANCE_MESSAGE1 = X_REMITTANCE_MESSAGE1)
760            OR ((Recinfo.REMITTANCE_MESSAGE1 is null)
761                AND (X_REMITTANCE_MESSAGE1 is null)))
762       AND ((Recinfo.REMITTANCE_MESSAGE2 = X_REMITTANCE_MESSAGE2)
763            OR ((Recinfo.REMITTANCE_MESSAGE2 is null)
764                AND (X_REMITTANCE_MESSAGE2 is null)))
765       AND ((Recinfo.REMITTANCE_MESSAGE3 = X_REMITTANCE_MESSAGE3)
766            OR ((Recinfo.REMITTANCE_MESSAGE3 is null)
767                AND (X_REMITTANCE_MESSAGE3 is null)))
768       AND ((Recinfo.bank_charge_bearer = X_bank_charge_bearer)
769            OR ((Recinfo.bank_charge_bearer is null)
770                AND (X_bank_charge_bearer is null)))
771       AND ((Recinfo.settlement_priority = X_settlement_priority)
772            OR ((Recinfo.settlement_priority is null)
773                AND (X_settlement_priority is null)))
774       AND ((Recinfo.payment_reason_comments = X_payment_reason_comments)
775            OR ((Recinfo.payment_reason_comments is null)
776                AND (X_payment_reason_comments is null)))
777       AND ((Recinfo.delivery_channel_code = X_delivery_channel_code)
778            OR ((Recinfo.delivery_channel_code is null)
779                AND (X_delivery_channel_code is null)))
780       AND (   (Recinfo.First_Amount = X_First_Amount)
781             OR (    (Recinfo.First_Amount IS NULL)
782                  AND (X_First_Amount IS NULL))) -- 2794958 (2774932)
783 
784       )then
785       return;
786      else
787       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
788       APP_EXCEPTION.Raise_Exception;
789     end if;
790 
791     EXCEPTION
792       WHEN OTHERS THEN
793         if (SQLCODE <> -20001) then
794           IF (SQLCODE = -54) THEN
795             FND_MESSAGE.SET_NAME('SQLAP','AP_RESOURCE_BUSY');
796           ELSE
797             FND_MESSAGE.SET_NAME('SQLAP', 'AP_DEBUG');
798             FND_MESSAGE.SET_TOKEN('ERROR', SQLERRM);
799             FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE', current_calling_sequence);
800             FND_MESSAGE.SET_TOKEN('PARAMETERS', 'Rowid = '||X_Rowid
801                ||', Recurring_payment_id = '||TO_CHAR(X_Recurring_Payment_Id)
802                                        );
803             FND_MESSAGE.SET_TOKEN('DEBUG_INFO', debug_info);
804       END IF;
805         end if;
806         APP_EXCEPTION.RAISE_EXCEPTION;
807   END Lock_Row;
808 
809   PROCEDURE Update_Row(X_Rowid                          VARCHAR2,
810                        X_Recurring_Payment_Id           NUMBER,
811                        X_Last_Update_Date               DATE,
812                        X_Last_Updated_By                NUMBER,
813                        X_Vendor_Id                      NUMBER,
814                        X_Recurring_Pay_Num              VARCHAR2,
815                        X_Vendor_Site_Id                 NUMBER,
816                        X_Rec_Pay_Period_Type            VARCHAR2,
817                        X_Num_Of_Periods                 NUMBER,
818                        X_First_Period                   VARCHAR2,
819                        X_First_Period_Num               NUMBER,
820                        X_Authorized_Total               NUMBER,
821                        X_Control_Amount                 NUMBER,
822                        X_Distribution_Set_Id            NUMBER   DEFAULT NULL,
823                        X_Terms_Id                       NUMBER,
824                        X_Set_Of_Books_Id                NUMBER,
825                        X_Amount_Applicable_To_Disc      NUMBER,
826                        X_Rem_Periods                    NUMBER   DEFAULT NULL,
827                        X_Accounting_Date                DATE     DEFAULT NULL,
828                        X_Released_Amount                NUMBER   DEFAULT NULL,
829                        X_Batch_Id                       NUMBER   DEFAULT NULL,
830                        X_Accts_Pay_Code_Comb            NUMBER   DEFAULT NULL,
831                        X_Invoice_Currency_Code          VARCHAR2,
832                        X_Payment_Currency_Code          VARCHAR2,
833                        X_Pay_Group_Lookup_Code          VARCHAR2 DEFAULT NULL,
834                        X_Tax_Amount                     NUMBER   DEFAULT NULL,
835                        X_Exchange_Rate                  NUMBER   DEFAULT NULL,
836                        X_Next_Period                    VARCHAR2 DEFAULT NULL,
837                        X_Next_Payment                   NUMBER   DEFAULT NULL,
838                        X_Increment_Percent              NUMBER   DEFAULT NULL,
839                        X_Num_Of_Periods_Rem             NUMBER   DEFAULT NULL,
840                        X_Special_Payment_Amount1        NUMBER   DEFAULT NULL,
841                        X_Special_Period_Name1           VARCHAR2 DEFAULT NULL,
842                        X_Special_Payment_Amount2        NUMBER   DEFAULT NULL,
843                        X_Special_Period_Name2           VARCHAR2 DEFAULT NULL,
844                        X_Description                    VARCHAR2 DEFAULT NULL,
845                        X_Paid_Flag1                     VARCHAR2 DEFAULT NULL,
846                        X_Paid_Flag2                     VARCHAR2 DEFAULT NULL,
847                        X_Hold_Lookup_Code               VARCHAR2 DEFAULT NULL,
848                        X_Hold_Reason                    VARCHAR2 DEFAULT NULL,
849                        X_Approved_By                    NUMBER   DEFAULT NULL,
850                        X_Expiry_Date                    DATE     DEFAULT NULL,
851                        X_Attribute_Category             VARCHAR2 DEFAULT NULL,
852                        X_Attribute1                     VARCHAR2 DEFAULT NULL,
853                        X_Attribute2                     VARCHAR2 DEFAULT NULL,
854                        X_Attribute3                     VARCHAR2 DEFAULT NULL,
855                        X_Attribute4                     VARCHAR2 DEFAULT NULL,
856                        X_Attribute5                     VARCHAR2 DEFAULT NULL,
857                        X_Exchange_Rate_Type             VARCHAR2 DEFAULT NULL,
858                        X_Payment_Cross_Rate             NUMBER,
859                        X_Exchange_Date                  DATE     DEFAULT NULL,
860                        X_Last_Update_Login              NUMBER   DEFAULT NULL,
861                        X_Tax_Name                       VARCHAR2 DEFAULT NULL,
862                        X_Attribute11                    VARCHAR2 DEFAULT NULL,
863                        X_Attribute12                    VARCHAR2 DEFAULT NULL,
864                        X_Attribute13                    VARCHAR2 DEFAULT NULL,
865                        X_Attribute14                    VARCHAR2 DEFAULT NULL,
866                        X_Attribute6                     VARCHAR2 DEFAULT NULL,
867                        X_Attribute7                     VARCHAR2 DEFAULT NULL,
868                        X_Attribute8                     VARCHAR2 DEFAULT NULL,
869                        X_Attribute9                     VARCHAR2 DEFAULT NULL,
870                        X_Attribute10                    VARCHAR2 DEFAULT NULL,
871                        X_Attribute15                    VARCHAR2 DEFAULT NULL,
872                        X_Exclusive_Payment_Flag         VARCHAR2 DEFAULT NULL,
873                        X_Awt_Group_Id                   NUMBER   DEFAULT NULL,
874                        X_Pay_Awt_Group_Id                   NUMBER   DEFAULT NULL,--bug6639866
875                        X_Org_Id                         NUMBER   DEFAULT MO_GLOBAL.GET_CURRENT_ORG_ID,
876                        X_Po_Header_Id                   NUMBER   DEFAULT NULL,
877                        X_Po_Line_Id                     NUMBER   DEFAULT NULL,
878                        X_Line_Location_Id               NUMBER   DEFAULT NULL,
879                        X_External_Bank_Account_Id       NUMBER   DEFAULT NULL,
880                        X_calling_sequence            IN VARCHAR2,
881                        X_Approval_Required_Flag         VARCHAR2,
882                     -- Removed for bug 4277744
883                     -- X_USSGL_Txn_Code                 VARCHAR2,
884                        X_Requester_id                   NUMBER   DEFAULT NULL,
885                        X_Po_Release_Id                  NUMBER   DEFAULT NULL,
886                        X_Item_Description               VARCHAR2 DEFAULT NULL,
887                        X_Manufacturer                   VARCHAR2 DEFAULT NULL,
888                        X_Model_Number                   VARCHAR2 DEFAULT NULL,
889 		       X_Tax_Control_Amount		NUMBER   DEFAULT NULL,
890 		       X_Taxation_Country		VARCHAR2 DEFAULT NULL,
891 		       X_Product_Fisc_Class		VARCHAR2 DEFAULT NULL,
892 		       X_User_Defined_Fisc_Class	VARCHAR2 DEFAULT NULL,
893 		       X_Trx_Bus_Category		VARCHAR2 DEFAULT NULL,
894 		       X_Primary_Intended_Use		VARCHAR2 DEFAULT NULL,
895 		       X_Legal_Entity_Id		NUMBER   DEFAULT NULL,
896                        x_PAYMENT_METHOD_CODE            varchar2 default null,
897                        x_PAYMENT_REASON_CODE            varchar2 default null,
898                        x_remittance_message1            varchar2 default null,
899                        x_remittance_message2            varchar2 default null,
900                        x_remittance_message3            varchar2 default null,
901                        x_bank_charge_bearer             varchar2 default null,
902                        x_settlement_priority            varchar2 default null,
903                        x_payment_reason_comments        varchar2 default null,
904                        x_delivery_channel_code          varchar2 default null,
905                        x_first_amount                   number, -- 2794958 (2774932)
906 		       X_REMIT_TO_SUPPLIER_NAME         VARCHAR2 DEFAULT NULL,
907 		       X_REMIT_TO_SUPPLIER_ID           NUMBER DEFAULT NULL,
908 		       X_REMIT_TO_SUPPLIER_SITE         VARCHAR2 DEFAULT NULL,
909 		       X_REMIT_TO_SUPPLIER_SITE_ID      NUMBER DEFAULT NULL,
910 		       X_RELATIONSHIP_ID                NUMBER DEFAULT NULL,
911 		       X_PRODUCT_TYPE			VARCHAR2 DEFAULT NULL, --Bug#8640313
912 		       X_PRODUCT_CATEGORY		VARCHAR2 DEFAULT NULL  --Bug#8640313
913   ) IS
914 
915     current_calling_sequence VARCHAR2(2000);
916     debug_info               VARCHAR2(100);
917 
918   BEGIN
919     -- Update the calling sequence
920     --
921     current_calling_sequence :=
922         'AP_RECURRING_PAYMENTS_PKG.UPDATE_ROW<-'||X_calling_sequence;
923 
924     debug_info := 'Update AP_RECURRING_PAYMENTS';
925     UPDATE AP_RECURRING_PAYMENTS_ALL
926     SET
927        recurring_payment_id            =     X_Recurring_Payment_Id,
931        recurring_pay_num               =     X_Recurring_Pay_Num,
928        last_update_date                =     X_Last_Update_Date,
929        last_updated_by                 =     X_Last_Updated_By,
930        vendor_id                       =     X_Vendor_Id,
932        vendor_site_id                  =     X_Vendor_Site_Id,
933        rec_pay_period_type             =     X_Rec_Pay_Period_Type,
934        num_of_periods                  =     X_Num_Of_Periods,
935        first_period                    =     X_First_Period,
936        first_period_num                =     X_First_Period_Num,
937        authorized_total                =     X_Authorized_Total,
938        control_amount                  =     X_Control_Amount,
939        distribution_set_id             =     X_Distribution_Set_Id,
940        terms_id                        =     X_Terms_Id,
941        set_of_books_id                 =     X_Set_Of_Books_Id,
942        amount_applicable_to_discount   =     X_Amount_Applicable_To_Disc,
943        rem_periods                     =     X_Rem_Periods,
944        accounting_date                 =     X_Accounting_Date,
945        released_amount                 =     X_Released_Amount,
946        batch_id                        =     X_Batch_Id,
947        accts_pay_code_combination_id   =     X_Accts_Pay_Code_Comb,
948        invoice_currency_code           =     X_Invoice_Currency_Code,
949        payment_currency_code           =     X_Payment_Currency_Code,
950        pay_group_lookup_code           =     X_Pay_Group_Lookup_Code,
951        tax_amount                      =     X_Tax_Amount,
952        exchange_rate                   =     X_Exchange_Rate,
953        next_period                     =     X_Next_Period,
954        next_payment                    =     X_Next_Payment,
955        increment_percent               =     X_Increment_Percent,
956        num_of_periods_rem              =     X_Num_Of_Periods_Rem,
957        special_payment_amount1         =     X_Special_Payment_Amount1,
958        special_period_name1            =     X_Special_Period_Name1,
959        special_payment_amount2         =     X_Special_Payment_Amount2,
960        special_period_name2            =     X_Special_Period_Name2,
961        description                     =     X_Description,
962        paid_flag1                      =     X_Paid_Flag1,
963        paid_flag2                      =     X_Paid_Flag2,
964        hold_lookup_code                =     X_Hold_Lookup_Code,
965        hold_reason                     =     X_Hold_Reason,
966        approved_by                     =     X_Approved_By,
967        expiry_date                     =     X_Expiry_Date,
968        attribute_category              =     X_Attribute_Category,
969        attribute1                      =     X_Attribute1,
970        attribute2                      =     X_Attribute2,
971        attribute3                      =     X_Attribute3,
972        attribute4                      =     X_Attribute4,
973        attribute5                      =     X_Attribute5,
974        exchange_rate_type              =     X_Exchange_Rate_Type,
975        payment_cross_rate              =     X_Payment_Cross_Rate,
976        exchange_date                   =     X_Exchange_Date,
977        last_update_login               =     X_Last_Update_Login,
978        tax_name                        =     X_Tax_Name,
979        attribute11                     =     X_Attribute11,
980        attribute12                     =     X_Attribute12,
981        attribute13                     =     X_Attribute13,
982        attribute14                     =     X_Attribute14,
983        attribute6                      =     X_Attribute6,
984        attribute7                      =     X_Attribute7,
985        attribute8                      =     X_Attribute8,
986        attribute9                      =     X_Attribute9,
987        attribute10                     =     X_Attribute10,
988        attribute15                     =     X_Attribute15,
989        exclusive_payment_flag          =     X_Exclusive_Payment_Flag,
990        awt_group_id                    =     X_Awt_Group_Id,
991        pay_awt_group_id                =     X_Pay_Awt_Group_Id,--bug6639866
992        po_header_id                    =     X_Po_Header_Id,
993        po_line_id                      =     X_Po_Line_Id,
994        External_Bank_Account_Id        =     X_External_Bank_Account_Id,
995        line_location_id                =     X_Line_Location_Id,
996        Approval_Required_Flag           =     X_Approval_Required_Flag,
997     -- Removed for bug 4277744
998     -- USSGL_Transaction_Code          =     X_USSGL_Txn_Code,
999        org_id                          =     X_org_id,
1000        requester_id                    =     X_Requester_id,
1001        po_release_id                   =     X_Po_Release_Id,
1002        Item_Description                =     X_Item_Description,
1003        Manufacturer                    =     X_Manufacturer,
1004        Model_Number                    =     X_Model_Number,
1005        Tax_Control_Amount	       =     X_Tax_Control_Amount,
1006        Taxation_Country		       =     X_Taxation_Country,
1007        Product_Fisc_Classification     =     X_Product_Fisc_Class,
1008        User_Defined_Fisc_Class         =     X_User_Defined_Fisc_Class,
1009        Trx_Business_Category           =     X_Trx_Bus_Category,
1010        Primary_Intended_Use            =     X_Primary_Intended_Use,
1011        Legal_Entity_Id		       =     X_Legal_Entity_Id,
1012        PAYMENT_METHOD_CODE             =     x_PAYMENT_METHOD_CODE,
1013        PAYMENT_REASON_CODE             =     x_PAYMENT_REASON_CODE,
1014        REMITTANCE_MESSAGE1             =     X_REMITTANCE_MESSAGE1,
1015        REMITTANCE_MESSAGE2             =     X_REMITTANCE_MESSAGE2,
1016        REMITTANCE_MESSAGE3             =     X_REMITTANCE_MESSAGE3,
1017        bank_charge_bearer              =     x_bank_charge_bearer,
1018        settlement_priority             =     x_settlement_priority,
1019        payment_reason_comments         =     x_payment_reason_comments,
1020        delivery_channel_code           =     x_delivery_channel_code,
1021        first_amount                    =     x_first_amount, -- 2794958 (2774932)
1022        REMIT_TO_SUPPLIER_NAME          =     X_REMIT_TO_SUPPLIER_NAME,
1023        REMIT_TO_SUPPLIER_ID            =     X_REMIT_TO_SUPPLIER_ID,
1024        REMIT_TO_SUPPLIER_SITE          =     X_REMIT_TO_SUPPLIER_SITE,
1025        REMIT_TO_SUPPLIER_SITE_ID       =     X_REMIT_TO_SUPPLIER_SITE_ID,
1026        RELATIONSHIP_ID                 =     X_RELATIONSHIP_ID,
1027        PRODUCT_TYPE                    =     X_PRODUCT_TYPE,  --Bug#8640313
1028        PRODUCT_CATEGORY                =     X_PRODUCT_CATEGORY  --Bug#8640313
1029     WHERE rowid = X_Rowid;
1030 
1031     if (SQL%NOTFOUND) then
1032       Raise NO_DATA_FOUND;
1033     end if;
1034 
1035     EXCEPTION
1036       WHEN OTHERS THEN
1037         if (SQLCODE <> -20001) then
1038           FND_MESSAGE.SET_NAME('SQLAP', 'AP_DEBUG');
1039           FND_MESSAGE.SET_TOKEN('ERROR', SQLERRM);
1040           FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE', current_calling_sequence);
1041           FND_MESSAGE.SET_TOKEN('PARAMETERS', 'Rowid = '||X_Rowid
1042                           ||', Recurring_payment_id = '||TO_CHAR(X_Recurring_Payment_Id)
1043                                        );
1044           FND_MESSAGE.SET_TOKEN('DEBUG_INFO', debug_info);
1045         end if;
1046         APP_EXCEPTION.RAISE_EXCEPTION;
1047 
1048   END Update_Row;
1049 
1050   PROCEDURE Delete_Row(X_Rowid                 VARCHAR2,
1051                X_calling_sequence    IN    VARCHAR2) IS
1052 
1053     current_calling_sequence VARCHAR2(2000);
1054     debug_info               VARCHAR2(100);
1055 
1056   BEGIN
1057 
1058     -- Update the calling sequence
1059     --
1060     current_calling_sequence :=
1061         'AP_RECURRING_PAYMENTS_PKG.DELETE_ROW<-'||X_calling_sequence;
1062 
1063     debug_info := 'Delete from AP_RECURRING_PAYMENTS';
1064     DELETE FROM AP_RECURRING_PAYMENTS_ALL
1065     WHERE rowid = X_Rowid;
1066 
1067     if (SQL%NOTFOUND) then
1068       Raise NO_DATA_FOUND;
1069     end if;
1070 
1071     EXCEPTION
1072       WHEN OTHERS THEN
1073         if (SQLCODE <> -20001) then
1074           FND_MESSAGE.SET_NAME('SQLAP', 'AP_DEBUG');
1075           FND_MESSAGE.SET_TOKEN('ERROR', SQLERRM);
1076           FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE', current_calling_sequence);
1077           FND_MESSAGE.SET_TOKEN('PARAMETERS', 'Rowid = '||X_Rowid);
1078           FND_MESSAGE.SET_TOKEN('DEBUG_INFO', debug_info);
1079         end if;
1080         APP_EXCEPTION.RAISE_EXCEPTION;
1081 
1082   END Delete_Row;
1083 
1084 END AP_RECURRING_PAYMENTS_PKG;