DBA Data[Home] [Help]

PACKAGE BODY: APPS.AP_CARDS_PKG

Source


1 PACKAGE BODY AP_CARDS_PKG as
2 /* $Header: apiwcrdb.pls 120.6.12010000.2 2009/01/22 07:55:17 cjain ship $ */
3 
4   PROCEDURE Insert_Row(X_Rowid                   IN OUT NOCOPY VARCHAR2,
5                        X_Employee_Id                    NUMBER,
6                        X_Card_Number                    VARCHAR2,
7 	               X_Card_Expiration_Date           DATE,
8                        X_Card_Id                        IN OUT NOCOPY NUMBER,
9                        X_Limit_Override_Amount          NUMBER,
10                        X_Trx_Limit_Override_Amount      NUMBER,
11                        X_Profile_Id                     NUMBER,
12                        X_Cardmember_Name                VARCHAR2,
13                        X_Department_Name                VARCHAR2,
14                        X_Physical_Card_Flag             VARCHAR2,
15                        X_Paper_Statement_Req_Flag       VARCHAR2,
16                        X_Location_Id                    NUMBER,
17    -- 		       X_Mothers_Maiden_Name            VARCHAR2,Commented for bug 2928064
18                        X_Description                    VARCHAR2,
19                        X_Org_Id                         NUMBER,
20                        X_Inactive_Date                  DATE,
21                        X_Last_Update_Date               DATE,
22                        X_Last_Updated_By                NUMBER,
23                        X_Last_Update_Login              NUMBER,
24                        X_Creation_Date                  DATE,
25                        X_Created_By                     NUMBER,
26                        X_Attribute_Category             VARCHAR2,
27                        X_Attribute1                     VARCHAR2,
28                        X_Attribute2                     VARCHAR2,
29                        X_Attribute3                     VARCHAR2,
30                        X_Attribute4                     VARCHAR2,
31                        X_Attribute5                     VARCHAR2,
32                        X_Attribute6                     VARCHAR2,
33                        X_Attribute7                     VARCHAR2,
34                        X_Attribute8                     VARCHAR2,
35                        X_Attribute9                     VARCHAR2,
36                        X_Attribute10                    VARCHAR2,
37                        X_Attribute11                    VARCHAR2,
38                        X_Attribute12                    VARCHAR2,
39                        X_Attribute13                    VARCHAR2,
40                        X_Attribute14                    VARCHAR2,
41                        X_Attribute15                    VARCHAR2,
42                        X_Attribute16                    VARCHAR2,
43                        X_Attribute17                    VARCHAR2,
44                        X_Attribute18                    VARCHAR2,
45                        X_Attribute19                    VARCHAR2,
46                        X_Attribute20                    VARCHAR2,
47                        X_Attribute21                    VARCHAR2,
48                        X_Attribute22                    VARCHAR2,
49                        X_Attribute23                    VARCHAR2,
50                        X_Attribute24                    VARCHAR2,
51                        X_Attribute25                    VARCHAR2,
52                        X_Attribute26                    VARCHAR2,
53                        X_Attribute27                    VARCHAR2,
54                        X_Attribute28                    VARCHAR2,
55                        X_Attribute29                    VARCHAR2,
56                        X_Attribute30                    VARCHAR2,
57                        X_CardProgramId                  NUMBER,
58                        X_CardReferenceId                NUMBER,
59                        X_paycardreferenceid             NUMBER
60   ) IS
61     CURSOR C IS SELECT rowid FROM ap_cards
62                  WHERE card_id = X_Card_Id;
63       CURSOR C2 IS SELECT ap_cards_s.nextval FROM sys.dual;
64    BEGIN
65       if (X_Card_Id is NULL) then
66         OPEN C2;
67         FETCH C2 INTO X_Card_Id;
68         CLOSE C2;
69       end if;
70 
71        INSERT INTO ap_cards(
72               employee_id,
73               card_number,
74 	          card_expiration_date,
75               card_id,
76               limit_override_amount,
77               trx_limit_override_amount,
78               profile_id,
79               cardmember_name,
80               department_name,
81               physical_card_flag,
82               paper_statement_req_flag,
83               location_id,
84    --         mothers_maiden_name, Commented for bug 2928064
85               description,
86               inactive_date,
87               last_update_date,
88               last_updated_by,
89               last_update_login,
90               creation_date,
91               created_by,
92               attribute_category,
93               attribute1,
94               attribute2,
95               attribute3,
96               attribute4,
97               attribute5,
98               attribute6,
99               attribute7,
100               attribute8,
101               attribute9,
102               attribute10,
103               attribute11,
104               attribute12,
105               attribute13,
106               attribute14,
107               attribute15,
108               attribute16,
109               attribute17,
110               attribute18,
111               attribute19,
112               attribute20,
113               attribute21,
114               attribute22,
115               attribute23,
116               attribute24,
117               attribute25,
118               attribute26,
119               attribute27,
120               attribute28,
121               attribute29,
122               attribute30,
123               card_program_id,
124               card_reference_id,
125               org_id,
126               paycard_reference_id
127              ) VALUES (
128 
129               X_Employee_Id,
130               X_Card_Number,
131               X_Card_Expiration_Date,
132               X_Card_Id,
133               X_Limit_Override_Amount,
134               X_Trx_Limit_Override_Amount,
135               X_Profile_Id,
136               X_Cardmember_Name,
137               X_Department_Name,
138               X_Physical_Card_Flag,
139               X_Paper_Statement_Req_Flag,
140               X_Location_Id,
141   --          X_Mothers_Maiden_Name,Commented for bug 2928064
142               X_Description,
143               X_Inactive_Date,
144               X_Last_Update_Date,
145               X_Last_Updated_By,
146               X_Last_Update_Login,
147               X_Creation_Date,
148               X_Created_By,
149               X_Attribute_Category,
150               X_Attribute1,
151               X_Attribute2,
152               X_Attribute3,
153               X_Attribute4,
154               X_Attribute5,
155               X_Attribute6,
156               X_Attribute7,
157               X_Attribute8,
158               X_Attribute9,
159               X_Attribute10,
160               X_Attribute11,
161               X_Attribute12,
162               X_Attribute13,
163               X_Attribute14,
164               X_Attribute15,
165               X_Attribute16,
166               X_Attribute17,
167               X_Attribute18,
168               X_Attribute19,
169               X_Attribute20,
170               X_Attribute21,
171               X_Attribute22,
172               X_Attribute23,
173               X_Attribute24,
174               X_Attribute25,
175               X_Attribute26,
176               X_Attribute27,
177               X_Attribute28,
178               X_Attribute29,
179               X_Attribute30,
180               X_CardProgramId,
181               X_CardReferenceId,
182               X_Org_Id,
183               X_paycardreferenceid
184              );
185 
186     OPEN C;
187     FETCH C INTO X_Rowid;
188     if (C%NOTFOUND) then
189       CLOSE C;
190       Raise NO_DATA_FOUND;
191     end if;
192     CLOSE C;
193     commit; --Bug 3491216
194   END Insert_Row;
195 
196 
197   PROCEDURE Lock_Row(X_Rowid                            VARCHAR2,
198                      X_Employee_Id                      NUMBER,
199             	     X_Card_Expiration_Date		DATE,
200                      X_Card_Id                          NUMBER,
201                      X_Limit_Override_Amount            NUMBER,
202                      X_Trx_Limit_Override_Amount        NUMBER,
203                      X_Profile_Id                       NUMBER,
204                      X_Cardmember_Name                  VARCHAR2,
205                      X_Department_Name                  VARCHAR2,
206                      X_Physical_Card_Flag               VARCHAR2,
207                      X_Paper_Statement_Req_Flag         VARCHAR2,
208                      X_Location_Id                      NUMBER,
209    --                X_Mothers_Maiden_Name              VARCHAR2,Commented for bug 2928064
210                      X_Description                      VARCHAR2,
211                      X_Org_Id                           NUMBER,
212                      X_Inactive_Date                    DATE,
213                      X_Attribute_Category               VARCHAR2,
214                      X_Attribute1                       VARCHAR2,
215                      X_Attribute2                       VARCHAR2,
216                      X_Attribute3                       VARCHAR2,
217                      X_Attribute4                       VARCHAR2,
218                      X_Attribute5                       VARCHAR2,
219                      X_Attribute6                       VARCHAR2,
220                      X_Attribute7                       VARCHAR2,
221                      X_Attribute8                       VARCHAR2,
222                      X_Attribute9                       VARCHAR2,
223                      X_Attribute10                      VARCHAR2,
224                      X_Attribute11                      VARCHAR2,
225                      X_Attribute12                      VARCHAR2,
226                      X_Attribute13                      VARCHAR2,
227                      X_Attribute14                      VARCHAR2,
228                      X_Attribute15                      VARCHAR2,
229                      X_Attribute16                      VARCHAR2,
230                      X_Attribute17                      VARCHAR2,
231                      X_Attribute18                      VARCHAR2,
232                      X_Attribute19                      VARCHAR2,
233                      X_Attribute20                      VARCHAR2,
234                      X_Attribute21                      VARCHAR2,
235                      X_Attribute22                      VARCHAR2,
236                      X_Attribute23                      VARCHAR2,
237                      X_Attribute24                      VARCHAR2,
238                      X_Attribute25                      VARCHAR2,
239                      X_Attribute26                      VARCHAR2,
240                      X_Attribute27                      VARCHAR2,
241                      X_Attribute28                      VARCHAR2,
242                      X_Attribute29                      VARCHAR2,
243                      X_Attribute30                      VARCHAR2,
244                      X_CardProgramId                    NUMBER
245   ) IS
246     CURSOR C IS
247         SELECT *
248         FROM   ap_cards
249         WHERE  rowid = X_Rowid
250         FOR UPDATE of Card_Id NOWAIT;
251     Recinfo C%ROWTYPE;
252 
253   BEGIN
254     OPEN C;
255     FETCH C INTO Recinfo;
256     if (C%NOTFOUND) then
257       CLOSE C;
258       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_DELETED');
259       APP_EXCEPTION.Raise_Exception;
260     end if;
261     CLOSE C;
262     if (   (   (Recinfo.employee_id =  X_Employee_Id)
263                 OR (    (Recinfo.employee_id IS NULL)
264                     AND (X_Employee_Id IS NULL)))
265 	   AND (   (Recinfo.card_expiration_date = X_Card_Expiration_Date)
266 		OR (	(Recinfo.card_expiration_date IS NULL)
267 		    AND (X_Card_Expiration_Date IS NULL)))
268            AND (   (Recinfo.card_id =  X_Card_Id)
269 		OR (	(Recinfo.card_id IS NULL)
270 		    AND (X_Card_Id IS NULL)))
271            AND (   (Recinfo.limit_override_amount =  X_Limit_Override_Amount)
272                 OR (    (Recinfo.limit_override_amount IS NULL)
273                     AND (X_Limit_Override_Amount IS NULL)))
274            AND (   (Recinfo.trx_limit_override_amount =  X_Trx_Limit_Override_Amount)
275                 OR (    (Recinfo.trx_limit_override_amount IS NULL)
276                     AND (X_Trx_Limit_Override_Amount IS NULL)))
277            AND (   (Recinfo.profile_id =  X_Profile_Id)
278                 OR (    (Recinfo.profile_id IS NULL)
279                     AND (X_Profile_Id IS NULL)))
280            AND (   (Recinfo.cardmember_name =  X_Cardmember_Name)
281                 OR (    (Recinfo.cardmember_name IS NULL)
282                     AND (X_Cardmember_Name IS NULL)))
283            AND (   (Recinfo.department_name =  X_Department_Name)
284                 OR (    (Recinfo.department_name IS NULL)
285                     AND (X_Department_Name IS NULL)))
286            AND (   (Recinfo.physical_card_flag =  X_Physical_Card_Flag)
287                 OR (    (Recinfo.physical_card_flag IS NULL)
288                     AND (X_Physical_Card_Flag IS NULL)))
289            AND (   (Recinfo.paper_statement_req_flag =  X_Paper_Statement_Req_Flag)
290                 OR (    (Recinfo.paper_statement_req_flag IS NULL)
291                     AND (X_Paper_Statement_Req_Flag IS NULL)))
292            AND (   (Recinfo.location_id =  X_Location_Id)
293                 OR (    (Recinfo.location_id IS NULL)
294                     AND (X_Location_Id IS NULL)))
295    /* Commented for bug 2928064
296            AND (   (Recinfo.mothers_maiden_name =  X_Mothers_Maiden_Name)
297                 OR (    (Recinfo.mothers_maiden_name IS NULL)
298                     AND (X_Mothers_Maiden_Name IS NULL)))
299    */
300            AND (   (Recinfo.description =  X_Description)
301                 OR (    (Recinfo.description IS NULL)
302                     AND (X_Description IS NULL)))
303            AND (   (Recinfo.inactive_date =  X_Inactive_Date)
304                 OR (    (Recinfo.inactive_date IS NULL)
305                     AND (X_Inactive_Date IS NULL)))
306            AND (   (Recinfo.attribute_category =  X_Attribute_Category)
307                 OR (    (Recinfo.attribute_category IS NULL)
308                     AND (X_Attribute_Category IS NULL)))
309            AND (   (Recinfo.attribute1 =  X_Attribute1)
310                 OR (    (Recinfo.attribute1 IS NULL)
311                     AND (X_Attribute1 IS NULL)))
312            AND (   (Recinfo.attribute2 =  X_Attribute2)
313                 OR (    (Recinfo.attribute2 IS NULL)
314                     AND (X_Attribute2 IS NULL)))
315            AND (   (Recinfo.attribute3 =  X_Attribute3)
316                 OR (    (Recinfo.attribute3 IS NULL)
317                     AND (X_Attribute3 IS NULL)))
318            AND (   (Recinfo.attribute4 =  X_Attribute4)
319                 OR (    (Recinfo.attribute4 IS NULL)
320                     AND (X_Attribute4 IS NULL)))
321            AND (   (Recinfo.attribute5 =  X_Attribute5)
322                 OR (    (Recinfo.attribute5 IS NULL)
323                     AND (X_Attribute5 IS NULL)))
324            AND (   (Recinfo.attribute6 =  X_Attribute6)
325                 OR (    (Recinfo.attribute6 IS NULL)
326                     AND (X_Attribute6 IS NULL)))
327            AND (   (Recinfo.attribute7 =  X_Attribute7)
328                 OR (    (Recinfo.attribute7 IS NULL)
329                     AND (X_Attribute7 IS NULL)))
330            AND (   (Recinfo.attribute8 =  X_Attribute8)
331                 OR (    (Recinfo.attribute8 IS NULL)
332                     AND (X_Attribute8 IS NULL)))
333            AND (   (Recinfo.attribute9 =  X_Attribute9)
334                 OR (    (Recinfo.attribute9 IS NULL)
335                     AND (X_Attribute9 IS NULL)))
336            AND (   (Recinfo.attribute10 =  X_Attribute10)
337                 OR (    (Recinfo.attribute10 IS NULL)
338                     AND (X_Attribute10 IS NULL)))
339            AND (   (Recinfo.attribute11 =  X_Attribute11)
340                 OR (    (Recinfo.attribute11 IS NULL)
344                     AND (X_Attribute12 IS NULL)))
341                     AND (X_Attribute11 IS NULL)))
342            AND (   (Recinfo.attribute12 =  X_Attribute12)
343                 OR (    (Recinfo.attribute12 IS NULL)
345            AND (   (Recinfo.attribute13 =  X_Attribute13)
346                 OR (    (Recinfo.attribute13 IS NULL)
347                     AND (X_Attribute13 IS NULL)))
348            AND (   (Recinfo.attribute14 =  X_Attribute14)
349                 OR (    (Recinfo.attribute14 IS NULL)
350                     AND (X_Attribute14 IS NULL)))
351            AND (   (Recinfo.attribute15 =  X_Attribute15)
352                 OR (    (Recinfo.attribute15 IS NULL)
353                     AND (X_Attribute15 IS NULL)))
354            AND (   (Recinfo.attribute16 =  X_Attribute16)
355                 OR (    (Recinfo.attribute16 IS NULL)
356                     AND (X_Attribute16 IS NULL)))
357            AND (   (Recinfo.attribute17 =  X_Attribute17)
358                 OR (    (Recinfo.attribute17 IS NULL)
359                     AND (X_Attribute17 IS NULL)))
360            AND (   (Recinfo.attribute18 =  X_Attribute18)
361                 OR (    (Recinfo.attribute18 IS NULL)
362                     AND (X_Attribute18 IS NULL)))
363            AND (   (Recinfo.attribute19 =  X_Attribute19)
364                 OR (    (Recinfo.attribute19 IS NULL)
365                     AND (X_Attribute19 IS NULL)))
366            AND (   (Recinfo.attribute20 =  X_Attribute20)
367                 OR (    (Recinfo.attribute20 IS NULL)
368                     AND (X_Attribute20 IS NULL)))
369            AND (   (Recinfo.attribute21 =  X_Attribute21)
370                 OR (    (Recinfo.attribute21 IS NULL)
371                     AND (X_Attribute21 IS NULL)))
372            AND (   (Recinfo.attribute22 =  X_Attribute22)
373                 OR (    (Recinfo.attribute22 IS NULL)
374                     AND (X_Attribute22 IS NULL)))
375            AND (   (Recinfo.attribute23 =  X_Attribute23)
376                 OR (    (Recinfo.attribute23 IS NULL)
377                     AND (X_Attribute23 IS NULL)))
378            AND (   (Recinfo.attribute24 =  X_Attribute24)
379                 OR (    (Recinfo.attribute24 IS NULL)
380                     AND (X_Attribute24 IS NULL)))
381            AND (   (Recinfo.attribute25 =  X_Attribute25)
382                 OR (    (Recinfo.attribute25 IS NULL)
383                     AND (X_Attribute25 IS NULL)))
384            AND (   (Recinfo.attribute26 =  X_Attribute26)
385                 OR (    (Recinfo.attribute26 IS NULL)
386                     AND (X_Attribute26 IS NULL)))
387            AND (   (Recinfo.attribute27 =  X_Attribute27)
388                 OR (    (Recinfo.attribute27 IS NULL)
389                     AND (X_Attribute27 IS NULL)))
390            AND (   (Recinfo.attribute28 =  X_Attribute28)
391                 OR (    (Recinfo.attribute28 IS NULL)
392                     AND (X_Attribute28 IS NULL)))
393            AND (   (Recinfo.attribute29 =  X_Attribute29)
394                 OR (    (Recinfo.attribute29 IS NULL)
395                     AND (X_Attribute29 IS NULL)))
396            AND (   (Recinfo.attribute30 =  X_Attribute30)
397                 OR (    (Recinfo.attribute30 IS NULL)
398                     AND (X_Attribute30 IS NULL)))
399            AND (   (Recinfo.card_program_id =  X_CardProgramId)
400                 OR (    (Recinfo.card_program_id IS NULL)
401                     AND (X_CardProgramId IS NULL)))
402       ) then
403       return;
404     else
405       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
406       APP_EXCEPTION.Raise_Exception;
407     end if;
408   END Lock_Row;
409 
410 
411 
412   PROCEDURE Update_Row(X_Rowid                          VARCHAR2,
413                        X_Employee_Id                    NUMBER,
414                        X_Card_Expiration_Date		DATE,
415                        X_Card_Id                        NUMBER,
416                        X_Limit_Override_Amount          NUMBER,
417                        X_Trx_Limit_Override_Amount      NUMBER,
418                        X_Profile_Id                     NUMBER,
419                        X_Cardmember_Name                VARCHAR2,
420                        X_Department_Name                VARCHAR2,
421                        X_Physical_Card_Flag             VARCHAR2,
422                        X_Paper_Statement_Req_Flag       VARCHAR2,
423                        X_Location_Id                    NUMBER,
424    --                  X_Mothers_Maiden_Name            VARCHAR2,Commented for bug 2928064
425                        X_Description                    VARCHAR2,
426                        X_Org_Id                         NUMBER,
427                        X_Inactive_Date                  DATE,
428                        X_Last_Update_Date               DATE,
429                        X_Last_Updated_By                NUMBER,
430                        X_Last_Update_Login              NUMBER,
431                        X_Attribute_Category             VARCHAR2,
432                        X_Attribute1                     VARCHAR2,
433                        X_Attribute2                     VARCHAR2,
434                        X_Attribute3                     VARCHAR2,
435                        X_Attribute4                     VARCHAR2,
436                        X_Attribute5                     VARCHAR2,
437                        X_Attribute6                     VARCHAR2,
438                        X_Attribute7                     VARCHAR2,
439                        X_Attribute8                     VARCHAR2,
443                        X_Attribute12                    VARCHAR2,
440                        X_Attribute9                     VARCHAR2,
441                        X_Attribute10                    VARCHAR2,
442                        X_Attribute11                    VARCHAR2,
444                        X_Attribute13                    VARCHAR2,
445                        X_Attribute14                    VARCHAR2,
446                        X_Attribute15                    VARCHAR2,
447                        X_Attribute16                    VARCHAR2,
448                        X_Attribute17                    VARCHAR2,
449                        X_Attribute18                    VARCHAR2,
450                        X_Attribute19                    VARCHAR2,
451                        X_Attribute20                    VARCHAR2,
452                        X_Attribute21                    VARCHAR2,
453                        X_Attribute22                    VARCHAR2,
454                        X_Attribute23                    VARCHAR2,
455                        X_Attribute24                    VARCHAR2,
456                        X_Attribute25                    VARCHAR2,
457                        X_Attribute26                    VARCHAR2,
458                        X_Attribute27                    VARCHAR2,
459                        X_Attribute28                    VARCHAR2,
460                        X_Attribute29                    VARCHAR2,
461                        X_Attribute30                    VARCHAR2,
462                        X_CardProgramId                  NUMBER
463 
464 
465   ) IS
466   BEGIN
467     UPDATE ap_cards
468     SET
469        employee_id                     =     X_Employee_Id,
470        card_expiration_date	           =     X_Card_Expiration_Date,
471        card_id                         =     X_Card_Id,
472        limit_override_amount           =     X_Limit_Override_Amount,
473        trx_limit_override_amount       =     X_Trx_Limit_Override_Amount,
474        profile_id                      =     X_Profile_Id,
475        cardmember_name                 =     X_Cardmember_Name,
476        department_name                 =     X_Department_Name,
477        physical_card_flag              =     X_Physical_Card_Flag,
478        paper_statement_req_flag        =     X_Paper_Statement_Req_Flag,
479        location_id                     =     X_Location_Id,
480 --     mothers_maiden_name             =     X_Mothers_Maiden_Name,Commented for bug 2928064
481        description                     =     X_Description,
482        inactive_date                   =     X_Inactive_Date,
483        last_update_date                =     X_Last_Update_Date,
484        last_updated_by                 =     X_Last_Updated_By,
485        last_update_login               =     X_Last_Update_Login,
486        attribute_category              =     X_Attribute_Category,
487        attribute1                      =     X_Attribute1,
488        attribute2                      =     X_Attribute2,
489        attribute3                      =     X_Attribute3,
490        attribute4                      =     X_Attribute4,
491        attribute5                      =     X_Attribute5,
492        attribute6                      =     X_Attribute6,
493        attribute7                      =     X_Attribute7,
494        attribute8                      =     X_Attribute8,
495        attribute9                      =     X_Attribute9,
496        attribute10                     =     X_Attribute10,
497        attribute11                     =     X_Attribute11,
498        attribute12                     =     X_Attribute12,
499        attribute13                     =     X_Attribute13,
500        attribute14                     =     X_Attribute14,
501        attribute15                     =     X_Attribute15,
502        attribute16                     =     X_Attribute16,
503        attribute17                     =     X_Attribute17,
504        attribute18                     =     X_Attribute18,
505        attribute19                     =     X_Attribute19,
506        attribute20                     =     X_Attribute20,
507        attribute21                     =     X_Attribute21,
508        attribute22                     =     X_Attribute22,
509        attribute23                     =     X_Attribute23,
510        attribute24                     =     X_Attribute24,
511        attribute25                     =     X_Attribute25,
512        attribute26                     =     X_Attribute26,
513        attribute27                     =     X_Attribute27,
514        attribute28                     =     X_Attribute28,
515        attribute29                     =     X_Attribute29,
516        attribute30                     =     X_Attribute30,
517        card_program_id                 =     X_CardProgramId
518     WHERE rowid = X_Rowid;
519 
520     if (SQL%NOTFOUND) then
521       Raise NO_DATA_FOUND;
522     end if;
523   END Update_Row;
524   PROCEDURE Delete_Row(X_Rowid VARCHAR2) IS
525   BEGIN
526     DELETE FROM ap_cards
527     WHERE rowid = X_Rowid;
528 
529     if (SQL%NOTFOUND) then
530       Raise NO_DATA_FOUND;
531     end if;
532   END Delete_Row;
533 
534  PROCEDURE Supplier_Insert_Row( x_Card_Id NUMBER,
535                                X_Vendor_id NUMBER,
536                                X_Vendor_Site_id NUMBER,
537                                X_Last_Updated_By NUMBER,
538                                X_Last_Update_Login NUMBER,
539                                X_Last_Update_Date DATE,
543                                X_Rowid IN OUT NOCOPY VARCHAR2 ) IS
540                                X_Created_By NUMBER,
541                                X_Creation_Date DATE,
542                                X_Org_Id NUMBER,
544 
545   CURSOR Fetch_Row_Id_Cur IS
546     SELECT row_id
547     FROM   Ap_Card_Suppliers_V
548     WHERE  Card_Id = x_card_id
549       AND  Vendor_Id = x_vendor_id
550       AND  Vendor_Site_Id = x_vendor_site_id;
551 
552 BEGIN
553 
554   INSERT INTO Ap_Card_Suppliers_V( Card_Id,
555                                    Vendor_Id,
556                                    Vendor_Site_Id,
557                                    last_update_date,
558                                    last_updated_by,
559                                    last_update_login,
560                                    creation_date,
561                                    created_by,
562                                    org_id)
563   VALUES
564   ( x_card_id,
565     x_vendor_id,
566     x_vendor_site_id,
567     x_last_update_date,
568     x_last_updated_by,
569     x_last_update_login,
570     x_creation_date,
571     x_created_by,
572     x_org_id );
573 
574     OPEN Fetch_Row_Id_Cur;
575     FETCH Fetch_Row_Id_Cur INTO X_Rowid;
576     if (Fetch_Row_Id_Cur%NOTFOUND) then
577       CLOSE Fetch_Row_Id_Cur;
578       Raise NO_DATA_FOUND;
579     end if;
580     CLOSE Fetch_Row_Id_Cur;
581 
582 END Supplier_Insert_Row;
583 
584 PROCEDURE Supplier_Update_Row( x_Card_Id NUMBER,
585                                X_Vendor_id NUMBER,
586                                X_Vendor_Site_id NUMBER,
587                                X_Last_Updated_By NUMBER,
588                                X_Last_Update_Login NUMBER,
589                                X_Last_Update_Date DATE,
590                                X_Rowid VARCHAR2 ) IS
591 BEGIN
592 
593   UPDATE Ap_Card_Suppliers_V
594   SET    Vendor_Site_Id = x_vendor_site_id,
595          Last_Updated_By = x_last_updated_by,
596          Last_Update_Login = x_last_update_login,
597          Last_Update_Date = x_last_update_date
598   WHERE  Row_Id = x_rowid;
599 
600   IF (SQL%NOTFOUND) THEN
601       RAISE NO_DATA_FOUND;
602   END IF;
603 
604 END Supplier_Update_Row;
605 
606 PROCEDURE Supplier_Lock_Row( X_Rowid VARCHAR2,
607                              X_Vendor_Site_Id NUMBER ) IS
608 
609     CURSOR C IS
610         SELECT *
611         FROM   ap_card_suppliers_v
612         WHERE  rowid = X_Rowid
613         FOR UPDATE of Card_Id NOWAIT;
614 
615     Recinfo C%ROWTYPE;
616 
617 BEGIN
618     OPEN C;
619     FETCH C INTO Recinfo;
620     IF (C%NOTFOUND) THEN
621       CLOSE C;
622       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_DELETED');
623       APP_EXCEPTION.Raise_Exception;
624     END IF;
625     CLOSE C;
626 
627     IF ( (Recinfo.Vendor_Site_Id =  x_vendor_site_id )
628             OR ((Recinfo.Vendor_Site_id IS NULL)
629                     AND (X_Vendor_Site_Id IS NULL)))
630     THEN
631       RETURN;
632     ELSE
633       FND_MESSAGE.Set_Name('FND', 'FORM_RECORD_CHANGED');
634       APP_EXCEPTION.Raise_Exception;
635     END IF;
636 END Supplier_Lock_Row;
637 
638 PROCEDURE Supplier_Delete_Row ( x_rowid IN VARCHAR2 ) IS
639 BEGIN
640   DELETE FROM Ap_Card_Suppliers_V
641   WHERE rowid = X_Rowid;
642 
643   IF (SQL%NOTFOUND) THEN
644       RAISE NO_DATA_FOUND;
645   END IF;
646 
647 END Supplier_Delete_Row;
648 
649 END AP_CARDS_PKG;