DBA Data[Home] [Help]

PACKAGE BODY: APPS.AP_BATCHES_PKG

Source


1 PACKAGE BODY AP_BATCHES_PKG as
2 /* $Header: apibatcb.pls 120.3 2004/10/28 00:00:52 pjena noship $ */
3 
4 
5   -----------------------------------------------------------------------
6   -- Function get_actual_inv_count returns the total number of invoices
7   -- in the given batch.
8   FUNCTION get_actual_inv_count(l_batch_id IN NUMBER)
9       RETURN NUMBER
10   IS
11       invoice_count	NUMBER := 0;
12 
13   BEGIN
14 
15        SELECT COUNT(*)
16        INTO   invoice_count
17        FROM   ap_invoices
18        WHERE  batch_id = l_batch_id;
19 
20        RETURN(invoice_count);
21 
22   END get_actual_inv_count;
23 
24 
25   -----------------------------------------------------------------------
26   -- Function get_actual_inv_amount returns the total of all invoice amounts
27   -- in the given batch.
28   FUNCTION get_actual_inv_amount(l_batch_id IN NUMBER)
29       RETURN NUMBER
30   IS
31       invoice_amount	NUMBER := 0;
32 
33   BEGIN
34 
35        SELECT SUM(nvl(invoice_amount,0))
36        INTO   invoice_amount
37        FROM   ap_invoices
38        WHERE  batch_id = l_batch_id;
39 
40        RETURN(invoice_amount);
41 
42   END get_actual_inv_amount;
43 
44 PROCEDURE CHECK_UNIQUE (X_ROWID             	VARCHAR2,
45                         X_BATCH_NAME        	VARCHAR2,
46 			X_calling_sequence  IN	VARCHAR2) IS
47   dummy number;
48   current_calling_sequence    VARCHAR2(2000);
49   debug_info                  VARCHAR2(100);
50 
51 begin
52 --Update the calling sequence
53 --
54   current_calling_sequence := 'AP_BATCHES_PKG.CHECK_UNIQUE<-' ||
55                                X_calling_sequence;
56 
57   debug_info := 'Count rows with this batch_name';
58   select count(1)
59   into   dummy
60   from   ap_batches_all
61   where  batch_name = X_BATCH_NAME
62   and    ((X_ROWID is null) or (rowid <> X_ROWID));
63 
64   if (dummy >= 1) then
65     fnd_message.set_name('SQLAP','AP_ALL_DUPLICATE_VALUE');
66     app_exception.raise_exception;
67   end if;
68 
69   EXCEPTION
70        WHEN OTHERS THEN
71            IF (SQLCODE <> -20001) THEN
72               FND_MESSAGE.SET_NAME('SQLAP','AP_DEBUG');
73               FND_MESSAGE.SET_TOKEN('ERROR',SQLERRM);
74               FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE',current_calling_sequence);
75               FND_MESSAGE.SET_TOKEN('PARAMETERS','ROWID = ' || X_ROWID ||
76                         		', BATCH_NAME = ' || X_BATCH_NAME);
77               FND_MESSAGE.SET_TOKEN('DEBUG_INFO',debug_info);
78            END IF;
79            APP_EXCEPTION.RAISE_EXCEPTION;
80 
81 
82 end CHECK_UNIQUE;
83 
84 
85 
86   PROCEDURE Insert_Row(X_Rowid                   IN OUT NOCOPY VARCHAR2,
87                        X_Batch_Id                       NUMBER,
88                        X_Batch_Name                     VARCHAR2,
89                        X_Batch_Date                     DATE,
90                        X_Last_Update_Date               DATE,
91                        X_Last_Updated_By                NUMBER,
92                        X_Control_Invoice_Count          NUMBER,
93                        X_Control_Invoice_Total          NUMBER,
94                        X_Invoice_Currency_Code          VARCHAR2,
95                        X_Payment_Currency_Code          VARCHAR2,
96                        X_Last_Update_Login              NUMBER,
97                        X_Creation_Date                  DATE,
98                        X_Created_By                     NUMBER,
99                        X_Pay_Group_Lookup_Code          VARCHAR2,
100                        X_Payment_Priority               NUMBER,
101                        X_Batch_Code_Combination_Id      NUMBER,
102                        X_Terms_Id                       NUMBER,
103                        X_Attribute1                     VARCHAR2,
104                        X_Attribute2                     VARCHAR2,
105                        X_Attribute3                     VARCHAR2,
106                        X_Attribute4                     VARCHAR2,
107                        X_Attribute_Category             VARCHAR2,
108                        X_Attribute5                     VARCHAR2,
109                        X_Attribute6                     VARCHAR2,
110                        X_Attribute7                     VARCHAR2,
111                        X_Attribute8                     VARCHAR2,
112                        X_Attribute9                     VARCHAR2,
113                        X_Attribute10                    VARCHAR2,
114                        X_Attribute11                    VARCHAR2,
115                        X_Attribute12                    VARCHAR2,
116                        X_Attribute13                    VARCHAR2,
117                        X_Attribute14                    VARCHAR2,
118                        X_Attribute15                    VARCHAR2,
119                        X_Invoice_Type_Lookup_Code       VARCHAR2,
120                        X_Hold_Lookup_Code               VARCHAR2,
121                        X_Hold_Reason                    VARCHAR2,
122                        X_Doc_Category_Code              VARCHAR2,
123                        X_Org_Id                         NUMBER,
124 		       X_calling_sequence	IN	VARCHAR2,
125 		       X_gl_date			DATE        -- **1
126   ) IS
127     CURSOR C IS SELECT rowid FROM AP_BATCHES_ALL
128                  WHERE batch_id = X_Batch_Id;
129     current_calling_sequence    VARCHAR2(2000);
130     debug_info                  VARCHAR2(100);
131 
132    BEGIN
133 --Update the calling sequence
134 --
135   current_calling_sequence := 'AP_BATCHES_PKG.INSERT_ROW<-' ||
136                                X_calling_sequence;
137 
138   -- Check uniqueness first
139   ap_batches_pkg.check_unique(X_ROWID,
140                               X_BATCH_NAME,
141 			      X_calling_sequence => current_calling_sequence);
142 
143        debug_info := 'Insert into AP_BATCHES';
144        INSERT INTO AP_BATCHES_ALL(
145               batch_id,
146               batch_name,
147               batch_date,
148               last_update_date,
149               last_updated_by,
150               control_invoice_count,
151               control_invoice_total,
152               invoice_currency_code,
153               payment_currency_code,
154               last_update_login,
155               creation_date,
156               created_by,
157               pay_group_lookup_code,
158               payment_priority,
159               batch_code_combination_id,
160               terms_id,
161               attribute1,
162               attribute2,
163               attribute3,
164               attribute4,
165               attribute_category,
166               attribute5,
167               attribute6,
168               attribute7,
169               attribute8,
170               attribute9,
171               attribute10,
172               attribute11,
173               attribute12,
174               attribute13,
175               attribute14,
176               attribute15,
177               invoice_type_lookup_code,
178               hold_lookup_code,
179               hold_reason,
180               doc_category_code,
181 	      gl_date,					 -- **1
182               org_id
183               ) VALUES (
184               X_Batch_Id,
185               X_Batch_Name,
186               X_Batch_Date,
187               X_Last_Update_Date,
188               X_Last_Updated_By,
189               X_Control_Invoice_Count,
190               X_Control_Invoice_Total,
191               X_Invoice_Currency_Code,
192               X_Payment_Currency_Code,
193               X_Last_Update_Login,
194               X_Creation_Date,
195               X_Created_By,
196               X_Pay_Group_Lookup_Code,
197               X_Payment_Priority,
198               X_Batch_Code_Combination_Id,
199               X_Terms_Id,
200               X_Attribute1,
201               X_Attribute2,
202               X_Attribute3,
203               X_Attribute4,
204               X_Attribute_Category,
205               X_Attribute5,
206               X_Attribute6,
207               X_Attribute7,
208               X_Attribute8,
209               X_Attribute9,
210               X_Attribute10,
211               X_Attribute11,
212               X_Attribute12,
213               X_Attribute13,
214               X_Attribute14,
215               X_Attribute15,
216               X_Invoice_Type_Lookup_Code,
217               X_Hold_Lookup_Code,
218               X_Hold_Reason,
219               X_Doc_Category_Code,
220 	      X_gl_date,					 -- **1
221               X_org_id
222              );
223 
224     debug_info := 'Open cursor C';
225     OPEN C;
226     debug_info := 'Fetch cursor C';
227     FETCH C INTO X_Rowid;
228     if (C%NOTFOUND) then
229       debug_info := 'Close cursor C - ROW NOTFOUND';
230       CLOSE C;
231       Raise NO_DATA_FOUND;
232     end if;
233     debug_info := 'Close cursor C';
234     CLOSE C;
235 
236     EXCEPTION
237        WHEN OTHERS THEN
238            IF (SQLCODE <> -20001) THEN
239               FND_MESSAGE.SET_NAME('SQLAP','AP_DEBUG');
240               FND_MESSAGE.SET_TOKEN('ERROR',SQLERRM);
241               FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE',current_calling_sequence);
242               FND_MESSAGE.SET_TOKEN('PARAMETERS','BATCH_ID = ' || TO_CHAR(X_Batch_Id) ||
243 						', ROWID = ' || X_Rowid);
244               FND_MESSAGE.SET_TOKEN('DEBUG_INFO',debug_info);
245            END IF;
246            APP_EXCEPTION.RAISE_EXCEPTION;
247 
248   END Insert_Row;
249 
250 
251   PROCEDURE Lock_Row(X_Rowid                            VARCHAR2,
252                      X_Batch_Id                         NUMBER,
253                      X_Batch_Name                       VARCHAR2,
254                      X_Batch_Date                       DATE,
255                      X_Control_Invoice_Count            NUMBER,
256                      X_Control_Invoice_Total            NUMBER,
257                      X_Invoice_Currency_Code            VARCHAR2,
258                      X_Payment_Currency_Code            VARCHAR2,
259                      X_Pay_Group_Lookup_Code            VARCHAR2,
260                      X_Payment_Priority                 NUMBER,
261                      X_Batch_Code_Combination_Id        NUMBER,
262                      X_Terms_Id                         NUMBER,
263                      X_Attribute1                       VARCHAR2,
264                      X_Attribute2                       VARCHAR2,
265                      X_Attribute3                       VARCHAR2,
266                      X_Attribute4                       VARCHAR2,
267                      X_Attribute_Category               VARCHAR2,
268                      X_Attribute5                       VARCHAR2,
269                      X_Attribute6                       VARCHAR2,
270                      X_Attribute7                       VARCHAR2,
271                      X_Attribute8                       VARCHAR2,
272                      X_Attribute9                       VARCHAR2,
273                      X_Attribute10                      VARCHAR2,
274                      X_Attribute11                      VARCHAR2,
275                      X_Attribute12                      VARCHAR2,
276                      X_Attribute13                      VARCHAR2,
277                      X_Attribute14                      VARCHAR2,
278                      X_Attribute15                      VARCHAR2,
279                      X_Invoice_Type_Lookup_Code         VARCHAR2,
280                      X_Hold_Lookup_Code                 VARCHAR2,
281                      X_Hold_Reason                      VARCHAR2,
282                      X_Doc_Category_Code                VARCHAR2,
283                      X_Org_Id                           NUMBER,
284 		     X_calling_sequence		IN	VARCHAR2,
285 		     X_gl_date				DATE		 -- **1
286   ) IS
287     CURSOR C IS
288         SELECT *
289         FROM   AP_BATCHES_ALL
290         WHERE  rowid = X_Rowid
291         FOR UPDATE of Batch_Id NOWAIT;
292     Recinfo C%ROWTYPE;
293     current_calling_sequence    VARCHAR2(2000);
294     debug_info                  VARCHAR2(100);
295 
296 
297   BEGIN
298 --  Update the calling sequence
299 --
300     current_calling_sequence := 'AP_BATCHES_PKG.LOCK_ROW<-' ||
301                                  X_calling_sequence;
302     debug_info := 'Open cursor C';
303     OPEN C;
304     debug_info := 'Fetch cursor C';
305     FETCH C INTO Recinfo;
306     if (C%NOTFOUND) then
307       debug_info := 'Close cursor C - ROW NOTFOUND';
308       CLOSE C;
309       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_DELETED');
310       APP_EXCEPTION.Raise_Exception;
311     end if;
312     debug_info := 'Close cursor C';
313     CLOSE C;
314     if (
315 
316                (Recinfo.batch_id =  X_Batch_Id)
317            AND (Recinfo.batch_name =  X_Batch_Name)
318            AND (Recinfo.batch_date =  X_Batch_Date)
319            AND (   (Recinfo.control_invoice_count =  X_Control_Invoice_Count)
320                 OR (    (Recinfo.control_invoice_count IS NULL)
321                     AND (X_Control_Invoice_Count IS NULL)))
322            AND (   (Recinfo.control_invoice_total =  X_Control_Invoice_Total)
323                 OR (    (Recinfo.control_invoice_total IS NULL)
324                     AND (X_Control_Invoice_Total IS NULL)))
325            AND (   (Recinfo.invoice_currency_code =  X_Invoice_Currency_Code)
326                 OR (    (Recinfo.invoice_currency_code IS NULL)
327                     AND (X_Invoice_Currency_Code IS NULL)))
328            AND (   (Recinfo.payment_currency_code =  X_Payment_Currency_Code)
329                 OR (    (Recinfo.payment_currency_code IS NULL)
330                     AND (X_Payment_Currency_Code IS NULL)))
331            AND (   (Recinfo.pay_group_lookup_code =  X_Pay_Group_Lookup_Code)
332                 OR (    (Recinfo.pay_group_lookup_code IS NULL)
333                     AND (X_Pay_Group_Lookup_Code IS NULL)))
334            AND (   (Recinfo.payment_priority =  X_Payment_Priority)
335                 OR (    (Recinfo.payment_priority IS NULL)
336                     AND (X_Payment_Priority IS NULL)))
337            AND (   (Recinfo.batch_code_combination_id =  X_Batch_Code_Combination_Id)
338                 OR (    (Recinfo.batch_code_combination_id IS NULL)
339                     AND (X_Batch_Code_Combination_Id IS NULL)))
340            AND (   (Recinfo.terms_id =  X_Terms_Id)
341                 OR (    (Recinfo.terms_id IS NULL)
342                     AND (X_Terms_Id IS NULL)))
343            AND (   (Recinfo.attribute1 =  X_Attribute1)
344                 OR (    (Recinfo.attribute1 IS NULL)
345                     AND (X_Attribute1 IS NULL)))
346            AND (   (Recinfo.attribute2 =  X_Attribute2)
347                 OR (    (Recinfo.attribute2 IS NULL)
348                     AND (X_Attribute2 IS NULL)))
349            AND (   (Recinfo.attribute3 =  X_Attribute3)
350                 OR (    (Recinfo.attribute3 IS NULL)
351                     AND (X_Attribute3 IS NULL)))
352            AND (   (Recinfo.attribute4 =  X_Attribute4)
353                 OR (    (Recinfo.attribute4 IS NULL)
354                     AND (X_Attribute4 IS NULL)))
355            AND (   (Recinfo.attribute_category =  X_Attribute_Category)
356                 OR (    (Recinfo.attribute_category IS NULL)
357                     AND (X_Attribute_Category IS NULL)))
358            AND (   (Recinfo.attribute5 =  X_Attribute5)
359                 OR (    (Recinfo.attribute5 IS NULL)
360                     AND (X_Attribute5 IS NULL)))
361            AND (   (Recinfo.attribute6 =  X_Attribute6)
362                 OR (    (Recinfo.attribute6 IS NULL)
363                     AND (X_Attribute6 IS NULL)))
364            AND (   (Recinfo.attribute7 =  X_Attribute7)
365                 OR (    (Recinfo.attribute7 IS NULL)
369                     AND (X_Attribute8 IS NULL)))
366                     AND (X_Attribute7 IS NULL)))
367            AND (   (Recinfo.attribute8 =  X_Attribute8)
368                 OR (    (Recinfo.attribute8 IS NULL)
370            AND (   (Recinfo.attribute9 =  X_Attribute9)
371                 OR (    (Recinfo.attribute9 IS NULL)
372                     AND (X_Attribute9 IS NULL)))
373            AND (   (Recinfo.attribute10 =  X_Attribute10)
374                 OR (    (Recinfo.attribute10 IS NULL)
375                     AND (X_Attribute10 IS NULL)))
376            AND (   (Recinfo.attribute11 =  X_Attribute11)
377                 OR (    (Recinfo.attribute11 IS NULL)
378                     AND (X_Attribute11 IS NULL)))
379            AND (   (Recinfo.attribute12 =  X_Attribute12)
380                 OR (    (Recinfo.attribute12 IS NULL)
381                     AND (X_Attribute12 IS NULL)))
382            AND (   (Recinfo.attribute13 =  X_Attribute13)
383                 OR (    (Recinfo.attribute13 IS NULL)
384                     AND (X_Attribute13 IS NULL)))
385            AND (   (Recinfo.attribute14 =  X_Attribute14)
386                 OR (    (Recinfo.attribute14 IS NULL)
387                     AND (X_Attribute14 IS NULL)))
388            AND (   (Recinfo.attribute15 =  X_Attribute15)
389                 OR (    (Recinfo.attribute15 IS NULL)
390                     AND (X_Attribute15 IS NULL)))
391            AND (   (Recinfo.invoice_type_lookup_code =  X_Invoice_Type_Lookup_Code)
392                 OR (    (Recinfo.invoice_type_lookup_code IS NULL)
393                     AND (X_Invoice_Type_Lookup_Code IS NULL)))
394            AND (   (Recinfo.hold_lookup_code =  X_Hold_Lookup_Code)
395                 OR (    (Recinfo.hold_lookup_code IS NULL)
396                     AND (X_Hold_Lookup_Code IS NULL)))
397            AND (   (Recinfo.hold_reason =  X_Hold_Reason)
398                 OR (    (Recinfo.hold_reason IS NULL)
399                     AND (X_Hold_Reason IS NULL)))
400            AND (   (Recinfo.doc_category_code =  X_Doc_Category_Code)
401                 OR (    (Recinfo.doc_category_code IS NULL)
402                     AND (X_Doc_Category_Code IS NULL)))
403 	   AND (   (Recinfo.gl_date =  X_gl_date)             	-- **1
404                 OR (    (Recinfo.gl_date IS NULL)
405                     AND (X_gl_date IS NULL)))
406            AND (   (Recinfo.org_id =  X_org_id)               -- **1
407                 OR (    (Recinfo.org_id IS NULL)
408                     AND (X_org_id IS NULL)))
409       ) then
410       return;
411     else
412       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
413       APP_EXCEPTION.Raise_Exception;
414     end if;
415 
416     EXCEPTION
417        WHEN OTHERS THEN
418          IF (SQLCODE <> -20001) THEN
419            IF (SQLCODE = -54) THEN
420              FND_MESSAGE.SET_NAME('SQLAP','AP_RESOURCE_BUSY');
421            ELSE
422              FND_MESSAGE.SET_NAME('SQLAP','AP_DEBUG');
423              FND_MESSAGE.SET_TOKEN('ERROR',SQLERRM);
424              FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE',current_calling_sequence);
425              FND_MESSAGE.SET_TOKEN('PARAMETERS','ROWID = ' || X_Rowid ||
426                     			', BATCH_ID = ' || TO_CHAR(X_Batch_Id));
427              FND_MESSAGE.SET_TOKEN('DEBUG_INFO',debug_info);
428            END IF;
429          END IF;
430          APP_EXCEPTION.RAISE_EXCEPTION;
431 
432   END Lock_Row;
433 
434 
435 
436   PROCEDURE Update_Row(X_Rowid                          VARCHAR2,
437                        X_Batch_Id                       NUMBER,
438                        X_Batch_Name                     VARCHAR2,
439                        X_Batch_Date                     DATE,
440                        X_Last_Update_Date               DATE,
441                        X_Last_Updated_By                NUMBER,
442                        X_Control_Invoice_Count          NUMBER,
443                        X_Control_Invoice_Total          NUMBER,
444                        X_Invoice_Currency_Code          VARCHAR2,
445                        X_Payment_Currency_Code          VARCHAR2,
446                        X_Last_Update_Login              NUMBER,
447                        X_Pay_Group_Lookup_Code          VARCHAR2,
448                        X_Payment_Priority               NUMBER,
449                        X_Batch_Code_Combination_Id      NUMBER,
450                        X_Terms_Id                       NUMBER,
451                        X_Attribute1                     VARCHAR2,
452                        X_Attribute2                     VARCHAR2,
453                        X_Attribute3                     VARCHAR2,
454                        X_Attribute4                     VARCHAR2,
455                        X_Attribute_Category             VARCHAR2,
456                        X_Attribute5                     VARCHAR2,
457                        X_Attribute6                     VARCHAR2,
458                        X_Attribute7                     VARCHAR2,
459                        X_Attribute8                     VARCHAR2,
460                        X_Attribute9                     VARCHAR2,
461                        X_Attribute10                    VARCHAR2,
462                        X_Attribute11                    VARCHAR2,
463                        X_Attribute12                    VARCHAR2,
464                        X_Attribute13                    VARCHAR2,
465                        X_Attribute14                    VARCHAR2,
469                        X_Hold_Reason                    VARCHAR2,
466                        X_Attribute15                    VARCHAR2,
467                        X_Invoice_Type_Lookup_Code       VARCHAR2,
468                        X_Hold_Lookup_Code               VARCHAR2,
470                        X_Doc_Category_Code              VARCHAR2,
471                        X_Org_Id                         NUMBER,
472 		       X_calling_sequence	IN	VARCHAR2,
473 		       X_gl_date			DATE		-- **1
474 
475   ) IS
476   current_calling_sequence    VARCHAR2(2000);
477   debug_info                  VARCHAR2(100);
478   BEGIN
479     --Update the calling sequence
480     --
481     current_calling_sequence := 'AP_BATCHES_PKG.UPDATE_ROW<-' ||
482                                  X_calling_sequence;
483 
484     -- Check uniqueness first
485     ap_batches_pkg.check_unique(X_ROWID,
486                                 X_BATCH_NAME,
487 				X_calling_sequence => current_calling_sequence);
488 
489     debug_info := 'Update AP_BATCHES_ALL';
490     UPDATE AP_BATCHES_ALL
491     SET
492        batch_id                        =     X_Batch_Id,
493        batch_name                      =     X_Batch_Name,
494        batch_date                      =     X_Batch_Date,
495        last_update_date                =     X_Last_Update_Date,
496        last_updated_by                 =     X_Last_Updated_By,
497        control_invoice_count           =     X_Control_Invoice_Count,
498        control_invoice_total           =     X_Control_Invoice_Total,
499        invoice_currency_code           =     X_Invoice_Currency_Code,
500        payment_currency_code           =     X_Payment_Currency_Code,
501        last_update_login               =     X_Last_Update_Login,
502        pay_group_lookup_code           =     X_Pay_Group_Lookup_Code,
503        payment_priority                =     X_Payment_Priority,
504        batch_code_combination_id       =     X_Batch_Code_Combination_Id,
505        terms_id                        =     X_Terms_Id,
506        attribute1                      =     X_Attribute1,
507        attribute2                      =     X_Attribute2,
508        attribute3                      =     X_Attribute3,
509        attribute4                      =     X_Attribute4,
510        attribute_category              =     X_Attribute_Category,
511        attribute5                      =     X_Attribute5,
512        attribute6                      =     X_Attribute6,
513        attribute7                      =     X_Attribute7,
514        attribute8                      =     X_Attribute8,
515        attribute9                      =     X_Attribute9,
516        attribute10                     =     X_Attribute10,
517        attribute11                     =     X_Attribute11,
518        attribute12                     =     X_Attribute12,
519        attribute13                     =     X_Attribute13,
520        attribute14                     =     X_Attribute14,
521        attribute15                     =     X_Attribute15,
522        invoice_type_lookup_code        =     X_Invoice_Type_Lookup_Code,
523        hold_lookup_code                =     X_Hold_Lookup_Code,
524        hold_reason                     =     X_Hold_Reason,
525        doc_category_code               =     X_Doc_Category_Code,
526        gl_date			       =     X_gl_date,              -- **1
527        org_id                          =     X_org_id
528     WHERE rowid = X_Rowid;
529 
530     if (SQL%NOTFOUND) then
531       Raise NO_DATA_FOUND;
532     end if;
533 
534     EXCEPTION
535        WHEN OTHERS THEN
536            IF (SQLCODE <> -20001) THEN
537               FND_MESSAGE.SET_NAME('SQLAP','AP_DEBUG');
538               FND_MESSAGE.SET_TOKEN('ERROR',SQLERRM);
539               FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE',current_calling_sequence);
540               FND_MESSAGE.SET_TOKEN('PARAMETERS','ROWID = ' || X_Rowid ||
541                        			', BATCH_ID = ' || TO_CHAR(X_Batch_Id));
542               FND_MESSAGE.SET_TOKEN('DEBUG_INFO',debug_info);
543            END IF;
544            APP_EXCEPTION.RAISE_EXCEPTION;
545 
546   END Update_Row;
547 
548   PROCEDURE Delete_Row(X_Rowid 				VARCHAR2,
549 		       X_calling_sequence	IN	VARCHAR2) IS
550   current_calling_sequence    VARCHAR2(2000);
551   debug_info                  VARCHAR2(100);
552   BEGIN
553 --  Update the calling sequence
554 --
555     current_calling_sequence := 'AP_BATCHES_PKG.DELETE_ROW<-' ||
556                                  X_calling_sequence;
557     debug_info := 'Delete from AP_BATCHES';
558     DELETE FROM AP_BATCHES_ALL
559     WHERE rowid = X_Rowid;
560 
561     if (SQL%NOTFOUND) then
562       Raise NO_DATA_FOUND;
563     end if;
564 
565     EXCEPTION
566        WHEN OTHERS THEN
567            IF (SQLCODE <> -20001) THEN
568               FND_MESSAGE.SET_NAME('SQLAP','AP_DEBUG');
569               FND_MESSAGE.SET_TOKEN('ERROR',SQLERRM);
570               FND_MESSAGE.SET_TOKEN('CALLING_SEQUENCE',current_calling_sequence);
571               FND_MESSAGE.SET_TOKEN('PARAMETERS','ROWID = ' || X_Rowid );
572               FND_MESSAGE.SET_TOKEN('DEBUG_INFO',debug_info);
573            END IF;
574            APP_EXCEPTION.RAISE_EXCEPTION;
575 
576   END Delete_Row;
577 
578 
579 END AP_BATCHES_PKG;