DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGF_AW_COA_GRP_ITEM_PKG

Source


1 PACKAGE BODY igf_aw_coa_grp_item_pkg AS
2 /* $Header: IGFWI06B.pls 120.0 2005/06/01 13:27:12 appldev noship $ */
3 
4   l_rowid VARCHAR2(25);
5   old_references igf_aw_coa_grp_item_all%ROWTYPE;
6   new_references igf_aw_coa_grp_item_all%ROWTYPE;
7 
8   PROCEDURE set_column_values (
9     p_action                            IN     VARCHAR2,
10     x_rowid                             IN     VARCHAR2,
11     x_coa_code                          IN     VARCHAR2,
12     x_ci_cal_type                       IN     VARCHAR2,
13     x_ci_sequence_number                IN     NUMBER,
14     x_item_code                         IN     VARCHAR2,
15     x_default_value                     IN     NUMBER,
16     x_fixed_cost                        IN     VARCHAR2,
17     x_pell_coa                          IN     VARCHAR2,
18     x_active                            IN     VARCHAR2,
19     x_creation_date                     IN     DATE,
20     x_created_by                        IN     NUMBER,
21     x_last_update_date                  IN     DATE,
22     x_last_updated_by                   IN     NUMBER,
23     x_last_update_login                 IN     NUMBER,
24     x_pell_amount                       IN     NUMBER,
25     x_pell_alternate_amt                IN     NUMBER,
26     x_item_dist                         IN     VARCHAR2,
27     x_lock_flag                         IN     VARCHAR2
28 
29   ) AS
30   /*
31   ||  Created By : adhawan
32   ||  Created On : 13-NOV-2000
33   ||  Purpose : Initialises the Old and New references for the columns of the table.
34   ||  Known limitations, enhancements or remarks :
35   ||  Change History :
36   ||  Who             When            What
37   ||  (reverse chronological order - newest change first)
38   */
39 
40     CURSOR cur_old_ref_values IS
41       SELECT   *
42       FROM     IGF_AW_COA_GRP_ITEM_ALL
43       WHERE    rowid = x_rowid;
44 
45   BEGIN
46 
47     l_rowid := x_rowid;
48 
49     -- Code for setting the Old and New Reference Values.
50     -- Populate Old Values.
51     OPEN cur_old_ref_values;
52     FETCH cur_old_ref_values INTO old_references;
53     IF ((cur_old_ref_values%NOTFOUND) AND (p_action NOT IN ('INSERT', 'VALIDATE_INSERT'))) THEN
54       CLOSE cur_old_ref_values;
55       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
56       igs_ge_msg_stack.add;
57       app_exception.raise_exception;
58       RETURN;
59     END IF;
60     CLOSE cur_old_ref_values;
61 
62     -- Populate New Values.
63     new_references.coa_code                          := x_coa_code;
64     new_references.ci_cal_type                       := x_ci_cal_type;
65     new_references.ci_sequence_number                := x_ci_sequence_number;
66     new_references.item_code                         := x_item_code;
67     new_references.default_value                     := x_default_value;
68     new_references.fixed_cost                        := x_fixed_cost;
69     new_references.pell_coa                          := x_pell_coa;
70     new_references.active                            := x_active;
71     new_references.pell_amount                     := x_pell_amount;
72     new_references.pell_alternate_amt              := x_pell_alternate_amt;
73     new_references.item_dist                       := x_item_dist;
74     new_references.lock_flag                       := x_lock_flag;
75 
76 
77     IF (p_action = 'UPDATE') THEN
78       new_references.creation_date                   := old_references.creation_date;
79       new_references.created_by                      := old_references.created_by;
80     ELSE
81       new_references.creation_date                   := x_creation_date;
82       new_references.created_by                      := x_created_by;
83     END IF;
84 
85     new_references.last_update_date                  := x_last_update_date;
86     new_references.last_updated_by                   := x_last_updated_by;
87     new_references.last_update_login                 := x_last_update_login;
88 
89   END set_column_values;
90 
91 
92   PROCEDURE check_parent_existance AS
93   /*
94   ||  Created By : adhawan
95   ||  Created On : 13-NOV-2000
96   ||  Purpose : Checks for the existance of Parent records.
97   ||  Known limitations, enhancements or remarks :
98   ||  Change History :
99   ||  Who             When            What
100   ||  (reverse chronological order - newest change first)
101   */
102   BEGIN
103 
104     IF (((old_references.coa_code = new_references.coa_code) AND
105          (old_references.ci_cal_type = new_references.ci_cal_type) AND
106          (old_references.ci_sequence_number = new_references.ci_sequence_number)) OR
107         ((new_references.coa_code IS NULL) OR
108          (new_references.ci_cal_type IS NULL) OR
109          (new_references.ci_sequence_number IS NULL))) THEN
110       NULL;
111     ELSIF NOT igf_aw_coa_group_pkg.get_pk_for_validation (
112                 new_references.coa_code,
113                 new_references.ci_cal_type,
114                 new_references.ci_sequence_number
115               ) THEN
116       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
117       igs_ge_msg_stack.add;
118       app_exception.raise_exception;
119     END IF;
120 
121     IF (((old_references.item_code = new_references.item_code)) OR
122         ((new_references.item_code IS NULL))) THEN
123       NULL;
124     ELSIF NOT igf_aw_item_pkg.get_pk_for_validation (
125                 new_references.item_code
126               ) THEN
127       fnd_message.set_name ('FND', 'FORM_RECORD_DELETED');
128       igs_ge_msg_stack.add;
129       app_exception.raise_exception;
130     END IF;
131 
132   END check_parent_existance;
133 
134   PROCEDURE check_child_existance IS
135   /*
136   ||  Created By : prchandr
137   ||  Created On : 01-JUN-2001
138   ||  Purpose : Checks for the existance of Child records.
139   ||  Known limitations, enhancements or remarks :
140   ||  Change History :
141   ||  Who             When            What
142   ||  (reverse chronological order - newest change first)
143   */
144   BEGIN
145 
146     igf_aw_cit_ld_ovrd_pkg.get_fk_igf_aw_coa_grp_item (
147       old_references.coa_code,
148       old_references.ci_cal_type,
149       old_references.ci_sequence_number,
150       old_references.item_code
151     );
152 
153   END check_child_existance;
154 
155 
156   FUNCTION get_pk_for_validation (
157     x_coa_code                          IN     VARCHAR2,
158     x_ci_cal_type                       IN     VARCHAR2,
159     x_ci_sequence_number                IN     NUMBER,
160     x_item_code                         IN     VARCHAR2
161   ) RETURN BOOLEAN AS
162   /*
163   ||  Created By : adhawan
164   ||  Created On : 13-NOV-2000
165   ||  Purpose : Validates the Primary Key of the table.
166   ||  Known limitations, enhancements or remarks :
167   ||  Change History :
168   ||  Who             When            What
169   ||  (reverse chronological order - newest change first)
170   */
171     CURSOR cur_rowid IS
172       SELECT   rowid
173       FROM     igf_aw_coa_grp_item_all
174       WHERE    coa_code = x_coa_code
175       AND      ci_cal_type = x_ci_cal_type
176       AND      ci_sequence_number = x_ci_sequence_number
177       AND      item_code = x_item_code
178       FOR UPDATE NOWAIT;
179 
180     lv_rowid cur_rowid%RowType;
181 
182   BEGIN
183 
184     OPEN cur_rowid;
185     FETCH cur_rowid INTO lv_rowid;
186     IF (cur_rowid%FOUND) THEN
187       CLOSE cur_rowid;
188       RETURN(TRUE);
189     ELSE
190       CLOSE cur_rowid;
191       RETURN(FALSE);
192     END IF;
193 
194   END get_pk_for_validation;
195 
196 
197   PROCEDURE get_fk_igf_aw_coa_group (
198     x_coa_code                          IN     VARCHAR2,
199     x_ci_cal_type                       IN     VARCHAR2,
200     x_ci_sequence_number                IN     NUMBER
201   ) AS
202   /*
203   ||  Created By : adhawan
204   ||  Created On : 13-NOV-2000
205   ||  Purpose : Validates the Foreign Keys for the table.
206   ||  Known limitations, enhancements or remarks :
207   ||  Change History :
208   ||  Who             When            What
209   ||  (reverse chronological order - newest change first)
210   */
211     CURSOR cur_rowid IS
212       SELECT   rowid
213       FROM     igf_aw_coa_grp_item_all
214       WHERE   ((coa_code = x_coa_code) AND
215                (ci_cal_type = x_ci_cal_type) AND
216                (ci_sequence_number = x_ci_sequence_number));
217 
218     lv_rowid cur_rowid%RowType;
219 
220   BEGIN
221 
222     OPEN cur_rowid;
223     FETCH cur_rowid INTO lv_rowid;
224     IF (cur_rowid%FOUND) THEN
225       CLOSE cur_rowid;
226       fnd_message.set_name ('IGF', 'IGF_AW_COAGI_COAG_FK');
227       igs_ge_msg_stack.add;
228       app_exception.raise_exception;
229       RETURN;
230     END IF;
231     CLOSE cur_rowid;
232 
233   END get_fk_igf_aw_coa_group;
234 
235 
236   PROCEDURE get_fk_igf_aw_item (
237     x_item_code                         IN     VARCHAR2
238   ) AS
239   /*
240   ||  Created By : adhawan
241   ||  Created On : 13-NOV-2000
242   ||  Purpose : Validates the Foreign Keys for the table.
243   ||  Known limitations, enhancements or remarks :
244   ||  Change History :
245   ||  Who             When            What
246   ||  (reverse chronological order - newest change first)
247   */
248     CURSOR cur_rowid IS
249       SELECT   rowid
250       FROM     igf_aw_coa_grp_item_all
251       WHERE   ((item_code = x_item_code));
252 
253     lv_rowid cur_rowid%RowType;
254 
255   BEGIN
256 
257     OPEN cur_rowid;
258     FETCH cur_rowid INTO lv_rowid;
259     IF (cur_rowid%FOUND) THEN
260       CLOSE cur_rowid;
261       fnd_message.set_name ('IGF', 'IGF_AW_COAGI_AWITEM_FK');
262       igs_ge_msg_stack.add;
263       app_exception.raise_exception;
264       RETURN;
265     END IF;
266     CLOSE cur_rowid;
267 
268   END get_fk_igf_aw_item;
269 
270 
271   PROCEDURE before_dml (
272     p_action                            IN     VARCHAR2,
273     x_rowid                             IN     VARCHAR2,
274     x_coa_code                          IN     VARCHAR2,
275     x_ci_cal_type                       IN     VARCHAR2,
276     x_ci_sequence_number                IN     NUMBER,
277     x_item_code                         IN     VARCHAR2,
278     x_default_value                     IN     NUMBER,
279     x_fixed_cost                        IN     VARCHAR2,
280     x_pell_coa                          IN     VARCHAR2,
281     x_active                            IN     VARCHAR2,
282     x_creation_date                     IN     DATE,
283     x_created_by                        IN     NUMBER,
284     x_last_update_date                  IN     DATE,
285     x_last_updated_by                   IN     NUMBER,
286     x_last_update_login                 IN     NUMBER,
287     x_pell_amount                       IN     NUMBER,
288     x_pell_alternate_amt                IN     NUMBER,
289     x_item_dist                         IN     VARCHAR2,
290     x_lock_flag                         IN     VARCHAR2
291   ) AS
292   /*
293   ||  Created By : adhawan
294   ||  Created On : 13-NOV-2000
295   ||  Purpose : Initialises the columns, Checks Constraints, Calls the
296   ||            Trigger Handlers for the table, before any DML operation.
297   ||  Known limitations, enhancements or remarks :
298   ||  Change History :
299   ||  Who             When            What
300   ||  (reverse chronological order - newest change first)
301   */
302   BEGIN
303 
304     set_column_values (
305       p_action,
306       x_rowid,
307       x_coa_code,
308       x_ci_cal_type,
309       x_ci_sequence_number,
310       x_item_code,
311       x_default_value,
312       x_fixed_cost,
313       x_pell_coa,
314       x_active,
315       x_creation_date,
316       x_created_by,
317       x_last_update_date,
318       x_last_updated_by,
319       x_last_update_login,
320       x_pell_amount,
321       x_pell_alternate_amt,
322       x_item_dist,
323       x_lock_flag
324     );
325 
326     IF (p_action = 'INSERT') THEN
327       -- Call all the procedures related to Before Insert.
328       IF ( get_pk_for_validation(
329              new_references.coa_code,
330              new_references.ci_cal_type,
331              new_references.ci_sequence_number,
332              new_references.item_code
333            )
334          ) THEN
335         fnd_message.set_name('IGS','IGS_GE_RECORD_ALREADY_EXISTS');
336         igs_ge_msg_stack.add;
337         app_exception.raise_exception;
338       END IF;
339       check_parent_existance;
340     ELSIF (p_action = 'UPDATE') THEN
341       -- Call all the procedures related to Before Update.
342       check_parent_existance;
343     ELSIF (p_action = 'VALIDATE_INSERT') THEN
344       -- Call all the procedures related to Before Insert.
345       IF ( get_pk_for_validation (
346              new_references.coa_code,
347              new_references.ci_cal_type,
348              new_references.ci_sequence_number,
349              new_references.item_code
350            )
351          ) THEN
352         fnd_message.set_name('IGS','IGS_GE_RECORD_ALREADY_EXISTS');
353         igs_ge_msg_stack.add;
354         app_exception.raise_exception;
355       END IF;
356     ELSIF (p_action = 'VALIDATE_DELETE') THEN
357       check_child_existance;
358     END IF;
359 
360   END before_dml;
361 
362 
363   PROCEDURE insert_row (
364     x_rowid                             IN OUT NOCOPY VARCHAR2,
365     x_coa_code                          IN     VARCHAR2,
366     x_ci_cal_type                       IN     VARCHAR2,
367     x_ci_sequence_number                IN     NUMBER,
368     x_item_code                         IN     VARCHAR2,
369     x_default_value                     IN     NUMBER,
370     x_fixed_cost                        IN     VARCHAR2,
371     x_pell_coa                          IN     VARCHAR2,
372     x_active                            IN     VARCHAR2,
373     x_pell_amount                       IN     NUMBER,
374     x_pell_alternate_amt                IN     NUMBER,
375     x_item_dist                         IN     VARCHAR2,
376     x_lock_flag                         IN     VARCHAR2,
377     x_mode                              IN     VARCHAR2
378   ) AS
379   /*
380   ||  Created By : adhawan
381   ||  Created On : 13-NOV-2000
382   ||  Purpose : Handles the INSERT DML logic for the table.
383   ||  Known limitations, enhancements or remarks :
384   ||  Change History :
385   ||  Who             When            What
386   ||  (reverse chronological order - newest change first)
387   */
388     CURSOR c IS
389       SELECT   rowid
390       FROM     igf_aw_coa_grp_item_all
391       WHERE    coa_code                          = x_coa_code
392       AND      ci_cal_type                       = x_ci_cal_type
393       AND      ci_sequence_number                = x_ci_sequence_number
394       AND      item_code                         = x_item_code;
395 
396     x_last_update_date           DATE;
397     x_last_updated_by            NUMBER;
398     x_last_update_login          NUMBER;
399     l_org_id                igf_aw_coa_grp_item_all.org_id%TYPE  DEFAULT igf_aw_gen.get_org_id;
400   BEGIN
401 
402     x_last_update_date := SYSDATE;
403     IF (x_mode = 'I') THEN
404       x_last_updated_by := 1;
405       x_last_update_login := 0;
406     ELSIF (x_mode = 'R') THEN
407       x_last_updated_by := fnd_global.user_id;
408       IF (x_last_updated_by IS NULL) THEN
409         x_last_updated_by := -1;
410       END IF;
411       x_last_update_login := fnd_global.login_id;
412       IF (x_last_update_login IS NULL) THEN
413         x_last_update_login := -1;
414       END IF;
415     ELSE
416       fnd_message.set_name ('FND', 'SYSTEM-INVALID ARGS');
417       igs_ge_msg_stack.add;
418       app_exception.raise_exception;
419     END IF;
420 
421     before_dml(
422       p_action                            => 'INSERT',
423       x_rowid                             => x_rowid,
424       x_coa_code                          => x_coa_code,
425       x_ci_cal_type                       => x_ci_cal_type,
426       x_ci_sequence_number                => x_ci_sequence_number,
427       x_item_code                         => x_item_code,
428       x_default_value                     => x_default_value,
429       x_fixed_cost                        => x_fixed_cost,
430       x_pell_coa                          => x_pell_coa,
431       x_active                            => x_active,
432       x_creation_date                     => x_last_update_date,
433       x_created_by                        => x_last_updated_by,
434       x_last_update_date                  => x_last_update_date,
435       x_last_updated_by                   => x_last_updated_by,
436       x_last_update_login                 => x_last_update_login,
437       x_pell_amount                       => x_pell_amount,
438       x_pell_alternate_amt                => x_pell_alternate_amt,
439       x_item_dist                         => x_item_dist,
440       x_lock_flag                         => x_lock_flag
441      );
442 
443     INSERT INTO igf_aw_coa_grp_item_all (
444       coa_code,
445       ci_cal_type,
446       ci_sequence_number,
447       item_code,
448       default_value,
449       fixed_cost,
450       active,
451       creation_date,
452       created_by,
453       last_update_date,
454       last_updated_by,
455       last_update_login,
456       org_id,
457       pell_amount,
458       pell_alternate_amt,
459       item_dist,
460       lock_flag
461     ) VALUES (
462       new_references.coa_code,
463       new_references.ci_cal_type,
464       new_references.ci_sequence_number,
465       new_references.item_code,
466       new_references.default_value,
467       new_references.fixed_cost,
468       new_references.active,
469       x_last_update_date,
470       x_last_updated_by,
471       x_last_update_date,
472       x_last_updated_by,
473       x_last_update_login ,
474       l_org_id,
475       new_references.pell_amount,
476       new_references.pell_alternate_amt,
477       new_references.item_dist,
478       new_references.lock_flag
479     );
480 
481     OPEN c;
482     FETCH c INTO x_rowid;
483     IF (c%NOTFOUND) THEN
484       CLOSE c;
485       RAISE NO_DATA_FOUND;
486     END IF;
487     CLOSE c;
488 
489   END insert_row;
490 
491 
492   PROCEDURE lock_row (
493     x_rowid                             IN     VARCHAR2,
494     x_coa_code                          IN     VARCHAR2,
495     x_ci_cal_type                       IN     VARCHAR2,
496     x_ci_sequence_number                IN     NUMBER,
497     x_item_code                         IN     VARCHAR2,
498     x_default_value                     IN     NUMBER,
499     x_fixed_cost                        IN     VARCHAR2,
500     x_pell_coa                          IN     VARCHAR2,
501     x_active                            IN     VARCHAR2,
502     x_pell_amount                       IN     NUMBER,
503     x_pell_alternate_amt                IN     NUMBER,
504     x_item_dist                         IN     VARCHAR2,
505     x_lock_flag                         IN     VARCHAR2
506   ) AS
507   /*
508   ||  Created By : adhawan
509   ||  Created On : 13-NOV-2000
510   ||  Purpose : Handles the LOCK mechanism for the table.
511   ||  Known limitations, enhancements or remarks :
512   ||  Change History :
513   ||  Who             When            What
514   ||  (reverse chronological order - newest change first)
515   */
516     CURSOR c1 IS
517       SELECT
518         default_value,
519         fixed_cost,
520         active,
521         pell_amount,
522         pell_alternate_amt,
523         item_dist,
524         lock_flag
525       FROM  igf_aw_coa_grp_item_all
526       WHERE rowid = x_rowid
527       FOR UPDATE NOWAIT;
528 
529     tlinfo c1%ROWTYPE;
530 
531   BEGIN
532 
533     OPEN c1;
534     FETCH c1 INTO tlinfo;
535     IF (c1%notfound) THEN
536       fnd_message.set_name('FND', 'FORM_RECORD_DELETED');
537       igs_ge_msg_stack.add;
538       CLOSE c1;
539       app_exception.raise_exception;
540       RETURN;
541     END IF;
542     CLOSE c1;
543 
544     IF (
545         ((tlinfo.default_value = x_default_value) OR ((tlinfo.default_value IS NULL) AND (x_default_value IS NULL)))
546         AND
547         ((tlinfo.item_dist = x_item_dist) OR ((tlinfo.item_dist IS NULL) AND (x_item_dist IS NULL)))
548         AND
549         ((tlinfo.pell_amount = x_pell_amount) OR ((tlinfo.pell_amount IS NULL) AND (x_pell_amount IS NULL)))
550         AND
551         ((tlinfo.pell_alternate_amt = x_pell_alternate_amt) OR ((tlinfo.pell_alternate_amt IS NULL) AND (x_pell_alternate_amt IS NULL)))
552         AND
553         (tlinfo.fixed_cost = x_fixed_cost)
554         AND
555         (tlinfo.active = x_active)
556         AND
557         (tlinfo.lock_flag = x_lock_flag)
558        ) THEN
559       NULL;
560     ELSE
561       fnd_message.set_name('FND', 'FORM_RECORD_CHANGED');
562       igs_ge_msg_stack.add;
563       app_exception.raise_exception;
564     END IF;
565 
566     RETURN;
567 
568   END lock_row;
569 
570 
571   PROCEDURE update_row (
572     x_rowid                             IN     VARCHAR2,
573     x_coa_code                          IN     VARCHAR2,
574     x_ci_cal_type                       IN     VARCHAR2,
575     x_ci_sequence_number                IN     NUMBER,
576     x_item_code                         IN     VARCHAR2,
577     x_default_value                     IN     NUMBER,
578     x_fixed_cost                        IN     VARCHAR2,
579     x_pell_coa                          IN     VARCHAR2,
580     x_active                            IN     VARCHAR2,
581     x_pell_amount                       IN     NUMBER,
582     x_pell_alternate_amt                IN     NUMBER,
583     x_item_dist                         IN     VARCHAR2,
584     x_lock_flag                         IN     VARCHAR2,
585     x_mode                              IN     VARCHAR2
586     ) AS
587   /*
588   ||  Created By : adhawan
589   ||  Created On : 13-NOV-2000
590   ||  Purpose : Handles the UPDATE DML logic for the table.
591   ||  Known limitations, enhancements or remarks :
592   ||  Change History :
593   ||  Who             When            What
594   ||  (reverse chronological order - newest change first)
595   */
596     x_last_update_date           DATE ;
597     x_last_updated_by            NUMBER;
598     x_last_update_login          NUMBER;
599 
600   BEGIN
601 
602     x_last_update_date := SYSDATE;
603     IF (X_MODE = 'I') THEN
604       x_last_updated_by := 1;
605       x_last_update_login := 0;
606     ELSIF (x_mode = 'R') THEN
607       x_last_updated_by := fnd_global.user_id;
608       IF x_last_updated_by IS NULL THEN
609         x_last_updated_by := -1;
610       END IF;
611       x_last_update_login := fnd_global.login_id;
612       IF (x_last_update_login IS NULL) THEN
613         x_last_update_login := -1;
614       END IF;
615     ELSE
616       fnd_message.set_name( 'FND', 'SYSTEM-INVALID ARGS');
617       igs_ge_msg_stack.add;
618       app_exception.raise_exception;
619     END IF;
620 
621     before_dml(
622       p_action                            => 'UPDATE',
623       x_rowid                             => x_rowid,
624       x_coa_code                          => x_coa_code,
625       x_ci_cal_type                       => x_ci_cal_type,
626       x_ci_sequence_number                => x_ci_sequence_number,
627       x_item_code                         => x_item_code,
628       x_default_value                     => x_default_value,
629       x_fixed_cost                        => x_fixed_cost,
630       x_pell_coa                          => x_pell_coa,
631       x_active                            => x_active,
632       x_creation_date                     => x_last_update_date,
633       x_created_by                        => x_last_updated_by,
634       x_last_update_date                  => x_last_update_date,
635       x_last_updated_by                   => x_last_updated_by,
636       x_last_update_login                 => x_last_update_login,
637       x_pell_amount                       => x_pell_amount,
638       x_pell_alternate_amt                => x_pell_alternate_amt,
639       x_item_dist                         => x_item_dist,
640       x_lock_flag                         => x_lock_flag
641     );
642 
643     UPDATE igf_aw_coa_grp_item_all
644       SET
645         default_value                     = new_references.default_value,
646         fixed_cost                        = new_references.fixed_cost,
647         active                            = new_references.active,
648         last_update_date                  = x_last_update_date,
649         last_updated_by                   = x_last_updated_by,
650         last_update_login                 = x_last_update_login,
651         pell_amount                       = new_references.pell_amount,
652         pell_alternate_amt                = new_references.pell_alternate_amt,
653         item_dist                         = new_references.item_dist,
654         lock_flag                         = new_references.lock_flag
655       WHERE rowid = x_rowid;
656 
657     IF (SQL%NOTFOUND) THEN
658       RAISE NO_DATA_FOUND;
659     END IF;
660 
661   END update_row;
662 
663 
664   PROCEDURE add_row (
665     x_rowid                             IN OUT NOCOPY VARCHAR2,
666     x_coa_code                          IN     VARCHAR2,
667     x_ci_cal_type                       IN     VARCHAR2,
668     x_ci_sequence_number                IN     NUMBER,
669     x_item_code                         IN     VARCHAR2,
670     x_default_value                     IN     NUMBER,
671     x_fixed_cost                        IN     VARCHAR2,
672     x_pell_coa                          IN     VARCHAR2,
673     x_active                            IN     VARCHAR2,
674     x_pell_amount                       IN     NUMBER,
675     x_pell_alternate_amt                IN     NUMBER,
676     x_item_dist                         IN     VARCHAR2,
677     x_lock_flag                         IN     VARCHAR2,
678     x_mode                              IN     VARCHAR2
679   ) AS
680   /*
681   ||  Created By : adhawan
682   ||  Created On : 13-NOV-2000
683   ||  Purpose : Adds a row if there is no existing row, otherwise updates existing row in the table.
684   ||  Known limitations, enhancements or remarks :
685   ||  Change History :
686   ||  Who             When            What
687   ||  (reverse chronological order - newest change first)
688   */
689     CURSOR c1 IS
690       SELECT   rowid
691       FROM     igf_aw_coa_grp_item_all
692       WHERE    coa_code                          = x_coa_code
693       AND      ci_cal_type                       = x_ci_cal_type
694       AND      ci_sequence_number                = x_ci_sequence_number
695       AND      item_code                         = x_item_code
696       AND      lock_flag                         = x_lock_flag;
697 
698   BEGIN
699 
700     OPEN c1;
701     FETCH c1 INTO x_rowid;
702     IF (c1%NOTFOUND) THEN
703       CLOSE c1;
704 
705       insert_row (
706         x_rowid,
707         x_coa_code,
708         x_ci_cal_type,
709         x_ci_sequence_number,
710         x_item_code,
711         x_default_value,
712         x_fixed_cost,
713         x_pell_coa,
714         x_active,
715         x_pell_amount,
716         x_pell_alternate_amt,
717         x_item_dist,
718         x_lock_flag,
719         x_mode
720       );
721       RETURN;
722     END IF;
723     CLOSE c1;
724 
725     update_row (
726       x_rowid,
727       x_coa_code,
728       x_ci_cal_type,
729       x_ci_sequence_number,
730       x_item_code,
731       x_default_value,
732       x_fixed_cost,
733       x_pell_coa,
734       x_active,
735       x_pell_amount,
736       x_pell_alternate_amt,
737       x_item_dist,
738       x_lock_flag,
739       x_mode
740     );
741 
742   END add_row;
743 
744 
745   PROCEDURE delete_row (
746     x_rowid IN VARCHAR2
747   ) AS
748   /*
749   ||  Created By : adhawan
750   ||  Created On : 13-NOV-2000
751   ||  Purpose : Handles the DELETE DML logic for the table.
752   ||  Known limitations, enhancements or remarks :
753   ||  Change History :
754   ||  Who             When            What
755   ||  (reverse chronological order - newest change first)
756   */
757   BEGIN
758 
759     before_dml (
760       p_action => 'DELETE',
761       x_rowid => x_rowid
762     );
763 
764     DELETE FROM igf_aw_coa_grp_item_all
765     WHERE rowid = x_rowid;
766 
767     IF (SQL%NOTFOUND) THEN
768       RAISE NO_DATA_FOUND;
769     END IF;
770 
771   END delete_row;
772 
773 
774 END igf_aw_coa_grp_item_pkg;