DBA Data[Home] [Help]

PACKAGE BODY: APPS.IGF_SL_CL_RESP_R8_PKG

Source


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