[Home] [Help]
PACKAGE BODY: APPS.OKC_OC_INT_PUB
Source
1 PACKAGE BODY OKC_OC_INT_PUB AS
2 /* $Header: OKCPORDB.pls 120.1 2005/12/13 03:07:29 npalepu noship $ */
3 l_debug VARCHAR2(1) := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'),'N');
4
5 -------------------------------------------------------------------------------
6 --
7 -- global package structures
8 --
9 -------------------------------------------------------------------------------
10 --
11 -- global constants
12 --
13 G_EXCEPTION_HALT_VALIDATION EXCEPTION;
14 G_UNEXPECTED_ERROR CONSTANT VARCHAR2(200) := 'OKC_CONTRACTS_UNEXP_ERROR';
15 G_SQLCODE_TOKEN CONSTANT VARCHAR2(200) := 'SQLCODE';
16 G_SQLERRM_TOKEN CONSTANT VARCHAR2(200) := 'SQLERRM';
17 G_PKG_NAME CONSTANT VARCHAR2(200) := 'OKC_OC_INT_PUB';
18 G_APP_NAME CONSTANT VARCHAR2(3) := OKC_API.G_APP_NAME;
19 G_FND_APP CONSTANT VARCHAR2(200) := OKC_API.G_FND_APP;
20 G_FORM_UNABLE_TO_RESERVE_REC CONSTANT VARCHAR2(200) := OKC_API.G_FORM_UNABLE_TO_RESERVE_REC;
21 G_API_TYPE VARCHAR2(30) := '_PROCESS';
22
23 L_LOG_ENABLED VARCHAR2(200);
24
25 -------------------------------------------------------------------------------
26 --
27 -- APIs: K->Q
28 --
29 -------------------------------------------------------------------------------
30 --
31 -- Procedure: create_quote_for_renewal
32 -- Version: 1.0
33 -- Purpose: Create a quote from a contract.
34 -- This API is used in the outcome queue.
35 -- This will be a wrapper for create_quote_from_k
36 -- procedure described bellow
37
38 PROCEDURE create_quote_for_renewal(p_init_msg_list IN VARCHAR2
39 ,x_return_status OUT NOCOPY VARCHAR2
40 ,x_msg_count OUT NOCOPY NUMBER
41 ,x_msg_data OUT NOCOPY VARCHAR2
42 ,p_contract_id IN OKC_K_HEADERS_B.ID%TYPE
43 ,p_trace_mode IN VARCHAR2
44 ) IS
45
46 l_api_version CONSTANT NUMBER := 1;
47 l_rel_type OKC_K_REL_OBJS.rty_code%TYPE:=OKC_OC_INT_KTQ_PVT.g_rlt_cod_qrk;
48 lx_quote_id okx_quote_headers_v.id1%TYPE;
49
50 BEGIN
51 --
52 -- call full version of create_quote_from_k
53 --
54 OKC_OC_INT_PUB.create_quote_from_k(p_api_version => l_api_version
55 ,p_init_msg_list => OKC_API.G_TRUE
56 ,p_commit => OKC_API.G_TRUE
57 ,x_return_status => x_return_status
58 ,x_msg_count => x_msg_count
59 ,x_msg_data => x_msg_data
60 --
61 ,p_contract_id => p_contract_id
62 ,p_rel_type => l_rel_type
63 --
64 ,p_trace_mode => p_trace_mode
65 ,x_quote_id => lx_quote_id);
66
67 -- no need to check for errors, message stack should be set,
68 -- nothing to return to caller
69 END create_quote_for_renewal;
70
71 -------------------------------------------------------------------------------
72
73 -- Procedure: create_quote_from_k
74 -- Version: 1.0
75 -- Purpose: Create a quote from a contract.
76 -- This API is used in a concurrent program definition
77 -- This will be a wrapper for create_quote_from_k
78 -- procedure described bellow
79
80 PROCEDURE create_quote_from_k(ERRBUF OUT NOCOPY VARCHAR2
81 ,RETCODE OUT NOCOPY NUMBER
82 --
83 ,p_contract_category IN OKC_K_HEADERS_B.SCS_CODE%TYPE
84 ,p_contract_number IN OKC_K_HEADERS_B.ID%TYPE
85 -- Contains in fact the contract ID
86 ,p_rel_type IN FND_LOOKUPS.LOOKUP_CODE%TYPE
87 ,p_trace_mode IN VARCHAR2
88 ) IS
89
90 l_api_version CONSTANT NUMBER := 1;
91 lx_quote_id okx_quote_headers_v.id1%TYPE := NULL;
92 lx_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
93 lx_msg_count NUMBER := 0;
94 lx_msg_data VARCHAR2(2000);
95 l_trace_mode VARCHAR2(1) := OKC_API.G_TRUE;
96
97 BEGIN
98 --
99 -- call full version of create_quote_from_k
100 --
101 IF p_trace_mode = OKC_API.G_MISS_CHAR OR p_trace_mode IS NULL THEN
102 l_trace_mode:=OKC_API.G_TRUE;
103 ELSE
104 l_trace_mode:=p_trace_mode;
105 END IF;
106 OKC_OC_INT_PUB.create_quote_from_k(p_api_version => l_api_version
107 ,p_init_msg_list => OKC_API.G_TRUE
108 ,p_commit => OKC_API.G_TRUE
109 ,x_return_status => lx_return_status
110 ,x_msg_count => lx_msg_count
111 ,x_msg_data => lx_msg_data
112 --
113 ,p_contract_id => p_contract_number
114 ,p_rel_type => p_rel_type
115 --
116 ,p_trace_mode => l_trace_mode
117 ,x_quote_id => lx_quote_id);
118
119 -- no need to check for errors, message stack should be set,
120 -- nothing to return to caller
121 IF lx_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
122 IF lx_quote_id IS NULL THEN
123 RETCODE := 2;
124 ELSE
125 RETCODE := 1;
126 END IF;
127 ELSE
128 RETCODE:=0;
129 END IF;
130 ERRBUF:=lx_msg_data;
131 END create_quote_from_k;
132
133 --
134 -- full version of the procedure to create a quote from a contract
135 --
136
137 PROCEDURE create_quote_from_k(p_api_version IN NUMBER
138 ,p_init_msg_list IN VARCHAR2
139 ,p_commit IN VARCHAR2
140 ,x_return_status OUT NOCOPY VARCHAR2
141 ,x_msg_count OUT NOCOPY NUMBER
142 ,x_msg_data OUT NOCOPY VARCHAR2
143 --
144 ,p_contract_id IN OKC_K_HEADERS_B.ID%TYPE
145 ,p_rel_type IN OKC_K_REL_OBJS.rty_code%TYPE
146 --
147 ,p_trace_mode IN VARCHAR2
148 ,x_quote_id OUT NOCOPY okx_quote_headers_v.id1%TYPE
149 ) IS
150
151 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_Q_FROM_K';
152 l_api_version CONSTANT NUMBER := 1;
153 lx_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
154 lx_msg_count NUMBER := 0;
155 lx_msg_data VARCHAR2(2000);
156 l_trace_mode VARCHAR2(1);
157
158 BEGIN
159 -- call START_ACTIVITY to create savepoint, check compatibility
160 -- and initialize message list
161 lx_return_status := OKC_API.START_ACTIVITY(
162 p_api_name => l_api_name,
163 p_pkg_name => g_pkg_name,
164 p_init_msg_list => p_init_msg_list,
165 l_api_version => l_api_version,
166 p_api_version => p_api_version,
167 p_api_type => g_api_type,
168 x_return_status => lx_return_status);
169
170 -- check if activity started successfully
171 IF (lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
172 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
173 ELSIF (lx_return_status = OKC_API.G_RET_STS_ERROR) THEN
174 RAISE OKC_API.G_EXCEPTION_ERROR;
175 END IF;
176
177 -- call before user hooks
178 null;
179
180 -- trace mode initialization turned ON
181 IF p_trace_mode = okc_api.g_true OR
182 FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y' OR
183 p_trace_mode = okc_oc_int_ktq_pvt.g_support THEN
184 l_trace_mode := okc_api.g_true;
185 okc_util.init_trace;
186 ELSE
187 -- Bug 2234902
188 okc_util.set_trace_context(FND_GLOBAL.conc_request_id, lx_return_status);
189 okc_util.l_output_flag :=TRUE;
190 lx_return_status := OKC_API.G_RET_STS_SUCCESS;
191 -- End Bug 2234902
192 l_trace_mode := okc_api.g_false;
193 END IF;
194
195 -- call the main routine
196 OKC_OC_INT_KTQ_PVT.create_quote_from_k(p_api_version => l_api_version
197 ,p_init_msg_list => OKC_API.G_FALSE
198 ,x_return_status => lx_return_status
199 ,x_msg_count => lx_msg_count
200 ,x_msg_data => lx_msg_data
201 --
202 ,p_contract_id => p_contract_id
203 ,p_rel_type => p_rel_type
204 --
205 ,p_trace_mode => l_trace_mode
206 ,x_quote_id => x_quote_id
207 );
208
209 -- trace mode initialization turned OFF
210 IF l_trace_mode = okc_api.g_true OR FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y' THEN
211 okc_util.stop_trace;
212 END IF;
213
214 -- check return status
215 IF lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
216 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
217 ELSIF lx_return_status = OKC_API.G_RET_STS_ERROR THEN
218 RAISE OKC_API.G_EXCEPTION_ERROR;
219 END IF;
220
221 -- call AFTER user hook
222 null;
223
224 -- if we got this far, then we are successful
225 IF p_trace_mode <> okc_oc_int_ktq_pvt.g_support OR
226 p_trace_mode IS NULL THEN
227 IF p_commit = OKC_API.G_TRUE THEN
228 COMMIT;
229 END IF;
230 END IF;
231
232
233 -- end activity
234 OKC_API.END_ACTIVITY( x_msg_count => lx_msg_count,
235 x_msg_data => lx_msg_data);
236
237 x_return_status := lx_return_status;
238 x_msg_count := lx_msg_count;
239 x_msg_data := lx_msg_data;
240
241 EXCEPTION
242 when OKC_API.G_EXCEPTION_ERROR then
243 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
244 p_api_name => l_api_name,
245 p_pkg_name => g_pkg_name,
246 p_exc_name => 'OKC_API.G_RET_STS_ERROR',
247 x_msg_count => x_msg_count,
248 x_msg_data => x_msg_data,
249 p_api_type => g_api_type);
250
251 when OKC_API.G_EXCEPTION_UNEXPECTED_ERROR then
252 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
253 p_api_name => l_api_name,
254 p_pkg_name => g_pkg_name,
255 p_exc_name => 'OKC_API.G_RET_STS_UNEXP_ERROR',
256 x_msg_count => x_msg_count,
257 x_msg_data => x_msg_data,
258 p_api_type => g_api_type);
259
260 when OTHERS then
261 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
262 p_api_name => l_api_name,
263 p_pkg_name => g_pkg_name,
264 p_exc_name => 'OTHERS',
265 x_msg_count => x_msg_count,
266 x_msg_data => x_msg_data,
267 p_api_type => g_api_type);
268
269 END create_quote_from_k;
270
271 -------------------------------------------------------------------------------
272 -- Procedure: update_quote_from_k
273 -- Version: 1.0
274 -- Purpose: update a quote from a contract.
275 -- This API is used in a concurrent program definition
276 -- This will be a wrapper for update_quote_from_k
277 -- procedure described below
278
279 PROCEDURE update_quote_from_k(ERRBUF OUT NOCOPY VARCHAR2
280 ,RETCODE OUT NOCOPY NUMBER
281 --
282 ,p_contract_number IN OKC_K_HEADERS_B.ID%TYPE
283 -- p_contract_number is in fact equal to contract ID
284 --
285 ,p_quote_number IN OKX_QUOTE_HEADERS_V.ID1%TYPE
286 -- p_quote_number is in fact equal to quote ID
287 --
288 ,p_trace_mode IN VARCHAR2
289
290 ) IS
291
292 l_api_version CONSTANT NUMBER := 1;
293 l_trace_mode VARCHAR2(1) := OKC_API.G_TRUE;
294 --
295 lx_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
296 lx_msg_count NUMBER := 0;
297 lx_msg_data VARCHAR2(2000);
298
299 BEGIN
300 --
301 -- call full version of update_quote_from_k
302 --
303 IF p_trace_mode = OKC_API.G_MISS_CHAR OR p_trace_mode IS NULL THEN
304 l_trace_mode:=OKC_API.G_TRUE;
305 ELSE
306 l_trace_mode:=p_trace_mode;
307 END IF;
308 OKC_OC_INT_PUB.update_quote_from_k(p_api_version => l_api_version
309 ,p_init_msg_list => OKC_API.G_FALSE
310 ,p_commit => OKC_API.G_FALSE
311 --
312 ,p_quote_id => p_quote_number
313 ,p_contract_id => p_contract_number
314 --
315 ,p_trace_mode => l_trace_mode
316 --
317 ,x_return_status => lx_return_status
318 ,x_msg_count => lx_msg_count
319 ,x_msg_data => lx_msg_data );
320
321
322 -- no need to check for errors, message stack should be set,
323 -- nothing to return to caller
324 IF lx_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
325 -- IF lx_quote_id IS NULL THEN
326 -- RETCODE := 2;
327 -- ELSE
328 -- RETCODE := 1;
329 -- END IF;
330 RETCODE := 2;
331 ELSE
332 RETCODE:=0;
333 END IF;
334 ERRBUF:=lx_msg_data;
335 END update_quote_from_k;
336
337 --
338 -- full version of the procedure to update a quote from a contract
339 --
340
341 PROCEDURE update_quote_from_k(p_api_version IN NUMBER
342 ,p_init_msg_list IN VARCHAR2
343 ,p_commit IN VARCHAR2
344 --
345 ,p_quote_id IN OKX_QUOTE_HEADERS_V.id1%TYPE
346 ,p_contract_id IN OKC_K_HEADERS_B.ID%TYPE
347 --
348 ,p_trace_mode IN VARCHAR2
349 --
350 ,x_return_status OUT NOCOPY VARCHAR2
351 ,x_msg_count OUT NOCOPY NUMBER
352 ,x_msg_data OUT NOCOPY VARCHAR2
353 ) IS
354
355 l_api_name CONSTANT VARCHAR2(30) := 'UPDATE_Q_FROM_K';
356 l_api_version CONSTANT NUMBER := 1;
357 l_trace_mode VARCHAR2(1);
358 --
359 lx_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
360 lx_msg_count NUMBER := 0;
361 lx_msg_data VARCHAR2(2000);
362
363 BEGIN
364
365 NULL;
366
367 /* ----------- COMMENTING THE FOLLWOING SECTION OF CODE --------------------
368 ** This API is desupported following marcio's disccussion with Tony Goughan
369 ** and Srini( Istore Director ). This feature cannot be delivered because
370 ** iStore team could not deliver the required functionality to support the
371 ** Business Flows( Update Quote API's were not ready.., Quote Status model
372 ** was not ready etc..)
373 ** Also it was agreed that this peice of code would be owned by iStore team
374 ** if at a later date we had to support business flow that requires updating
375 ** quote from a contract..
376 ** Date: 09/13/2001
377 ** -- call START_ACTIVITY to create savepoint, check compatibility
378 ** -- and initialize message list
379 ** lx_return_status := OKC_API.START_ACTIVITY(
380 ** p_api_name => l_api_name,
381 ** p_pkg_name => g_pkg_name,
382 ** p_init_msg_list => p_init_msg_list,
383 ** l_api_version => l_api_version,
384 ** p_api_version => p_api_version,
385 ** p_api_type => g_api_type,
386 ** x_return_status => lx_return_status);
387 **
388 ** -- check if activity started successfully
389 ** IF (lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
390 ** RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
391 ** ELSIF (lx_return_status = OKC_API.G_RET_STS_ERROR) THEN
392 ** RAISE OKC_API.G_EXCEPTION_ERROR;
393 ** END IF;
394 **
395 ** -- call before user hooks
396 ** null;
397 **
398 ** -- trace mode initialization turned ON
399 ** IF p_trace_mode = okc_api.g_true OR
400 ** FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y' OR
401 ** p_trace_mode = okc_oc_int_ktq_pvt.g_support THEN
402 ** l_trace_mode := okc_api.g_true;
403 ** okc_util.init_trace;
404 ** ELSE
405 ** l_trace_mode := okc_api.g_false;
406 ** END IF;
407 **
408 ** -- call the main routine
409 ** OKC_OC_INT_KTQ_PVT.update_quote_from_k(
410 ** p_api_version => l_api_version
411 ** ,p_init_msg_list => OKC_API.G_FALSE
412 ** --
413 ** ,p_quote_id => p_quote_id
414 ** ,p_contract_id => p_contract_id
415 ** --
416 ** ,p_trace_mode => l_trace_mode
417 ** --
418 ** ,x_return_status => lx_return_status
419 ** ,x_msg_count => lx_msg_count
420 ** ,x_msg_data => lx_msg_data );
421 **
422 ** -- trace mode initialization turned OFF
423 ** IF l_trace_mode = okc_api.g_true OR FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y' THEN
424 ** okc_util.stop_trace;
425 ** END IF;
426 **
427 ** -- check return status
428 ** IF lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
429 ** RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
430 ** ELSIF lx_return_status = OKC_API.G_RET_STS_ERROR THEN
431 ** RAISE OKC_API.G_EXCEPTION_ERROR;
432 ** END IF;
433 **
434 ** -- call AFTER user hook
435 ** null;
436 **
437 ** -- if we got this far, then we are successful
438 ** IF p_trace_mode <> okc_oc_int_ktq_pvt.g_support OR
439 ** p_trace_mode IS NULL THEN
440 ** IF p_commit = OKC_API.G_TRUE THEN
441 ** COMMIT;
442 ** END IF;
443 ** END IF;
444 **
445 **
446 ** -- end activity
447 ** OKC_API.END_ACTIVITY( x_msg_count => lx_msg_count,
448 ** x_msg_data => lx_msg_data);
449 **
450 */
451 x_return_status := lx_return_status;
452 x_msg_count := lx_msg_count;
453 x_msg_data := lx_msg_data;
454
455 EXCEPTION
456 when OKC_API.G_EXCEPTION_ERROR then
457 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
458 p_api_name => l_api_name,
459 p_pkg_name => g_pkg_name,
460 p_exc_name => 'OKC_API.G_RET_STS_ERROR',
461 x_msg_count => x_msg_count,
462 x_msg_data => x_msg_data,
463 p_api_type => g_api_type);
464
465 when OKC_API.G_EXCEPTION_UNEXPECTED_ERROR then
466 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
467 p_api_name => l_api_name,
468 p_pkg_name => g_pkg_name,
469 p_exc_name => 'OKC_API.G_RET_STS_UNEXP_ERROR',
470 x_msg_count => x_msg_count,
471 x_msg_data => x_msg_data,
472 p_api_type => g_api_type);
473
474 when OTHERS then
475 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
476 p_api_name => l_api_name,
477 p_pkg_name => g_pkg_name,
478 p_exc_name => 'OTHERS',
479 x_msg_count => x_msg_count,
480 x_msg_data => x_msg_data,
481 p_api_type => g_api_type);
482
483 END update_quote_from_k;
484
485 -------------------------------------------------------------------------------
486 --
487 -- APIs: K->O
488 --
489 -------------------------------------------------------------------------------
490
491 -- Procedure: create_order_from_k
492 -- Version: 1.0
493 -- Purpose: Create an order from a contract.
494 -- This API is used in a concurrent program definition
495 -- This will be a wrapper for create_order_from_k
496 -- procedure described above
497
498
499 PROCEDURE create_order_from_k(ERRBUF OUT NOCOPY VARCHAR2
500 ,RETCODE OUT NOCOPY NUMBER
501 --
502 ,p_contract_category IN OKC_K_HEADERS_B.SCS_CODE%TYPE
503 ,p_contract_number IN OKC_K_HEADERS_B.ID%TYPE
504 -- Contains in fact the contract ID
505 ,p_rel_type IN FND_LOOKUPS.LOOKUP_CODE%TYPE
506 ,p_trace_mode IN VARCHAR2
507 ) IS
508
509 l_api_version CONSTANT NUMBER := 1;
510 lx_order_id okx_order_headers_v.id1%TYPE := NULL;
511 lx_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
512 lx_msg_count NUMBER := 0;
513 lx_msg_data VARCHAR2(2000);
514 l_trace_mode VARCHAR2(1) := OKC_API.G_TRUE;
515
516 BEGIN
517 --
518 -- call full version of create_order_from_k
519 --
520 IF p_trace_mode = OKC_API.G_MISS_CHAR OR p_trace_mode IS NULL THEN
521 l_trace_mode:=OKC_API.G_TRUE;
522 ELSE
523 l_trace_mode:=p_trace_mode;
524 END IF;
525 OKC_OC_INT_PUB.create_order_from_k(p_api_version => l_api_version
526 ,p_init_msg_list => OKC_API.G_TRUE
527 ,p_commit => OKC_API.G_TRUE
528 ,x_return_status => lx_return_status
529 ,x_msg_count => lx_msg_count
530 ,x_msg_data => lx_msg_data
531 --
532 ,p_contract_id => p_contract_number
533 ,p_rel_type => p_rel_type
534 --
535 ,p_trace_mode => l_trace_mode
536 ,x_order_id => lx_order_id);
537
538 -- no need to check for errors, message stack should be set,
539 -- nothing to return to caller
540 IF lx_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
541 IF lx_order_id IS NULL THEN
542 RETCODE := 2;
543 ELSE
544 RETCODE := 1;
545 END IF;
546 ELSE
547 RETCODE:=0;
548 END IF;
549 ERRBUF:=lx_msg_data;
550 END create_order_from_k;
551
552 --
553 -- full version of the procedure to create an order from a contract
554 --
555
556 PROCEDURE create_order_from_k(p_api_version IN NUMBER
557 ,p_init_msg_list IN VARCHAR2
558 ,p_commit IN VARCHAR2
559 ,x_return_status OUT NOCOPY VARCHAR2
560 ,x_msg_count OUT NOCOPY NUMBER
561 ,x_msg_data OUT NOCOPY VARCHAR2
562 --
563 ,p_contract_id IN OKC_K_HEADERS_B.ID%TYPE
564 ,p_rel_type IN OKC_K_REL_OBJS.rty_code%TYPE
565 --
566 ,p_trace_mode IN VARCHAR2
567 ,x_order_id OUT NOCOPY okx_order_headers_v.id1%TYPE
568 ) IS
569
570 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_O_FROM_K';
571 l_api_version CONSTANT NUMBER := 1;
572 lx_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
573 lx_msg_count NUMBER := 0;
574 lx_msg_data VARCHAR2(2000);
575 l_trace_mode VARCHAR2(1);
576
577 BEGIN
578 -- call START_ACTIVITY to create savepoint, check compatibility
579 -- and initialize message list
580 lx_return_status := OKC_API.START_ACTIVITY(
581 p_api_name => l_api_name,
582 p_pkg_name => g_pkg_name,
583 p_init_msg_list => p_init_msg_list,
584 l_api_version => l_api_version,
585 p_api_version => p_api_version,
586 p_api_type => g_api_type,
587 x_return_status => lx_return_status);
588
589 -- check if activity started successfully
590 IF (lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
591 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
592 ELSIF (lx_return_status = OKC_API.G_RET_STS_ERROR) THEN
593 RAISE OKC_API.G_EXCEPTION_ERROR;
594 END IF;
595
596 -- call before user hooks
597 null;
598
599 -- trace mode initialization turned ON
600 IF p_trace_mode = okc_api.g_true OR
601 FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y' OR
602 p_trace_mode = okc_oc_int_ktq_pvt.g_support THEN
603 l_trace_mode := okc_api.g_true;
604 okc_util.init_trace;
605 ELSE
606 -- Bug 2234902
607 okc_util.set_trace_context(FND_GLOBAL.conc_request_id, lx_return_status);
608 okc_util.l_output_flag :=TRUE;
609 lx_return_status := OKC_API.G_RET_STS_SUCCESS;
610 -- End Bug 2234902
611 l_trace_mode := okc_api.g_false;
612 END IF;
613
614 -- call the main routine
615 OKC_OC_INT_KTO_PVT.create_order_from_k(p_api_version => l_api_version
616 ,p_init_msg_list => OKC_API.G_FALSE
617 ,x_return_status => lx_return_status
618 ,x_msg_count => lx_msg_count
619 ,x_msg_data => lx_msg_data
620 --
621 ,p_contract_id => p_contract_id
622 ,p_rel_type => p_rel_type
623 --
624 ,p_trace_mode => l_trace_mode
625 ,x_order_id => x_order_id
626 );
627
628 -- trace mode initialization turned OFF
629 IF l_trace_mode = okc_api.g_true OR FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y' THEN
630 okc_util.stop_trace;
631 END IF;
632
633 -- check return status
634 IF lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
635 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
636 ELSIF lx_return_status = OKC_API.G_RET_STS_ERROR THEN
637 RAISE OKC_API.G_EXCEPTION_ERROR;
638 END IF;
639
640 -- call AFTER user hook
641 null;
642
643 -- if we got this far, then we are successful
644 IF p_trace_mode <> okc_oc_int_ktq_pvt.g_support OR
645 p_trace_mode IS NULL THEN
646 IF p_commit = OKC_API.G_TRUE THEN
647 COMMIT;
648 END IF;
649 END IF;
650
651
652 -- end activity
653 OKC_API.END_ACTIVITY( x_msg_count => lx_msg_count,
654 x_msg_data => lx_msg_data);
655
656 x_return_status := lx_return_status;
657 x_msg_count := lx_msg_count;
658 x_msg_data := lx_msg_data;
659
660 EXCEPTION
661 when OKC_API.G_EXCEPTION_ERROR then
662 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
663 p_api_name => l_api_name,
664 p_pkg_name => g_pkg_name,
665 p_exc_name => 'OKC_API.G_RET_STS_ERROR',
666 x_msg_count => x_msg_count,
667 x_msg_data => x_msg_data,
668 p_api_type => g_api_type);
669
670 when OKC_API.G_EXCEPTION_UNEXPECTED_ERROR then
671 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
672 p_api_name => l_api_name,
673 p_pkg_name => g_pkg_name,
674 p_exc_name => 'OKC_API.G_RET_STS_UNEXP_ERROR',
675 x_msg_count => x_msg_count,
676 x_msg_data => x_msg_data,
677 p_api_type => g_api_type);
678
679 when OTHERS then
680 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
681 p_api_name => l_api_name,
682 p_pkg_name => g_pkg_name,
683 p_exc_name => 'OTHERS',
684 x_msg_count => x_msg_count,
685 x_msg_data => x_msg_data,
686 p_api_type => g_api_type);
687 END create_order_from_k;
688
689
690 -------------------------------------------------------------------------------
691 --
692 -- APIs: Q->K
693 --
694 -------------------------------------------------------------------------------
695
696 -- Procedure: create_k_from_quote
697 -- Version: 1.0
698 -- Purpose: Create a contract from a quote.
699 -- This will be a wrapper for create_k_from_quote
700 -- procedure, created for running it as a conc prog.
701
702 -- Bug : 1686001 Changed references to ASO_QUOTE_HEADERS_ALL.QUOTE_HEADER_ID to OKX_QUOTE_HEADERS_V.ID1
703 PROCEDURE create_k_from_quote(ERRBUF OUT NOCOPY VARCHAR2
704 ,RETCODE OUT NOCOPY NUMBER
705 ,p_quote_id IN OKX_QUOTE_HEADERS_V.ID1%TYPE
706 ,p_contract_category IN OKC_K_HEADERS_B.SCS_CODE%TYPE
707 ,p_template_id IN OKC_K_HEADERS_B.ID%TYPE
708 ,p_template_version IN NUMBER
709 ,p_rel_type IN FND_LOOKUPS.LOOKUP_CODE%TYPE
710 ,p_trace_mode IN VARCHAR2
711 ) IS
712
713 l_api_version CONSTANT NUMBER := 1;
714 lx_contract_id okc_k_headers_b.id%TYPE := NULL;
715 lx_contract_number VARCHAR2(1000) := NULL;
716 lx_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
717 lx_msg_count NUMBER := 0;
718 lx_msg_data VARCHAR2(2000);
719 l_trace_mode VARCHAR2(1) := OKC_API.G_TRUE;
720
721 BEGIN
722 --
723 -- call full version of create_quote_from_k
724 --
725 IF p_trace_mode = OKC_API.G_MISS_CHAR OR p_trace_mode IS NULL THEN
726 l_trace_mode:=OKC_API.G_TRUE;
727 ELSE
728 l_trace_mode:=p_trace_mode;
729 END IF;
730 OKC_OC_INT_PUB.create_k_from_quote(p_api_version => l_api_version
731 ,p_init_msg_list => OKC_API.G_TRUE
732 ,p_commit => OKC_API.G_TRUE
733 ,p_quote_id => p_quote_id
734 ,p_template_id => p_template_id
735 ,p_template_version => p_template_version
736 ,p_rel_type => p_rel_type
737 ,p_terms_agreed_flag => OKC_API.G_FALSE
738 ,p_trace_mode => l_trace_mode
739 ,x_contract_id => lx_contract_id
740 ,x_contract_number => lx_contract_number
741 ,x_return_status => lx_return_status
742 ,x_msg_count => lx_msg_count
743 ,x_msg_data => lx_msg_data);
744
745 -- no need to check for errors, message stack should be set,
746 -- nothing to return to caller
747 IF lx_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
748 IF lx_contract_id IS NULL THEN
749 RETCODE := 2;
750 ELSE
751 RETCODE := 1;
752 END IF;
753 ELSE
754 RETCODE:=0;
755 END IF;
756 ERRBUF:=lx_msg_data;
757 END create_k_from_quote;
758
759 -- Procedure: create_k_from_quote
760 -- Version: 1.0
761 -- Purpose: Create a contract from a quote.
762 -- Provides process 3.2.2 in data flow diagram in HLD.
763 -- Create relationships from quote to contract
764 -- In Parameters: p_quote_id Quote for which to create contract
765 -- p_template_id Template contract to use in creating contract
766 -- Out Parameters: x_contract_id Id of created contract
767 -- x_contract_number contract number of newly created contract
768 --
769
770 PROCEDURE create_k_from_quote(p_api_version IN NUMBER
771 ,p_init_msg_list IN VARCHAR2
772 ,p_commit IN VARCHAR2
773 ,p_quote_id IN OKX_QUOTE_HEADERS_V.ID1%TYPE
774 ,p_template_id IN OKC_K_HEADERS_B.ID%TYPE
775 ,p_template_version IN NUMBER
776 ,p_rel_type IN OKC_K_REL_OBJS.RTY_CODE%TYPE
777 ,p_terms_agreed_flag IN VARCHAR2
778 ,p_trace_mode IN VARCHAR2
779 ,x_contract_id OUT NOCOPY OKC_K_HEADERS_B.ID%TYPE
780 ,x_contract_number OUT NOCOPY OKC_K_HEADERS_B.CONTRACT_NUMBER%TYPE
781 ,x_return_status OUT NOCOPY VARCHAR2
782 ,x_msg_count OUT NOCOPY NUMBER
783 ,x_msg_data OUT NOCOPY VARCHAR2
784 ) IS
785
786 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_K_FROM_Q';
787 l_api_version CONSTANT NUMBER := 1;
788 lx_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
789 lx_msg_count NUMBER := 0;
790 lx_msg_data VARCHAR2(2000);
791
792 BEGIN
793 lx_return_status := OKC_API.START_ACTIVITY(
794 p_api_name => l_api_name,
795 p_pkg_name => g_pkg_name,
796 p_init_msg_list => p_init_msg_list,
797 l_api_version => l_api_version,
798 p_api_version => p_api_version,
799 p_api_type => g_api_type,
800 x_return_status => lx_return_status);
801
802 IF (lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
803 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
804 ELSIF (lx_return_status = OKC_API.G_RET_STS_ERROR) THEN
805 RAISE OKC_API.G_EXCEPTION_ERROR;
806 END IF;
807
808 -- call before user hooks
809 null;
810
811 -- trace mode initialization turned ON
812 IF p_trace_mode = okc_api.g_true OR
813 FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y' THEN
814 okc_util.init_trace;
815 END IF;
816
817 -- call the main routine
818 OKC_OC_INT_QTK_PVT.create_k_from_quote(p_api_version => l_api_version
819 ,p_init_msg_list => OKC_API.G_FALSE
820 ,p_quote_id => p_quote_id
821 ,p_template_id => p_template_id
822 ,p_template_version => p_template_version
823 ,p_rel_type => p_rel_type
824 ,p_terms_agreed_flag => p_terms_agreed_flag
825 ,x_contract_id => x_contract_id
826 ,x_contract_number => x_contract_number
827 ,x_return_status => lx_return_status
828 ,x_msg_count => lx_msg_count
829 ,x_msg_data => lx_msg_data
830 );
831
832 -- trace mode initialization turned OFF
833 IF p_trace_mode = okc_api.g_true OR FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y' THEN
834 okc_util.stop_trace;
835 END IF;
836
837 -- check return status
838 IF lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
839 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
840 ELSIF lx_return_status = OKC_API.G_RET_STS_ERROR THEN
841 RAISE OKC_API.G_EXCEPTION_ERROR;
842 END IF;
843
844 -- call AFTER user hook
845 null;
846
847 -- if we got this far, then we are successful
848 IF p_commit = OKC_API.G_TRUE THEN
849 COMMIT;
850 END IF;
851
852 -- end activity
853 OKC_API.END_ACTIVITY( x_msg_count => lx_msg_count,
854 x_msg_data => lx_msg_data);
855
856 x_return_status := lx_return_status;
857 x_msg_count := lx_msg_count;
858 x_msg_data := lx_msg_data;
859
860 EXCEPTION
861 when OKC_API.G_EXCEPTION_ERROR then
862 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
863 p_api_name => l_api_name,
864 p_pkg_name => g_pkg_name,
865 p_exc_name => 'OKC_API.G_RET_STS_ERROR',
866 x_msg_count => x_msg_count,
867 x_msg_data => x_msg_data,
868 p_api_type => g_api_type);
869
870 when OKC_API.G_EXCEPTION_UNEXPECTED_ERROR then
871 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
872 p_api_name => l_api_name,
873 p_pkg_name => g_pkg_name,
874 p_exc_name => 'OKC_API.G_RET_STS_UNEXP_ERROR',
875 x_msg_count => x_msg_count,
876 x_msg_data => x_msg_data,
877 p_api_type => g_api_type);
878
879 when OTHERS then
880 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
881 p_api_name => l_api_name,
882 p_pkg_name => g_pkg_name,
883 p_exc_name => 'OTHERS',
884 x_msg_count => x_msg_count,
885 x_msg_data => x_msg_data,
886 p_api_type => g_api_type);
887 END create_k_from_quote;
888
889 -- Procedure: create_k_from_quote
890 -- Version: 1.0
891 -- Purpose: Create a contract from a quote. Overloaded procedure
892 -- Does not return contract number.
893 -- Provides process 3.2.2 in data flow diagram in HLD.
894 -- Create relationships from quote to contract
895 -- In Parameters: p_quote_id Quote for which to create contract
896 -- p_template_id Template contract to use in creating contract
897 -- Out Parameters: x_contract_id Id of created contract
898 --
899 PROCEDURE create_k_from_quote(p_api_version IN NUMBER
900 ,p_init_msg_list IN VARCHAR2
901 ,p_commit IN VARCHAR2
902 ,p_quote_id IN OKX_QUOTE_HEADERS_V.ID1%TYPE
903 ,p_template_id IN OKC_K_HEADERS_B.ID%TYPE
904 ,p_template_version IN NUMBER
905 ,p_rel_type IN OKC_K_REL_OBJS.RTY_CODE%TYPE
906 ,p_trace_mode IN VARCHAR2
907 ,x_contract_id OUT NOCOPY OKC_K_HEADERS_B.ID%TYPE
908 ,x_return_status OUT NOCOPY VARCHAR2
909 ,x_msg_count OUT NOCOPY NUMBER
910 ,x_msg_data OUT NOCOPY VARCHAR2
911 ) IS
912
913 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_K_FROM_Q';
914 l_api_version CONSTANT NUMBER := 1;
915
916 x_contract_number OKC_K_HEADERS_B.CONTRACT_NUMBER%TYPE;
917
918 BEGIN
919
920 -- call the main routine
921 create_k_from_quote(p_api_version => l_api_version
922 ,p_init_msg_list => OKC_API.G_FALSE
923 ,p_commit => p_commit
924 ,p_quote_id => p_quote_id
925 ,p_template_id => p_template_id
926 ,p_template_version => p_template_version
927 ,p_rel_type => p_rel_type
928 ,p_terms_agreed_flag => OKC_API.G_FALSE
929 ,x_contract_id => x_contract_id
930 ,p_trace_mode => p_trace_mode
931 ,x_contract_number => x_contract_number
932 ,x_return_status => x_return_status
933 ,x_msg_count => x_msg_count
934 ,x_msg_data => x_msg_data
935 );
936
937 END create_k_from_quote;
938
939 -- Procedure: create_k_relationships
940 -- Version: 1.0
941 -- ...
942
943 PROCEDURE create_k_relationships(p_api_version IN NUMBER
944 ,p_init_msg_list IN VARCHAR2
945 ,p_commit IN VARCHAR2
946 ,p_sales_contract_id IN OKC_K_HEADERS_B.ID%TYPE
947 ,p_service_contract_id IN OKC_K_HEADERS_B.ID%TYPE
948 ,p_quote_id IN OKX_QUOTE_HEADERS_V.ID1%TYPE
949 ,p_quote_line_tab IN OKC_OC_INT_PUB.OKC_QUOTE_LINE_TAB
950 ,p_order_id IN OKX_ORDER_HEADERS_V.ID1%TYPE
951 ,p_order_line_tab IN OKC_OC_INT_PUB.OKC_ORDER_LINE_TAB
952 ,p_trace_mode IN VARCHAR2
953 ,x_return_status OUT NOCOPY VARCHAR2
954 ,x_msg_count OUT NOCOPY NUMBER
955 ,x_msg_data OUT NOCOPY VARCHAR2) IS
956
957 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_K_REL';
958 l_api_version CONSTANT NUMBER := 1;
959 lx_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
960 lx_msg_count NUMBER := 0;
961 lx_msg_data VARCHAR2(2000);
962 l_trace_mode VARCHAR2(1);
963
964 BEGIN
965 -- call START_ACTIVITY to create savepoint, check compatibility and initialize message list
966 lx_return_status := OKC_API.START_ACTIVITY(
967 p_api_name => l_api_name,
968 p_pkg_name => g_pkg_name,
969 p_init_msg_list => p_init_msg_list,
970 l_api_version => l_api_version,
971 p_api_version => p_api_version,
972 p_api_type => g_api_type,
973 x_return_status => lx_return_status);
974
975 -- check if activity started successfully
976 IF (lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
977 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
978 ELSIF (lx_return_status = OKC_API.G_RET_STS_ERROR) THEN
979 RAISE OKC_API.G_EXCEPTION_ERROR;
980 END IF;
981
982 -- call before user hooks
983 null;
984
985 -- trace mode initialization turned ON
986 IF p_trace_mode = okc_api.g_true OR
987 FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y'
988 THEN
989 l_trace_mode := okc_api.g_true;
990 okc_util.init_trace;
991 ELSE
992 l_trace_mode := okc_api.g_false;
993 END IF;
994
995 -- call the main routine
996 OKC_OC_INT_KTO_PVT.create_k_relationships(p_api_version => l_api_version
997 ,p_init_msg_list => OKC_API.G_FALSE
998 ,p_sales_contract_id => p_sales_contract_id
999 ,p_service_contract_id => p_service_contract_id
1000 ,p_quote_id => p_quote_id
1001 ,p_quote_line_tab => p_quote_line_tab
1002 ,p_order_id => p_order_id
1003 ,p_order_line_tab => p_order_line_tab
1004 ,x_return_status => lx_return_status
1005 ,x_msg_count => lx_msg_count
1006 ,x_msg_data => lx_msg_data
1007 );
1008
1009
1010 -- trace mode initialization turned OFF
1011 IF l_trace_mode = okc_api.g_true OR FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y' THEN
1012 okc_util.stop_trace;
1013 END IF;
1014
1015 -- check return status
1016 IF lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
1017 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1018 ELSIF lx_return_status = OKC_API.G_RET_STS_ERROR THEN
1019 RAISE OKC_API.G_EXCEPTION_ERROR;
1020 END IF;
1021
1022 -- call AFTER user hook
1023 null;
1024
1025 -- commit if necessary
1026 IF p_commit = OKC_API.G_TRUE THEN
1027 COMMIT;
1028 END IF;
1029
1030 -- end activity
1031 OKC_API.END_ACTIVITY( x_msg_count => lx_msg_count,
1032 x_msg_data => lx_msg_data);
1033
1034 x_return_status := lx_return_status;
1035 x_msg_count := lx_msg_count;
1036 x_msg_data := lx_msg_data;
1037
1038 EXCEPTION
1039 when OKC_API.G_EXCEPTION_ERROR then
1040 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1041 p_api_name => l_api_name,
1042 p_pkg_name => g_pkg_name,
1043 p_exc_name => 'OKC_API.G_RET_STS_ERROR',
1044 x_msg_count => x_msg_count,
1045 x_msg_data => x_msg_data,
1046 p_api_type => g_api_type);
1047
1048 when OKC_API.G_EXCEPTION_UNEXPECTED_ERROR then
1049 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1050 p_api_name => l_api_name,
1051 p_pkg_name => g_pkg_name,
1052 p_exc_name => 'OKC_API.G_RET_STS_UNEXP_ERROR',
1053 x_msg_count => x_msg_count,
1054 x_msg_data => x_msg_data,
1055 p_api_type => g_api_type);
1056
1057 when OTHERS then
1058 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1059 p_api_name => l_api_name,
1060 p_pkg_name => g_pkg_name,
1061 p_exc_name => 'OTHERS',
1062 x_msg_count => x_msg_count,
1063 x_msg_data => x_msg_data,
1064 p_api_type => g_api_type);
1065
1066 END create_k_relationships;
1067
1068
1069 -- Procedure: create_interaction_history
1070 -- Version: 1.0
1071 -- Purpose: 1. In the event of a new contract's terms and conditions
1072 -- not being approved by the customer, fresh negotiations
1073 -- of the terms and conditions is undertaken and the
1074 -- contract administrator notified.
1075 -- Following the fresh negotiations, the customer may
1076 -- or may not approve. If the customer still does not
1077 -- approve, the contract has to be set back to an
1078 -- ENTERED state.
1079 --
1080 -- This procedure records the information used for
1081 -- the these negotiations.
1082 --
1083 -- In Parameters: p_api_version API version (to be initialized to 1)
1084 -- p_init_msg_list Flag to reset the error message stack
1085 -- p_commit Commit flag for the transaction
1086 -- p_contract_id contract header id of the contract
1087 -- whose TsandCs need to be negotiated
1088 -- p_party_id Customer contract as party id of
1089 -- the contact of relationship
1090 -- between the customer and his contact
1091 -- p_interaction_subject Short message to introduce
1092 -- the interaction, like
1093 -- 'Terms and conditions of contract'
1094 -- p_interaction_body Message body to be used to
1095 -- build the interaction
1096 -- p_trace_mode Trace mode option to generate
1097 -- a trace file
1098 --
1099 -- Out Parameters: x_return_status Final status of notification
1100 -- sending API:
1101 -- -OKC_API.G_RET_STS_SUCCESS
1102 -- -OKC_API.G_RET_STS_ERROR
1103 -- -OKC_API.G_RET_STS_UNEXP_ERROR
1104 -- x_msg_count Number of messages set on the stack
1105 -- x_msg_data Message info id x_msg_count = 1
1106 --
1107 -- THIS IS A WRAPPER FOR OKC_OC_INT_QTK_PVT.create_interaction_history
1108
1109 PROCEDURE create_interaction_history(p_api_version IN NUMBER
1110 ,p_init_msg_list IN VARCHAR2
1111 ,p_commit IN VARCHAR2
1112 ,p_contract_id IN NUMBER
1113 ,p_party_id IN NUMBER
1114 ,p_interaction_subject IN VARCHAR2
1115 ,p_interaction_body IN VARCHAR2
1116 ,p_trace_mode IN VARCHAR2
1117 ,x_return_status OUT NOCOPY VARCHAR2
1118 ,x_msg_count OUT NOCOPY NUMBER
1119 ,x_msg_data OUT NOCOPY VARCHAR2) IS
1120
1121
1122
1123 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_INTHIST';
1124 l_api_version CONSTANT NUMBER := 1;
1125 lx_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1126 lx_msg_count NUMBER := 0;
1127 lx_msg_data VARCHAR2(2000);
1128 l_trace_mode VARCHAR2(1);
1129
1130 BEGIN
1131 -- call START_ACTIVITY to create savepoint, check compatibility and initialize message list
1132 lx_return_status := OKC_API.START_ACTIVITY(
1133 p_api_name => l_api_name,
1134 p_pkg_name => g_pkg_name,
1135 p_init_msg_list => p_init_msg_list,
1136 l_api_version => l_api_version,
1137 p_api_version => p_api_version,
1138 p_api_type => g_api_type,
1139 x_return_status => lx_return_status);
1140
1141 -- check if activity started successfully
1142 IF (lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1143 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1144 ELSIF (lx_return_status = OKC_API.G_RET_STS_ERROR) THEN
1145 RAISE OKC_API.G_EXCEPTION_ERROR;
1146 END IF;
1147
1148 -- call before user hooks
1149 null;
1150
1151 -- trace mode initialization turned ON
1152 IF p_trace_mode = okc_api.g_true OR
1153 FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y'
1154 THEN
1155 l_trace_mode := okc_api.g_true;
1156 okc_util.init_trace;
1157 ELSE
1158 l_trace_mode := okc_api.g_false;
1159 END IF;
1160
1161 -- call the main routine
1162 OKC_OC_INT_QTK_PVT.create_interaction_history(
1163 p_api_version => l_api_version
1164 ,p_init_msg_list => OKC_API.G_FALSE
1165 ,p_contract_id => p_contract_id
1166 ,p_party_id => p_party_id
1167 ,p_interaction_subject => p_interaction_subject
1168 ,p_interaction_body => p_interaction_body
1169 ,x_return_status => lx_return_status
1170 ,x_msg_count => lx_msg_count
1171 ,x_msg_data => lx_msg_data
1172 );
1173
1174 -- trace mode initialization turned OFF
1175 IF l_trace_mode = okc_api.g_true OR FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y' THEN
1176 okc_util.stop_trace;
1177 END IF;
1178
1179 -- check return status
1180 IF lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
1181 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1182 ELSIF lx_return_status = OKC_API.G_RET_STS_ERROR THEN
1183 RAISE OKC_API.G_EXCEPTION_ERROR;
1184 END IF;
1185
1186 -- call AFTER user hook
1187 null;
1188
1189 -- commit if necessary
1190 IF p_commit = OKC_API.G_TRUE THEN
1191 COMMIT;
1192 END IF;
1193
1194 -- end activity
1195 OKC_API.END_ACTIVITY( x_msg_count => lx_msg_count,
1196 x_msg_data => lx_msg_data);
1197
1198 x_return_status := lx_return_status;
1199 x_msg_count := lx_msg_count;
1200 x_msg_data := lx_msg_data;
1201
1202 EXCEPTION
1203 when OKC_API.G_EXCEPTION_ERROR then
1204 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1205 p_api_name => l_api_name,
1206 p_pkg_name => g_pkg_name,
1207 p_exc_name => 'OKC_API.G_RET_STS_ERROR',
1208 x_msg_count => x_msg_count,
1209 x_msg_data => x_msg_data,
1210 p_api_type => g_api_type);
1211
1212 when OKC_API.G_EXCEPTION_UNEXPECTED_ERROR then
1213 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1214 p_api_name => l_api_name,
1215 p_pkg_name => g_pkg_name,
1216 p_exc_name => 'OKC_API.G_RET_STS_UNEXP_ERROR',
1217 x_msg_count => x_msg_count,
1218 x_msg_data => x_msg_data,
1219 p_api_type => g_api_type);
1220
1221 when OTHERS then
1222 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1223 p_api_name => l_api_name,
1224 p_pkg_name => g_pkg_name,
1225 p_exc_name => 'OTHERS',
1226 x_msg_count => x_msg_count,
1227 x_msg_data => x_msg_data,
1228 p_api_type => g_api_type);
1229
1230 END create_interaction_history;
1231
1232
1233 -- Procedure: notify_k_adm
1234 -- Version: 1.0
1235 -- ...
1236
1237 -- Bug : 1905226 OKC, ISTORE TESTING: K ALERT RESULTS GRID SHOULD POPULATE K# FIELD
1238 -- Problem : Notifications in Launchpad's Inbox don't show KNUMBER in subject
1239 -- and 'Contract Number' column
1240 -- Fix: p_contract_id was added into parameter list of notify_k_adm procedure
1241
1242 PROCEDURE notify_k_adm(p_api_version IN NUMBER
1243 ,p_init_msg_list IN VARCHAR2
1244 ,p_commit IN VARCHAR2
1245 ,p_application_name IN VARCHAR2
1246 ,p_message_subject IN FND_NEW_MESSAGES.MESSAGE_NAME%TYPE
1247 ,p_message_body IN FND_NEW_MESSAGES.MESSAGE_NAME%TYPE
1248 ,p_message_body_token1 IN VARCHAR2
1249 ,p_message_body_token1_value IN VARCHAR2
1250 ,p_message_body_token2 IN VARCHAR2
1251 ,p_message_body_token2_value IN VARCHAR2
1252 ,p_message_body_token3 IN VARCHAR2
1253 ,p_message_body_token3_value IN VARCHAR2
1254 ,p_trace_mode IN VARCHAR2
1255 ,p_contract_id IN OKC_K_HEADERS_B.ID%TYPE
1256 ,x_k_admin_user_name OUT NOCOPY VARCHAR2
1257 ,x_return_status OUT NOCOPY VARCHAR2
1258 ,x_msg_count OUT NOCOPY NUMBER
1259 ,x_msg_data OUT NOCOPY VARCHAR2) IS
1260
1261 l_api_name CONSTANT VARCHAR2(30) := 'NOTIFY_K_ADM';
1262 l_api_version CONSTANT NUMBER :=1;
1263 lx_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1264 lx_msg_count NUMBER ;
1265 lx_msg_data FND_NEW_MESSAGES.message_text%TYPE;
1266
1267 BEGIN
1268 lx_return_status := OKC_API.START_ACTIVITY(
1269 p_api_name => l_api_name,
1270 p_pkg_name => g_pkg_name,
1271 p_init_msg_list => p_init_msg_list,
1272 l_api_version => l_api_version,
1273 p_api_version => p_api_version,
1274 p_api_type => g_api_type,
1275 x_return_status => lx_return_status);
1276
1277 IF (lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1278 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1279 ELSIF (lx_return_status = OKC_API.G_RET_STS_ERROR) THEN
1280 RAISE OKC_API.G_EXCEPTION_ERROR;
1281 END IF;
1282
1283 -- call before user hooks
1284 null;
1285
1286 -- trace mode initialization turned ON
1287 IF p_trace_mode = okc_api.g_true OR
1288 FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y'
1289 THEN
1290 okc_util.init_trace;
1291 END IF;
1292
1293 -- call the main routine
1294
1295 -- Bug : 1905226 OKC, ISTORE TESTING: K ALERT RESULTS GRID SHOULD POPULATE K# FIELD
1296 -- Problem : Notifications in Launchpad's Inbox don't show KNUMBER in subject
1297 -- and 'Contract Number' column
1298 -- Fix: calls of notify_k_adm procedure were changed to pass 'contract ID'
1299
1300 okc_oc_int_qtk_pvt.notify_k_adm(
1301 p_api_version => l_api_version
1302 ,p_init_msg_list => OKC_API.G_FALSE
1303 ,p_application_name => p_application_name
1304 ,p_message_subject => p_message_subject
1305 ,p_message_body => p_message_body
1306 ,p_message_body_token1 => p_message_body_token1
1307 ,p_message_body_token1_value => p_message_body_token1_value
1308 ,p_message_body_token2 => p_message_body_token2
1309 ,p_message_body_token2_value => p_message_body_token2_value
1310 ,p_message_body_token3 => p_message_body_token3
1311 ,p_message_body_token3_value => p_message_body_token3_value
1312 ,p_contract_id => p_contract_id
1313 ,x_k_admin_user_name => x_k_admin_user_name
1314 ,x_return_status => lx_return_status
1315 ,x_msg_count => lx_msg_count
1316 ,x_msg_data => lx_msg_data
1317 );
1318
1319 -- trace mode initialization turned OFF
1320 IF p_trace_mode = okc_api.g_true OR FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y' THEN
1321 okc_util.stop_trace;
1322 END IF;
1323
1324
1325 -- check return status
1326 IF lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
1327 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1328 ELSIF lx_return_status = OKC_API.G_RET_STS_ERROR THEN
1329 RAISE OKC_API.G_EXCEPTION_ERROR;
1330 END IF;
1331
1332 -- call AFTER user hook
1333 null;
1334
1335 -- if we got this far, then we are successful
1336 IF p_commit = OKC_API.G_TRUE THEN
1337 COMMIT;
1338 END IF;
1339
1340 -- end activity
1341 OKC_API.END_ACTIVITY(x_msg_count => lx_msg_count,
1342 x_msg_data => lx_msg_data);
1343
1344 x_return_status := lx_return_status;
1345 x_msg_count := lx_msg_count;
1346 x_msg_data := lx_msg_data;
1347
1348 EXCEPTION
1349 when OKC_API.G_EXCEPTION_ERROR then
1350 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1351 p_api_name => l_api_name,
1352 p_pkg_name => g_pkg_name,
1353 p_exc_name => 'OKC_API.G_RET_STS_ERROR',
1354 x_msg_count => lx_msg_count,
1355 x_msg_data => lx_msg_data,
1356 p_api_type => g_api_type);
1357
1358 when OKC_API.G_EXCEPTION_UNEXPECTED_ERROR then
1359 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1360 p_api_name => l_api_name,
1361 p_pkg_name => g_pkg_name,
1362 p_exc_name => 'OKC_API.G_RET_STS_UNEXP_ERROR',
1363 x_msg_count => lx_msg_count,
1364 x_msg_data => lx_msg_data,
1365 p_api_type => g_api_type);
1366
1367 when OTHERS then
1368 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1369 p_api_name => l_api_name,
1370 p_pkg_name => g_pkg_name,
1371 p_exc_name => 'OTHERS',
1372 x_msg_count => lx_msg_count,
1373 x_msg_data => lx_msg_data,
1374 p_api_type => g_api_type);
1375 END notify_k_adm;
1376
1377
1378 -------------------------------------------------------------------------------
1379 -- Procedure: notify_sales_rep
1380 -- Version: 1.0
1381 -- Purpose: API is used to retrive Quotation , contract status
1382 -- (If required) and generate notification to Order Capture
1383 -- and Istore
1384 -- THIS API IS CALLED FROM OKC_WF_K_APPROVE.NOTIFY_SALES_REP_W
1385 -- IN Parameters : p_contract_id, p_contract_status, p_trace_mode
1386 --
1387 -- OUT Parameters : x_return_status
1388 -------------------------------------------------------------------------------
1389
1390 PROCEDURE notify_sales_rep (p_api_version IN NUMBER
1391 ,p_init_msg_list IN VARCHAR2
1392 ,p_contract_id IN NUMBER
1393 ,p_contract_status IN VARCHAR2
1394 ,p_trace_mode IN VARCHAR2
1395 ,p_commit IN VARCHAR2
1396 ,x_return_status OUT NOCOPY VARCHAR2
1397 ,x_msg_count OUT NOCOPY NUMBER
1398 ,x_msg_data OUT NOCOPY VARCHAR2) IS
1399 l_api_name CONSTANT VARCHAR2(30) := 'NOTIFY_SALES_REP';
1400 l_api_version CONSTANT NUMBER :=1;
1401 lx_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1402 lx_msg_count NUMBER ;
1403 lx_msg_data FND_NEW_MESSAGES.message_text%TYPE;
1404
1405 BEGIN
1406 lx_return_status := OKC_API.START_ACTIVITY(
1407 p_api_name => l_api_name,
1408 p_pkg_name => g_pkg_name,
1409 p_init_msg_list => p_init_msg_list,
1410 l_api_version => l_api_version,
1411 --npalepu modified on 22-11-2005 for bug # 4737495
1412 /* p_api_version => p_api_version, */
1413 p_api_version => 1.0,
1414 --end npalepu
1415 p_api_type => g_api_type,
1416 x_return_status => lx_return_status);
1417
1418 IF (lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1419 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1420 ELSIF (lx_return_status = OKC_API.G_RET_STS_ERROR) THEN
1421 RAISE OKC_API.G_EXCEPTION_ERROR;
1422 END IF;
1423
1424 -- call before user hooks
1425 null;
1426
1427 -- trace mode initialization turned ON
1428 IF p_trace_mode = okc_api.g_true OR
1429 FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y'
1430 THEN
1431 okc_util.init_trace;
1432 END IF;
1433
1434 -- call the main routine
1435
1436 okc_oc_int_qtk_pvt.notify_sales_rep(
1437 p_api_version => l_api_version
1438 ,p_init_msg_list => OKC_API.G_FALSE
1439 ,p_contract_id => p_contract_id
1440 ,p_contract_status => p_contract_status
1441 ,x_return_status => lx_return_status
1442 ,x_msg_count => lx_msg_count
1443 ,x_msg_data => lx_msg_data
1444 );
1445
1446 -- trace mode initialization turned OFF
1447 IF p_trace_mode = okc_api.g_true OR FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y' THEN
1448 okc_util.stop_trace;
1449 END IF;
1450
1451
1452 -- check return status
1453 IF lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
1454 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1455 ELSIF lx_return_status = OKC_API.G_RET_STS_ERROR THEN
1456 RAISE OKC_API.G_EXCEPTION_ERROR;
1457 END IF;
1458
1459 -- call AFTER user hook
1460 null;
1461
1462 -- if we got this far, then we are successful
1463 IF p_commit = OKC_API.G_TRUE THEN
1464 COMMIT;
1465 END IF;
1466
1467 -- end activity
1468 OKC_API.END_ACTIVITY(x_msg_count => lx_msg_count,
1469 x_msg_data => lx_msg_data);
1470
1471 x_return_status := lx_return_status;
1472 x_msg_count := lx_msg_count;
1473 x_msg_data := lx_msg_data;
1474
1475 EXCEPTION
1476 when OKC_API.G_EXCEPTION_ERROR then
1477 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1478 p_api_name => l_api_name,
1479 p_pkg_name => g_pkg_name,
1480 p_exc_name => 'OKC_API.G_RET_STS_ERROR',
1481 x_msg_count => lx_msg_count,
1482 x_msg_data => lx_msg_data,
1483 p_api_type => g_api_type);
1484
1485 when OKC_API.G_EXCEPTION_UNEXPECTED_ERROR then
1486 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1487 p_api_name => l_api_name,
1488 p_pkg_name => g_pkg_name,
1489 p_exc_name => 'OKC_API.G_RET_STS_UNEXP_ERROR',
1490 x_msg_count => lx_msg_count,
1491 x_msg_data => lx_msg_data,
1492 p_api_type => g_api_type);
1493
1494 when OTHERS then
1495 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1496 p_api_name => l_api_name,
1497 p_pkg_name => g_pkg_name,
1498 p_exc_name => 'OTHERS',
1499 x_msg_count => lx_msg_count,
1500 x_msg_data => lx_msg_data,
1501 p_api_type => g_api_type);
1502 END notify_sales_rep;
1503
1504 -- Procedure: get_k_number
1505 -- Version: 1.0
1506 -- ...
1507
1508 PROCEDURE get_k_number(p_api_version IN NUMBER
1509 ,p_init_msg_list IN VARCHAR2
1510 ,p_commit IN VARCHAR2
1511 ,p_contract_id IN NUMBER
1512 ,p_trace_mode IN VARCHAR2
1513 ,x_contract_number OUT NOCOPY OKC_K_HEADERS_B.contract_number%TYPE
1514 ,x_contract_number_modifier OUT NOCOPY OKC_K_HEADERS_B.contract_number_modifier%TYPE
1515 ,x_return_status OUT NOCOPY VARCHAR2
1516 ,x_msg_count OUT NOCOPY NUMBER
1517 ,x_msg_data OUT NOCOPY VARCHAR2) IS
1518
1519 l_api_name CONSTANT VARCHAR2(30) := 'GET_K_NUMBER';
1520 l_api_version CONSTANT NUMBER := 1;
1521 lx_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1522 lx_msg_count NUMBER := 0;
1523 lx_msg_data VARCHAR2(50) := 'msg';
1524
1525 BEGIN
1526 lx_return_status := OKC_API.START_ACTIVITY(
1527 p_api_name => l_api_name,
1528 p_pkg_name => g_pkg_name,
1529 p_init_msg_list => p_init_msg_list,
1530 l_api_version => l_api_version,
1531 p_api_version => p_api_version,
1532 p_api_type => g_api_type,
1533 x_return_status => lx_return_status);
1534
1535 IF (lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1536 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1537 ELSIF (lx_return_status = OKC_API.G_RET_STS_ERROR) THEN
1538 RAISE OKC_API.G_EXCEPTION_ERROR;
1539 END IF;
1540
1541 -- call before user hooks
1542 null;
1543
1544 -- trace mode initialization turned ON
1545 IF p_trace_mode = okc_api.g_true OR
1546 FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y'
1547 THEN
1548 okc_util.init_trace;
1549 END IF;
1550
1551 -- call the main routine
1552
1553 okc_oc_int_qtk_pvt.get_k_number(
1554 p_api_version => l_api_version
1555 ,p_init_msg_list => OKC_API.G_FALSE
1556 ,p_contract_id => p_contract_id
1557 ,x_contract_number => x_contract_number
1558 ,x_contract_number_modifier => x_contract_number_modifier
1559 ,x_return_status => lx_return_status
1560 ,x_msg_count => lx_msg_count
1561 ,x_msg_data => lx_msg_data
1562 );
1563
1564 -- trace mode initialization turned OFF
1565 IF p_trace_mode = okc_api.g_true OR FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y' THEN
1566 okc_util.stop_trace;
1567 END IF;
1568
1569
1570 -- check return status
1571 IF lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
1572 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1573 ELSIF lx_return_status = OKC_API.G_RET_STS_ERROR THEN
1574 RAISE OKC_API.G_EXCEPTION_ERROR;
1575 END IF;
1576
1577 -- call AFTER user hook
1578 null;
1579
1580 -- if we got this far, then we are successful
1581 IF p_commit = OKC_API.G_TRUE THEN
1582 COMMIT;
1583 END IF;
1584
1585 -- end activity
1586 OKC_API.END_ACTIVITY(x_msg_count => lx_msg_count,
1587 x_msg_data => lx_msg_data);
1588
1589 x_return_status := lx_return_status;
1590 x_msg_count := lx_msg_count;
1591 x_msg_data := lx_msg_data;
1592
1593 EXCEPTION
1594 when OKC_API.G_EXCEPTION_ERROR then
1595 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1596 p_api_name => l_api_name,
1597 p_pkg_name => g_pkg_name,
1598 p_exc_name => 'OKC_API.G_RET_STS_ERROR',
1599 x_msg_count => lx_msg_count,
1600 x_msg_data => lx_msg_data,
1601 p_api_type => g_api_type);
1602
1603 when OKC_API.G_EXCEPTION_UNEXPECTED_ERROR then
1604 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1605 p_api_name => l_api_name,
1606 p_pkg_name => g_pkg_name,
1607 p_exc_name => 'OKC_API.G_RET_STS_UNEXP_ERROR',
1608 x_msg_count => lx_msg_count,
1609 x_msg_data => lx_msg_data,
1610 p_api_type => g_api_type);
1611
1612 when OTHERS then
1613 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1614 p_api_name => l_api_name,
1615 p_pkg_name => g_pkg_name,
1616 p_exc_name => 'OTHERS',
1617 x_msg_count => lx_msg_count,
1618 x_msg_data => lx_msg_data,
1619 p_api_type => g_api_type);
1620 END get_k_number;
1621
1622
1623 -- Procedure: k_signed
1624 -- Version: 1.0
1625 -- Purpose: While creating a contract from a quote, the contract
1626 -- is set within an ENTERED status. If the customer
1627 -- agrees with the standard TsandCs, this status has to be
1628 -- changed at its creation time from ENTERED to SIGNED.
1629 --
1630 -- This procedure changes the status of the contract, e
1631 -- ither from an ENTERED status to a SIGNED status, or
1632 -- from an APPROVED status to a SIGNED status.
1633 --
1634 -- This API will be called either directly from the creation
1635 -- contract API (ENTERED to SIGNED), or later by Order
1636 -- Capture/iStore (APPROVED to SIGNED)
1637 --
1638 -- In Parameters: p_party_id Contract header id
1639 -- p_date_signed Signing date of the contract
1640 --
1641 -- Out Parameters: x_return_status Final status of the contract status update
1642 -- -OKC_API.G_RET_STS_SUCCESS
1643 -- -OKC_API.G_RET_STS_ERROR
1644 -- -OKC_API.G_RET_STS_UNEXP_ERROR
1645 --
1646 -- THIS IS A PLAIN BARE-BONES WRAPPER FOR OKC_CONTRACT_APPROVAL_PUB.k_signed
1647
1648 PROCEDURE k_signed(p_api_version IN NUMBER
1649 ,p_init_msg_list IN VARCHAR2
1650 ,p_commit IN VARCHAR2
1651 ,p_contract_id IN NUMBER
1652 ,p_date_signed IN DATE
1653 ,p_trace_mode IN VARCHAR2
1654 ,x_return_status OUT NOCOPY VARCHAR2
1655 ,x_msg_count OUT NOCOPY NUMBER
1656 ,x_msg_data OUT NOCOPY VARCHAR2) IS
1657
1658 l_api_name CONSTANT VARCHAR2(30) := 'K_SIGNED';
1659 l_api_version CONSTANT NUMBER := 1;
1660 lx_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1661 lx_msg_count NUMBER := 0;
1662 lx_msg_data VARCHAR2(50) := 'msg';
1663
1664 BEGIN
1665
1666 -- call before user hooks
1667 null;
1668
1669 -- trace mode initialization turned ON
1670 IF p_trace_mode = okc_api.g_true OR
1671 FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y'
1672 THEN
1673 okc_util.init_trace;
1674 END IF;
1675
1676 -- call the main routine
1677
1678 OKC_CONTRACT_APPROVAL_PUB.k_signed(p_contract_id => p_contract_id
1679 ,p_date_signed => p_date_signed
1680 ,x_return_status => lx_return_status);
1681
1682 -- trace mode initialization turned OFF
1683 IF p_trace_mode = okc_api.g_true OR FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y' THEN
1684 okc_util.stop_trace;
1685 END IF;
1686
1687 -- check return status
1688 IF lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
1689 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1690 ELSIF lx_return_status = OKC_API.G_RET_STS_ERROR THEN
1691 RAISE OKC_API.G_EXCEPTION_ERROR;
1692 END IF;
1693
1694 -- call AFTER user hook
1695 null;
1696
1697 -- if we got this far, then we are successful
1698 IF p_commit = OKC_API.G_TRUE THEN
1699 COMMIT;
1700 END IF;
1701
1702 -- end activity
1703 OKC_API.END_ACTIVITY(x_msg_count => lx_msg_count,
1704 x_msg_data => lx_msg_data);
1705
1706 x_return_status := lx_return_status;
1707 x_msg_count := lx_msg_count;
1708 x_msg_data := lx_msg_data;
1709
1710 EXCEPTION
1711 when OKC_API.G_EXCEPTION_ERROR then
1712 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1713 p_api_name => l_api_name,
1714 p_pkg_name => g_pkg_name,
1715 p_exc_name => 'OKC_API.G_RET_STS_ERROR',
1716 x_msg_count => lx_msg_count,
1717 x_msg_data => lx_msg_data,
1718 p_api_type => g_api_type);
1719
1720 when OKC_API.G_EXCEPTION_UNEXPECTED_ERROR then
1721 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1722 p_api_name => l_api_name,
1723 p_pkg_name => g_pkg_name,
1724 p_exc_name => 'OKC_API.G_RET_STS_UNEXP_ERROR',
1725 x_msg_count => lx_msg_count,
1726 x_msg_data => lx_msg_data,
1727 p_api_type => g_api_type);
1728
1729 when OTHERS then
1730 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1731 p_api_name => l_api_name,
1732 p_pkg_name => g_pkg_name,
1733 p_exc_name => 'OTHERS',
1734 x_msg_count => lx_msg_count,
1735 x_msg_data => lx_msg_data,
1736 p_api_type => g_api_type);
1737 END k_signed;
1738
1739
1740 -- Procedure: k_erase_approved
1741 -- Version: 1.0
1742 -- ...
1743
1744 PROCEDURE k_erase_approved(p_api_version IN NUMBER
1745 ,p_init_msg_list IN VARCHAR2
1746 ,p_commit IN VARCHAR2
1747 ,p_contract_id IN NUMBER
1748 ,p_trace_mode IN VARCHAR2
1749 ,x_return_status OUT NOCOPY VARCHAR2
1750 ,x_msg_count OUT NOCOPY NUMBER
1751 ,x_msg_data OUT NOCOPY VARCHAR2) IS
1752
1753 l_api_name CONSTANT VARCHAR2(30) := 'K_ERASE_APPROV';
1754 l_api_version CONSTANT NUMBER :=1;
1755 lx_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1756 lx_msg_count NUMBER := 0;
1757 lx_msg_data VARCHAR2(50) := 'msg';
1758
1759 lx_contract_number OKC_K_HEADERS_B.contract_number%TYPE; -- new contract number
1760 lx_contract_number_modifier OKC_K_HEADERS_B.contract_number_modifier%TYPE; -- new contract number modifier
1761 lx_k_admin_user_name FND_USER.user_name%TYPE;
1762
1763 BEGIN
1764
1765 -- call before user hooks
1766 null;
1767
1768 -- trace mode initialization turned ON
1769 IF p_trace_mode = okc_api.g_true OR
1770 FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y'
1771 THEN
1772 okc_util.init_trace;
1773 END IF;
1774
1775 -- call the main routine
1776
1777 OKC_CONTRACT_APPROVAL_PUB.k_erase_approved(p_contract_id => p_contract_id
1778 ,x_return_status => lx_return_status);
1779
1780 -- check return status
1781 IF lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
1782 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1783 ELSIF lx_return_status = OKC_API.G_RET_STS_ERROR THEN
1784 RAISE OKC_API.G_EXCEPTION_ERROR;
1785 END IF;
1786
1787 -- call the another routine
1788 OKC_OC_INT_PUB.get_k_number (
1789 p_api_version => 1
1790 ,p_init_msg_list => OKC_API.g_false
1791 ,p_commit => OKC_API.g_false
1792 ,p_contract_id => p_contract_id
1793 ,p_trace_mode => OKC_API.g_false
1794 ,x_contract_number => lx_contract_number
1795 ,x_contract_number_modifier => lx_contract_number_modifier
1796 ,x_return_status => lx_return_status
1797 ,x_msg_count => lx_msg_count
1798 ,x_msg_data => lx_msg_data);
1799
1800 -- check return status
1801 IF lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
1802 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1803 ELSIF lx_return_status = OKC_API.G_RET_STS_ERROR THEN
1804 RAISE OKC_API.G_EXCEPTION_ERROR;
1805 END IF;
1806
1807 -- call another main routine
1808 OKC_OC_INT_PUB.notify_k_adm(
1809 p_api_version =>1,
1810 p_init_msg_list => OKC_API.g_false,
1811 p_commit => OKC_API.g_false,
1812 p_application_name=> OKC_API.g_app_name,
1813 -- p_message_subject => 'OKC_Q2K_KAENOTIF_SUBJ', Bug#2449811
1814 p_message_subject => 'OKC_Q2K_KAENOTIF_SUBJECT',
1815 p_message_body => 'OKC_Q2K_KAENOTIF_BODY',
1816 p_message_body_token1 => 'KNUMBER',
1817 p_message_body_token1_value => lx_contract_number,
1818 p_message_body_token2 => 'KNUMMODIFIER',
1819 -- p_message_body_token2_value => lx_contract_number_modifier, Bug#2454456
1820 p_message_body_token2_value => Nvl(lx_contract_number_modifier,' '),
1821 p_trace_mode => OKC_API.g_false,
1822 x_k_admin_user_name => lx_k_admin_user_name,
1823 x_return_status => lx_return_status,
1824 x_msg_count => lx_msg_count,
1825 x_msg_data => lx_msg_data);
1826
1827 IF (lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR OR
1828 lx_return_status = OKC_API.G_RET_STS_ERROR) THEN
1829 okc_api.set_message(p_app_name => g_app_name,
1830 p_msg_name => 'OKC_Q2K_NOTIFFAILURE',
1831 p_token1 => 'KNUMBER',
1832 p_token1_value => lx_contract_number,
1833 p_token2 => 'KADMINUSERNAME',
1834 p_token2_value => lx_k_admin_user_name);
1835 END IF;
1836
1837 -- check return status
1838 IF lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
1839 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1840 ELSIF lx_return_status = OKC_API.G_RET_STS_ERROR THEN
1841 RAISE OKC_API.G_EXCEPTION_ERROR;
1842 END IF;
1843
1844 -- trace mode initialization turned OFF
1845 IF p_trace_mode = okc_api.g_true OR FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y' THEN
1846 okc_util.stop_trace;
1847 END IF;
1848
1849 -- call AFTER user hook
1850 null;
1851
1852 -- if we got this far, then we are successful
1853 IF p_commit = OKC_API.G_TRUE THEN
1854 COMMIT;
1855 END IF;
1856
1857 -- end activity
1858 OKC_API.END_ACTIVITY(x_msg_count => lx_msg_count,
1859 x_msg_data => lx_msg_data);
1860
1861 x_return_status := lx_return_status;
1862 x_msg_count := lx_msg_count;
1863 x_msg_data := lx_msg_data;
1864
1865 EXCEPTION
1866 when OKC_API.G_EXCEPTION_ERROR then
1867 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1868 p_api_name => l_api_name,
1869 p_pkg_name => g_pkg_name,
1870 p_exc_name => 'OKC_API.G_RET_STS_ERROR',
1871 x_msg_count => lx_msg_count,
1872 x_msg_data => lx_msg_data,
1873 p_api_type => g_api_type);
1874
1875 when OKC_API.G_EXCEPTION_UNEXPECTED_ERROR then
1876 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1877 p_api_name => l_api_name,
1878 p_pkg_name => g_pkg_name,
1879 p_exc_name => 'OKC_API.G_RET_STS_UNEXP_ERROR',
1880 x_msg_count => lx_msg_count,
1881 x_msg_data => lx_msg_data,
1882 p_api_type => g_api_type);
1883
1884 when OTHERS then
1885 x_return_status := OKC_API.HANDLE_EXCEPTIONS(
1886 p_api_name => l_api_name,
1887 p_pkg_name => g_pkg_name,
1888 p_exc_name => 'OTHERS',
1889 x_msg_count => lx_msg_count,
1890 x_msg_data => lx_msg_data,
1891 p_api_type => g_api_type);
1892 END k_erase_approved;
1893
1894
1895 -- Procedure: get_articles
1896 -- Version: 1.0
1897 -- Purpose: This is the public API which intent to call private API
1898 -- to select all articles for the contract.
1899 -- In Parameters : P_contract_id Id of the contract
1900 -- Out Parameters: x_articles contract articles (clob datatype)
1901
1902 PROCEDURE get_articles (p_api_version IN NUMBER
1903 ,p_init_msg_list IN VARCHAR2
1904 ,p_commit IN VARCHAR2
1905 ,p_contract_id IN NUMBER
1906 ,p_release_id IN NUMBER
1907 ,p_trace_mode IN VARCHAR2
1908 ,x_articles OUT NOCOPY OKC_K_ARTICLES_TL.TEXT%TYPE
1909 ,x_return_status OUT NOCOPY VARCHAR2
1910 ,x_msg_count OUT NOCOPY NUMBER
1911 ,x_msg_data OUT NOCOPY VARCHAR2) IS
1912
1913 l_api_name CONSTANT VARCHAR2(30) := 'GET_ARTICLES';
1914 l_api_version CONSTANT NUMBER :=1;
1915 lx_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1916 lx_msg_count NUMBER := 0;
1917 lx_msg_data VARCHAR2(50) := 'msg';
1918
1919 BEGIN
1920 /* Removing Start and End activity because system could not read the LOB
1921 -- data from the calling program --Guna
1922 --lx_return_status := OKC_API.START_ACTIVITY(
1923 -- p_api_name => l_api_name,
1924 -- p_pkg_name => g_pkg_name,
1925 -- p_init_msg_list => p_init_msg_list,
1926 -- l_api_version => l_api_version,
1927 -- p_api_version => p_api_version,
1928 -- p_api_type => g_api_type,
1929 -- x_return_status => lx_return_status);
1930 --
1931 -- IF (lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1932 -- RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1933 -- ELSIF (lx_return_status = OKC_API.G_RET_STS_ERROR) THEN
1934 -- RAISE OKC_API.G_EXCEPTION_ERROR;
1935 -- END IF;
1936 --
1937 */
1938
1939 -- call before user hooks
1940 null;
1941
1942 -- trace mode initialization turned ON
1943 IF p_trace_mode = okc_api.g_true OR
1944 FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y'
1945 THEN
1946 okc_util.init_trace;
1947 END IF;
1948
1949 -- call the main routine
1950
1951 okc_oc_int_qtk_pvt.get_articles(
1952 p_api_version => l_api_version
1953 ,p_init_msg_list => OKC_API.G_FALSE
1954 ,p_contract_id => p_contract_id
1955 ,p_release_id => p_release_id
1956 ,x_articles => x_articles
1957 ,x_return_status => lx_return_status
1958 ,x_msg_count => lx_msg_count
1959 ,x_msg_data => lx_msg_data
1960 );
1961
1962 -- trace mode initialization turned OFF
1963 IF p_trace_mode = okc_api.g_true OR FND_PROFILE.VALUE('AFLOG_ENABLED') = 'Y' THEN
1964 okc_util.stop_trace;
1965 END IF;
1966
1967
1968 -- check return status
1969 IF lx_return_status = OKC_API.G_RET_STS_UNEXP_ERROR THEN
1970 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1971 ELSIF lx_return_status = OKC_API.G_RET_STS_ERROR THEN
1972 RAISE OKC_API.G_EXCEPTION_ERROR;
1973 END IF;
1974
1975 -- call AFTER user hook
1976 null;
1977
1978 -- if we got this far, then we are successful
1979 IF p_commit = OKC_API.G_TRUE THEN
1980 COMMIT;
1981 END IF;
1982
1983 /*
1984 -- end activity
1985 -- OKC_API.END_ACTIVITY(x_msg_count => lx_msg_count,
1986 -- x_msg_data => lx_msg_data);
1987 */
1988
1989 x_return_status := lx_return_status;
1990 x_msg_count := lx_msg_count;
1991 x_msg_data := lx_msg_data;
1992
1993 -- Bug 1835096
1994 -- Replaced okc_api.handle_exceptions with the following exception
1995 -- logic to avoid rolling back to a savepoint that was not set
1996 -- because usage of CLOB API's prevented us from using set_activity
1997 -- which was setting the savepoint.
1998 EXCEPTION
1999 when OKC_API.G_EXCEPTION_ERROR then
2000 FND_MSG_PUB.Count_And_Get
2001 (
2002 p_count => x_msg_count,
2003 p_data => x_msg_data
2004 );
2005 x_return_status := OKC_API.G_RET_STS_ERROR;
2006
2007 when OKC_API.G_EXCEPTION_UNEXPECTED_ERROR then
2008 FND_MSG_PUB.Count_And_Get
2009 (
2010 p_count => x_msg_count,
2011 p_data => x_msg_data
2012 );
2013 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2014
2015 when OTHERS then
2016 IF FND_MSG_PUB.Check_Msg_Level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
2017 THEN
2018 FND_MSG_PUB.Add_Exc_Msg
2019 (
2020 g_pkg_name,
2021 l_api_name
2022 );
2023 END IF;
2024 FND_MSG_PUB.Count_And_Get
2025 (
2026 p_count => x_msg_count,
2027 p_data => x_msg_data
2028 );
2029 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2030 END get_articles;
2031
2032
2033 -- Procedure: Submit_Request
2034 -- Version: 1.0
2035 -- Purpose: Outcome PL/SQL API to submit concurrent requests
2036 -- Arguments
2037 -- application - Short name of application under which the program
2038 -- - is registered
2039 -- program - concurrent program name for which the request has
2040 -- - to be submitted
2041 -- description - Optional. Will be displayed along with user
2042 -- - concurrent program name
2043 -- start_time - Optional. Time at which the request has to start
2044 -- - running
2045 -- sub_request - Optional. Set to TRUE if the request is submitted
2046 -- - from another running request and has to be treated
2047 -- - as a sub request. Default is FALSE
2048 -- argument1..100 - Optional. Arguments for the concurrent request
2049
2050 PROCEDURE submit_request (
2051 application IN varchar2 ,
2052 program IN varchar2 ,
2053 description IN varchar2 ,
2054 start_time IN varchar2 ,
2055 sub_request IN boolean ,
2056 argument1 IN varchar2 ,
2057 argument2 IN varchar2 ,
2058 argument3 IN varchar2 ,
2059 argument4 IN varchar2 ,
2060 argument5 IN varchar2 ,
2061 argument6 IN varchar2 ,
2062 argument7 IN varchar2 ,
2063 argument8 IN varchar2 ,
2064 argument9 IN varchar2 ,
2065 argument10 IN varchar2 ,
2066 argument11 IN varchar2 ,
2067 argument12 IN varchar2 ,
2068 argument13 IN varchar2 ,
2069 argument14 IN varchar2 ,
2070 argument15 IN varchar2 ,
2071 argument16 IN varchar2 ,
2072 argument17 IN varchar2 ,
2073 argument18 IN varchar2 ,
2074 argument19 IN varchar2 ,
2075 argument20 IN varchar2 ,
2076 argument21 IN varchar2 ,
2077 argument22 IN varchar2 ,
2078 argument23 IN varchar2 ,
2079 argument24 IN varchar2 ,
2080 argument25 IN varchar2 ,
2081 argument26 IN varchar2 ,
2082 argument27 IN varchar2 ,
2083 argument28 IN varchar2 ,
2084 argument29 IN varchar2 ,
2085 argument30 IN varchar2 ,
2086 argument31 IN varchar2 ,
2087 argument32 IN varchar2 ,
2088 argument33 IN varchar2 ,
2089 argument34 IN varchar2 ,
2090 argument35 IN varchar2 ,
2091 argument36 IN varchar2 ,
2092 argument37 IN varchar2 ,
2093 argument38 IN varchar2 ,
2094 argument39 IN varchar2 ,
2095 argument40 IN varchar2 ,
2096 argument41 IN varchar2 ,
2097 argument42 IN varchar2 ,
2098 argument43 IN varchar2 ,
2099 argument44 IN varchar2 ,
2100 argument45 IN varchar2 ,
2101 argument46 IN varchar2 ,
2102 argument47 IN varchar2 ,
2103 argument48 IN varchar2 ,
2104 argument49 IN varchar2 ,
2105 argument50 IN varchar2 ,
2106 argument51 IN varchar2 ,
2107 argument52 IN varchar2 ,
2108 argument53 IN varchar2 ,
2109 argument54 IN varchar2 ,
2110 argument55 IN varchar2 ,
2111 argument56 IN varchar2 ,
2112 argument57 IN varchar2 ,
2113 argument58 IN varchar2 ,
2114 argument59 IN varchar2 ,
2115 argument60 IN varchar2 ,
2116 argument61 IN varchar2 ,
2117 argument62 IN varchar2 ,
2118 argument63 IN varchar2 ,
2119 argument64 IN varchar2 ,
2120 argument65 IN varchar2 ,
2121 argument66 IN varchar2 ,
2122 argument67 IN varchar2 ,
2123 argument68 IN varchar2 ,
2124 argument69 IN varchar2 ,
2125 argument70 IN varchar2 ,
2126 argument71 IN varchar2 ,
2127 argument72 IN varchar2 ,
2128 argument73 IN varchar2 ,
2129 argument74 IN varchar2 ,
2130 argument75 IN varchar2 ,
2131 argument76 IN varchar2 ,
2132 argument77 IN varchar2 ,
2133 argument78 IN varchar2 ,
2134 argument79 IN varchar2 ,
2135 argument80 IN varchar2 ,
2136 argument81 IN varchar2 ,
2137 argument82 IN varchar2 ,
2138 argument83 IN varchar2 ,
2139 argument84 IN varchar2 ,
2140 argument85 IN varchar2 ,
2141 argument86 IN varchar2 ,
2142 argument87 IN varchar2 ,
2143 argument88 IN varchar2 ,
2144 argument89 IN varchar2 ,
2145 argument90 IN varchar2 ,
2146 argument91 IN varchar2 ,
2147 argument92 IN varchar2 ,
2148 argument93 IN varchar2 ,
2149 argument94 IN varchar2 ,
2150 argument95 IN varchar2 ,
2151 argument96 IN varchar2 ,
2152 argument97 IN varchar2 ,
2153 argument98 IN varchar2 ,
2154 argument99 IN varchar2 ,
2155 argument100 IN varchar2 ,
2156 p_init_msg_list IN VARCHAR2
2157 ,x_return_status OUT NOCOPY VARCHAR2
2158 ,x_msg_count OUT NOCOPY NUMBER
2159 ,x_msg_data OUT NOCOPY VARCHAR2) IS
2160
2161 l_request_id NUMBER := 0;
2162 l_proc varchar2(72) := ' OKC_OC_INT_PUB.'||'submit_request';
2163
2164 BEGIN
2165
2166 --
2167 -- Call fnd_request.submit_request function, to submit concurrent
2168 -- request
2169 IF (l_debug = 'Y') THEN
2170 okc_debug.Set_Indentation(l_proc);
2171 okc_debug.Log('10: Entering ',2);
2172 END IF;
2173
2174 IF (l_debug = 'Y') THEN
2175 okc_debug.Log('20: Before fnd_request.submit_request for outcome',2);
2176 END IF;
2177 l_request_id := fnd_request.submit_request(
2178 application, program, description, start_time, sub_request,
2179 Argument1, Argument2, Argument3, Argument4, Argument5,
2180 Argument6, Argument7, Argument8, Argument9, Argument10,
2181 Argument11, Argument12, Argument13, Argument14, Argument15,
2182 Argument16, Argument17, Argument18, Argument19, Argument20,
2183 Argument21, Argument22, Argument23, Argument24, Argument25,
2184 Argument26, Argument27, Argument28, Argument29, Argument30,
2185 Argument31, Argument32, Argument33, Argument34, Argument35,
2186 Argument36, Argument37, Argument38, Argument39, Argument40,
2187 Argument41, Argument42, Argument43, Argument44, Argument45,
2188 Argument46, Argument47, Argument48, Argument49, Argument50,
2189 Argument51, Argument52, Argument53, Argument54, Argument55,
2190 Argument56, Argument57, Argument58, Argument59, Argument60,
2191 Argument61, Argument62, Argument63, Argument64, Argument65,
2192 Argument66, Argument67, Argument68, Argument69, Argument70,
2193 Argument71, Argument72, Argument73, Argument74, Argument75,
2194 Argument76, Argument77, Argument78, Argument79, Argument80,
2195 Argument81, Argument82, Argument83, Argument84, Argument85,
2196 Argument86, Argument87, Argument88, Argument89, Argument90,
2197 Argument91, Argument92, Argument93, Argument94, Argument95,
2198 Argument96, Argument97, Argument98, Argument99, Argument100);
2199 IF (l_debug = 'Y') THEN
2200 okc_debug.Log('20: After fnd_request.submit_request for outcome',2);
2201 END IF;
2202
2203 IF ( l_request_id <> 0 ) THEN
2204 -- Successfully submitted conc request
2205 x_return_status := OKC_API.G_RET_STS_SUCCESS;
2206 IF (l_debug = 'Y') THEN
2207 okc_debug.Log('30: Conc Req ' || to_char(l_request_id) || ' successfully submitted',2);
2208 END IF;
2209 OKC_API.set_message(G_APP_NAME
2210 ,'OKC_SUBMIT_REQUEST_SUCCESS'
2211 ,'REQUEST_ID'
2212 ,to_char(l_request_id));
2213
2214 ELSE
2215 -- Error in submitting conc request
2216 x_return_status := OKC_API.G_RET_STS_ERROR;
2217 IF (l_debug = 'Y') THEN
2218 okc_debug.Log('30: Conc Req failed' || to_char(l_request_id),2);
2219 END IF;
2220 OKC_API.set_message(G_APP_NAME
2221 ,G_UNEXPECTED_ERROR
2222 ,G_SQLCODE_TOKEN
2223 ,SQLCODE
2224 ,G_SQLERRM_TOKEN
2225 ,SQLERRM);
2226 END IF;
2227 IF (l_debug = 'Y') THEN
2228 okc_debug.Log('40: Leaving ',2);
2229 okc_debug.Reset_Indentation;
2230 END IF;
2231
2232 EXCEPTION WHEN others THEN
2233 x_msg_data := SQLERRM;
2234 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2235 OKC_API.set_message(G_APP_NAME
2236 ,G_UNEXPECTED_ERROR
2237 ,G_SQLCODE_TOKEN
2238 ,SQLCODE
2239 ,G_SQLERRM_TOKEN
2240 ,SQLERRM);
2241 END submit_request;
2242
2243 END OKC_OC_INT_PUB;