[Home] [Help]
PACKAGE BODY: APPS.OKL_CREDIT_CHECKLIST_PVT
Source
1 PACKAGE BODY OKL_CREDIT_CHECKLIST_PVT AS
2 /* $Header: OKLRCLCB.pls 120.6 2005/09/23 12:18:27 varangan noship $ */
3 ----------------------------------------------------------------------------
4 -- Global Message Constants
5 ----------------------------------------------------------------------------
6 G_STS_CODE VARCHAR2(10) := 'NEW';
7 G_CREDIT_CHKLST_TPL CONSTANT VARCHAR2(30) := 'LACCLH';
8 G_CREDIT_CHKLST_TPL_RULE1 CONSTANT VARCHAR2(30) := 'LACCLT';
9 G_CREDIT_CHKLST_TPL_RULE2 CONSTANT VARCHAR2(30) := 'LACCLD';
10 G_CREDIT_CHKLST_TPL_RULE3 CONSTANT VARCHAR2(30) := 'LACLFD';
11 G_CREDIT_CHKLST_TPL_RULE4 CONSTANT VARCHAR2(30) := 'LACLFM';
12 G_RGP_TYPE CONSTANT VARCHAR2(30) := 'KRG';
13
14 G_INSERT_MODE VARCHAR2(10) := 'INSERT';
15 G_UPDATE_MODE VARCHAR2(10) := 'UPDATE';
16 G_DELETE_MODE VARCHAR2(10) := 'DELETE';
17
18 ----------------------------------------------------------------------------
19 -- Procedures and Functions
20 ----------------------------------------------------------------------------
21 --start: May-10-2005 cklee okl.h Lease Application ER for Authoring
22 --------------------------------------------------------------------------
23 ----- Validate Function Id
24 --------------------------------------------------------------------------
25 FUNCTION validate_function_id(
26 p_rulv_rec rulv_rec_type,
27 p_type varchar2
28 ) RETURN VARCHAR2
29 IS
30 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
31 l_dummy number;
32
33 l_row_not_found boolean := false;
34 l_function_id varchar2(100);
35
36 CURSOR c_fun (p_id number)
37 IS
38 SELECT 1
39 FROM OKL_DATA_SRC_FNCTNS_V fun
40 WHERE fun.id = p_id
41 ;
42
43 BEGIN
44
45 IF p_type is not null and p_type <> 'NONE' THEN
46
47 IF p_type = 'ACTIVATION' THEN
48 l_function_id := p_rulv_rec.RULE_INFORMATION9;
49 ELSIF p_type = 'FUNDING' THEN
50 l_function_id := p_rulv_rec.RULE_INFORMATION6;
51 END IF;
52 -- FK check
53 -- check only if object exists
54 IF (l_function_id IS NOT NULL AND
55 l_function_id <> OKL_API.G_MISS_CHAR)
56 THEN
57
58 OPEN c_fun(l_function_id);
59 FETCH c_fun INTO l_dummy;
60 l_row_not_found := c_fun%NOTFOUND;
61 CLOSE c_fun;
62
63 IF (l_row_not_found) THEN
64 OKL_API.Set_Message(p_app_name => G_APP_NAME,
65 p_msg_name => G_INVALID_VALUE,
66 p_token1 => G_COL_NAME_TOKEN,
67 p_token1_value => 'FUNCTION_ID');
68
69 RAISE G_EXCEPTION_HALT_VALIDATION;
70 END IF;
71 END IF;
72 END IF;
73
74 RETURN l_return_status;
75
76 EXCEPTION
77 WHEN G_EXCEPTION_HALT_VALIDATION THEN
78 l_return_status := OKL_API.G_RET_STS_ERROR;
79 RETURN l_return_status;
80 WHEN OTHERS THEN
81 l_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
82 OKL_API.Set_Message(p_app_name => G_APP_NAME,
83 p_msg_name => G_UNEXPECTED_ERROR,
84 p_token1 => G_SQLCODE_TOKEN,
85 p_token1_value => SQLCODE,
86 p_token2 => G_SQLERRM_TOKEN,
87 p_token2_value => SQLERRM);
88 RETURN l_return_status;
89 END;
90 --------------------------------------------------------------------------
91 ----- Validate Checklist Type
92 --------------------------------------------------------------------------
93 FUNCTION validate_checklist_type(
94 p_rulv_rec rulv_rec_type,
95 p_type varchar2,
96 p_mode varchar2
97 ) RETURN VARCHAR2
98 IS
99 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
100 l_dummy number;
101
102 l_row_not_found boolean := false;
103 l_checklist_type varchar2(30);
104
105 CURSOR c_lok (p_lookup_code varchar2, p_type varchar2)
106 IS
107 SELECT 1
108 FROM fnd_lookups lok
109 WHERE lookup_type = 'OKL_CHECKLIST_TYPE'
110 and lok.enabled_flag = 'Y'
111 and lok.lookup_code = p_type
112 and lok.lookup_code = p_lookup_code
113 ;
114
115 BEGIN
116
117 IF p_type is not null and p_type <> 'NONE' THEN
118
119 IF p_type = 'ACTIVATION' THEN
120 l_checklist_type := p_rulv_rec.RULE_INFORMATION10;
121 ELSIF p_type = 'FUNDING' THEN
122 l_checklist_type := p_rulv_rec.RULE_INFORMATION7;
123 END IF;
124
125 IF (p_mode = G_INSERT_MODE) THEN
126
127 -- column is required:
128 IF (l_checklist_type IS NULL) OR
129 (l_checklist_type = OKL_API.G_MISS_CHAR)
130 THEN
131 OKL_API.Set_Message(p_app_name => G_APP_NAME,
132 p_msg_name => G_REQUIRED_VALUE,
133 p_token1 => G_COL_NAME_TOKEN,
134 p_token1_value => 'CHECKLIST_TYPE');
135 RAISE G_EXCEPTION_HALT_VALIDATION;
136 END IF;
137
138 END IF;
139
140 -- FK check
141 -- check only if object exists
142 IF (l_checklist_type IS NOT NULL AND
143 l_checklist_type <> OKL_API.G_MISS_CHAR)
144 THEN
145
146 OPEN c_lok(l_checklist_type, p_type);
147 FETCH c_lok INTO l_dummy;
148 l_row_not_found := c_lok%NOTFOUND;
149 CLOSE c_lok;
150
151 IF (l_row_not_found) THEN
152 OKL_API.Set_Message(p_app_name => G_APP_NAME,
153 p_msg_name => G_INVALID_VALUE,
154 p_token1 => G_COL_NAME_TOKEN,
155 p_token1_value => 'CHECKLIST_TYPE');
156
157 RAISE G_EXCEPTION_HALT_VALIDATION;
158 END IF;
159 END IF;
160
161 END IF;
162
163 RETURN l_return_status;
164
165 EXCEPTION
166 WHEN G_EXCEPTION_HALT_VALIDATION THEN
167 l_return_status := OKL_API.G_RET_STS_ERROR;
168 RETURN l_return_status;
169 WHEN OTHERS THEN
170 l_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
171 OKL_API.Set_Message(p_app_name => G_APP_NAME,
172 p_msg_name => G_UNEXPECTED_ERROR,
173 p_token1 => G_SQLCODE_TOKEN,
174 p_token1_value => SQLCODE,
175 p_token2 => G_SQLERRM_TOKEN,
176 p_token2_value => SQLERRM);
177 RETURN l_return_status;
178 END;
179 --------------------------------------------------------------------------
180 ----- Validate to-do item
181 --------------------------------------------------------------------------
182 FUNCTION validate_todo_item(
183 p_rulv_rec rulv_rec_type,
184 p_type varchar2,
185 p_mode varchar2
186 ) RETURN VARCHAR2
187 IS
188 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
189 l_dummy number;
190
191 l_row_not_found boolean := false;
192 l_todo_item varchar2(30);
193
194 CURSOR c_lok (p_lookup_code varchar2)
195 IS
196 SELECT 1
197 FROM fnd_lookups lok
198 WHERE lookup_type = 'OKL_TODO_ITEMS'
199 and lok.enabled_flag = 'Y'
200 and lok.lookup_code = p_lookup_code
201 ;
202
203 BEGIN
204
205 IF p_type is not null and p_type <> 'NONE' THEN
206
207 IF (p_mode = G_INSERT_MODE) THEN
208
209 -- column is required:
210 IF (p_rulv_rec.RULE_INFORMATION1 IS NULL) OR
211 (p_rulv_rec.RULE_INFORMATION1 = OKL_API.G_MISS_CHAR)
212 THEN
213 OKL_API.Set_Message(p_app_name => G_APP_NAME,
214 p_msg_name => G_REQUIRED_VALUE,
215 p_token1 => G_COL_NAME_TOKEN,
216 p_token1_value => 'TODO_ITEM');
217 RAISE G_EXCEPTION_HALT_VALIDATION;
218 END IF;
219
220 END IF;
221
222 -- FK check
223 -- check only if object exists
224 IF (p_rulv_rec.RULE_INFORMATION1 IS NOT NULL AND
225 p_rulv_rec.RULE_INFORMATION1 <> OKL_API.G_MISS_CHAR)
226 THEN
227
228 OPEN c_lok(p_rulv_rec.RULE_INFORMATION1);
229 FETCH c_lok INTO l_dummy;
230 l_row_not_found := c_lok%NOTFOUND;
231 CLOSE c_lok;
232
233 IF (l_row_not_found) THEN
234 OKL_API.Set_Message(p_app_name => G_APP_NAME,
235 p_msg_name => G_INVALID_VALUE,
236 p_token1 => G_COL_NAME_TOKEN,
237 p_token1_value => 'TODO_ITEM');
238
239 RAISE G_EXCEPTION_HALT_VALIDATION;
240 END IF;
241 END IF;
242
243 END IF;
244
245 RETURN l_return_status;
246
247 EXCEPTION
248 WHEN G_EXCEPTION_HALT_VALIDATION THEN
249 l_return_status := OKL_API.G_RET_STS_ERROR;
250 RETURN l_return_status;
251 WHEN OTHERS THEN
252 l_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
253 OKL_API.Set_Message(p_app_name => G_APP_NAME,
254 p_msg_name => G_UNEXPECTED_ERROR,
255 p_token1 => G_SQLCODE_TOKEN,
256 p_token1_value => SQLCODE,
257 p_token2 => G_SQLERRM_TOKEN,
258 p_token2_value => SQLERRM);
259 RETURN l_return_status;
260 END;
261 --------------------------------------------------------------------------
262 ----- Validate duplicated to-do item, function_id
263 --------------------------------------------------------------------------
264 FUNCTION validate_dup_item(
265 p_rulv_rec rulv_rec_type,
266 p_type varchar2
267 ) RETURN VARCHAR2
268 IS
269 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
270 l_count number := 0;
271 l_row_found boolean := false;
272 l_dummy number;
273 l_item varchar2(30);
274 l_function_id varchar2(100);
275 l_chr_id number;
276
277
278 CURSOR c_unq_crd (p_chr_id number)
279 IS
280 SELECT 1
281 FROM okl_credit_checklists_uv lst
282 WHERE lst.khr_id = p_chr_id
283 group by lst.todo_item_code, lst.function_id
284 having count(1) > 1
285 ;
286
287 CURSOR c_unq_fun (p_chr_id number)
288 IS
289 SELECT 1
290 FROM okl_crd_fund_checklists_tpl_uv lst
291 WHERE lst.khr_id = p_chr_id
292 group by lst.todo_item_code, lst.function_id
293 having count(1) > 1
294 ;
295
296
297 BEGIN
298
299 IF p_type is not null and p_type <> 'NONE' AND
300 p_rulv_rec.dnz_chr_id is not null and p_rulv_rec.dnz_chr_id <> OKL_API.G_MISS_NUM THEN
301
302 l_chr_id := p_rulv_rec.dnz_chr_id;
303
304 IF p_type = 'ACTIVATION' THEN
305 OPEN c_unq_crd(l_chr_id);
306 FETCH c_unq_crd INTO l_dummy;
307 l_row_found := c_unq_crd%FOUND;
308 CLOSE c_unq_crd;
309
310 ELSIF p_type = 'FUNDING' THEN
311 OPEN c_unq_fun(l_chr_id);
312 FETCH c_unq_fun INTO l_dummy;
313 l_row_found := c_unq_fun%FOUND;
314 CLOSE c_unq_fun;
315
316 END IF;
317
318 IF (l_row_found) THEN
319 OKL_API.Set_Message(p_app_name => G_APP_NAME,
320 p_msg_name => G_NOT_UNIQUE,
321 p_token1 => G_COL_NAME_TOKEN,
322 p_token1_value => 'The combinations of the Checklist Item and the Function');
323
324 RAISE G_EXCEPTION_HALT_VALIDATION;
325 END IF;
326
327 END IF;
328
329
330 RETURN l_return_status;
331
332 EXCEPTION
333 WHEN G_EXCEPTION_HALT_VALIDATION THEN
334 l_return_status := OKL_API.G_RET_STS_ERROR;
335 RETURN l_return_status;
336 WHEN OTHERS THEN
337 l_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
338 OKL_API.Set_Message(p_app_name => G_APP_NAME,
339 p_msg_name => G_UNEXPECTED_ERROR,
340 p_token1 => G_SQLCODE_TOKEN,
341 p_token1_value => SQLCODE,
342 p_token2 => G_SQLERRM_TOKEN,
343 p_token2_value => SQLERRM);
344 RETURN l_return_status;
345 END;
346
347 --end: May-10-2005 cklee okl.h Lease Application ER for Authoring
348
349 --------------------------------------------------------------------------
350 ----- Validate Short Description
351 --------------------------------------------------------------------------
352 FUNCTION validate_short_desc(
353 p_rulv_rec rulv_rec_type,
354 p_type varchar2
355 ) RETURN VARCHAR2
356 IS
357 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
358 BEGIN
359
360 IF p_type is not null and p_type = 'NONE' THEN
361
362 IF (p_rulv_rec.RULE_INFORMATION4 IS NOT NULL AND
363 p_rulv_rec.RULE_INFORMATION4 <> OKL_API.G_MISS_CHAR)
364 THEN
365
366 IF (length(p_rulv_rec.RULE_INFORMATION4) > 450) THEN
367
368 OKL_API.Set_Message(p_app_name => G_APP_NAME,
369 p_msg_name => 'OKL_LLA_EXCEED_MAXIMUM_LENGTH',
370 p_token1 => 'MAX_CHARS',
371 p_token1_value => '450',
372 p_token2 => 'COL_NAME',
373 p_token2_value => 'Short Description');
374
375 RAISE G_EXCEPTION_HALT_VALIDATION;
376 END IF;
377 END IF;
378
379 END IF;
380
381 RETURN l_return_status;
382 EXCEPTION
383 WHEN G_EXCEPTION_HALT_VALIDATION THEN
384 l_return_status := OKL_API.G_RET_STS_ERROR;
385 RETURN l_return_status;
386 WHEN OTHERS THEN
387 l_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
388 OKL_API.Set_Message(p_app_name => G_APP_NAME,
389 p_msg_name => G_UNEXPECTED_ERROR,
390 p_token1 => G_SQLCODE_TOKEN,
391 p_token1_value => SQLCODE,
392 p_token2 => G_SQLERRM_TOKEN,
393 p_token2_value => SQLERRM);
394 RETURN l_return_status;
395 END;
396
397 --------------------------------------------------------------------------
398 ----- Validate Effective From
399 --------------------------------------------------------------------------
400 FUNCTION validate_effective_from(
401 p_rulv_rec rulv_rec_type,
402 p_type varchar2
403 ) RETURN VARCHAR2
404 IS
405 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
406 l_dummy number;
407 l_effective_date date;
408
409 BEGIN
410
411 IF p_type is not null and p_type = 'NONE' THEN
412
413 IF (p_rulv_rec.RULE_INFORMATION1 IS NOT NULL AND
414 p_rulv_rec.RULE_INFORMATION1 <> TO_CHAR(OKL_API.G_MISS_DATE))
415 THEN
416
417 -- check date format
418 BEGIN
419 l_effective_date := to_date(p_rulv_rec.rule_information1,G_UI_DATE_MASK);
420 EXCEPTION
421 WHEN OTHERS THEN
422 OKL_API.Set_Message(p_app_name => G_APP_NAME,
423 p_msg_name => G_OKL_LLA_INVALID_DATE_FORMAT,
424 p_token1 => 'DATE_FORMAT',
425 p_token1_value => G_UI_DATE_MASK,
426 p_token2 => 'COL_NAME',
427 p_token2_value => 'Effective From');
428
429 RAISE G_EXCEPTION_HALT_VALIDATION;
430 END;
431 END IF;
432
433 END IF;
434
435 RETURN l_return_status;
436
437 EXCEPTION
438 WHEN G_EXCEPTION_HALT_VALIDATION THEN
439 l_return_status := OKL_API.G_RET_STS_ERROR;
440 RETURN l_return_status;
441 WHEN OTHERS THEN
442 l_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
443 OKL_API.Set_Message(p_app_name => G_APP_NAME,
444 p_msg_name => G_UNEXPECTED_ERROR,
445 p_token1 => G_SQLCODE_TOKEN,
446 p_token1_value => SQLCODE,
447 p_token2 => G_SQLERRM_TOKEN,
448 p_token2_value => SQLERRM);
449 RETURN l_return_status;
450 END;
451
452 --------------------------------------------------------------------------
453 ----- Validate Effective To
454 --------------------------------------------------------------------------
455 FUNCTION validate_effective_to(
456 p_rulv_rec rulv_rec_type,
457 p_type varchar2
458 ) RETURN VARCHAR2
459 IS
460 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
461 l_dummy number;
462 l_effective_date date;
463
464 BEGIN
465
466 IF p_type is not null and p_type = 'NONE' THEN
467
468 --1. column is required:
469 IF (p_rulv_rec.RULE_INFORMATION2 IS NULL OR
470 p_rulv_rec.RULE_INFORMATION2 = TO_CHAR(OKL_API.G_MISS_DATE,G_UI_DATE_MASK))
471 THEN
472
473 OKL_API.Set_Message(p_app_name => G_APP_NAME,
474 p_msg_name => G_REQUIRED_VALUE,
475 p_token1 => G_COL_NAME_TOKEN,
476 p_token1_value => 'Effective To');
477 RAISE G_EXCEPTION_HALT_VALIDATION;
478 END IF;
479
480
481 -- 2. check date format
482 BEGIN
483 l_effective_date := to_date(p_rulv_rec.rule_information2,G_UI_DATE_MASK);
484 EXCEPTION
485 WHEN OTHERS THEN
486 OKL_API.Set_Message(p_app_name => G_APP_NAME,
487 p_msg_name => G_OKL_LLA_INVALID_DATE_FORMAT,
488 p_token1 => 'DATE_FORMAT',
489 p_token1_value => G_UI_DATE_MASK,
490 p_token2 => 'COL_NAME',
491 p_token2_value => 'Effective To');
492
493 RAISE G_EXCEPTION_HALT_VALIDATION;
494 END;
495
496 -- 3. check vs sysdate
497 IF (trunc(l_effective_date) < trunc(sysdate))
498 THEN
499 OKL_API.Set_Message(p_app_name => G_APP_NAME,
500 p_msg_name => G_LLA_RANGE_CHECK,
501 p_token1 => 'COL_NAME1',
502 p_token1_value => 'Effective To',
503 p_token2 => 'COL_NAME2',
504 p_token2_value => 'today');
505
506 RAISE G_EXCEPTION_HALT_VALIDATION;
507 END IF;
508
509 END IF;
510
511 RETURN l_return_status;
512
513
514 EXCEPTION
515 WHEN G_EXCEPTION_HALT_VALIDATION THEN
516 l_return_status := OKL_API.G_RET_STS_ERROR;
517 RETURN l_return_status;
518 WHEN OTHERS THEN
519 l_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
520 OKL_API.Set_Message(p_app_name => G_APP_NAME,
521 p_msg_name => G_UNEXPECTED_ERROR,
522 p_token1 => G_SQLCODE_TOKEN,
523 p_token1_value => SQLCODE,
524 p_token2 => G_SQLERRM_TOKEN,
525 p_token2_value => SQLERRM);
526 RETURN l_return_status;
527 END;
528
529 --------------------------------------------------------------------------
530 ----- Validate Effective from and Effective To: after image
531 --------------------------------------------------------------------------
532 FUNCTION validate_effective_date(
533 p_rulv_rec rulv_rec_type,
534 p_type varchar2
535 ) RETURN VARCHAR2
536 IS
537 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
538 l_dummy number;
539 l_row_found boolean := false;
540
541 cursor c_date(p_id number)
542 is select 1
543 FROM
544 OKC_RULES_B rulh
545 where rulh.RULE_INFORMATION1 is not null
546 and trunc(FND_DATE.CANONICAL_TO_DATE(rulh.RULE_INFORMATION1)) > trunc(FND_DATE.CANONICAL_TO_DATE(rulh.RULE_INFORMATION2))
547 --and rulh.rule_information_category = 'LACLFM'
548 and rulh.id = p_id;
549
550 /*
551 from okl_crd_fund_chklst_tpl_hdr_uv fcl
552 where fcl.effective_from is not null
553 and trunc(fcl.effective_from) > trunc(fcl.effective_to)
554 and fcl.id = p_id
555 */
556
557 BEGIN
558
559 IF p_type is not null and p_type = 'NONE' THEN
560
561 open c_date(p_rulv_rec.id);
562 fetch c_date into l_dummy;
563 l_row_found := c_date%FOUND;
564 close c_date;
565
566 IF (l_row_found) THEN
567 OKL_API.Set_Message(p_app_name => G_APP_NAME,
568 p_msg_name => G_LLA_RANGE_CHECK,
569 p_token1 => 'COL_NAME1',
570 p_token1_value => 'Effective To',
571 p_token2 => 'COL_NAME2',
572 p_token2_value => 'Effective From');
573
574 RAISE G_EXCEPTION_HALT_VALIDATION;
575 END IF;
576
577 END IF;
578
579 RETURN l_return_status;
580
581 EXCEPTION
582 WHEN G_EXCEPTION_HALT_VALIDATION THEN
583 l_return_status := OKL_API.G_RET_STS_ERROR;
584 RETURN l_return_status;
585 WHEN OTHERS THEN
586 l_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
587 OKL_API.Set_Message(p_app_name => G_APP_NAME,
588 p_msg_name => G_UNEXPECTED_ERROR,
589 p_token1 => G_SQLCODE_TOKEN,
590 p_token1_value => SQLCODE,
591 p_token2 => G_SQLERRM_TOKEN,
592 p_token2_value => SQLERRM);
593 RETURN l_return_status;
594 END;
595
596 --------------------------------------------------------------------------
597 FUNCTION validate_header_attributes(
598 p_rulv_rec rulv_rec_type,
599 p_mode varchar2,
600 p_type varchar2
601 ) RETURN VARCHAR2
602 IS
603 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
604 x_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
605
606 BEGIN
607
608 -- Do formal attribute validation:
609 l_return_status := validate_short_desc(p_rulv_rec => p_rulv_rec,
610 p_type => p_type);
611 --- Store the highest degree of error
612 IF (l_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
613 IF (x_return_status <> OKL_API.G_RET_STS_UNEXP_ERROR) THEN
614 x_return_status := l_return_status;
615 END IF;
616 RAISE G_EXCEPTION_HALT_VALIDATION;
617 END IF;
618
619 l_return_status := validate_effective_from(p_rulv_rec => p_rulv_rec,
620 p_type => p_type);
621 --- Store the highest degree of error
622 IF (l_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
623 IF (x_return_status <> OKL_API.G_RET_STS_UNEXP_ERROR) THEN
624 x_return_status := l_return_status;
625 END IF;
626 RAISE G_EXCEPTION_HALT_VALIDATION;
627 END IF;
628
629 l_return_status := validate_effective_to(p_rulv_rec => p_rulv_rec,
630 p_type => p_type);
631 --- Store the highest degree of error
632 IF (l_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
633 IF (x_return_status <> OKL_API.G_RET_STS_UNEXP_ERROR) THEN
634 x_return_status := l_return_status;
635 END IF;
636 RAISE G_EXCEPTION_HALT_VALIDATION;
637 END IF;
638 --start: May-10-2005 cklee okl.h Lease Application ER for Authoring
639 l_return_status := validate_function_id(p_rulv_rec => p_rulv_rec,
640 p_type => p_type);
641 --- Store the highest degree of error
642 IF (l_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
643 IF (x_return_status <> OKL_API.G_RET_STS_UNEXP_ERROR) THEN
644 x_return_status := l_return_status;
645 END IF;
646 RAISE G_EXCEPTION_HALT_VALIDATION;
647 END IF;
648
649 l_return_status := validate_checklist_type(p_rulv_rec => p_rulv_rec,
650 p_type => p_type,
651 p_mode => p_mode);
652 --- Store the highest degree of error
653 IF (l_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
654 IF (x_return_status <> OKL_API.G_RET_STS_UNEXP_ERROR) THEN
655 x_return_status := l_return_status;
656 END IF;
657 RAISE G_EXCEPTION_HALT_VALIDATION;
658 END IF;
659
660 l_return_status := validate_todo_item(p_rulv_rec => p_rulv_rec,
661 p_type => p_type,
662 p_mode => p_mode);
663 --- Store the highest degree of error
664 IF (l_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
665 IF (x_return_status <> OKL_API.G_RET_STS_UNEXP_ERROR) THEN
666 x_return_status := l_return_status;
667 END IF;
668 RAISE G_EXCEPTION_HALT_VALIDATION;
669 END IF;
670
671 --end: May-10-2005 cklee okl.h Lease Application ER for Authoring
672
673 RETURN x_return_status;
674 EXCEPTION
675 WHEN G_EXCEPTION_HALT_VALIDATION THEN
676 RETURN x_return_status;
677 WHEN OTHERS THEN
678 l_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
679 OKL_API.Set_Message(p_app_name => G_APP_NAME,
680 p_msg_name => G_UNEXPECTED_ERROR,
681 p_token1 => G_SQLCODE_TOKEN,
682 p_token1_value => SQLCODE,
683 p_token2 => G_SQLERRM_TOKEN,
684 p_token2_value => SQLERRM);
685 RETURN l_return_status;
686 END validate_header_attributes;
687 -----------------------------------------------------------------------------
688 --- validate attrs after image-----------------------------------------------
689 -----------------------------------------------------------------------------
690 FUNCTION validate_hdr_attr_aftimg(
691 p_rulv_rec rulv_rec_type,
692 p_type varchar2
693 ) RETURN VARCHAR2
694 IS
695 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
696 x_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
697
698 BEGIN
699
700 l_return_status := validate_effective_date(p_rulv_rec => p_rulv_rec,
701 p_type => p_type);
702 --- Store the highest degree of error
703 IF (l_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
704 IF (x_return_status <> OKL_API.G_RET_STS_UNEXP_ERROR) THEN
705 x_return_status := l_return_status;
706 END IF;
707 RAISE G_EXCEPTION_HALT_VALIDATION;
708 END IF;
709
710 RETURN x_return_status;
711 EXCEPTION
712 WHEN G_EXCEPTION_HALT_VALIDATION THEN
713 RETURN x_return_status;
714 WHEN OTHERS THEN
715 l_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
716 OKL_API.Set_Message(p_app_name => G_APP_NAME,
717 p_msg_name => G_UNEXPECTED_ERROR,
718 p_token1 => G_SQLCODE_TOKEN,
719 p_token1_value => SQLCODE,
720 p_token2 => G_SQLERRM_TOKEN,
721 p_token2_value => SQLERRM);
722 RETURN l_return_status;
723 END validate_hdr_attr_aftimg;
724
725 ----------------------------------------------------------------------------------
726 -- Start of comments
727 --
728 -- Procedure Name : copy_rulv_rec
729 -- Description :
730 -- Business Rules :
731 -- Parameters :
732 -- Version : 1.0
733 -- End of comments
734 ----------------------------------------------------------------------------------
735 PROCEDURE copy_rulv_rec(
736 p_api_version IN NUMBER
737 ,p_init_msg_list IN VARCHAR2
738 ,x_return_status OUT NOCOPY VARCHAR2
739 ,x_msg_count OUT NOCOPY NUMBER
740 ,x_msg_data OUT NOCOPY VARCHAR2
741 ,p_rulv_rec IN rulv_rec_type
742 ,p_rulv_migr_rec OUT NOCOPY okl_rule_pub.rulv_rec_type
743 ,p_type IN varchar2
744 ,p_mode IN varchar2
745 )
746 is
747 l_api_name CONSTANT VARCHAR2(30) := 'copy_rulv_rec';
748 l_api_version CONSTANT NUMBER := 1.0;
749 i NUMBER;
750 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
751 l_rgp_id number;
752 l_object1_id1 varchar2(100);
753
754 cursor c_rgp_id (chr_id number)
755 is
756 select id
757 from okc_rule_groups_b
758 where rgd_code = G_CREDIT_CHKLST_TPL--'LACCLH'
759 and dnz_chr_id = chr_id;
760
761 cursor c_obj_id (chr_id number)
762 is
763 select id
764 from okc_rules_b
765 where RULE_INFORMATION_CATEGORY = G_CREDIT_CHKLST_TPL_RULE4--'LACLFM'
766 and dnz_chr_id = chr_id;
767
768
769 begin
770 -- Set API savepoint
771 SAVEPOINT copy_rulv_rec;
772
773 -- Check for call compatibility
774 IF (NOT FND_API.Compatible_API_Call (l_api_version,
775 p_api_version,
776 l_api_name,
777 G_PKG_NAME ))
778 THEN
779 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
780 END IF;
781
782 -- Initialize message list if requested
783 IF (FND_API.to_Boolean(p_init_msg_list)) THEN
784 FND_MSG_PUB.initialize;
785 END IF;
786
787 -- Initialize API status to success
788 x_return_status := OKL_API.G_RET_STS_SUCCESS;
789
790
791 /*** Begin API body ****************************************************/
792
793 --
794 -- validate
795 --
796
797 l_return_status := validate_header_attributes(p_rulv_rec => p_rulv_rec,
798 p_type => p_type,
799 p_mode => p_mode);
800 --- Store the highest degree of error
801 IF (l_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
802 IF (x_return_status <> OKL_API.G_RET_STS_UNEXP_ERROR) THEN
803 x_return_status := l_return_status;
804 END IF;
805 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
806 END IF;
807
808 p_rulv_migr_rec.id := p_rulv_rec.id;
809
810 p_rulv_migr_rec.rule_information1 := p_rulv_rec.rule_information1;
811
812 -- start : 28-Feb-05 cklee -- fixed bug#4056212
813 /* IF (p_rulv_rec.rule_information2 = 'Y' or p_rulv_rec.rule_information2 = 'N') THEN
814 p_rulv_migr_rec.rule_information2 := p_rulv_rec.rule_information2;
815 ELSE
816 p_rulv_migr_rec.rule_information2 := 'N';
817 END IF;
818
819 IF (p_rulv_rec.rule_information3 = 'Y' or p_rulv_rec.rule_information3 = 'N') THEN
820 p_rulv_migr_rec.rule_information3 := p_rulv_rec.rule_information3;
821 ELSE
822 p_rulv_migr_rec.rule_information3 := 'N';
823 END IF;
824 */
825 -- end : 28-Feb-05 cklee -- fixed bug#4056212
826 p_rulv_migr_rec.rule_information2 := p_rulv_rec.rule_information2;
827 p_rulv_migr_rec.rule_information3 := p_rulv_rec.rule_information3;
828
829 --start:cklee May-10-2005 cklee okl.h Lease Application ER for Authoring
830 p_rulv_migr_rec.rule_information4 := p_rulv_rec.rule_information4;
831 p_rulv_migr_rec.rule_information5 := p_rulv_rec.rule_information5;
832 p_rulv_migr_rec.rule_information6 := p_rulv_rec.rule_information6;
833
834 -- set default
835 IF p_type = 'ACTIVATION' and
836 (p_rulv_rec.rule_information7 not in ('UNDETERMINED', 'PASSED', 'FAILED', 'ERROR') or
837 p_rulv_rec.rule_information7 is null or
838 p_rulv_rec.rule_information7 = OKL_API.G_MISS_CHAR) THEN
839 p_rulv_migr_rec.rule_information7 := 'UNDETERMINED';
840 else
841 p_rulv_migr_rec.rule_information7 := p_rulv_rec.rule_information7;
842 END IF;
843
844 IF p_type = 'ACTIVATION' THEN
845 p_rulv_migr_rec.rule_information8 := p_rulv_rec.rule_information8;
846 p_rulv_migr_rec.rule_information9 := p_rulv_rec.rule_information9;
847 p_rulv_migr_rec.rule_information10 := p_rulv_rec.rule_information10;
848 END IF;
849
850 IF p_mode = G_INSERT_MODE THEN
851 OPEN c_rgp_id(p_rulv_rec.DNZ_CHR_ID);
852 FETCH c_rgp_id into l_rgp_id;
853 CLOSE c_rgp_id;
854
855 p_rulv_migr_rec.DNZ_CHR_ID := p_rulv_rec.DNZ_CHR_ID;
856 p_rulv_migr_rec.RGP_ID := l_rgp_id;
857 IF p_type = 'ACTIVATION' THEN
858 p_rulv_migr_rec.RULE_INFORMATION_CATEGORY := G_CREDIT_CHKLST_TPL_RULE2;-- 'LACCLD'
859 ELSIF p_type = 'FUNDING' THEN
860
861 OPEN c_obj_id(p_rulv_rec.DNZ_CHR_ID);
862 FETCH c_obj_id into l_object1_id1;
863 CLOSE c_obj_id;
864
865 p_rulv_migr_rec.OBJECT1_ID1 := l_object1_id1;
866 p_rulv_migr_rec.OBJECT1_ID2 := '#';
867
868 p_rulv_migr_rec.RULE_INFORMATION_CATEGORY := G_CREDIT_CHKLST_TPL_RULE3;-- 'LACLFD'
869 END IF;
870 p_rulv_migr_rec.STD_TEMPLATE_YN := 'N';
871 p_rulv_migr_rec.WARN_YN := 'N';
872
873 END IF;
874 --end:cklee May-10-2005 cklee okl.h Lease Application ER for Authoring
875
876
877 /*** End API body ******************************************************/
878
879 -- Get message count and if count is 1, get message info
880 FND_MSG_PUB.Count_And_Get
881 (p_count => x_msg_count,
882 p_data => x_msg_data);
883
884 EXCEPTION
885 WHEN OKL_API.G_EXCEPTION_ERROR THEN
886 ROLLBACK TO copy_rulv_rec;
887 x_return_status := OKL_API.G_RET_STS_ERROR;
888 FND_MSG_PUB.Count_And_Get
889 (p_count => x_msg_count,
890 p_data => x_msg_data);
891
892 WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
893 ROLLBACK TO copy_rulv_rec;
894 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
895 FND_MSG_PUB.Count_And_Get
896 (p_count => x_msg_count,
897 p_data => x_msg_data);
898
899 WHEN OTHERS THEN
900 ROLLBACK TO copy_rulv_rec;
901 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
902 OKL_API.Set_Message(p_app_name => G_APP_NAME,
903 p_msg_name => G_UNEXPECTED_ERROR,
904 p_token1 => G_SQLCODE_TOKEN,
905 p_token1_value => SQLCODE,
906 p_token2 => G_SQLERRM_TOKEN,
907 p_token2_value => SQLERRM);
908 FND_MSG_PUB.Count_And_Get
909 (p_count => x_msg_count,
910 p_data => x_msg_data);
911 end;
912 ----------------------------------------------------------------------------------
913 -- Start of comments
914 --
915 -- Procedure Name : copy_rulv_tbl
916 -- Description :
917 -- Business Rules :
918 -- Parameters :
919 -- Version : 1.0
920 -- End of comments
921 ----------------------------------------------------------------------------------
922 PROCEDURE copy_rulv_tbl(
923 p_api_version IN NUMBER
924 ,p_init_msg_list IN VARCHAR2
925 ,x_return_status OUT NOCOPY VARCHAR2
926 ,x_msg_count OUT NOCOPY NUMBER
927 ,x_msg_data OUT NOCOPY VARCHAR2
928 ,p_rulv_tbl IN rulv_tbl_type
929 ,p_rulv_migr_tbl OUT NOCOPY okl_rule_pub.rulv_tbl_type
930 ,p_type IN varchar2
931 ,p_mode IN varchar2)
932 is
933 l_api_name CONSTANT VARCHAR2(30) := 'copy_rulv_tbl';
934 l_api_version CONSTANT NUMBER := 1.0;
935 i NUMBER;
936 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
937
938 begin
939 -- Set API savepoint
940 SAVEPOINT copy_rulv_tbl;
941
942 -- Check for call compatibility
943 IF (NOT FND_API.Compatible_API_Call (l_api_version,
944 p_api_version,
945 l_api_name,
946 G_PKG_NAME ))
947 THEN
948 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
949 END IF;
950
951 -- Initialize message list if requested
952 IF (FND_API.to_Boolean(p_init_msg_list)) THEN
953 FND_MSG_PUB.initialize;
954 END IF;
955
956 -- Initialize API status to success
957 x_return_status := OKL_API.G_RET_STS_SUCCESS;
958
959 /*** Begin API body ****************************************************/
960
961 IF (p_rulv_tbl.COUNT > 0) THEN
962 i := p_rulv_tbl.FIRST;
963 LOOP
964
965 copy_rulv_rec(
966 p_api_version => p_api_version,
967 p_init_msg_list => p_init_msg_list,
968 x_return_status => x_return_status,
969 x_msg_count => x_msg_count,
970 x_msg_data => x_msg_data,
971 p_rulv_rec => p_rulv_tbl(i),
972 p_rulv_migr_rec => p_rulv_migr_tbl(i),
973 p_type => p_type,
974 p_mode => p_mode
975 );
976
977 If (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
978 raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
979 Elsif (x_return_status = OKC_API.G_RET_STS_ERROR) then
980 raise OKC_API.G_EXCEPTION_ERROR;
981 End If;
982
983 EXIT WHEN (i = p_rulv_tbl.LAST);
984 i := p_rulv_tbl.NEXT(i);
985 END LOOP;
986 END IF;
987
988 /*** End API body ******************************************************/
989
990 -- Get message count and if count is 1, get message info
991 FND_MSG_PUB.Count_And_Get
992 (p_count => x_msg_count,
993 p_data => x_msg_data);
994
995 EXCEPTION
996 WHEN OKL_API.G_EXCEPTION_ERROR THEN
997 ROLLBACK TO copy_rulv_tbl;
998 x_return_status := OKL_API.G_RET_STS_ERROR;
999 FND_MSG_PUB.Count_And_Get
1000 (p_count => x_msg_count,
1001 p_data => x_msg_data);
1002
1003 WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1004 ROLLBACK TO copy_rulv_tbl;
1005 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
1006 FND_MSG_PUB.Count_And_Get
1007 (p_count => x_msg_count,
1008 p_data => x_msg_data);
1009
1010 WHEN OTHERS THEN
1011 ROLLBACK TO copy_rulv_tbl;
1012 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
1013 OKL_API.Set_Message(p_app_name => G_APP_NAME,
1014 p_msg_name => G_UNEXPECTED_ERROR,
1015 p_token1 => G_SQLCODE_TOKEN,
1016 p_token1_value => SQLCODE,
1017 p_token2 => G_SQLERRM_TOKEN,
1018 p_token2_value => SQLERRM);
1019 FND_MSG_PUB.Count_And_Get
1020 (p_count => x_msg_count,
1021 p_data => x_msg_data);
1022 end;
1023
1024 ----------------------------------------------------------------------------------
1025 -- Start of comments
1026 --
1027 -- Procedure Name : create_credit_chklst
1028 -- Description : wrapper api for create credit checklists associated
1029 -- with credit line contract ID
1030 -- Business Rules :
1031 -- Parameters :
1032 -- Version : 1.0
1033 -- End of comments
1034 ----------------------------------------------------------------------------------
1035 PROCEDURE create_credit_chklst(
1036 p_api_version IN NUMBER
1037 ,p_init_msg_list IN VARCHAR2
1038 ,x_return_status OUT NOCOPY VARCHAR2
1039 ,x_msg_count OUT NOCOPY NUMBER
1040 ,x_msg_data OUT NOCOPY VARCHAR2
1041 ,p_rulv_tbl IN rulv_tbl_type
1042 ,x_rulv_tbl OUT NOCOPY rulv_tbl_type
1043 )
1044 is
1045 l_api_name CONSTANT VARCHAR2(30) := 'create_credit_chklst';
1046 l_api_version CONSTANT NUMBER := 1.0;
1047 i NUMBER;
1048 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1049 -- lp_rulv_tbl rulv_tbl_type := p_rulv_tbl;
1050 -- lx_rulv_tbl rulv_tbl_type := x_rulv_tbl;
1051 lp_rulv_tbl okl_rule_pub.rulv_tbl_type;
1052 lx_rulv_tbl okl_rule_pub.rulv_tbl_type;
1053
1054 begin
1055 -- Set API savepoint
1056 SAVEPOINT create_credit_chklst;
1057
1058 -- Check for call compatibility
1059 IF (NOT FND_API.Compatible_API_Call (l_api_version,
1060 p_api_version,
1061 l_api_name,
1062 G_PKG_NAME ))
1063 THEN
1064 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1065 END IF;
1066
1067 -- Initialize message list if requested
1068 IF (FND_API.to_Boolean(p_init_msg_list)) THEN
1069 FND_MSG_PUB.initialize;
1070 END IF;
1071
1072 -- Initialize API status to success
1073 x_return_status := OKL_API.G_RET_STS_SUCCESS;
1074
1075
1076 /*** Begin API body ****************************************************/
1077 --DBMS_OUTPUT.PUT_LINE('before copy_rulv_tbl');
1078
1079 copy_rulv_tbl(
1080 p_api_version => p_api_version,
1081 p_init_msg_list => p_init_msg_list,
1082 x_return_status => x_return_status,
1083 x_msg_count => x_msg_count,
1084 x_msg_data => x_msg_data,
1085 p_rulv_tbl => p_rulv_tbl,
1086 p_rulv_migr_tbl => lp_rulv_tbl,
1087 p_type => 'ACTIVATION',
1088 p_mode => G_INSERT_MODE
1089 );
1090
1091 If (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
1092 raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1093 Elsif (x_return_status = OKC_API.G_RET_STS_ERROR) then
1094 raise OKC_API.G_EXCEPTION_ERROR;
1095 End If;
1096
1097 --DBMS_OUTPUT.PUT_LINE('after copy_rulv_tbl');
1098 -- validation
1099
1100 okl_rule_pub.create_rule(
1101 p_api_version => p_api_version,
1102 p_init_msg_list => p_init_msg_list,
1103 x_return_status => x_return_status,
1104 x_msg_count => x_msg_count,
1105 x_msg_data => x_msg_data,
1106 p_rulv_tbl => lp_rulv_tbl,
1107 x_rulv_tbl => lx_rulv_tbl);
1108
1109 If (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
1110 raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1111 Elsif (x_return_status = OKC_API.G_RET_STS_ERROR) then
1112 raise OKC_API.G_EXCEPTION_ERROR;
1113 End If;
1114
1115 --start: May-10-2005 cklee okl.h Lease Application ER for Authoring
1116 l_return_status := validate_dup_item(p_rulv_rec => p_rulv_tbl(p_rulv_tbl.FIRST),
1117 p_type => 'ACTIVATION');
1118 --- Store the highest degree of error
1119 IF (l_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
1120 IF (x_return_status <> OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1121 x_return_status := l_return_status;
1122 END IF;
1123 RAISE G_EXCEPTION_HALT_VALIDATION;
1124 END IF;
1125 --end: May-10-2005 cklee okl.h Lease Application ER for Authoring
1126
1127
1128
1129 /*** End API body ******************************************************/
1130
1131 -- Get message count and if count is 1, get message info
1132 FND_MSG_PUB.Count_And_Get
1133 (p_count => x_msg_count,
1134 p_data => x_msg_data);
1135
1136 EXCEPTION
1137 WHEN OKL_API.G_EXCEPTION_ERROR THEN
1138 ROLLBACK TO create_credit_chklst;
1139 x_return_status := OKL_API.G_RET_STS_ERROR;
1140 FND_MSG_PUB.Count_And_Get
1141 (p_count => x_msg_count,
1142 p_data => x_msg_data);
1143
1144 WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1145 ROLLBACK TO create_credit_chklst;
1146 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
1147 FND_MSG_PUB.Count_And_Get
1148 (p_count => x_msg_count,
1149 p_data => x_msg_data);
1150
1151 WHEN OTHERS THEN
1152 ROLLBACK TO create_credit_chklst;
1153 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
1154 OKL_API.Set_Message(p_app_name => G_APP_NAME,
1155 p_msg_name => G_UNEXPECTED_ERROR,
1156 p_token1 => G_SQLCODE_TOKEN,
1157 p_token1_value => SQLCODE,
1158 p_token2 => G_SQLERRM_TOKEN,
1159 p_token2_value => SQLERRM);
1160 FND_MSG_PUB.Count_And_Get
1161 (p_count => x_msg_count,
1162 p_data => x_msg_data);
1163
1164 end create_credit_chklst;
1165
1166 ----------------------------------------------------------------------------------
1167 -- Start of comments
1168 --
1169 -- Procedure Name : update_credit_chklst
1170 -- Description : wrapper api for update credit checklists associated
1171 -- with credit line contract ID
1172 -- Business Rules :
1173 -- Parameters :
1174 -- Version : 1.0
1175 -- End of comments
1176 ----------------------------------------------------------------------------------
1177 PROCEDURE update_credit_chklst(
1178 p_api_version IN NUMBER
1179 ,p_init_msg_list IN VARCHAR2
1180 ,x_return_status OUT NOCOPY VARCHAR2
1181 ,x_msg_count OUT NOCOPY NUMBER
1182 ,x_msg_data OUT NOCOPY VARCHAR2
1183 ,p_rulv_tbl IN rulv_tbl_type
1184 ,x_rulv_tbl OUT NOCOPY rulv_tbl_type
1185 )
1186 is
1187 l_api_name CONSTANT VARCHAR2(30) := 'update_credit_chklst';
1188 l_api_version CONSTANT NUMBER := 1.0;
1189 i NUMBER;
1190 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1191 -- lp_rulv_tbl rulv_tbl_type := p_rulv_tbl;
1192 -- lx_rulv_tbl rulv_tbl_type := x_rulv_tbl;
1193 lp_rulv_tbl okl_rule_pub.rulv_tbl_type;
1194 lx_rulv_tbl okl_rule_pub.rulv_tbl_type;
1195
1196 begin
1197 -- Set API savepoint
1198 SAVEPOINT update_credit_chklst;
1199
1200 -- Check for call compatibility
1201 IF (NOT FND_API.Compatible_API_Call (l_api_version,
1202 p_api_version,
1203 l_api_name,
1204 G_PKG_NAME ))
1205 THEN
1206 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1207 END IF;
1208
1209 -- Initialize message list if requested
1210 IF (FND_API.to_Boolean(p_init_msg_list)) THEN
1211 FND_MSG_PUB.initialize;
1212 END IF;
1213
1214 -- Initialize API status to success
1215 x_return_status := OKL_API.G_RET_STS_SUCCESS;
1216
1217
1218 /*** Begin API body ****************************************************/
1219
1220 --DBMS_OUTPUT.PUT_LINE('before copy_rulv_tbl');
1221
1222 copy_rulv_tbl(
1223 p_api_version => p_api_version,
1224 p_init_msg_list => p_init_msg_list,
1225 x_return_status => x_return_status,
1226 x_msg_count => x_msg_count,
1227 x_msg_data => x_msg_data,
1228 p_rulv_tbl => p_rulv_tbl,
1229 p_rulv_migr_tbl => lp_rulv_tbl,
1230 p_type => 'ACTIVATION',
1231 p_mode => G_UPDATE_MODE
1232 );
1233
1234 If (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
1235 raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1236 Elsif (x_return_status = OKC_API.G_RET_STS_ERROR) then
1237 raise OKC_API.G_EXCEPTION_ERROR;
1238 End If;
1239
1240 --DBMS_OUTPUT.PUT_LINE('after copy_rulv_tbl');
1241 -- validation
1242
1243 okl_rule_pub.update_rule(
1244 p_api_version => p_api_version,
1245 p_init_msg_list => p_init_msg_list,
1246 x_return_status => x_return_status,
1247 x_msg_count => x_msg_count,
1248 x_msg_data => x_msg_data,
1249 p_rulv_tbl => lp_rulv_tbl,
1250 x_rulv_tbl => lx_rulv_tbl);
1251
1252 If (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
1253 raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1254 Elsif (x_return_status = OKC_API.G_RET_STS_ERROR) then
1255 raise OKC_API.G_EXCEPTION_ERROR;
1256 End If;
1257
1258 --start: May-10-2005 cklee okl.h Lease Application ER for Authoring
1259 l_return_status := validate_dup_item(p_rulv_rec => p_rulv_tbl(p_rulv_tbl.FIRST),
1260 p_type => 'ACTIVATION');
1261 --- Store the highest degree of error
1262 IF (l_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
1263 IF (x_return_status <> OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1264 x_return_status := l_return_status;
1265 END IF;
1266 RAISE G_EXCEPTION_HALT_VALIDATION;
1267 END IF;
1268 --end: May-10-2005 cklee okl.h Lease Application ER for Authoring
1269
1270
1271
1272 /*** End API body ******************************************************/
1273
1274 -- Get message count and if count is 1, get message info
1275 FND_MSG_PUB.Count_And_Get
1276 (p_count => x_msg_count,
1277 p_data => x_msg_data);
1278
1279 EXCEPTION
1280 WHEN OKL_API.G_EXCEPTION_ERROR THEN
1281 ROLLBACK TO update_credit_chklst;
1282 x_return_status := OKL_API.G_RET_STS_ERROR;
1283 FND_MSG_PUB.Count_And_Get
1284 (p_count => x_msg_count,
1285 p_data => x_msg_data);
1286
1287 WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1288 ROLLBACK TO update_credit_chklst;
1289 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
1290 FND_MSG_PUB.Count_And_Get
1291 (p_count => x_msg_count,
1292 p_data => x_msg_data);
1293
1294 WHEN OTHERS THEN
1295 ROLLBACK TO update_credit_chklst;
1296 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
1297 OKL_API.Set_Message(p_app_name => G_APP_NAME,
1298 p_msg_name => G_UNEXPECTED_ERROR,
1299 p_token1 => G_SQLCODE_TOKEN,
1300 p_token1_value => SQLCODE,
1301 p_token2 => G_SQLERRM_TOKEN,
1302 p_token2_value => SQLERRM);
1303 FND_MSG_PUB.Count_And_Get
1304 (p_count => x_msg_count,
1305 p_data => x_msg_data);
1306
1307 end update_credit_chklst;
1308
1309 ----------------------------------------------------------------------------------
1310 -- Start of comments
1311 --
1312 -- Procedure Name : delete_credit_chklst
1313 -- Description : wrapper api for delete credit checklists associated
1314 -- with credit line contract ID
1315 -- Business Rules :
1316 -- Parameters :
1317 -- Version : 1.0
1318 -- End of comments
1319 ----------------------------------------------------------------------------------
1320 PROCEDURE delete_credit_chklst(
1321 p_api_version IN NUMBER
1322 ,p_init_msg_list IN VARCHAR2
1323 ,x_return_status OUT NOCOPY VARCHAR2
1324 ,x_msg_count OUT NOCOPY NUMBER
1325 ,x_msg_data OUT NOCOPY VARCHAR2
1326 ,p_rulv_tbl IN rulv_tbl_type
1327 )
1328 is
1329 l_api_name CONSTANT VARCHAR2(30) := 'delete_credit_chklst';
1330 l_api_version CONSTANT NUMBER := 1.0;
1331 i NUMBER;
1332 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1333 -- lp_rulv_tbl rulv_tbl_type := p_rulv_tbl;
1334 -- lx_rulv_tbl rulv_tbl_type := x_rulv_tbl;
1335 lp_rulv_tbl okl_rule_pub.rulv_tbl_type;
1336 lx_rulv_tbl okl_rule_pub.rulv_tbl_type;
1337
1338 begin
1339 -- Set API savepoint
1340 SAVEPOINT delete_credit_chklst;
1341
1342 -- Check for call compatibility
1343 IF (NOT FND_API.Compatible_API_Call (l_api_version,
1344 p_api_version,
1345 l_api_name,
1346 G_PKG_NAME ))
1347 THEN
1348 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1349 END IF;
1350
1351 -- Initialize message list if requested
1352 IF (FND_API.to_Boolean(p_init_msg_list)) THEN
1353 FND_MSG_PUB.initialize;
1354 END IF;
1355
1356 -- Initialize API status to success
1357 x_return_status := OKL_API.G_RET_STS_SUCCESS;
1358
1359
1360 /*** Begin API body ****************************************************/
1361 --DBMS_OUTPUT.PUT_LINE('before copy_rulv_tbl');
1362
1363 copy_rulv_tbl(
1364 p_api_version => p_api_version,
1365 p_init_msg_list => p_init_msg_list,
1366 x_return_status => x_return_status,
1367 x_msg_count => x_msg_count,
1368 x_msg_data => x_msg_data,
1369 p_rulv_tbl => p_rulv_tbl,
1370 p_rulv_migr_tbl => lp_rulv_tbl,
1371 p_type => null,
1372 p_mode => G_DELETE_MODE
1373 );
1374
1375 If (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
1376 raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1377 Elsif (x_return_status = OKC_API.G_RET_STS_ERROR) then
1378 raise OKC_API.G_EXCEPTION_ERROR;
1379 End If;
1380
1381 --DBMS_OUTPUT.PUT_LINE('after copy_rulv_tbl');
1382
1383 okl_rule_pub.delete_rule(
1384 p_api_version => p_api_version,
1385 p_init_msg_list => p_init_msg_list,
1386 x_return_status => x_return_status,
1387 x_msg_count => x_msg_count,
1388 x_msg_data => x_msg_data,
1389 p_rulv_tbl => lp_rulv_tbl);
1390
1391 If (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
1392 raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1393 Elsif (x_return_status = OKC_API.G_RET_STS_ERROR) then
1394 raise OKC_API.G_EXCEPTION_ERROR;
1395 End If;
1396
1397 /*** End API body ******************************************************/
1398
1399 -- Get message count and if count is 1, get message info
1400 FND_MSG_PUB.Count_And_Get
1401 (p_count => x_msg_count,
1402 p_data => x_msg_data);
1403
1404 EXCEPTION
1405 WHEN OKL_API.G_EXCEPTION_ERROR THEN
1406 ROLLBACK TO delete_credit_chklst;
1407 x_return_status := OKL_API.G_RET_STS_ERROR;
1408 FND_MSG_PUB.Count_And_Get
1409 (p_count => x_msg_count,
1410 p_data => x_msg_data);
1411
1412 WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1413 ROLLBACK TO delete_credit_chklst;
1414 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
1415 FND_MSG_PUB.Count_And_Get
1416 (p_count => x_msg_count,
1417 p_data => x_msg_data);
1418
1419 WHEN OTHERS THEN
1420 ROLLBACK TO delete_credit_chklst;
1421 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
1422 OKL_API.Set_Message(p_app_name => G_APP_NAME,
1423 p_msg_name => G_UNEXPECTED_ERROR,
1424 p_token1 => G_SQLCODE_TOKEN,
1425 p_token1_value => SQLCODE,
1426 p_token2 => G_SQLERRM_TOKEN,
1427 p_token2_value => SQLERRM);
1428 FND_MSG_PUB.Count_And_Get
1429 (p_count => x_msg_count,
1430 p_data => x_msg_data);
1431
1432 end delete_credit_chklst;
1433
1434 ----------------------------------------------------------------------------------
1435 -- Start of comments
1436 --
1437 -- Procedure Name : approve_credit_chklst
1438 -- Description : set credit line checklist sttaus to "Active".
1439 -- Business Rules :
1440 -- Parameters :
1441 -- Version : 1.0
1442 -- End of comments
1443 ----------------------------------------------------------------------------------
1444 PROCEDURE approve_credit_chklst(
1445 p_api_version IN NUMBER
1446 ,p_init_msg_list IN VARCHAR2
1447 ,x_return_status OUT NOCOPY VARCHAR2
1448 ,x_msg_count OUT NOCOPY NUMBER
1449 ,x_msg_data OUT NOCOPY VARCHAR2
1450 ,p_rulv_rec IN rulv_rec_type
1451 )
1452 is
1453 l_api_name CONSTANT VARCHAR2(30) := 'approve_credit_chklst';
1454 l_api_version CONSTANT NUMBER := 1.0;
1455 i NUMBER;
1456 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1457
1458 lp_rulv_tbl okl_rule_pub.rulv_tbl_type;
1459 lx_rulv_tbl okl_rule_pub.rulv_tbl_type;
1460 l_id number;
1461
1462 cursor c_ids (p_chr_id okc_k_headers_b.id%TYPE)
1463 is
1464 select a.id
1465 from okc_rules_b a
1466 where a.dnz_chr_id = p_chr_id
1467 and a.RULE_INFORMATION_CATEGORY = G_CREDIT_CHKLST_TPL_RULE2--'LACCLD'
1468 ;
1469
1470
1471 begin
1472 -- Set API savepoint
1473 SAVEPOINT approve_credit_chklst;
1474
1475 -- Check for call compatibility
1476 IF (NOT FND_API.Compatible_API_Call (l_api_version,
1477 p_api_version,
1478 l_api_name,
1479 G_PKG_NAME ))
1480 THEN
1481 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1482 END IF;
1483
1484 -- Initialize message list if requested
1485 IF (FND_API.to_Boolean(p_init_msg_list)) THEN
1486 FND_MSG_PUB.initialize;
1487 END IF;
1488
1489 -- Initialize API status to success
1490 x_return_status := OKL_API.G_RET_STS_SUCCESS;
1491
1492
1493 /*** Begin API body ****************************************************/
1494
1495 open c_ids(p_rulv_rec.dnz_chr_id);
1496 i := 0;
1497 loop
1498
1499 fetch c_ids into l_id;
1500 exit when c_ids%NOTFOUND;
1501
1502 lp_rulv_tbl(i).ID := l_id;
1503 lp_rulv_tbl(i).RULE_INFORMATION5 := 'ACTIVE';
1504
1505 i := i+1;
1506 end loop;
1507
1508 -- validation
1509
1510 okl_rule_pub.update_rule(
1511 p_api_version => p_api_version,
1512 p_init_msg_list => p_init_msg_list,
1513 x_return_status => x_return_status,
1514 x_msg_count => x_msg_count,
1515 x_msg_data => x_msg_data,
1516 p_rulv_tbl => lp_rulv_tbl,
1517 x_rulv_tbl => lx_rulv_tbl);
1518
1519 If (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
1520 raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1521 Elsif (x_return_status = OKC_API.G_RET_STS_ERROR) then
1522 raise OKC_API.G_EXCEPTION_ERROR;
1523 End If;
1524
1525 /*** End API body ******************************************************/
1526
1527 -- Get message count and if count is 1, get message info
1528 FND_MSG_PUB.Count_And_Get
1529 (p_count => x_msg_count,
1530 p_data => x_msg_data);
1531
1532 EXCEPTION
1533 WHEN OKL_API.G_EXCEPTION_ERROR THEN
1534 ROLLBACK TO approve_credit_chklst;
1535 x_return_status := OKL_API.G_RET_STS_ERROR;
1536 FND_MSG_PUB.Count_And_Get
1537 (p_count => x_msg_count,
1538 p_data => x_msg_data);
1539
1540 WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1541 ROLLBACK TO approve_credit_chklst;
1542 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
1543 FND_MSG_PUB.Count_And_Get
1544 (p_count => x_msg_count,
1545 p_data => x_msg_data);
1546
1547 WHEN OTHERS THEN
1548 ROLLBACK TO approve_credit_chklst;
1549 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
1550 OKL_API.Set_Message(p_app_name => G_APP_NAME,
1551 p_msg_name => G_UNEXPECTED_ERROR,
1552 p_token1 => G_SQLCODE_TOKEN,
1553 p_token1_value => SQLCODE,
1554 p_token2 => G_SQLERRM_TOKEN,
1555 p_token2_value => SQLERRM);
1556 FND_MSG_PUB.Count_And_Get
1557 (p_count => x_msg_count,
1558 p_data => x_msg_data);
1559
1560 end approve_credit_chklst;
1561 ----------------------------------------------------------------------------------
1562 -- Start of comments
1563 --
1564 -- Procedure Name : update_fund_chklst_tpl_hdr
1565 -- Description : wrapper api for update funding checklists template header associated
1566 -- with credit line contract ID
1567 -- Business Rules :
1568 -- Parameters :
1569 -- Version : 1.0
1570 -- End of comments
1571 ----------------------------------------------------------------------------------
1572 PROCEDURE update_fund_chklst_tpl_hdr(
1573 p_api_version IN NUMBER
1574 ,p_init_msg_list IN VARCHAR2
1575 ,x_return_status OUT NOCOPY VARCHAR2
1576 ,x_msg_count OUT NOCOPY NUMBER
1577 ,x_msg_data OUT NOCOPY VARCHAR2
1578 ,p_rulv_tbl IN rulv_tbl_type
1579 ,x_rulv_tbl OUT NOCOPY rulv_tbl_type
1580 )
1581 is
1582 l_api_name CONSTANT VARCHAR2(30) := 'update_fund_chklst_tpl_hdr_pvt';
1583 l_api_version CONSTANT NUMBER := 1.0;
1584 i NUMBER;
1585 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1586 -- lp_rulv_tbl rulv_tbl_type := p_rulv_tbl;
1587 -- lx_rulv_tbl rulv_tbl_type := x_rulv_tbl;
1588 lp_rulv_tbl okl_rule_pub.rulv_tbl_type;
1589 lx_rulv_tbl okl_rule_pub.rulv_tbl_type;
1590
1591 begin
1592 -- Set API savepoint
1593 SAVEPOINT update_fund_chklst_tpl_hdr;
1594
1595 -- Check for call compatibility
1596 IF (NOT FND_API.Compatible_API_Call (l_api_version,
1597 p_api_version,
1598 l_api_name,
1599 G_PKG_NAME ))
1600 THEN
1601 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1602 END IF;
1603
1604 -- Initialize message list if requested
1605 IF (FND_API.to_Boolean(p_init_msg_list)) THEN
1606 FND_MSG_PUB.initialize;
1607 END IF;
1608
1609 -- Initialize API status to success
1610 x_return_status := OKL_API.G_RET_STS_SUCCESS;
1611
1612
1613 /*** Begin API body ****************************************************/
1614 /*** End API body ******************************************************/
1615
1616 -- Get message count and if count is 1, get message info
1617 FND_MSG_PUB.Count_And_Get
1618 (p_count => x_msg_count,
1619 p_data => x_msg_data);
1620
1621 EXCEPTION
1622 WHEN OKL_API.G_EXCEPTION_ERROR THEN
1623 ROLLBACK TO update_fund_chklst_tpl_hdr;
1624 x_return_status := OKL_API.G_RET_STS_ERROR;
1625 FND_MSG_PUB.Count_And_Get
1626 (p_count => x_msg_count,
1627 p_data => x_msg_data);
1628
1629 WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1630 ROLLBACK TO update_fund_chklst_tpl_hdr;
1631 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
1632 FND_MSG_PUB.Count_And_Get
1633 (p_count => x_msg_count,
1634 p_data => x_msg_data);
1635
1636 WHEN OTHERS THEN
1637 ROLLBACK TO update_fund_chklst_tpl_hdr;
1638 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
1639 OKL_API.Set_Message(p_app_name => G_APP_NAME,
1640 p_msg_name => G_UNEXPECTED_ERROR,
1641 p_token1 => G_SQLCODE_TOKEN,
1642 p_token1_value => SQLCODE,
1643 p_token2 => G_SQLERRM_TOKEN,
1644 p_token2_value => SQLERRM);
1645 FND_MSG_PUB.Count_And_Get
1646 (p_count => x_msg_count,
1647 p_data => x_msg_data);
1648
1649 end update_fund_chklst_tpl_hdr;
1650
1651 ----------------------------------------------------------------------------------
1652 -- Start of comments
1653 --
1654 -- Procedure Name : update_fund_chklst_tpl_hdr
1655 -- Description : wrapper api for update funding checklists template header associated
1656 -- with credit line contract ID
1657 -- Business Rules :
1658 -- Parameters :
1659 -- Version : 1.0
1660 -- End of comments
1661 ----------------------------------------------------------------------------------
1662 PROCEDURE update_fund_chklst_tpl_hdr(
1663 p_api_version IN NUMBER
1664 ,p_init_msg_list IN VARCHAR2
1665 ,x_return_status OUT NOCOPY VARCHAR2
1666 ,x_msg_count OUT NOCOPY NUMBER
1667 ,x_msg_data OUT NOCOPY VARCHAR2
1668 ,p_rulv_rec IN rulv_rec_type
1669 ,x_rulv_rec OUT NOCOPY rulv_rec_type
1670 )
1671 is
1672 l_api_name CONSTANT VARCHAR2(30) := 'update_fund_chklst_tpl_hdr_pvt';
1673 l_api_version CONSTANT NUMBER := 1.0;
1674 i NUMBER;
1675 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1676 -- lp_rulv_tbl rulv_tbl_type := p_rulv_tbl;
1677 -- lx_rulv_tbl rulv_tbl_type := x_rulv_tbl;
1678 lp_rulv_rec okl_rule_pub.rulv_rec_type;
1679 lx_rulv_rec okl_rule_pub.rulv_rec_type;
1680
1681 begin
1682 -- Set API savepoint
1683 SAVEPOINT update_fund_chklst_tpl_hdr;
1684
1685 -- Check for call compatibility
1686 IF (NOT FND_API.Compatible_API_Call (l_api_version,
1687 p_api_version,
1688 l_api_name,
1689 G_PKG_NAME ))
1690 THEN
1691 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1692 END IF;
1693
1694 -- Initialize message list if requested
1695 IF (FND_API.to_Boolean(p_init_msg_list)) THEN
1696 FND_MSG_PUB.initialize;
1697 END IF;
1698
1699 -- Initialize API status to success
1700 x_return_status := OKL_API.G_RET_STS_SUCCESS;
1701
1702
1703 /*** Begin API body ****************************************************/
1704
1705 --
1706 -- 1. validate
1707 --
1708 l_return_status := validate_header_attributes(p_rulv_rec => p_rulv_rec,
1709 p_type => 'NONE',
1710 p_mode => G_UPDATE_MODE); -- funding checklist header
1711 --- Store the highest degree of error
1712 IF (l_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
1713 IF (x_return_status <> OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1714 x_return_status := l_return_status;
1715 END IF;
1716 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1717 END IF;
1718
1719 --
1720 -- copy from local record to rule record
1721 --
1722 lp_rulv_rec.id := p_rulv_rec.id;
1723
1724 -- effective from
1725 IF (p_rulv_rec.rule_information1 IS NOT NULL AND
1726 p_rulv_rec.rule_information1 <> TO_CHAR(OKC_API.G_MISS_DATE,G_UI_DATE_MASK) ) THEN
1727 lp_rulv_rec.rule_information1 := FND_DATE.date_to_canonical(to_date(p_rulv_rec.rule_information1,G_UI_DATE_MASK));
1728 END IF;
1729
1730 -- effective to
1731 IF (p_rulv_rec.rule_information2 IS NOT NULL AND
1732 p_rulv_rec.rule_information2 <> TO_CHAR(OKC_API.G_MISS_DATE,G_UI_DATE_MASK) ) THEN
1733 lp_rulv_rec.rule_information2 := FND_DATE.date_to_canonical(to_date(p_rulv_rec.rule_information2,G_UI_DATE_MASK));
1734 END IF;
1735
1736 -- status
1737 IF (p_rulv_rec.rule_information3 IS NOT NULL AND
1738 p_rulv_rec.rule_information3 <> OKC_API.G_MISS_CHAR ) THEN
1739 lp_rulv_rec.rule_information3 := p_rulv_rec.rule_information3;
1740 END IF;
1741
1742 lp_rulv_rec.rule_information4 := p_rulv_rec.rule_information4; -- description
1743
1744 --
1745 -- call rule api
1746 --
1747 okl_rule_pub.update_rule(
1748 p_api_version => p_api_version,
1749 p_init_msg_list => p_init_msg_list,
1750 x_return_status => x_return_status,
1751 x_msg_count => x_msg_count,
1752 x_msg_data => x_msg_data,
1753 p_rulv_rec => lp_rulv_rec,
1754 x_rulv_rec => lx_rulv_rec);
1755
1756 If (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
1757 raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1758 Elsif (x_return_status = OKC_API.G_RET_STS_ERROR) then
1759 raise OKC_API.G_EXCEPTION_ERROR;
1760 End If;
1761
1762 --
1763 -- validate after image
1764 --
1765 l_return_status := validate_hdr_attr_aftimg(p_rulv_rec => p_rulv_rec,
1766 p_type => 'NONE');
1767 --- Store the highest degree of error
1768 IF (l_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
1769 IF (x_return_status <> OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1770 x_return_status := l_return_status;
1771 END IF;
1772 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1773 END IF;
1774
1775
1776 /*** End API body ******************************************************/
1777
1778 -- Get message count and if count is 1, get message info
1779 FND_MSG_PUB.Count_And_Get
1780 (p_count => x_msg_count,
1781 p_data => x_msg_data);
1782
1783 EXCEPTION
1784 WHEN OKL_API.G_EXCEPTION_ERROR THEN
1785 ROLLBACK TO update_fund_chklst_tpl_hdr;
1786 x_return_status := OKL_API.G_RET_STS_ERROR;
1787 FND_MSG_PUB.Count_And_Get
1788 (p_count => x_msg_count,
1789 p_data => x_msg_data);
1790
1791 WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1792 ROLLBACK TO update_fund_chklst_tpl_hdr;
1793 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
1794 FND_MSG_PUB.Count_And_Get
1795 (p_count => x_msg_count,
1796 p_data => x_msg_data);
1797
1798 WHEN OTHERS THEN
1799 ROLLBACK TO update_fund_chklst_tpl_hdr;
1800 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
1801 OKL_API.Set_Message(p_app_name => G_APP_NAME,
1802 p_msg_name => G_UNEXPECTED_ERROR,
1803 p_token1 => G_SQLCODE_TOKEN,
1804 p_token1_value => SQLCODE,
1805 p_token2 => G_SQLERRM_TOKEN,
1806 p_token2_value => SQLERRM);
1807 FND_MSG_PUB.Count_And_Get
1808 (p_count => x_msg_count,
1809 p_data => x_msg_data);
1810
1811 end update_fund_chklst_tpl_hdr;
1812
1813 ----------------------------------------------------------------------------------
1814 -- Start of comments
1815 --
1816 -- Procedure Name : update_funding_chklst_tpl
1817 -- Description : wrapper api for update funding checklists template associated
1818 -- with credit line contract ID
1819 -- Business Rules :
1820 -- Parameters :
1821 -- Version : 1.0
1822 -- End of comments
1823 ----------------------------------------------------------------------------------
1824 PROCEDURE update_funding_chklst_tpl(
1825 p_api_version IN NUMBER
1826 ,p_init_msg_list IN VARCHAR2
1827 ,x_return_status OUT NOCOPY VARCHAR2
1828 ,x_msg_count OUT NOCOPY NUMBER
1829 ,x_msg_data OUT NOCOPY VARCHAR2
1830 ,p_rulv_tbl IN rulv_tbl_type
1831 ,x_rulv_tbl OUT NOCOPY rulv_tbl_type
1832 )
1833 is
1834 l_api_name CONSTANT VARCHAR2(30) := 'update_funding_chklst_tpl';
1835 l_api_version CONSTANT NUMBER := 1.0;
1836 i NUMBER;
1837 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1838 -- lp_rulv_tbl rulv_tbl_type := p_rulv_tbl;
1839 -- lx_rulv_tbl rulv_tbl_type := x_rulv_tbl;
1840 lp_rulv_tbl okl_rule_pub.rulv_tbl_type;
1841 lx_rulv_tbl okl_rule_pub.rulv_tbl_type;
1842
1843 begin
1844 -- Set API savepoint
1845 SAVEPOINT update_funding_chklst_tpl;
1846
1847 -- Check for call compatibility
1848 IF (NOT FND_API.Compatible_API_Call (l_api_version,
1849 p_api_version,
1850 l_api_name,
1851 G_PKG_NAME ))
1852 THEN
1853 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1854 END IF;
1855
1856 -- Initialize message list if requested
1857 IF (FND_API.to_Boolean(p_init_msg_list)) THEN
1858 FND_MSG_PUB.initialize;
1859 END IF;
1860
1861 -- Initialize API status to success
1862 x_return_status := OKL_API.G_RET_STS_SUCCESS;
1863
1864
1865 /*** Begin API body ****************************************************/
1866
1867 --DBMS_OUTPUT.PUT_LINE('before copy_rulv_tbl');
1868
1869 copy_rulv_tbl(
1870 p_api_version => p_api_version,
1871 p_init_msg_list => p_init_msg_list,
1872 x_return_status => x_return_status,
1873 x_msg_count => x_msg_count,
1874 x_msg_data => x_msg_data,
1875 p_rulv_tbl => p_rulv_tbl,
1876 p_rulv_migr_tbl => lp_rulv_tbl,
1877 p_type => 'FUNDING',
1878 p_mode => G_UPDATE_MODE
1879 );
1880
1881 If (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
1882 raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1883 Elsif (x_return_status = OKC_API.G_RET_STS_ERROR) then
1884 raise OKC_API.G_EXCEPTION_ERROR;
1885 End If;
1886
1887 --DBMS_OUTPUT.PUT_LINE('after copy_rulv_tbl');
1888 -- validation
1889
1890 okl_rule_pub.update_rule(
1891 p_api_version => p_api_version,
1892 p_init_msg_list => p_init_msg_list,
1893 x_return_status => x_return_status,
1894 x_msg_count => x_msg_count,
1895 x_msg_data => x_msg_data,
1896 p_rulv_tbl => lp_rulv_tbl,
1897 x_rulv_tbl => lx_rulv_tbl);
1898
1899 If (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
1900 raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1901 Elsif (x_return_status = OKC_API.G_RET_STS_ERROR) then
1902 raise OKC_API.G_EXCEPTION_ERROR;
1903 End If;
1904
1905 --start: May-10-2005 cklee okl.h Lease Application ER for Authoring
1906 l_return_status := validate_dup_item(p_rulv_rec => p_rulv_tbl(p_rulv_tbl.FIRST),
1907 p_type => 'FUNDING');
1908 --- Store the highest degree of error
1909 IF (l_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
1910 IF (x_return_status <> OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1911 x_return_status := l_return_status;
1912 END IF;
1913 RAISE G_EXCEPTION_HALT_VALIDATION;
1914 END IF;
1915 --end: May-10-2005 cklee okl.h Lease Application ER for Authoring
1916
1917
1918
1919 /*** End API body ******************************************************/
1920
1921 -- Get message count and if count is 1, get message info
1922 FND_MSG_PUB.Count_And_Get
1923 (p_count => x_msg_count,
1924 p_data => x_msg_data);
1925
1926 EXCEPTION
1927 WHEN OKL_API.G_EXCEPTION_ERROR THEN
1928 ROLLBACK TO update_funding_chklst_tpl;
1929 x_return_status := OKL_API.G_RET_STS_ERROR;
1930 FND_MSG_PUB.Count_And_Get
1931 (p_count => x_msg_count,
1932 p_data => x_msg_data);
1933
1934 WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1935 ROLLBACK TO update_funding_chklst_tpl;
1936 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
1937 FND_MSG_PUB.Count_And_Get
1938 (p_count => x_msg_count,
1939 p_data => x_msg_data);
1940
1941 WHEN OTHERS THEN
1942 ROLLBACK TO update_funding_chklst_tpl;
1943 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
1944 OKL_API.Set_Message(p_app_name => G_APP_NAME,
1945 p_msg_name => G_UNEXPECTED_ERROR,
1946 p_token1 => G_SQLCODE_TOKEN,
1947 p_token1_value => SQLCODE,
1948 p_token2 => G_SQLERRM_TOKEN,
1949 p_token2_value => SQLERRM);
1950 FND_MSG_PUB.Count_And_Get
1951 (p_count => x_msg_count,
1952 p_data => x_msg_data);
1953
1954 end update_funding_chklst_tpl;
1955
1956
1957 ----------------------------------------------------------------------------------
1958 -- Start of comments
1959 --
1960 -- Procedure Name : approve_funding_chklst_tpl
1961 -- Description : set funding checklists template status to "Active"
1962 -- Business Rules :
1963 -- Parameters :
1964 -- Version : 1.0
1965 -- End of comments
1966 ----------------------------------------------------------------------------------
1967 PROCEDURE approve_funding_chklst_tpl(
1968 p_api_version IN NUMBER
1969 ,p_init_msg_list IN VARCHAR2
1970 ,x_return_status OUT NOCOPY VARCHAR2
1971 ,x_msg_count OUT NOCOPY NUMBER
1972 ,x_msg_data OUT NOCOPY VARCHAR2
1973 ,p_rulv_rec IN rulv_rec_type
1974 )
1975 is
1976 l_api_name CONSTANT VARCHAR2(30) := 'approve_funding_chklst_tpl';
1977 l_api_version CONSTANT NUMBER := 1.0;
1978 i NUMBER;
1979 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1980
1981 lp_rulv_rec okl_rule_pub.rulv_rec_type;
1982 lx_rulv_rec okl_rule_pub.rulv_rec_type;
1983
1984 l_id number;
1985
1986 cursor c_tpl_hdr (p_chr_id okc_k_headers_b.id%TYPE)
1987 is
1988 select a.id
1989 from okc_rules_b a
1990 where a.dnz_chr_id = p_chr_id
1991 and a.RULE_INFORMATION_CATEGORY = G_CREDIT_CHKLST_TPL_RULE4--'LACLFM'
1992 ;
1993
1994 begin
1995 -- Set API savepoint
1996 SAVEPOINT approve_credit_chklst;
1997
1998 -- Check for call compatibility
1999 IF (NOT FND_API.Compatible_API_Call (l_api_version,
2000 p_api_version,
2001 l_api_name,
2002 G_PKG_NAME ))
2003 THEN
2004 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2005 END IF;
2006
2007 -- Initialize message list if requested
2008 IF (FND_API.to_Boolean(p_init_msg_list)) THEN
2009 FND_MSG_PUB.initialize;
2010 END IF;
2011
2012 -- Initialize API status to success
2013 x_return_status := OKL_API.G_RET_STS_SUCCESS;
2014
2015
2016 /*** Begin API body ****************************************************/
2017
2018 -- update template header
2019 open c_tpl_hdr(p_rulv_rec.dnz_chr_id);
2020 fetch c_tpl_hdr into l_id;
2021 close c_tpl_hdr;
2022
2023 lp_rulv_rec.ID := l_id;
2024 lp_rulv_rec.RULE_INFORMATION3 := 'ACTIVE'; -- status
2025
2026 okl_rule_pub.update_rule(
2027 p_api_version => p_api_version,
2028 p_init_msg_list => p_init_msg_list,
2029 x_return_status => x_return_status,
2030 x_msg_count => x_msg_count,
2031 x_msg_data => x_msg_data,
2032 p_rulv_rec => lp_rulv_rec,
2033 x_rulv_rec => lx_rulv_rec);
2034
2035 If (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
2036 raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2037 Elsif (x_return_status = OKC_API.G_RET_STS_ERROR) then
2038 raise OKC_API.G_EXCEPTION_ERROR;
2039 End If;
2040
2041 /*** End API body ******************************************************/
2042
2043 -- Get message count and if count is 1, get message info
2044 FND_MSG_PUB.Count_And_Get
2045 (p_count => x_msg_count,
2046 p_data => x_msg_data);
2047
2048 EXCEPTION
2049 WHEN OKL_API.G_EXCEPTION_ERROR THEN
2050 ROLLBACK TO approve_funding_chklst_tpl;
2051 x_return_status := OKL_API.G_RET_STS_ERROR;
2052 FND_MSG_PUB.Count_And_Get
2053 (p_count => x_msg_count,
2054 p_data => x_msg_data);
2055
2056 WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2057 ROLLBACK TO approve_funding_chklst_tpl;
2058 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
2059 FND_MSG_PUB.Count_And_Get
2060 (p_count => x_msg_count,
2061 p_data => x_msg_data);
2062
2063 WHEN OTHERS THEN
2064 ROLLBACK TO approve_funding_chklst_tpl;
2065 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
2066 OKL_API.Set_Message(p_app_name => G_APP_NAME,
2067 p_msg_name => G_UNEXPECTED_ERROR,
2068 p_token1 => G_SQLCODE_TOKEN,
2069 p_token1_value => SQLCODE,
2070 p_token2 => G_SQLERRM_TOKEN,
2071 p_token2_value => SQLERRM);
2072 FND_MSG_PUB.Count_And_Get
2073 (p_count => x_msg_count,
2074 p_data => x_msg_data);
2075
2076 end approve_funding_chklst_tpl;
2077
2078 -- start: Apr 25, 2005 cklee: Modification for okl.h lease app enhancement for Authoring - Checklist
2079 ----------------------------------------------------------------------------------
2080 -- Start of comments
2081 --
2082 -- Procedure Name : create_funding_chklst_tpl
2083 -- Description : wrapper api for create funding checklists template associated
2084 -- with credit line contract ID
2085 -- Business Rules :
2086 -- Parameters :
2087 -- Version : 1.0
2088 -- End of comments
2089 ----------------------------------------------------------------------------------
2090 PROCEDURE create_funding_chklst_tpl(
2091 p_api_version IN NUMBER
2092 ,p_init_msg_list IN VARCHAR2
2093 ,x_return_status OUT NOCOPY VARCHAR2
2094 ,x_msg_count OUT NOCOPY NUMBER
2095 ,x_msg_data OUT NOCOPY VARCHAR2
2096 ,p_rulv_tbl IN rulv_tbl_type
2097 ,x_rulv_tbl OUT NOCOPY rulv_tbl_type
2098 )
2099 is
2100 l_api_name CONSTANT VARCHAR2(30) := 'create_funding_chklst_tpl';
2101 l_api_version CONSTANT NUMBER := 1.0;
2102 i NUMBER;
2103 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
2104 -- lp_rulv_tbl rulv_tbl_type := p_rulv_tbl;
2105 -- lx_rulv_tbl rulv_tbl_type := x_rulv_tbl;
2106 lp_rulv_tbl okl_rule_pub.rulv_tbl_type;
2107 lx_rulv_tbl okl_rule_pub.rulv_tbl_type;
2108
2109 begin
2110 -- Set API savepoint
2111 SAVEPOINT create_funding_chklst_tpl;
2112
2113 -- Check for call compatibility
2114 IF (NOT FND_API.Compatible_API_Call (l_api_version,
2115 p_api_version,
2116 l_api_name,
2117 G_PKG_NAME ))
2118 THEN
2119 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2120 END IF;
2121
2122 -- Initialize message list if requested
2123 IF (FND_API.to_Boolean(p_init_msg_list)) THEN
2124 FND_MSG_PUB.initialize;
2125 END IF;
2126
2127 -- Initialize API status to success
2128 x_return_status := OKL_API.G_RET_STS_SUCCESS;
2129
2130
2131 /*** Begin API body ****************************************************/
2132
2133 --DBMS_OUTPUT.PUT_LINE('before copy_rulv_tbl');
2134
2135 copy_rulv_tbl(
2136 p_api_version => p_api_version,
2137 p_init_msg_list => p_init_msg_list,
2138 x_return_status => x_return_status,
2139 x_msg_count => x_msg_count,
2140 x_msg_data => x_msg_data,
2141 p_rulv_tbl => p_rulv_tbl,
2142 p_rulv_migr_tbl => lp_rulv_tbl,
2143 p_type => 'FUNDING',
2144 p_mode => G_INSERT_MODE
2145 );
2146
2147 If (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
2148 raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2149 Elsif (x_return_status = OKC_API.G_RET_STS_ERROR) then
2150 raise OKC_API.G_EXCEPTION_ERROR;
2151 End If;
2152
2153 --DBMS_OUTPUT.PUT_LINE('after copy_rulv_tbl');
2154 -- validation
2155
2156 okl_rule_pub.create_rule(
2157 p_api_version => p_api_version,
2158 p_init_msg_list => p_init_msg_list,
2159 x_return_status => x_return_status,
2160 x_msg_count => x_msg_count,
2161 x_msg_data => x_msg_data,
2162 p_rulv_tbl => lp_rulv_tbl,
2163 x_rulv_tbl => lx_rulv_tbl);
2164
2165 If (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
2166 raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2167 Elsif (x_return_status = OKC_API.G_RET_STS_ERROR) then
2168 raise OKC_API.G_EXCEPTION_ERROR;
2169 End If;
2170
2171 --start: May-10-2005 cklee okl.h Lease Application ER for Authoring
2172 l_return_status := validate_dup_item(p_rulv_rec => p_rulv_tbl(p_rulv_tbl.FIRST),
2173 p_type => 'FUNDING');
2174 --- Store the highest degree of error
2175 IF (l_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
2176 IF (x_return_status <> OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2177 x_return_status := l_return_status;
2178 END IF;
2179 RAISE G_EXCEPTION_HALT_VALIDATION;
2180 END IF;
2181 --end: May-10-2005 cklee okl.h Lease Application ER for Authoring
2182
2183
2184 /*** End API body ******************************************************/
2185
2186 -- Get message count and if count is 1, get message info
2187 FND_MSG_PUB.Count_And_Get
2188 (p_count => x_msg_count,
2189 p_data => x_msg_data);
2190
2191 EXCEPTION
2192 WHEN OKL_API.G_EXCEPTION_ERROR THEN
2193 ROLLBACK TO create_funding_chklst_tpl;
2194 x_return_status := OKL_API.G_RET_STS_ERROR;
2195 FND_MSG_PUB.Count_And_Get
2196 (p_count => x_msg_count,
2197 p_data => x_msg_data);
2198
2199 WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2200 ROLLBACK TO create_funding_chklst_tpl;
2201 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
2202 FND_MSG_PUB.Count_And_Get
2203 (p_count => x_msg_count,
2204 p_data => x_msg_data);
2205
2206 WHEN OTHERS THEN
2207 ROLLBACK TO create_funding_chklst_tpl;
2208 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
2209 OKL_API.Set_Message(p_app_name => G_APP_NAME,
2210 p_msg_name => G_UNEXPECTED_ERROR,
2211 p_token1 => G_SQLCODE_TOKEN,
2212 p_token1_value => SQLCODE,
2213 p_token2 => G_SQLERRM_TOKEN,
2214 p_token2_value => SQLERRM);
2215 FND_MSG_PUB.Count_And_Get
2216 (p_count => x_msg_count,
2217 p_data => x_msg_data);
2218
2219 end create_funding_chklst_tpl;
2220
2221 ---------------------------------------------------------------------------------
2222 -- Start of comments
2223 --
2224 -- Procedure Name : delete_credit_funding_chklst
2225 -- Description : wrapper api for delete credit funding checklists associated
2226 -- with credit line contract ID
2227 -- Business Rules :
2228 -- Parameters :
2229 -- Version : 1.0
2230 -- End of comments
2231 ----------------------------------------------------------------------------------
2232 PROCEDURE delete_funding_chklst_tpl(
2233 p_api_version IN NUMBER
2234 ,p_init_msg_list IN VARCHAR2
2235 ,x_return_status OUT NOCOPY VARCHAR2
2236 ,x_msg_count OUT NOCOPY NUMBER
2237 ,x_msg_data OUT NOCOPY VARCHAR2
2238 ,p_rulv_tbl IN rulv_tbl_type
2239 )
2240 is
2241 l_api_name CONSTANT VARCHAR2(30) := 'delete_funding_chklst_tpl';
2242 l_api_version CONSTANT NUMBER := 1.0;
2243 i NUMBER;
2244 l_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
2245 -- lp_rulv_tbl rulv_tbl_type := p_rulv_tbl;
2246 -- lx_rulv_tbl rulv_tbl_type := x_rulv_tbl;
2247 lp_rulv_tbl okl_rule_pub.rulv_tbl_type;
2248 lx_rulv_tbl okl_rule_pub.rulv_tbl_type;
2249
2250 begin
2251 -- Set API savepoint
2252 SAVEPOINT delete_funding_chklst_tpl;
2253
2254 -- Check for call compatibility
2255 IF (NOT FND_API.Compatible_API_Call (l_api_version,
2256 p_api_version,
2257 l_api_name,
2258 G_PKG_NAME ))
2259 THEN
2260 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2261 END IF;
2262
2263 -- Initialize message list if requested
2264 IF (FND_API.to_Boolean(p_init_msg_list)) THEN
2265 FND_MSG_PUB.initialize;
2266 END IF;
2267
2268 -- Initialize API status to success
2269 x_return_status := OKL_API.G_RET_STS_SUCCESS;
2270
2271
2272 /*** Begin API body ****************************************************/
2273 --DBMS_OUTPUT.PUT_LINE('before copy_rulv_tbl');
2274
2275 copy_rulv_tbl(
2276 p_api_version => p_api_version,
2277 p_init_msg_list => p_init_msg_list,
2278 x_return_status => x_return_status,
2279 x_msg_count => x_msg_count,
2280 x_msg_data => x_msg_data,
2281 p_rulv_tbl => p_rulv_tbl,
2282 p_rulv_migr_tbl => lp_rulv_tbl,
2283 p_type => null,
2284 p_mode => G_DELETE_MODE
2285 );
2286
2287 If (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
2288 raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2289 Elsif (x_return_status = OKC_API.G_RET_STS_ERROR) then
2290 raise OKC_API.G_EXCEPTION_ERROR;
2291 End If;
2292
2293 --DBMS_OUTPUT.PUT_LINE('after copy_rulv_tbl');
2294 okl_rule_pub.delete_rule(
2295 p_api_version => p_api_version,
2296 p_init_msg_list => p_init_msg_list,
2297 x_return_status => x_return_status,
2298 x_msg_count => x_msg_count,
2299 x_msg_data => x_msg_data,
2300 p_rulv_tbl => lp_rulv_tbl);
2301
2302 If (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) then
2303 raise OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2304 Elsif (x_return_status = OKC_API.G_RET_STS_ERROR) then
2305 raise OKC_API.G_EXCEPTION_ERROR;
2306 End If;
2307
2308 /*** End API body ******************************************************/
2309
2310 -- Get message count and if count is 1, get message info
2311 FND_MSG_PUB.Count_And_Get
2312 (p_count => x_msg_count,
2313 p_data => x_msg_data);
2314
2315 EXCEPTION
2316 WHEN OKL_API.G_EXCEPTION_ERROR THEN
2317 ROLLBACK TO delete_funding_chklst_tpl;
2318 x_return_status := OKL_API.G_RET_STS_ERROR;
2319 FND_MSG_PUB.Count_And_Get
2320 (p_count => x_msg_count,
2321 p_data => x_msg_data);
2322
2323 WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2324 ROLLBACK TO delete_funding_chklst_tpl;
2325 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
2326 FND_MSG_PUB.Count_And_Get
2327 (p_count => x_msg_count,
2328 p_data => x_msg_data);
2329
2330 WHEN OTHERS THEN
2331 ROLLBACK TO delete_funding_chklst_tpl;
2332 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR ;
2333 OKL_API.Set_Message(p_app_name => G_APP_NAME,
2334 p_msg_name => G_UNEXPECTED_ERROR,
2335 p_token1 => G_SQLCODE_TOKEN,
2336 p_token1_value => SQLCODE,
2337 p_token2 => G_SQLERRM_TOKEN,
2338 p_token2_value => SQLERRM);
2339 FND_MSG_PUB.Count_And_Get
2340 (p_count => x_msg_count,
2341 p_data => x_msg_data);
2342
2343 end delete_funding_chklst_tpl;
2344 -- end: Apr 25, 2005 cklee: Modification for okl.h lease app enhancement for Authoring - Checklist
2345
2346 END OKL_CREDIT_CHECKLIST_PVT;