DBA Data[Home] [Help]

PACKAGE BODY: APPS.AP_BATCHES_PKG

Source


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