[Home] [Help]
PACKAGE BODY: APPS.OKL_LEASE_QUOTE_WORKFLOW_PVT
Source
1 PACKAGE BODY OKL_LEASE_QUOTE_WORKFLOW_PVT AS
2 /* $Header: OKLRQUWB.pls 120.8.12020000.6 2013/01/17 04:53:18 vloomba ship $ */
3 -- Bug 4741121 viselvar modified start
4 G_MSG_TOKEN_OBJECT_NAME CONSTANT VARCHAR2(20) := 'OBJECT_NAME';
5 G_MSG_TOKEN_NAME CONSTANT VARCHAR2(20) := 'NAME';
6 G_WF_ITM_APPLICATION_ID CONSTANT VARCHAR2(20) := 'APPLICATION_ID';
7 G_WF_ITM_TRANSACTION_TYPE_ID CONSTANT VARCHAR2(20) := 'TRX_TYPE_ID';
8 G_FE_APPROVAL_WF CONSTANT VARCHAR2(2) := 'WF';
9 G_FE_APPROVAL_AME CONSTANT VARCHAR2(3) := 'AME';
10 G_WF_ITM_TRANSACTION_ID CONSTANT VARCHAR2(20) := 'TRANSACTION_ID';
11 G_WF_ITM_REQUESTER CONSTANT VARCHAR2(20) := 'REQUESTER';
12 G_WF_ITM_REQUESTER_ID CONSTANT VARCHAR2(20) := 'REQUESTOR_ID';
13 G_WF_ITM_APPROVAL_REQ_MSG CONSTANT VARCHAR2(30) := 'APPROVAL_REQUEST_MESSAGE';
14 G_WF_ITM_PARENT_ITEM_KEY CONSTANT VARCHAR2(20) := 'PARENT_ITEM_KEY';
15 G_WF_ITM_PARENT_ITEM_TYPE CONSTANT VARCHAR2(20) := 'PARENT_ITEM_TYPE';
16 G_WF_ITM_APPROVED_YN CONSTANT VARCHAR2(15) := 'APPROVED_YN';
17 G_WF_ITM_MASTER CONSTANT VARCHAR2(10) := 'MASTER';
18 G_WF_ITM_MESSAGE_SUBJECT CONSTANT VARCHAR2(20) := 'MESSAGE_SUBJECT';
19 G_WF_ITM_APP_REQUEST_SUB CONSTANT VARCHAR2(30) := 'APP_REQUEST_SUB';
20 G_WF_ITM_APP_REMINDER_SUB CONSTANT VARCHAR2(30) := 'APP_REMINDER_SUB';
21 G_WF_ITM_APP_APPROVED_SUB CONSTANT VARCHAR2(30) := 'APP_APPROVED_SUB';
22 G_WF_ITM_APP_REJECTED_SUB CONSTANT VARCHAR2(30) := 'APP_REJECTED_SUB';
23 G_WF_ITM_APP_REMINDER_HEAD CONSTANT VARCHAR2(30) := 'APP_REMINDER_HEAD';
24 G_WF_ITM_APP_APPROVED_HEAD CONSTANT VARCHAR2(30) := 'APP_APPROVED_HEAD';
25 G_WF_ITM_APP_REJECTED_HEAD CONSTANT VARCHAR2(30) := 'APP_REJECTED_HEAD';
26 G_WF_ITM_APPROVER CONSTANT wf_item_attributes.name%TYPE DEFAULT 'APPROVER';
27 G_WF_ITM_MESSAGE_SUBJECT CONSTANT wf_item_attributes.name%TYPE DEFAULT 'MESSAGE_SUBJECT';
28 G_WF_ITM_MESSAGE_DESCR CONSTANT wf_item_attributes.name%TYPE DEFAULT 'MESSAGE_DESCRIPTION';
29 G_WF_ITM_MESSAGE_BODY CONSTANT wf_item_attributes.name%TYPE DEFAULT 'MESSAGE_DOC';
30 G_WF_ITM_RESULT CONSTANT wf_item_attributes.name%TYPE DEFAULT 'RESULT';
31 G_WF_ITM_APPROVED_YN_YES CONSTANT wf_item_attributes.name%TYPE DEFAULT 'APPROVED';
32 G_WF_ITM_APPROVED_YN_NO CONSTANT wf_item_attributes.name%TYPE DEFAULT 'REJECTED';
33 -- viselvar start
34 --subtype the lease application header
35 SUBTYPE lapv_rec_type IS OKL_LAP_PVT.LAPV_REC_TYPE;
36
37 -- curosr to fetch the parent record of
38 CURSOR get_parent_object(quote_id IN NUMBER) IS
39 SELECT parent_object_code, parent_object_id FROM okl_lease_quotes_b
40 WHERE id=quote_id;
41 -- viselvar end
42
43 ------------------------------------------------------------------------------
44 -- FUNCTION get_message
45 ------------------------------------------------------------------------------
46 -- Start of comments
47 --
48 -- Procedure Name : get_message
49 -- Description : function to return the message from fnd message for notifications
50 -- Business Rules : function to return the message from fnd message for notifications
51 -- Parameters :
52 -- Version : 1.0
53 -- History : viselvar created
54 --
55 -- End of comments
56
57 FUNCTION get_message(p_msg_name IN VARCHAR2, object_name IN VARCHAR2,
58 object_value IN VARCHAR2) RETURN VARCHAR2 IS
59 l_message VARCHAR2(100);
60
61 BEGIN
62
63 IF p_msg_name IS NOT NULL THEN
64 Fnd_Message.SET_NAME(APPLICATION => G_APP_NAME, NAME => p_msg_name);
65 Fnd_Message.SET_TOKEN(TOKEN => G_MSG_TOKEN_OBJECT_NAME,
66 VALUE => object_name);
67 Fnd_Message.SET_TOKEN(TOKEN => G_MSG_TOKEN_NAME, VALUE => object_value);
68 l_message := fnd_message.get();
69 END IF;
70 RETURN l_message;
71 EXCEPTION
72 WHEN OTHERS THEN
73 RETURN NULL;
74 END get_message;
75
76 ------------------------------------------------------------------------------
77 -- PROCEDURE get_token
78 ------------------------------------------------------------------------------
79 -- Start of comments
80 --
81 -- Function Name : get_token
82 -- Description : get the message for a message name frm fnd messages
83 -- Business Rules : get the message for a message name frm fnd messages
84 -- Parameters :
85 -- Version : 1.0
86 -- History : viselvar created
87 --
88 -- End of comments
89
90 FUNCTION get_token(p_msg_name IN VARCHAR2, token_name IN VARCHAR2,
91 token_value IN VARCHAR2) RETURN VARCHAR2 IS
92 l_message VARCHAR2(100);
93
94 BEGIN
95
96 IF p_msg_name IS NOT NULL THEN
97 Fnd_Message.SET_NAME(APPLICATION => G_APP_NAME, NAME => p_msg_name);
98 Fnd_Message.SET_TOKEN(TOKEN => token_name, VALUE => token_value);
99 l_message := fnd_message.get();
100 END IF;
101 RETURN l_message;
102 EXCEPTION
103 WHEN OTHERS THEN
104 RETURN NULL;
105 END get_token;
106
107 ------------------------------------------------------------------------------
108 -- PROCEDURE get_quote_msg_body
109 ------------------------------------------------------------------------------
110 -- Start of comments
111 --
112 -- Function Name : get_quote_msg_body
113 -- Description : this function generates the message body
114 -- Business Rules : this function generates the message body
115 -- Parameters :
116 -- Version : 1.0
117 -- History : viselvar created
118 --
119 -- End of comments
120
121 FUNCTION get_quote_msg_body(itemtype IN VARCHAR2, itemkey IN VARCHAR2) RETURN VARCHAR2 IS
122
123 l_name VARCHAR2(240);
124 l_currency VARCHAR2(30);
125 l_type VARCHAR2(30);
126 l_version_number VARCHAR2(24);
127 l_effective_from DATE;
128 l_effective_to DATE;
129 lv_message_body VARCHAR2(4000);
130 l_parent_object_code VARCHAR2(20);
131 l_parent_id NUMBER;
132 l_quote_id NUMBER;
133
134
135 CURSOR get_lease_app(lease_app_id IN NUMBER) IS
136 SELECT reference_number, valid_from, valid_to FROM
137 OKL_LEASE_APPLICATIONS_B
138 WHERE id= lease_app_id;
139
140 BEGIN
141 -- set the attributes
142 l_name := wf_engine.GetItemAttrText(itemtype, itemkey, 'QUOTE_NUM');
143 l_effective_from := wf_engine.GetItemAttrDate(itemtype,
144 itemkey,
145 'EFFECTIVE_FROM');
146 l_effective_to := wf_engine.GetItemAttrDate(itemtype,
147 itemkey,
148 'EFFECTIVE_TO');
149
150 l_quote_id:=wf_engine.GetItemAttrText(itemtype, itemkey, 'QUOTE_ID');
151
152
153 OPEN get_parent_object(l_quote_id);
154 FETCH get_parent_object INTO l_parent_object_code, l_parent_id;
155 CLOSE get_parent_object;
156
157 IF (l_parent_object_code = 'LEASEAPP') THEN
158 -- get the lease application details and not the quote details
159 OPEN get_lease_app(l_parent_id);
160 FETCH get_lease_app INTO l_name, l_effective_from, l_effective_to;
161 CLOSE get_lease_app;
162
163 END IF;
164 lv_message_body := '<body>' ||
165 get_token('OKL_NAME', 'NAME', l_name) ||
166 '<br>' ||
167 get_token('OKL_EFFECTIVE_FROM',
168 'FROM_DATE',
169 fnd_Date.date_to_displaydate(l_effective_from)) ||
170 '<br>' ||
171 get_token('OKL_EFFECTIVE_TO',
172 'TO_DATE',
173 fnd_Date.date_to_displaydate(l_effective_to)) ||
174 '<br>' ||
175 '</body>';
176
177 -- return the message body
178 RETURN lv_message_body;
179
180 END get_quote_msg_body;
181
182 ------------------------------------------------------------------------------
183 -- PROCEDURE get_quote_msg_doc
184 ------------------------------------------------------------------------------
185 -- Start of comments
186 --
187 -- Function Name : get_quote_msg_doc
188 -- Description : this function generates the message body
189 -- Business Rules : this function generates the message body
190 -- Parameters :
191 -- Version : 1.0
192 -- History : viselvar created
193 --
194 -- End of comments
195
196 PROCEDURE get_quote_msg_doc(document_id IN VARCHAR2,
197 display_type IN VARCHAR2,
198 document IN OUT NOCOPY VARCHAR2,
199 document_type IN OUT NOCOPY VARCHAR2) IS
200
201 BEGIN
202
203 -- get the message body
204
205 document := get_quote_msg_body('OKLSOQUO', document_id);
206 document_type := display_type;
207 END get_quote_msg_doc;
208
209 -- Bug 4741121 viselvar Modified End
210 --------------------------------
211 -- PROCEDURE change_quote_status
212 --------------------------------
213 PROCEDURE change_quote_status(p_quote_id IN NUMBER,
214 p_qte_status IN VARCHAR2,
215 x_return_status OUT NOCOPY VARCHAR2) IS
216
217 lx_return_status VARCHAR2(1);
218 lx_msg_count NUMBER;
219 lx_msg_data VARCHAR2(4000);
220
221 l_lease_qte_rec okl_lsq_pvt.lsqv_rec_type;
222 x_lease_qte_rec okl_lsq_pvt.lsqv_rec_type;
223
224 -- Bug 4713798 - Added cursor
225 CURSOR c_obj
226 IS
227 SELECT object_version_number
228 FROM okl_lease_quotes_b
229 WHERE id = p_quote_id;
230
231 BEGIN
232
233 l_lease_qte_rec.id := p_quote_id;
234 l_lease_qte_rec.status := p_qte_status;
235
236 OPEN c_obj;
237 FETCH c_obj INTO l_lease_qte_rec.object_version_number;
238 CLOSE c_obj;
239
240 okl_lsq_pvt.update_row(p_api_version => G_API_VERSION
241 ,p_init_msg_list => G_FALSE
242 ,x_return_status => lx_return_status
243 ,x_msg_count => lx_msg_count
244 ,x_msg_data => lx_msg_data
245 ,p_lsqv_rec => l_lease_qte_rec
246 ,x_lsqv_rec => x_lease_qte_rec );
247
248 IF lx_return_status = OKL_API.G_RET_STS_UNEXP_ERROR THEN
249 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
250 ELSIF lx_return_status = G_RET_STS_ERROR THEN
251 RAISE OKL_API.G_EXCEPTION_ERROR;
252 END IF;
253
254 x_return_status := lx_return_status;
255
256 EXCEPTION
257
258 WHEN OKL_API.G_EXCEPTION_ERROR THEN
259
260 x_return_status := G_RET_STS_ERROR;
261
262 WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
263
264 x_return_status := G_RET_STS_UNEXP_ERROR;
265
266 WHEN OTHERS THEN
267
268 OKL_API.SET_MESSAGE (p_app_name => G_APP_NAME,
269 p_msg_name => G_UNEXPECTED_ERROR,
270 p_token1 => G_SQLCODE_TOKEN,
271 p_token1_value => sqlcode,
272 p_token2 => G_SQLERRM_TOKEN,
273 p_token2_value => sqlerrm);
274
275 x_return_status := G_RET_STS_UNEXP_ERROR;
276
277 END change_quote_status;
278
279 -------------------------------------
280 -- PROCEDURE raise_quote_accept_event
281 -------------------------------------
282 PROCEDURE raise_quote_accept_event (p_quote_id IN NUMBER,
283 x_return_status OUT NOCOPY VARCHAR2) IS
284
285 l_parameter_list wf_parameter_list_t;
286 l_key VARCHAR2(240);
287 l_event_name VARCHAR2(240) := 'oracle.apps.okl.sales.acceptquote';
288 l_seq NUMBER;
289
290 lx_return_status VARCHAR2(1);
291
292 CURSOR okl_key_csr IS
293 SELECT okl_wf_item_s.nextval
294 FROM dual;
295
296 BEGIN
297
298 OPEN okl_key_csr;
299 FETCH okl_key_csr INTO l_seq;
300 CLOSE okl_key_csr;
301
302 l_key := l_event_name ||l_seq;
303
304 -- raise the business event
305 wf_event.AddParameterToList('QUOTE_ID', p_quote_id, l_parameter_list);
306 --added by akrangan
307 wf_event.AddParameterToList('ORG_ID',mo_global.get_current_org_id ,l_parameter_list);
308
309 wf_event.raise(p_event_name => l_event_name,
310 p_event_key => l_key,
311 p_parameters => l_parameter_list);
312
313 l_parameter_list.DELETE;
314
315 -- change the quote status
316 change_quote_status(p_quote_id => p_quote_id,
317 p_qte_status => 'CT-ACCEPTED',
318 x_return_status => lx_return_status);
319
320 IF lx_return_status = OKL_API.G_RET_STS_UNEXP_ERROR THEN
321 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
322 ELSIF lx_return_status = G_RET_STS_ERROR THEN
323 RAISE OKL_API.G_EXCEPTION_ERROR;
324 END IF;
325
326 x_return_status := lx_return_status;
327
328 EXCEPTION
329
330 WHEN OTHERS THEN
331
332 OKL_API.SET_MESSAGE (p_app_name => G_APP_NAME,
333 p_msg_name => G_UNEXPECTED_ERROR,
334 p_token1 => G_SQLCODE_TOKEN,
335 p_token1_value => sqlcode,
336 p_token2 => G_SQLERRM_TOKEN,
337 p_token2_value => sqlerrm);
338
339 x_return_status := G_RET_STS_UNEXP_ERROR;
340
341 END raise_quote_accept_event;
342
343 ------------------------------------
344 -- PROCEDURE populate_accept_attribs
345 ------------------------------------
346 PROCEDURE populate_accept_attribs(itemtype IN VARCHAR2,
347 itemkey IN VARCHAR2,
348 actid IN NUMBER,
349 funcmode IN VARCHAR2,
350 resultout OUT NOCOPY VARCHAR2) IS
351
352 l_api_name CONSTANT VARCHAR2(30) := 'populate_accept_attribs';
353
354 l_quote_number OKL_LEASE_QUOTES_V.REFERENCE_NUMBER%TYPE;
355 l_quote_id OKL_LEASE_QUOTES_V.ID%TYPE;
356
357 CURSOR c_fetch_quote_number(p_quote_id OKL_LEASE_QUOTES_V.ID%TYPE)
358 IS
359 SELECT reference_number
360 FROM okl_lease_quotes_v
361 WHERE id = p_quote_id;
362
363 lx_return_status VARCHAR2(1);
364
365 BEGIN
366
367 IF (funcmode = 'RUN') THEN
368
369 l_quote_id := wf_engine.GetItemAttrText(itemtype => itemtype,
370 itemkey => itemkey,
371 aname => 'QUOTE_ID');
372
373 OPEN c_fetch_quote_number(p_quote_id => l_quote_id);
374 FETCH c_fetch_quote_number INTO l_quote_number;
375 CLOSE c_fetch_quote_number;
376
377 wf_engine.SetItemAttrText (itemtype => itemtype,
378 itemkey => itemkey,
379 aname => 'QUOTE_ID',
380 avalue => l_quote_number);
381
382 change_quote_status(p_quote_id => l_quote_id,
383 p_qte_status => 'CT-ACCEPTED',
384 x_return_status => lx_return_status);
385
386 IF lx_return_status = OKL_API.G_RET_STS_UNEXP_ERROR THEN
387 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
388 ELSIF lx_return_status = G_RET_STS_ERROR THEN
389 RAISE OKL_API.G_EXCEPTION_ERROR;
390 END IF;
391
392 resultout := 'COMPLETE:';
393 RETURN;
394
395 END IF;
396
397 -- CANCEL mode
398 IF (funcmode = 'CANCEL') then
399 resultout := 'COMPLETE:';
400 RETURN;
401 END IF;
402 -- TIMEOUT mode
403 IF (funcmode = 'TIMEOUT') then
404 resultout := 'COMPLETE:';
405 RETURN;
406 END IF;
407
408 EXCEPTION
409
410 WHEN OKL_API.G_EXCEPTION_ERROR THEN
411
412 wf_core.context(G_PKG_NAME, l_api_name, itemtype, itemkey, actid, funcmode);
413 RAISE;
414
415 WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
416
417 wf_core.context(G_PKG_NAME, l_api_name, itemtype, itemkey, actid, funcmode);
418 RAISE;
419
420 WHEN OTHERS THEN
421
422 OKL_API.SET_MESSAGE (p_app_name => G_APP_NAME,
423 p_msg_name => G_UNEXPECTED_ERROR,
424 p_token1 => G_SQLCODE_TOKEN,
425 p_token1_value => sqlcode,
426 p_token2 => G_SQLERRM_TOKEN,
427 p_token2_value => sqlerrm);
428
429 wf_core.context(G_PKG_NAME, l_api_name, itemtype, itemkey, actid, funcmode);
430 RAISE;
431
432 END populate_accept_attribs;
433
434 -------------------------------------
435 -- PROCEDURE raise_quote_submit_event
436 -------------------------------------
437 PROCEDURE raise_quote_submit_event (p_quote_id IN NUMBER,
438 x_return_status OUT NOCOPY VARCHAR2) AS
439
440 CURSOR okl_key_csr IS
441 SELECT okl_wf_item_s.nextval
442 FROM dual;
443
444 l_parameter_list wf_parameter_list_t;
445 l_key VARCHAR2(240);
446 l_event_name CONSTANT VARCHAR2(100) := 'oracle.apps.okl.sales.submitquote';
447 l_seq NUMBER;
448
449 lx_return_status VARCHAR2(1) := G_RET_STS_SUCCESS ;
450 l_return_status VARCHAR2(1):=G_RET_STS_SUCCESS ;
451 l_lapv_rec lapv_rec_type;
452 x_lapv_rec lapv_rec_type;
453 l_parent_object VARCHAR2(30);
454 l_parent_id NUMBER;
455 x_msg_count NUMBER;
456 x_msg_data VARCHAR2(4000);
457
458 BEGIN
459
460 OPEN okl_key_csr;
461 FETCH okl_key_csr INTO l_seq;
462 CLOSE okl_key_csr;
463
464 l_key := l_event_name ||l_seq;
465
466 -- viselvar added
467 -- check the profile option and accordingly change the status
468 IF NVL(FND_PROFILE.VALUE('OKL_SO_APPROVAL_PROCESS'),'NONE') = 'NONE' THEN
469
470 change_quote_status(p_quote_id => p_quote_id,
471 p_qte_status => 'PR-APPROVED',
472 x_return_status => lx_return_status);
473
474 OPEN get_parent_object(p_quote_id);
475 FETCH get_parent_object INTO l_parent_object, l_parent_id;
476 CLOSE get_parent_object;
477
478 IF l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR THEN
479 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
480 ELSIF l_return_status = G_RET_STS_ERROR THEN
481 RAISE OKL_API.G_EXCEPTION_ERROR;
482 END IF;
483
484 IF (l_parent_object = 'LEASEAPP') THEN
485 l_lapv_rec.application_status := 'PR-APPROVED';
486 l_lapv_rec.id := l_parent_id;
487
488 -- update the status of the lease application to approved
489 OKL_LAP_PVT.UPDATE_ROW(
490 p_api_version => 1.0
491 ,p_init_msg_list => 'T'
492 ,x_return_status => l_return_status
493 ,x_msg_count => x_msg_count
494 ,x_msg_data => x_msg_data
495 ,p_lapv_rec => l_lapv_rec
496 ,x_lapv_rec => x_lapv_rec);
497
498 IF l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR THEN
499 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
500 ELSIF l_return_status = G_RET_STS_ERROR THEN
501 RAISE OKL_API.G_EXCEPTION_ERROR;
502 END IF;
503 END IF;
504 ELSE
505
506 wf_event.AddParameterToList('QUOTE_ID', p_quote_id, l_parameter_list);
507 --added by akrangan
508 wf_event.AddParameterToList('ORG_ID',mo_global.get_current_org_id ,l_parameter_list);
509
510 -- added by venkatho START Bug: 15933691
511 wf_event.AddParameterToList('USER_ID',Fnd_Global.User_Id ,l_parameter_list);
512 wf_event.AddParameterToList('RESPONSIBILITY_ID',Fnd_Global.Resp_Id ,l_parameter_list);
513 wf_event.AddParameterToList('APPLICATION_ID',Fnd_Global.Resp_Appl_Id ,l_parameter_list);
514 -- added by venkatho END Bug: 15933691
515
516 -- Raise Event
517 wf_event.raise(p_event_name => l_event_name,
518 p_event_key => l_key,
519 p_parameters => l_parameter_list);
520
521 l_parameter_list.DELETE;
522
523 END IF;
524 x_return_status := lx_return_status;
525
526 EXCEPTION
527
528 WHEN OTHERS THEN
529
530 OKL_API.SET_MESSAGE (p_app_name => G_APP_NAME,
531 p_msg_name => G_UNEXPECTED_ERROR,
532 p_token1 => G_SQLCODE_TOKEN,
533 p_token1_value => sqlcode,
534 p_token2 => G_SQLERRM_TOKEN,
535 p_token2_value => sqlerrm);
536
537 x_return_status := G_RET_STS_UNEXP_ERROR;
538
539 END raise_quote_submit_event;
540
541 ------------------------------------
542 -- PROCEDURE populate_submit_attribs
543 ------------------------------------
544 PROCEDURE populate_submit_attribs(itemtype IN VARCHAR2,
545 itemkey IN VARCHAR2,
546 actid IN NUMBER,
547 funcmode IN VARCHAR2,
548 resultout OUT NOCOPY VARCHAR2) AS
549
550 l_api_name CONSTANT VARCHAR2(30) := 'populate_submit_attribs';
551
552 l_quote_id OKL_LEASE_QUOTES_V.ID%TYPE;
553 l_quote_number OKL_LEASE_QUOTES_V.REFERENCE_NUMBER%TYPE;
554
555 lx_return_status VARCHAR2(1);
556 lx_msg_count NUMBER;
557 lx_msg_data VARCHAR2(4000);
558
559 CURSOR c_fetch_quote_number(p_quote_id OKL_LEASE_QUOTES_V.ID%TYPE)
560 IS
561 SELECT reference_number
562 FROM okl_lease_quotes_v
563 WHERE id = p_quote_id;
564
565 BEGIN
566
567 IF (funcmode = 'RUN') THEN
568
569 l_quote_id := wf_engine.GetItemAttrText(itemtype => itemtype,
570 itemkey => itemkey,
571 aname => 'QUOTE_ID');
572
573 OPEN c_fetch_quote_number(p_quote_id => l_quote_id);
574 FETCH c_fetch_quote_number INTO l_quote_number;
575 CLOSE c_fetch_quote_number;
576
577 wf_engine.SetItemAttrText (itemtype => itemtype,
578 itemkey => itemkey,
579 aname => 'QUOTE_ID',
580 avalue => l_quote_number);
581
582 change_quote_status(p_quote_id => l_quote_id,
583 p_qte_status => 'PR-APPROVED',
584 x_return_status => lx_return_status);
585
586 IF lx_return_status = OKL_API.G_RET_STS_UNEXP_ERROR THEN
587 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
588 ELSIF lx_return_status = G_RET_STS_ERROR THEN
589 RAISE OKL_API.G_EXCEPTION_ERROR;
590 END IF;
591
592 resultout := 'COMPLETE:';
593 RETURN;
594
595 END IF;
596
597 -- CANCEL mode
598 IF (funcmode = 'CANCEL') then
599 resultout := 'COMPLETE:';
600 RETURN;
601 END IF;
602
603 -- TIMEOUT mode
604 IF (funcmode = 'TIMEOUT') then
605 resultout := 'COMPLETE:';
606 RETURN;
607 END IF;
608
609 EXCEPTION
610
611 WHEN OKL_API.G_EXCEPTION_ERROR THEN
612
613 wf_core.context(G_PKG_NAME, l_api_name, itemtype, itemkey, actid, funcmode);
614 RAISE;
615
616 WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
617
618 wf_core.context(G_PKG_NAME, l_api_name, itemtype, itemkey, actid, funcmode);
619 RAISE;
620
621 WHEN OTHERS THEN
622
623 OKL_API.SET_MESSAGE (p_app_name => G_APP_NAME,
624 p_msg_name => G_UNEXPECTED_ERROR,
625 p_token1 => G_SQLCODE_TOKEN,
626 p_token1_value => sqlcode,
627 p_token2 => G_SQLERRM_TOKEN,
628 p_token2_value => sqlerrm);
629
630 wf_core.context(G_PKG_NAME, l_api_name, itemtype, itemkey, actid, funcmode);
631 RAISE;
632
633 END populate_submit_attribs;
634
635 -- Bug 4741121 viselvar Modified Start
636 ------------------------------------------------------------------------------
637 -- PROCEDURE check_approval_process
638 ------------------------------------------------------------------------------
639 -- Start of comments
640 --
641 -- Procedure Name : check_approval_process
642 -- Description : procedure to check the approval process
643 -- Business Rules : procedure to check the approval process
644 -- Parameters :
645 -- Version : 1.0
646 -- History : viselvar created
647 --
648 -- End of comments
649 PROCEDURE check_approval_process(itemtype IN VARCHAR2,
650 itemkey IN VARCHAR2, actid IN NUMBER,
651 funcmode IN VARCHAR2,
652 resultout OUT NOCOPY VARCHAR2) IS
653 l_approval_option VARCHAR2(10);
654 l_api_name CONSTANT VARCHAR2(30) DEFAULT 'check_approval_process';
655
656 -- added by venkatho START Bug: 15933691
657 l_user_id NUMBER;
658 l_resp_id NUMBER;
659 l_appl_id NUMBER;
660
661 -- Get the valid application id from FND
662 CURSOR c_get_app_id_csr
663 IS
664 SELECT application_id
665 FROM fnd_application
666 WHERE application_short_name = 'OKL';
667 -- added by venkatho END Bug: 15933691
668
669 BEGIN
670
671 IF (funcmode = 'RUN') THEN
672
673 -- Code added as part of Bug 15933691 - START
674 l_user_id := wf_engine.GetItemAttrNumber(itemtype => itemtype,
675 itemkey => itemkey,
676 aname => 'USER_ID');
677
678 l_resp_id := wf_engine.GetItemAttrNumber(itemtype => itemtype,
679 itemkey => itemkey,
680 aname => 'RESPONSIBILITY_ID');
681
682 OPEN c_get_app_id_csr;
683 FETCH c_get_app_id_csr INTO l_appl_id;
684 CLOSE c_get_app_id_csr;
685
686 fnd_global.apps_initialize(l_user_id,l_resp_id,l_appl_id);
687 -- Code added as part of Bug 15933691 - END
688
689
690 -- get the profile option
691
692 l_approval_option := fnd_profile.value('OKL_SO_APPROVAL_PROCESS');
693
694 -- depending on the profile option, take the workflow branch or the AME branch
695
696 IF l_approval_option = G_FE_APPROVAL_AME THEN
697 resultout := 'COMPLETE:AME';
698 ELSIF l_approval_option = G_FE_APPROVAL_WF THEN
699 resultout := 'COMPLETE:WF';
700 END IF;
701 RETURN;
702 END IF;
703
704 -- CANCEL mode
705
706 IF (funcmode = 'CANCEL') THEN
707 resultout := 'COMPLETE:';
708 RETURN;
709 END IF;
710
711 -- TIMEOUT mode
712
713 IF (funcmode = 'TIMEOUT') THEN
714 resultout := 'COMPLETE:';
715 RETURN;
716 END IF;
717
718 EXCEPTION
719 WHEN OTHERS THEN
720 wf_core.context(G_PKG_NAME,
721 l_api_name,
722 itemtype,
723 itemkey,
724 actid,
725 funcmode);
726 RAISE;
727 END check_approval_process;
728
729 ------------------------------------------------------------------------------
730 -- PROCEDURE populate_quote_attr
731 ------------------------------------------------------------------------------
732 -- Start of comments
733 --
734 -- Procedure Name : populate_quote_attr
735 -- Description : populate the quote attributes for the workflow
736 -- Business Rules : populate the quote attributes for the workflow
737 -- Parameters :
738 -- Version : 1.0
739 -- History : viselvar created
740 --
741 -- End of comments
742 PROCEDURE populate_quote_attr(itemtype IN VARCHAR2, itemkey IN VARCHAR2,
743 actid IN NUMBER, funcmode IN VARCHAR2,
744 resultout OUT NOCOPY VARCHAR2) IS
745
746 l_api_name CONSTANT VARCHAR2(30) DEFAULT 'quote_ame';
747 l_module CONSTANT fnd_log_messages.module%TYPE := 'okl.plsql.OKL_SUBSIDY_POOL_WF.PROCESS_POOL_AME';
748 l_debug_enabled VARCHAR2(10);
749 is_debug_procedure_on BOOLEAN;
750 l_quote_number VARCHAR2(100);
751 l_effective_from DATE;
752 l_effective_to DATE;
753 l_quote_id NUMBER;
754 l_object_name VARCHAR2(50);
755 l_request_message VARCHAR2(500);
756 l_approved_message VARCHAR2(500);
757 l_rejected_message VARCHAR2(500);
758 l_reminder_message VARCHAR2(500);
759 l_user_name VARCHAR2(240);
760 l_application_id fnd_application.application_id%TYPE;
761 l_parent_code VARCHAR2(20);
762 l_parent_id NUMBER;
763 l_approver_role VARCHAR2(100); -- added for BUG16175322
764
765 CURSOR c_fetch_quote_number(p_quote_id OKL_LEASE_QUOTES_V.ID%TYPE)
766 IS
767 SELECT reference_number, valid_from, valid_to, parent_object_code, parent_object_id
768 FROM okl_lease_quotes_b
769 WHERE id = p_quote_id;
770
771 -- Commented by Venkatho as part of Bug : 15933691
772 /* CURSOR fnd_user_csr IS
773 SELECT USER_NAME
774 FROM FND_USER
775 WHERE USER_ID = fnd_global.user_id; */
776
777 -- Added by Venkatho as part of Bug : 15933691 Start
778 CURSOR fnd_user_csr(p_user_id NUMBER) IS
779 SELECT USER_NAME
780 FROM FND_USER
781 WHERE USER_ID = p_user_id;
782
783 l_user_id NUMBER;
784 -- Added by Venkatho as part of Bug : 15933691 End
785
786 -- Get the valid application id from FND
787
788 CURSOR c_get_app_id_csr IS
789 SELECT APPLICATION_ID
790 FROM FND_APPLICATION
791 WHERE APPLICATION_SHORT_NAME = G_APP_NAME;
792
793
794 CURSOR get_lease_app(lease_app_id IN NUMBER) IS
795 SELECT reference_number FROM
796 OKL_LEASE_APPLICATIONS_B
797 WHERE id= lease_app_id;
798
799 CURSOR get_object_name(l_code IN VARCHAR2) IS
800 SELECT meaning from fnd_lookups where
801 lookup_type='OKL_FRONTEND_OBJECTS' and lookup_code=l_code;
802
803
804 BEGIN
805
806 -- RUN mode
807
808 IF (funcmode = 'RUN') THEN
809
810 -- get the messages and set the messages accordingly depending on the object type
811
812 l_quote_id := wf_engine.GetItemAttrText(itemtype => itemtype,
813 itemkey => itemkey,
814 aname => 'QUOTE_ID');
815
816 -- Start - Added by Venkatho as part of Bug : 15933691
817 l_user_id := wf_engine.GetItemAttrNumber(itemtype => itemtype,
818 itemkey => itemkey,
819 aname => 'USER_ID');
820 -- End - Added by Venkatho as part of Bug : 15933691
821
822 OPEN c_fetch_quote_number(p_quote_id => l_quote_id);
823 FETCH c_fetch_quote_number INTO l_quote_number, l_effective_from, l_effective_to,
824 l_parent_code, l_parent_id;
825 CLOSE c_fetch_quote_number;
826
827 wf_engine.SetItemAttrText (itemtype => itemtype,
828 itemkey => itemkey,
829 aname => 'QUOTE_NUM',
830 avalue => l_quote_number);
831
832 wf_engine.SetItemAttrText (itemtype => itemtype,
833 itemkey => itemkey,
834 aname => 'EFFECTIVE_FROM',
835 avalue => l_effective_from);
836
837 wf_engine.SetItemAttrText (itemtype => itemtype,
838 itemkey => itemkey,
839 aname => 'EFFECTIVE_TO',
840 avalue => l_effective_to);
841
842 IF (l_parent_code = 'LEASEAPP') THEN
843 -- get the lease application details and not the quote details
844 OPEN get_lease_app(l_parent_id);
845 FETCH get_lease_app INTO l_quote_number;
846 CLOSE get_lease_app;
847
848 OPEN get_object_name('LAP');
849 FETCH get_object_name INTO l_object_name;
850 CLOSE get_object_name;
851
852 ELSE
853
854 OPEN get_object_name('LQ');
855 FETCH get_object_name INTO l_object_name;
856 CLOSE get_object_name;
857
858 END IF;
859
860 l_request_message := get_message('OKL_FE_REQUEST_APPROVAL_SUB',
861 l_object_name,
862 l_quote_number);
863 l_approved_message := get_message('OKL_FE_REQUEST_APPROVED_SUB',
864 l_object_name,
865 l_quote_number);
866 l_rejected_message := get_message('OKL_FE_REQUEST_REJECTED_SUB',
867 l_object_name,
868 l_quote_number);
869 l_reminder_message := get_message('OKL_FE_REMINDER_APPROVAL_SUB',
870 l_object_name,
871 l_quote_number);
872 wf_engine.SetItemAttrText(itemtype,
873 itemkey,
874 G_WF_ITM_APP_REQUEST_SUB,
875 l_request_message);
876 wf_engine.SetItemAttrText(itemtype,
877 itemkey,
878 G_WF_ITM_APP_REMINDER_SUB,
879 l_reminder_message);
880 wf_engine.SetItemAttrText(itemtype,
881 itemkey,
882 G_WF_ITM_APP_REMINDER_HEAD,
883 l_reminder_message);
884 wf_engine.SetItemAttrText(itemtype,
885 itemkey,
886 G_WF_ITM_APP_APPROVED_SUB,
887 l_approved_message);
888 wf_engine.SetItemAttrText(itemtype,
889 itemkey,
890 G_WF_ITM_APP_APPROVED_HEAD,
891 l_approved_message);
892 wf_engine.SetItemAttrText(itemtype,
893 itemkey,
894 G_WF_ITM_APP_REJECTED_SUB,
895 l_rejected_message);
896 wf_engine.SetItemAttrText(itemtype,
897 itemkey,
898 G_WF_ITM_APP_REJECTED_HEAD,
899 l_rejected_message);
900 wf_engine.SetItemAttrText(itemtype => itemtype,
901 itemkey => itemkey,
902 aname => G_WF_ITM_MESSAGE_BODY,
903 avalue => 'plsql:okl_lease_quote_workflow_pvt.get_quote_msg_doc/' ||
904 itemkey);
905 wf_engine.SetItemAttrText(itemtype => itemtype,
906 itemkey => itemkey,
907 aname => G_WF_ITM_MESSAGE_DESCR,
908 avalue => get_quote_msg_body(itemtype, itemkey));
909
910
911 -- OPEN fnd_user_csr; -- Commented by venkatho as part of Bug: 15933691
912 OPEN fnd_user_csr(l_user_id); -- Added by venkatho as part of Bug: 15933691
913 FETCH fnd_user_csr INTO l_user_name ;
914 CLOSE fnd_user_csr;
915
916 -- get the application id
917
918 OPEN c_get_app_id_csr;
919 FETCH c_get_app_id_csr INTO l_application_id ;
920 CLOSE c_get_app_id_csr;
921
922 -- set the values of the approver and the requestor
923
924 -- Bug16175322 changes start here
925 l_approver_role:= wf_engine.getItemAttrText(itemtype,
926 itemkey,
927 'APPROVER');
928 IF l_approver_role is null THEN
929 wf_engine.SetItemAttrText(itemtype,
930 itemkey,
931 G_WF_ITM_APPROVER,
932 'SYSADMIN');
933 END IF;
934
935 -- Bug16175322 changes end here
936
937 -- Start APPROVER Attribute code is commented by venkatho as part of Bug: 15933691
938 /* wf_engine.SetItemAttrText(itemtype,
939 itemkey,
940 G_WF_ITM_APPROVER,
941 l_user_name); */
942 -- End APPROVER Attribute code is commented by venkatho as part of Bug: 15933691
943
944 wf_engine.SetItemAttrText(itemtype,
945 itemkey,
946 G_WF_ITM_REQUESTER,
947 l_user_name);
948 wf_engine.SetItemAttrText(itemtype,
949 itemkey,
950 G_WF_ITM_REQUESTER_ID,
951 -- fnd_global.user_id); -- Commented by venkatho as part of Bug: 15933691
952 l_user_id); -- Added by venkatho as part of Bug: 15933691
953 wf_engine.SetItemAttrText(itemtype,
954 itemkey,
955 G_WF_ITM_TRANSACTION_TYPE_ID,
956 itemtype);
957 wf_engine.SetItemAttrText(itemtype,
958 itemkey,
959 G_WF_ITM_TRANSACTION_ID,
960 l_quote_id);
961 wf_engine.SetItemAttrText(itemtype,
962 itemkey,
963 G_WF_ITM_APPLICATION_ID,
964 l_application_id);
965
966 resultout := 'COMPLETE:';
967 END IF;
968
969 -- CANCEL mode
970
971 IF (funcmode = 'CANCEL') THEN
972 resultout := 'COMPLETE:';
973 RETURN;
974 END IF;
975
976 -- TIMEOUT mode
977
978 IF (funcmode = 'TIMEOUT') THEN
979 resultout := 'COMPLETE:';
980 RETURN;
981 END IF;
982
983 EXCEPTION
984 WHEN OTHERS THEN
985 wf_core.context(G_PKG_NAME,
986 l_api_name,
987 itemtype,
988 itemkey,
989 actid,
990 funcmode);
991 RAISE;
992 END populate_quote_attr;
993 ------------------------------------------------------------------------------
994 -- PROCEDURE handle_approval
995 ------------------------------------------------------------------------------
996 -- Start of comments
997 --
998 -- Procedure Name : handle_approval
999 -- Description : this function handles the approval process by changing the status
1000 -- Business Rules : this function handles the approval process by changing the status
1001 -- Parameters :
1002 -- Version : 1.0
1003 -- History : viselvar created
1004 --
1005 -- End of comments
1006 PROCEDURE handle_approval(itemtype IN VARCHAR2,
1007 itemkey IN VARCHAR2,
1008 actid IN NUMBER,
1009 funcmode IN VARCHAR2,
1010 resultout OUT NOCOPY VARCHAR2) IS
1011
1012 l_api_name CONSTANT VARCHAR2(30) := 'handle_approval';
1013
1014 l_quote_id OKL_LEASE_QUOTES_V.ID%TYPE;
1015 l_result VARCHAR2(30);
1016 lv_approval_status_ame VARCHAR2(30);
1017 l_flag NUMBER;
1018
1019 lx_return_status VARCHAR2(1);
1020 l_parent_object VARCHAR2(30);
1021 l_parent_id NUMBER;
1022 x_msg_count NUMBER;
1023 x_msg_data VARCHAR2(4000);
1024
1025 --BUG 4951955 PAGARG Added cursor to obtain Lease App current status
1026 CURSOR lse_app_dtls_csr(cp_lap_id NUMBER)
1027 IS
1028 SELECT LAP.REFERENCE_NUMBER
1029 , LAP.APPLICATION_STATUS
1030 FROM OKL_LEASE_APPLICATIONS_B LAP
1031 WHERE LAP.ID = cp_lap_id;
1032 lse_app_dtls_rec lse_app_dtls_csr%ROWTYPE;
1033 BEGIN
1034
1035 IF (funcmode = 'RUN') THEN
1036 l_result := wf_engine.GetItemAttrText(itemtype, itemkey, 'RESULT');
1037 lv_approval_status_ame := wf_engine.GetItemAttrText(itemtype => itemtype,
1038 itemkey => itemkey,
1039 aname => 'APPROVED_YN');
1040
1041 l_quote_id := wf_engine.GetItemAttrText(itemtype => itemtype,
1042 itemkey => itemkey,
1043 aname => 'QUOTE_ID');
1044
1045 OPEN get_parent_object(l_quote_id);
1046 FETCH get_parent_object INTO l_parent_object, l_parent_id;
1047 CLOSE get_parent_object;
1048
1049 --BUG 4951955 PAGARG If parent object is Lease App then obtain the status.
1050 --If status is Pricing Submitted then set the flag as 1
1051 --If parent object is other than Lease App then set the flag as 1
1052 l_flag := 0;
1053 IF l_parent_object = 'LEASEAPP'
1054 THEN
1055 OPEN lse_app_dtls_csr(l_parent_id);
1056 FETCH lse_app_dtls_csr INTO lse_app_dtls_rec;
1057 CLOSE lse_app_dtls_csr;
1058 IF lse_app_dtls_rec.application_status = 'PR-SUBMITTED'
1059 THEN
1060 l_flag := 1;
1061 END IF;
1062 ELSE
1063 l_flag := 1;
1064 END IF;
1065
1066 -- if approved, then change the status
1067 IF (l_result = G_WF_ITM_APPROVED_YN_YES OR lv_approval_status_ame = 'Y') THEN
1068 IF(l_flag = 1)
1069 THEN
1070 change_quote_status(p_quote_id => l_quote_id,
1071 p_qte_status => 'PR-APPROVED',
1072 x_return_status => lx_return_status);
1073 END IF;
1074
1075 IF lx_return_status = OKL_API.G_RET_STS_UNEXP_ERROR THEN
1076 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1077 ELSIF lx_return_status = G_RET_STS_ERROR THEN
1078 RAISE OKL_API.G_EXCEPTION_ERROR;
1079 END IF;
1080
1081 --BUG 4951955 PAGARG Update Lease App status only if current status is
1082 --Pricing Submitted
1083 IF(l_parent_object = 'LEASEAPP'
1084 AND lse_app_dtls_rec.application_status = 'PR-SUBMITTED')
1085 THEN
1086 -- update the status of the lease application to Pricing approved
1087 OKL_LEASE_APP_PVT.SET_LEASE_APP_STATUS(
1088 p_api_version => 1.0
1089 ,p_init_msg_list => OKL_API.G_FALSE
1090 ,p_lap_id => l_parent_id
1091 ,p_lap_status => 'PR-APPROVED'
1092 ,x_return_status => lx_return_status
1093 ,x_msg_count => x_msg_count
1094 ,x_msg_data => x_msg_data);
1095
1096 IF(lx_return_status = OKL_API.G_RET_STS_UNEXP_ERROR)THEN
1097 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1098 ELSIF (lx_return_status = OKL_API.G_RET_STS_ERROR)THEN
1099 RAISE OKL_API.G_EXCEPTION_ERROR;
1100 END IF;
1101 END IF;
1102 ELSE
1103 IF(l_flag = 1)
1104 THEN
1105 change_quote_status(p_quote_id => l_quote_id,
1106 p_qte_status => 'PR-REJECTED',
1107 x_return_status => lx_return_status);
1108 END IF;
1109
1110 IF lx_return_status = OKL_API.G_RET_STS_UNEXP_ERROR THEN
1111 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1112 ELSIF lx_return_status = G_RET_STS_ERROR THEN
1113 RAISE OKL_API.G_EXCEPTION_ERROR;
1114 END IF;
1115
1116 --BUG 4951955 PAGARG Update Lease App status only if current status is
1117 --Pricing Submitted
1118 IF(l_parent_object = 'LEASEAPP'
1119 AND lse_app_dtls_rec.application_status = 'PR-SUBMITTED')
1120 THEN
1121 -- update the status of the lease application to Pricing Rejected
1122 OKL_LEASE_APP_PVT.SET_LEASE_APP_STATUS(
1123 p_api_version => 1.0
1124 ,p_init_msg_list => OKL_API.G_FALSE
1125 ,p_lap_id => l_parent_id
1126 ,p_lap_status => 'PR-REJECTED'
1127 ,x_return_status => lx_return_status
1128 ,x_msg_count => x_msg_count
1129 ,x_msg_data => x_msg_data);
1130
1131 IF(lx_return_status = OKL_API.G_RET_STS_UNEXP_ERROR)THEN
1132 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1133 ELSIF (lx_return_status = OKL_API.G_RET_STS_ERROR)THEN
1134 RAISE OKL_API.G_EXCEPTION_ERROR;
1135 END IF;
1136 END IF;
1137 END IF;
1138
1139 resultout := 'COMPLETE:';
1140 RETURN;
1141
1142 END IF;
1143
1144 -- CANCEL mode
1145 IF (funcmode = 'CANCEL') then
1146 resultout := 'COMPLETE:';
1147 RETURN;
1148 END IF;
1149 -- TIMEOUT mode
1150 IF (funcmode = 'TIMEOUT') then
1151 resultout := 'COMPLETE:';
1152 RETURN;
1153 END IF;
1154
1155 EXCEPTION
1156 WHEN OKL_API.G_EXCEPTION_ERROR THEN
1157 --Lease Quote Parent Object Cursor
1158 IF get_parent_object%ISOPEN
1159 THEN
1160 CLOSE get_parent_object;
1161 END IF;
1162 --Lease App Details Cursor
1163 IF lse_app_dtls_csr%ISOPEN
1164 THEN
1165 CLOSE lse_app_dtls_csr;
1166 END IF;
1167 wf_core.context(G_PKG_NAME, l_api_name, itemtype, itemkey, actid, funcmode);
1168 RAISE;
1169
1170 WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1171 --Lease Quote Parent Object Cursor
1172 IF get_parent_object%ISOPEN
1173 THEN
1174 CLOSE get_parent_object;
1175 END IF;
1176 --Lease App Details Cursor
1177 IF lse_app_dtls_csr%ISOPEN
1178 THEN
1179 CLOSE lse_app_dtls_csr;
1180 END IF;
1181 wf_core.context(G_PKG_NAME, l_api_name, itemtype, itemkey, actid, funcmode);
1182 RAISE;
1183
1184 WHEN OTHERS THEN
1185 --Lease Quote Parent Object Cursor
1186 IF get_parent_object%ISOPEN
1187 THEN
1188 CLOSE get_parent_object;
1189 END IF;
1190 --Lease App Details Cursor
1191 IF lse_app_dtls_csr%ISOPEN
1192 THEN
1193 CLOSE lse_app_dtls_csr;
1194 END IF;
1195 OKL_API.SET_MESSAGE (p_app_name => G_APP_NAME,
1196 p_msg_name => G_UNEXPECTED_ERROR,
1197 p_token1 => G_SQLCODE_TOKEN,
1198 p_token1_value => sqlcode,
1199 p_token2 => G_SQLERRM_TOKEN,
1200 p_token2_value => sqlerrm);
1201
1202 wf_core.context(G_PKG_NAME, l_api_name, itemtype, itemkey, actid, funcmode);
1203 RAISE;
1204
1205 END handle_approval;
1206 -- Bug 4741121 viselvar Modified End
1207
1208 END OKL_LEASE_QUOTE_WORKFLOW_PVT;