DBA Data[Home] [Help]

PACKAGE BODY: APPS.AP_PBATCH_SET_LINES_PKG

Source


1 PACKAGE BODY AP_PBATCH_SET_LINES_PKG as
2 /* $Header: apbsetlb.pls 120.3 2003/09/25 22:34:58 pjena noship $ */
3 /* BUG 2124337 :Parameters X_attribute_category to X_attribute15 added */
4 PROCEDURE Insert_Row(
5           X_Rowid                 IN OUT NOCOPY   VARCHAR2,
6           X_Batch_Name                     VARCHAR2,
7           X_Batch_Set_Id                   NUMBER,
8           X_Batch_Set_Line_Id              NUMBER,
9           X_Include_In_Set                 VARCHAR2 DEFAULT NULL,
10           X_Printer                        VARCHAR2 DEFAULT NULL,
11           X_Check_Stock_Id                 NUMBER DEFAULT NULL,
12           X_Ce_Bank_Acct_Use_Id            NUMBER DEFAULT NULL,
13           X_Vendor_Pay_Group               VARCHAR2 DEFAULT NULL,
14           X_Hi_Payment_Priority            NUMBER DEFAULT NULL,
15           X_Low_Payment_Priority           NUMBER DEFAULT NULL,
16           X_Max_Payment_Amount             NUMBER DEFAULT NULL,
17           X_Min_Check_Amount               NUMBER DEFAULT NULL,
18           X_Max_Outlay                     NUMBER DEFAULT NULL,
19           X_Pay_Only_When_Due_Flag         VARCHAR2 DEFAULT NULL,
20           X_Payment_Currency_Code          VARCHAR2,
21           X_Exchange_Rate_Type             VARCHAR2 DEFAULT NULL,
22           X_Document_Order_Lookup_Code     VARCHAR2 DEFAULT NULL,
23           X_Audit_Required_Flag            VARCHAR2 DEFAULT NULL,
24           X_Interval                       NUMBER DEFAULT NULL,
25           X_Volume_Serial_Number           VARCHAR2 DEFAULT NULL,
26           X_Zero_Amounts_Allowed           VARCHAR2 DEFAULT NULL,
27           X_Zero_Invoices_Allowed          VARCHAR2 DEFAULT NULL,
28           X_Org_Id                         NUMBER DEFAULT NULL,
29           X_Future_Pmts_Allowed            VARCHAR2 DEFAULT NULL,
30           X_Transfer_Priority              VARCHAR2 DEFAULT NULL,
31           X_Last_Update_Date               DATE,
32           X_Last_Updated_By                NUMBER,
33           X_Last_Update_Login              NUMBER DEFAULT NULL,
34           X_Creation_Date                  DATE DEFAULT NULL,
35           X_Created_By                     NUMBER DEFAULT NULL,
36           X_Inactive_Date                  DATE DEFAULT NULL,
37 	  X_calling_sequence	  IN	   VARCHAR2,
38 	  X_attribute_category		   VARCHAR2, /* BUG 2124337 */
39 	  X_attribute1			   VARCHAR2,
40 	  X_attribute2			   VARCHAR2,
41 	  X_attribute3			   VARCHAR2,
42 	  X_attribute4			   VARCHAR2,
43 	  X_attribute5			   VARCHAR2,
44 	  X_attribute6			   VARCHAR2,
45 	  X_attribute7			   VARCHAR2,
46 	  X_attribute8			   VARCHAR2,
47 	  X_attribute9			   VARCHAR2,
48 	  X_attribute10			   VARCHAR2,
49 	  X_attribute11			   VARCHAR2,
50 	  X_attribute12			   VARCHAR2,
51 	  X_attribute13			   VARCHAR2,
52 	  X_attribute14			   VARCHAR2,
53 	  X_attribute15			   VARCHAR2, /* BUG 2124337 */
54           X_Vendor_Id                      NUMBER,
55           X_days_between_check_cycles      NUMBER
56   ) IS
57     l_batch_set_line_id      NUMBER;
58     CURSOR C IS SELECT rowid FROM ap_pbatch_set_lines
59                  WHERE batch_name = X_Batch_Name
60                  AND   batch_set_line_id = l_Batch_Set_Line_Id;
61     current_calling_sequence VARCHAR2(2000);
62     debug_info               VARCHAR2(100);
63 
64    BEGIN
65     -- Update the calling sequence
66     --
67        current_calling_sequence :=
68        'AP_PBATCH_SET_LINES_PKG.INSERT_ROW<-'||X_Calling_Sequence;
69 
70        -- Get next batch set line id
71        debug_info := 'Get next Batch set line Id';
72 
73        --
74        -- Bugfix 2146760: generate a new batch_set_line_id only
75        -- if it is passed in as NULL
76        --
77        l_batch_set_line_id := X_Batch_Set_Line_Id;
78 
79        if (l_batch_set_line_id is NULL) then
80          select ap_pbatch_set_lines_s.nextval
81          into l_batch_set_line_id
82          from sys.dual;
83        end if;
84 
85        debug_info := 'Insert into ap_pbatch_set_lines';
86        INSERT INTO ap_pbatch_set_lines (
87               batch_name,
88               batch_set_id,
89               batch_set_line_id,
90               include_in_set,
91               printer,
92               check_stock_id,
93               ce_bank_acct_use_id,
94               vendor_pay_group,
95               hi_payment_priority,
96               low_payment_priority,
97               max_payment_amount,
98               min_check_amount,
99               max_outlay,
100               pay_only_when_due_flag,
101               payment_currency_code,
102               exchange_rate_type,
103               document_order_lookup_code,
104               audit_required_flag,
105               interval,
106               volume_serial_number,
107               zero_amounts_allowed,
108               zero_invoices_allowed,
109               future_pmts_allowed,
110               transfer_priority,
111               inactive_date,
112               last_update_date,
113               last_updated_by,
114               last_update_login,
115               creation_date,
116               created_by,
117               attribute_category,		   /* BUG 2124337 */
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,			  /* BUG 2124337 */
133               vendor_id,
134               org_id,
135               days_between_check_cycles
136              ) VALUES (
137 
138               X_Batch_Name,
139               X_Batch_Set_Id,
140               l_Batch_Set_Line_Id,
141               X_Include_In_Set,
142               X_Printer,
143               X_Check_Stock_Id,
144               X_Ce_Bank_Acct_Use_Id,
145               X_Vendor_Pay_Group,
146               X_Hi_Payment_Priority,
147               X_Low_Payment_Priority,
148               X_Max_Payment_amount,
149               X_Min_Check_Amount,
150               X_Max_Outlay,
151               X_Pay_Only_When_Due_Flag,
152               X_Payment_Currency_Code,
153               X_Exchange_Rate_Type,
154               X_Document_Order_Lookup_Code,
155               X_Audit_Required_Flag,
156               X_Interval,
157               X_Volume_Serial_Number,
158               X_Zero_Amounts_Allowed,
159               X_Zero_Invoices_Allowed,
160               X_Future_Pmts_Allowed,
161               X_Transfer_Priority,
162               X_Inactive_Date,
163               X_Last_Update_Date,
164               X_Last_Updated_By,
165               X_Last_Update_Login,
166               X_Creation_Date,
167               X_Created_By,
168               X_attribute_category,		   /* BUG 2124337 */
169 	      X_attribute1,
170 	      X_attribute2,
171 	      X_attribute3,
172 	      X_attribute4,
173 	      X_attribute5,
174 	      X_attribute6,
175 	      X_attribute7,
176 	      X_attribute8,
177 	      X_attribute9,
178 	      X_attribute10,
179 	      X_attribute11,
180 	      X_attribute12,
181 	      X_attribute13,
182 	      X_attribute14,
183 	      X_attribute15,			     /* BUG 2124337 */
184               X_Vendor_Id,
185               X_Org_Id,
186               X_days_between_check_cycles
187               );
188 
189    debug_info := 'Open cursor C';
190     OPEN C;
191     debug_info := 'Fetch cursor C';
192     FETCH C INTO X_Rowid;
193     if (C%NOTFOUND) then
194       debug_info := 'Close cursor C - ROW NOTFOUND';
195       CLOSE C;
196       Raise NO_DATA_FOUND;
197     end if;
198     debug_info := 'Close cursor C';
199     CLOSE C;
200 
201     EXCEPTION
202      WHEN OTHERS THEN
203       if (SQLCODE <> -20001) then
204         FND_MESSAGE.SET_NAME('SQLAP', 'AP_DEBUG');
205         FND_MESSAGE.SET_TOKEN('ERROR', SQLERRM);
206         FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE', current_calling_sequence);
207         FND_MESSAGE.SET_TOKEN('PARAMETERS', 'Batch Name = '||X_Batch_Name
208                                ||', Batch Set Line Id ='||l_Batch_Set_Line_Id
209                                ||', ROWID = '||X_ROWID);
210         FND_MESSAGE.SET_TOKEN('DEBUG_INFO', debug_info);
211       end if;
212       APP_EXCEPTION.RAISE_EXCEPTION;
213 
214   END Insert_Row;
215 
216 /* BUG 2124337 :Parameters X_attribute_category to X_attribute15 added */
217     PROCEDURE Lock_Row(
218               X_Rowid                          VARCHAR2,
219               X_Batch_Name                     VARCHAR2,
220               X_Batch_Set_Id                   NUMBER,
221               X_Batch_Set_Line_Id              NUMBER,
222               X_Include_In_Set                 VARCHAR2 DEFAULT NULL,
223               X_Printer                        VARCHAR2 DEFAULT NULL,
224               X_Check_Stock_Id                 NUMBER DEFAULT NULL,
225               X_Ce_Bank_Acct_Use_Id            NUMBER DEFAULT NULL,
226               X_Vendor_Pay_Group               VARCHAR2 DEFAULT NULL,
227               X_Hi_Payment_Priority            NUMBER DEFAULT NULL,
228               X_Low_Payment_Priority           NUMBER DEFAULT NULL,
229               X_Max_Payment_Amount             NUMBER DEFAULT NULL,
230               X_Min_Check_Amount               NUMBER DEFAULT NULL,
231               X_Max_Outlay                     NUMBER DEFAULT NULL,
232               X_Pay_Only_When_Due_Flag         VARCHAR2 DEFAULT NULL,
233               X_Currency_Code                  VARCHAR2,
234               X_Exchange_Rate_Type             VARCHAR2 DEFAULT NULL,
235               X_Document_Order_Lookup_Code     VARCHAR2 DEFAULT NULL,
236               X_Audit_Required_Flag            VARCHAR2 DEFAULT NULL,
237               X_Interval                       NUMBER DEFAULT NULL,
238               X_Volume_Serial_Number           VARCHAR2 DEFAULT NULL,
239               X_Zero_Amounts_Allowed           VARCHAR2 DEFAULT NULL,
240               X_Zero_Invoices_Allowed          VARCHAR2 DEFAULT NULL,
241               X_Org_Id                         NUMBER DEFAULT NULL,
242               X_Future_Pmts_Allowed            VARCHAR2 DEFAULT NULL,
243               X_transfer_priority              VARCHAR2 DEFAULT NULL,
244               X_Inactive_Date                  DATE DEFAULT NULL,
245 	      X_calling_sequence	IN     VARCHAR2,
246 	      X_attribute_category	       VARCHAR2, /* BUG 2124337 */
247 	      X_attribute1		       VARCHAR2,
248 	      X_attribute2		       VARCHAR2,
249 	      X_attribute3		       VARCHAR2,
250 	      X_attribute4		       VARCHAR2,
251 	      X_attribute5		       VARCHAR2,
252 	      X_attribute6	               VARCHAR2,
253 	      X_attribute7		       VARCHAR2,
254 	      X_attribute8		       VARCHAR2,
255 	      X_attribute9	               VARCHAR2,
256 	      X_attribute10		       VARCHAR2,
257 	      X_attribute11		       VARCHAR2,
258 	      X_attribute12		       VARCHAR2,
259 	      X_attribute13		       VARCHAR2,
260 	      X_attribute14		       VARCHAR2,
261 	      X_attribute15		       VARCHAR2,  /* BUG 2124337 */
262               X_Vendor_Id                      NUMBER,
263               X_days_between_check_cycles      NUMBER
264   ) IS
265     CURSOR C IS
266         SELECT *
267         FROM   ap_pbatch_set_lines
268         WHERE  rowid = X_Rowid
269         FOR UPDATE of Batch_Name NOWAIT;
270     Recinfo C%ROWTYPE;
271     current_calling_sequence VARCHAR2(2000);
272     debug_info               VARCHAR2(100);
273 
274 
275   BEGIN
276     -- Update the calling sequence
277     --
278     current_calling_sequence :=
279      'AP_PBATCH_SET_LINES_PKG.LOCK_ROW<-'||X_Calling_Sequence;
280 
281     debug_info := 'Open cursor C';
282     OPEN C;
283     debug_info := 'Fetch cursor C';
284     FETCH C INTO Recinfo;
285     if (C%NOTFOUND) then
286       debug_info := 'Close cursor C -ROW NOTFOUND';
287       CLOSE C;
288       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_DELETED');
289       APP_EXCEPTION.Raise_Exception;
290     end if;
291     debug_info := 'Close cursor C';
292     CLOSE C;
293     if (
294 
295                (Recinfo.batch_name =  X_Batch_Name)
296            AND (Recinfo.batch_set_id =  X_Batch_Set_Id)
297            AND (Recinfo.batch_set_line_id =  X_Batch_Set_Line_Id)
298            AND (   (Recinfo.include_in_set = X_Include_In_Set)
299                 OR (    (Recinfo.include_in_set IS NULL)
300                     AND (X_Include_In_Set IS NULL)))
301            AND (   (Recinfo.printer = X_Printer)
302                 OR (    (Recinfo.printer IS NULL)
303                     AND (X_Printer IS NULL)))
304           AND (   (Recinfo.check_stock_id = X_Check_Stock_Id)
305                 OR (    (Recinfo.check_stock_id IS NULL)
306                     AND (X_Check_Stock_Id IS NULL)))
307           AND (   (Recinfo.ce_bank_acct_use_id = X_Ce_Bank_Acct_Use_Id)
308                 OR (    (Recinfo.ce_bank_acct_use_id IS NULL)
309                     AND (X_Ce_Bank_Acct_Use_Id IS NULL)))
310            AND (   (Recinfo.vendor_pay_group = X_Vendor_Pay_Group)
311                 OR (    (Recinfo.vendor_pay_group IS NULL)
312                     AND (X_Vendor_Pay_Group IS NULL)))
313            AND (   (Recinfo.hi_payment_priority = X_Hi_Payment_Priority)
314                 OR (    (Recinfo.hi_payment_priority IS NULL)
315                     AND (X_Hi_Payment_Priority IS NULL)))
316            AND (   (Recinfo.low_payment_priority = X_Low_Payment_Priority)
317                 OR (    (Recinfo.low_payment_priority IS NULL)
318                     AND (X_Low_Payment_Priority IS NULL)))
319            AND (   (Recinfo.max_payment_amount = X_Max_Payment_Amount)
320                 OR (    (Recinfo.max_payment_amount IS NULL)
321                     AND (X_Max_Payment_Amount IS NULL)))
322            AND (   (Recinfo.min_check_amount = X_Min_Check_Amount)
323                 OR (    (Recinfo.min_check_amount IS NULL)
324                     AND (X_Min_Check_Amount IS NULL)))
325            AND (   (Recinfo.max_outlay = X_Max_Outlay)
326                 OR (    (Recinfo.max_outlay IS NULL)
327                     AND (X_Max_Outlay IS NULL)))
328            AND (   (Recinfo.pay_only_when_due_flag = X_Pay_Only_When_Due_flag)
329                 OR (    (Recinfo.pay_only_when_due_flag IS NULL)
330                     AND (X_Pay_Only_When_Due_Flag IS NULL)))
331            AND (Recinfo.payment_currency_code =  X_Currency_Code)
332            AND (   (Recinfo.exchange_rate_type = X_Exchange_Rate_Type)
333                 OR (    (Recinfo.exchange_rate_type IS NULL)
334                     AND (X_Exchange_Rate_Type IS NULL)))
335            AND (   (Recinfo.document_order_lookup_code =
336                          X_Document_Order_Lookup_Code)
337                 OR (    (Recinfo.document_order_lookup_code IS NULL)
338                     AND (X_Document_Order_Lookup_Code IS NULL)))
339            AND (   (Recinfo.audit_required_flag= X_Audit_Required_Flag)
340                 OR (    (Recinfo.audit_required_flag IS NULL)
341                     AND (X_Audit_Required_Flag IS NULL)))
342            AND (   (Recinfo.interval = X_Interval)
343                 OR (    (Recinfo.interval IS NULL)
344                     AND (X_Interval IS NULL)))
345            AND (   (Recinfo.volume_serial_number = X_Volume_Serial_Number)
346                 OR (    (Recinfo.volume_serial_number IS NULL)
347                     AND (X_Volume_Serial_Number IS NULL)))
348            AND (   (Recinfo.zero_amounts_allowed = X_Zero_Amounts_Allowed)
349                 OR (    (Recinfo.zero_amounts_allowed IS NULL)
350                     AND (X_Zero_Amounts_Allowed IS NULL)))
351            AND (   (Recinfo.zero_invoices_allowed = X_Zero_Invoices_Allowed)
352                 OR (    (Recinfo.zero_invoices_allowed IS NULL)
353                     AND (X_Zero_Invoices_Allowed IS NULL)))
354            AND (   (Recinfo.Future_Pmts_Allowed = X_Future_Pmts_Allowed)
355                 OR (    (Recinfo.Future_Pmts_Allowed IS NULL)
356                     AND (X_Future_Pmts_Allowed IS NULL)))
357            AND (   (Recinfo.transfer_priority = X_Transfer_Priority)
358                 OR (    (Recinfo.transfer_priority IS NULL)
362                     AND (X_Inactive_Date IS NULL)))
359                     AND (X_Transfer_Priority IS NULL)))
360            AND (   (Recinfo.inactive_date = X_Inactive_Date)
361                 OR (    (Recinfo.inactive_date IS NULL)
363            AND (   (Recinfo.attribute_category = X_attribute_category) /* Bug 2124337 */
364                 OR (    (Recinfo.attribute_category IS NULL)
365                     AND (X_attribute_category IS NULL)))
366            AND (   (Recinfo.attribute1 = X_attribute1)
367                 OR (    (Recinfo.attribute1 IS NULL)
368                     AND (X_attribute1 IS NULL)))
369            AND (   (Recinfo.attribute2 = X_attribute2)
370                 OR (    (Recinfo.attribute2 IS NULL)
371                     AND (X_attribute2 IS NULL)))
372            AND (   (Recinfo.attribute3 = X_attribute3)
373                 OR (    (Recinfo.attribute3 IS NULL)
374                     AND (X_attribute3 IS NULL)))
375            AND (   (Recinfo.attribute4 = X_attribute4)
376                 OR (    (Recinfo.attribute4 IS NULL)
377                     AND (X_attribute4 IS NULL)))
378            AND (   (Recinfo.attribute5 = X_attribute5)
379                 OR (    (Recinfo.attribute5 IS NULL)
380                     AND (X_attribute5 IS NULL)))
381            AND (   (Recinfo.attribute6 = X_attribute6)
382                 OR (    (Recinfo.attribute6 IS NULL)
383                     AND (X_attribute6 IS NULL)))
384            AND (   (Recinfo.attribute7 = X_attribute7)
385                 OR (    (Recinfo.attribute7 IS NULL)
386                     AND (X_attribute7 IS NULL)))
387            AND (   (Recinfo.attribute8 = X_attribute8)
388                 OR (    (Recinfo.attribute8 IS NULL)
389                     AND (X_attribute8 IS NULL)))
390            AND (   (Recinfo.attribute9 = X_attribute9)
391                 OR (    (Recinfo.attribute9 IS NULL)
392                     AND (X_attribute9 IS NULL)))
393            AND (   (Recinfo.attribute10 = X_attribute10)
394                 OR (    (Recinfo.attribute10 IS NULL)
395                     AND (X_attribute10 IS NULL)))
396            AND (   (Recinfo.attribute11 = X_attribute11)
397                 OR (    (Recinfo.attribute11 IS NULL)
398                     AND (X_attribute11 IS NULL)))
399            AND (   (Recinfo.attribute12 = X_attribute12)
400                 OR (    (Recinfo.attribute12 IS NULL)
401                     AND (X_attribute12 IS NULL)))
402            AND (   (Recinfo.attribute13 = X_attribute13)
403                 OR (    (Recinfo.attribute13 IS NULL)
404                     AND (X_attribute13 IS NULL)))
405            AND (   (Recinfo.attribute14 = X_attribute14)
406                 OR (    (Recinfo.attribute14 IS NULL)
407                     AND (X_attribute14 IS NULL)))
408            AND (   (Recinfo.attribute15 = X_attribute15)      /* Bug 2124337 */
409                 OR (    (Recinfo.attribute15 IS NULL)
410                     AND (X_attribute15 IS NULL)))
411            AND (   (Recinfo.vendor_id = X_Vendor_Id)
412                 OR (    (Recinfo.vendor_id IS NULL)
413                     AND (X_Vendor_Id IS NULL)))
414       ) then
415       return;
416     else
417       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
418       APP_EXCEPTION.Raise_Exception;
419     end if;
420 
421     EXCEPTION
422      WHEN OTHERS THEN
423       IF (SQLCODE <> -20001) THEN
424        IF (SQLCODE = -54) THEN
425          FND_MESSAGE.SET_NAME('SQLAP','AP_RESOURCE_BUSY');
426        ELSE
427          FND_MESSAGE.SET_NAME('SQLAP', 'AP_DEBUG');
428          FND_MESSAGE.SET_TOKEN('ERROR', SQLERRM);
429          FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE', current_calling_sequence);
430          FND_MESSAGE.SET_TOKEN('PARAMETERS','Batch Name = '||X_Batch_Name
431                                         ||', ROWID = '||X_Rowid);
432          FND_MESSAGE.SET_TOKEN('DEBUG_INFO', debug_info);
433        END IF;
434       END IF;
435       APP_EXCEPTION.RAISE_EXCEPTION;
436 
437   END Lock_Row;
438 /* BUG 2124337 :Parameters X_attribute_category to X_attribute15 added */
439   PROCEDURE Update_Row(
440             X_Rowid                          VARCHAR2,
441             X_Batch_Name                     VARCHAR2,
442             X_Batch_Set_Id                   NUMBER,
443             X_Batch_Set_Line_Id              NUMBER,
444             X_Include_In_Set                 VARCHAR2 DEFAULT NULL,
445             X_Printer                        VARCHAR2 DEFAULT NULL,
446             X_Check_Stock_Id                 NUMBER DEFAULT NULL,
447             X_Ce_Bank_Acct_Use_Id            NUMBER,
448             X_Vendor_Pay_Group               VARCHAR2 DEFAULT NULL,
449             X_Hi_Payment_Priority            NUMBER DEFAULT NULL,
450             X_Low_Payment_Priority           NUMBER DEFAULT NULL,
451             X_Max_Payment_Amount             NUMBER DEFAULT NULL,
452             X_Min_Check_Amount               NUMBER DEFAULT NULL,
453             X_Max_Outlay                     NUMBER DEFAULT NULL,
454             X_Pay_Only_When_Due_Flag         VARCHAR2 DEFAULT NULL,
455             X_Payment_Currency_Code          VARCHAR2,
456             X_Exchange_Rate_Type             VARCHAR2 DEFAULT NULL,
457             X_Document_Order_Lookup_Code     VARCHAR2 DEFAULT NULL,
458             X_Audit_Required_Flag            VARCHAR2 DEFAULT NULL,
459             X_Interval                       NUMBER DEFAULT NULL,
460             X_Volume_Serial_Number           VARCHAR2 DEFAULT NULL,
461             X_Zero_Amounts_Allowed           VARCHAR2 DEFAULT NULL,
465             X_transfer_priority              VARCHAR2 DEFAULT NULL,
462             X_Zero_Invoices_Allowed          VARCHAR2 DEFAULT NULL,
463             X_Org_Id                         NUMBER DEFAULT NULL,
464             X_Future_Pmts_Allowed            VARCHAR2 DEFAULT NULL,
466             X_Last_Update_Date               DATE,
467             X_Last_Updated_By                NUMBER,
468             X_Last_Update_Login              NUMBER DEFAULT NULL,
469             X_Creation_Date                  DATE DEFAULT NULL,
470             X_Created_By                     NUMBER DEFAULT NULL,
471             X_Inactive_Date                  DATE DEFAULT NULL,
472             X_calling_sequence	IN	     VARCHAR2,
473             X_attribute_category	     VARCHAR2, /* BUG 2124337 */
474 	    X_attribute1		     VARCHAR2,
475 	    X_attribute2		     VARCHAR2,
476 	    X_attribute3		     VARCHAR2,
477 	    X_attribute4		     VARCHAR2,
478 	    X_attribute5		     VARCHAR2,
479 	    X_attribute6		     VARCHAR2,
480 	    X_attribute7		     VARCHAR2,
481 	    X_attribute8		     VARCHAR2,
482 	    X_attribute9		     VARCHAR2,
483 	    X_attribute10		     VARCHAR2,
484 	    X_attribute11		     VARCHAR2,
485 	    X_attribute12		     VARCHAR2,
486 	    X_attribute13		     VARCHAR2,
487 	    X_attribute14		     VARCHAR2,
488 	    X_attribute15		     VARCHAR2,  /* BUG 2124337 */
489             X_Vendor_Id                      NUMBER,
490             X_days_between_check_cycles      NUMBER
491   ) IS
492     current_calling_sequence VARCHAR2(2000);
493     debug_info               VARCHAR2(100);
494   BEGIN
495     -- Update the calling sequence
496     --
497     current_calling_sequence :=
498      'AP_PBATCH_SET_LINES_PKG.UPDATE_ROW<-'||X_Calling_Sequence;
499 
500 
501     debug_info := 'Update ap_pbatch_set_lines';
502     UPDATE ap_pbatch_set_lines
503     SET
504        batch_name                      =     X_Batch_Name,
505        batch_set_id                    =     X_Batch_Set_Id,
506        batch_set_line_id               =     X_Batch_Set_Line_Id,
507        include_in_set                  =     X_Include_in_Set,
508        printer                         =     X_Printer,
509        check_stock_id                  =     X_Check_Stock_Id,
510        vendor_pay_group                =     X_Vendor_Pay_Group,
511        hi_payment_priority             =     X_Hi_Payment_Priority,
512        low_payment_priority            =     X_Low_Payment_Priority,
513        max_payment_amount              =     X_Max_Payment_Amount,
514        min_check_amount                =     X_Min_Check_Amount,
515        max_outlay                      =     X_Max_Outlay,
516        pay_only_when_due_flag          =     X_Pay_Only_When_Due_Flag,
517        payment_currency_code           =     X_Payment_Currency_Code,
518        exchange_rate_type              =     X_Exchange_Rate_Type,
519        document_order_lookup_code      =     X_Document_Order_Lookup_Code,
520        audit_required_flag             =     X_Audit_Required_Flag,
521        interval                        =     X_Interval,
522        volume_serial_number            =     X_Volume_Serial_Number,
523        zero_amounts_allowed            =     X_Zero_Amounts_Allowed,
524        zero_invoices_allowed           =     X_Zero_Invoices_Allowed,
525        future_pmts_allowed             =     X_Future_Pmts_Allowed,
526        ce_bank_acct_use_id             =     X_Ce_Bank_Acct_Use_Id,
527        transfer_priority               =     X_transfer_priority,
528        inactive_date                   =     X_Inactive_Date,
529        last_update_date                =     X_Last_Update_Date,
530        last_updated_by                 =     X_Last_Updated_By,
531        last_update_login               =     X_Last_Update_Login,
532        attribute_category              =     X_attribute_category,	   /* BUG 2124337 */
533        attribute1                      =     X_attribute1,
534        attribute2                      =     X_attribute2,
535        attribute3                      =     X_attribute3,
536        attribute4                      =     X_attribute4,
537        attribute5                      =     X_attribute5,
538        attribute6                      =     X_attribute6,
539        attribute7                      =     X_attribute7,
540        attribute8                      =     X_attribute8,
541        attribute9                      =     X_attribute9,
542        attribute10                     =     X_attribute10,
543        attribute11                     =     X_attribute11,
544        attribute12                     =     X_attribute12,
545        attribute13                     =     X_attribute13,
546        attribute14                     =     X_attribute14,
547        attribute15                     =     X_attribute15,		   /* BUG 2124337 */
548        vendor_id                       =     X_Vendor_Id,
549        days_between_check_cycles       =     X_days_between_check_cycles
550     WHERE rowid = X_Rowid;
551 
552     if (SQL%NOTFOUND) then
553       Raise NO_DATA_FOUND;
554     end if;
555 
556     EXCEPTION
557      WHEN OTHERS THEN
558       if (SQLCODE <> -20001) then
559         FND_MESSAGE.SET_NAME('SQLAP', 'AP_DEBUG');
560         FND_MESSAGE.SET_TOKEN('ERROR', SQLERRM);
561         FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE', current_calling_sequence);
562         FND_MESSAGE.SET_TOKEN('PARAMETERS', 'Batch Name = '||X_Batch_Name
566       end if;
563                                ||', Batch Set Line Id ='||X_Batch_Set_Line_Id
564                                ||', ROWID = '||X_Rowid);
565         FND_MESSAGE.SET_TOKEN('DEBUG_INFO', debug_info);
567       APP_EXCEPTION.RAISE_EXCEPTION;
568   END Update_Row;
569 
570 /*
571   PROCEDURE Delete_Row(X_Rowid 				VARCHAR2,
572 		       X_calling_sequence	IN	VARCHAR2) IS
573 
574     current_calling_sequence VARCHAR2(2000);
575     debug_info               VARCHAR2(100);
576 
577   BEGIN
578     -- Update the calling sequence
579     --
580     current_calling_sequence :=
581      'AP_PBATCH_SET_LINES_PKG.DELETE_ROW<-'||X_Calling_Sequence;
582 
583     debug_info := 'Delete from ap_pbatch_set_lines';
584     DELETE FROM ap_pbatch_set_lines
585     WHERE rowid = X_Rowid;
586 
587     if (SQL%NOTFOUND) then
588       Raise NO_DATA_FOUND;
589     end if;
590 
591     EXCEPTION
592      WHEN OTHERS THEN
593       if (SQLCODE <> -20001) then
594         FND_MESSAGE.SET_NAME('SQLAP', 'AP_DEBUG');
595         FND_MESSAGE.SET_TOKEN('ERROR', SQLERRM);
596         FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE', current_calling_sequence);
597         FND_MESSAGE.SET_TOKEN('PARAMETERS', 'ROWID = ' || X_Rowid);
598         FND_MESSAGE.SET_TOKEN('DEBUG_INFO', debug_info);
599       end if;
600       APP_EXCEPTION.RAISE_EXCEPTION;
601   END Delete_Row;
602 */
603 
604   Procedure Check_Unique_Run(X_Batch_set_id		VARCHAR2,
605                              X_Batch_Run_Name 		VARCHAR2,
606                              X_Calling_Sequence   IN	VARCHAR2) IS
607   dummy                    NUMBER;
608   current_calling_sequence VARCHAR2(2000);
609   debug_info               VARCHAR2(100);
610 
611   BEGIN
612     -- Update the calling sequence
613     --
614     current_calling_sequence :=
615      'AP_PBATCH_SET_LINES_PKG.CHECK_UNIQUE_RUN<-'||X_Calling_Sequence;
616 
617     debug_info := 'Count for batch run name';
618     select count(1)
619     into dummy
620     from   ap_invoice_selection_criteria
621     where batch_run_name = X_batch_run_name
622     and batch_set_id = X_batch_set_id;
623 
624     if (dummy >= 1) then
625       fnd_message.set_name('SQLAP','AP_ALL_DUPLICATE_VALUE');
626       app_exception.raise_exception;
627     end if;
628 
629     EXCEPTION
630      WHEN OTHERS THEN
631       if (SQLCODE <> -20001) then
632         FND_MESSAGE.SET_NAME('SQLAP', 'AP_DEBUG');
633         FND_MESSAGE.SET_TOKEN('ERROR', SQLERRM);
634         FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE', current_calling_sequence);
635         FND_MESSAGE.SET_TOKEN('PARAMETERS', 'Batch run Name = '||
636                               X_Batch_run_Name ||', Batch_set_id = '
637                               ||X_Batch_Set_Id);
638         FND_MESSAGE.SET_TOKEN('DEBUG_INFO', debug_info);
639       end if;
640       APP_EXCEPTION.RAISE_EXCEPTION;
641 
642   end Check_Unique_Run;
643 
644   Procedure Check_Unique_Batch(X_Batch_Run_Name 	VARCHAR2,
645                                X_Batch_Name		VARCHAR2,
646                                X_Calling_Sequence   IN  VARCHAR2) IS
647   dummy                    NUMBER;
648   current_calling_sequence VARCHAR2(2000);
649   debug_info               VARCHAR2(100);
650 
651   BEGIN
652     -- Update the calling sequence
653     --
654     current_calling_sequence :=
655      'AP_PBATCH_SET_LINES_PKG.CHECK_UNIQUE_BATCH<-'||X_Calling_Sequence;
656 
657     debug_info := 'Count for check run name';
658     select count(1)
659     into dummy
660     from   ap_invoice_selection_criteria
661     where checkrun_name = X_batch_name||X_batch_run_name;
662 
663      if (dummy >= 1) then
664       fnd_message.set_name('SQLAP','AP_ALL_DUPLICATE_VALUE');
665       app_exception.raise_exception;
666     end if;
667 
668     EXCEPTION
669      WHEN OTHERS THEN
670       if (SQLCODE <> -20001) then
671         FND_MESSAGE.SET_NAME('SQLAP', 'AP_DEBUG');
672         FND_MESSAGE.SET_TOKEN('ERROR', SQLERRM);
673         FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE', current_calling_sequence);
674         FND_MESSAGE.SET_TOKEN('PARAMETERS', 'Batch run Name = '||
675                               X_Batch_run_Name ); --**||', ROWID = '||X_Rowid);
676         FND_MESSAGE.SET_TOKEN('DEBUG_INFO', debug_info);
677       end if;
678       APP_EXCEPTION.RAISE_EXCEPTION;
679 
680   end Check_Unique_Batch;
681 
682 END AP_PBATCH_SET_LINES_PKG;