[Home] [Help]
PACKAGE BODY: APPS.OKL_RPC_PVT
Source
1 PACKAGE BODY OKL_RPC_PVT AS
2 /* $Header: OKLSRPCB.pls 120.6 2007/08/08 12:52:01 arajagop noship $ */
3
4
5
6 ----------------------------------------
7 -- GLOBAL CONSTANTS
8 -- Post-Generation Change
9 -- By RMUNJULU on 27-SEP-2001
10 ----------------------------------------
11 G_NO_PARENT_RECORD CONSTANT VARCHAR2(200) := 'OKC_NO_PARENT_RECORD';
12 G_UNEXPECTED_ERROR CONSTANT VARCHAR2(200) := 'OKC_CONTRACTS_UNEXPECTED_ERROR';
13 G_SQLERRM_TOKEN CONSTANT VARCHAR2(200) := 'SQLerrm';
14 G_SQLCODE_TOKEN CONSTANT VARCHAR2(200) := 'SQLcode';
15 G_EXCEPTION_HALT_VALIDATION EXCEPTION;
16
17 -- Start of comments
18 --
19 -- Procedure Name : validate_currency_record
20 -- Description : Used for validation of Currency Code Conversion Coulms
21 -- Business Rules : If transaction currency <> functional currency, then conversion columns
22 -- are mandatory
23 -- Else If transaction currency = functional currency, then conversion columns
24 -- should all be NULL
25 -- Parameters :
26 -- Version : 1.0
27 -- History : SPILLAIP 12-DEC-2002 2667636:Added new procedure
28 -- End of comments
29
30 PROCEDURE validate_currency_record(p_rpcv_rec IN rpcv_rec_type,
31 x_return_status OUT NOCOPY VARCHAR2) IS
32 BEGIN
33 x_return_status := OKC_API.G_RET_STS_SUCCESS;
34 -- If transaction currency <> functional currency, then conversion columns
35 -- are mandatory
36 IF (p_rpcv_rec.currency_code <> p_rpcv_rec.currency_conversion_code) THEN
37 IF (p_rpcv_rec.currency_conversion_type = OKC_API.G_MISS_CHAR OR
38 p_rpcv_rec.currency_conversion_type IS NULL) THEN
39 --SET MESSAGE
40 OKC_API.set_message(p_app_name => G_APP_NAME,
41 p_msg_name => G_REQUIRED_VALUE,
42 p_token1 => G_COL_NAME_TOKEN,
43 p_token1_value => 'currency_conversion_type');
44 x_return_status := OKC_API.G_RET_STS_ERROR;
45 END IF;
46 IF (p_rpcv_rec.currency_conversion_rate = OKC_API.G_MISS_NUM OR
47 p_rpcv_rec.currency_conversion_rate IS NULL) THEN
48 --SET MESSAGE
49 OKC_API.set_message(p_app_name => G_APP_NAME,
50 p_msg_name => G_REQUIRED_VALUE,
51 p_token1 => G_COL_NAME_TOKEN,
52 p_token1_value => 'currency_conversion_rate');
53 x_return_status := OKC_API.G_RET_STS_ERROR;
54 END IF;
55 IF (p_rpcv_rec.currency_conversion_date = OKC_API.G_MISS_DATE OR
56 p_rpcv_rec.currency_conversion_date IS NULL) THEN
57 --SET MESSAGE
58 OKC_API.set_message(p_app_name => G_APP_NAME,
59 p_msg_name => G_REQUIRED_VALUE,
60 p_token1 => G_COL_NAME_TOKEN,
61 p_token1_value => 'currency_conversion_date');
62 x_return_status := OKC_API.G_RET_STS_ERROR;
63 END IF;
64 -- Else If transaction currency = functional currency, then conversion columns
65 -- should all be NULL
66 ELSIF (p_rpcv_rec.currency_code = p_rpcv_rec.currency_conversion_code) THEN
67 IF (p_rpcv_rec.currency_conversion_type IS NOT NULL) OR
68 (p_rpcv_rec.currency_conversion_rate IS NOT NULL) OR
69 (p_rpcv_rec.currency_conversion_date IS NOT NULL) THEN
70 --SET MESSAGE
71 -- Currency conversion columns should be all null
72 IF p_rpcv_rec.currency_conversion_rate IS NOT NULL THEN
73 OKC_API.set_message(p_app_name => G_APP_NAME,
74 p_msg_name => G_INVALID_VALUE,
75 p_token1 => G_COL_NAME_TOKEN,
76 p_token1_value => 'currency_conversion_rate');
77 END IF;
78 IF p_rpcv_rec.currency_conversion_date IS NOT NULL THEN
79 OKC_API.set_message(p_app_name => G_APP_NAME,
80 p_msg_name => G_INVALID_VALUE,
81 p_token1 => G_COL_NAME_TOKEN,
82 p_token1_value => 'currency_conversion_date');
83 END IF;
84 IF p_rpcv_rec.currency_conversion_type IS NOT NULL THEN
85 OKC_API.set_message(p_app_name => G_APP_NAME,
86 p_msg_name => G_INVALID_VALUE,
87 p_token1 => G_COL_NAME_TOKEN,
88 p_token1_value => 'currency_conversion_type');
89 END IF;
90 x_return_status := OKC_API.G_RET_STS_ERROR;
91 END IF;
92 ELSE
93 x_return_status := OKC_API.G_RET_STS_ERROR;
94 END IF;
95 IF x_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
96 RAISE G_EXCEPTION_HALT_VALIDATION;
97 END IF;
98 EXCEPTION
99 WHEN G_EXCEPTION_HALT_VALIDATION THEN
100 x_return_status := OKC_API.G_RET_STS_ERROR;
101 WHEN OTHERS THEN
102 -- store SQL error message on message stack for caller
103 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
104 p_msg_name => g_unexpected_error,
105 p_token1 => g_sqlcode_token,
106 p_token1_value => sqlcode,
107 p_token2 => g_sqlerrm_token,
108 p_token2_value => sqlerrm);
109 -- notify caller of an UNEXPECTED error
110 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
111 END validate_currency_record;
112 ---------------------------------------------------------------------------------
113 -- Start of comments
114 --
115 -- Procedure Name : validate_currency_code
116 -- Description : Validation of Currency Code
117 -- Business Rules :
118 -- Parameters :
119 -- Version : 1.0
120 -- History : SPILLAIP 12-DEC-2002 2667636:Added new procedure
121 -- End of comments
122
123 PROCEDURE validate_currency_code(p_rpcv_rec IN rpcv_rec_type,
124 x_return_status OUT NOCOPY VARCHAR2) IS
125 l_return_status VARCHAR2(3) := OKC_API.G_TRUE;
126 BEGIN
127 -- initialize return status
128 x_return_status := OKC_API.G_RET_STS_SUCCESS;
129 -- data is required
130 IF (p_rpcv_rec.currency_code IS NULL) OR
131 (p_rpcv_rec.currency_code = OKC_API.G_MISS_CHAR) THEN
132 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
133 ,p_msg_name => G_REQUIRED_VALUE
134 ,p_token1 => G_COL_NAME_TOKEN
135 ,p_token1_value => 'currency_code');
136
137 -- halt further validation of this column
138 RAISE G_EXCEPTION_HALT_VALIDATION;
139 END IF;
140 -- check from currency values using the generic okl_util.validate_currency_code
141 l_return_status := OKL_ACCOUNTING_UTIL.validate_currency_code(p_rpcv_rec.currency_code);
142 IF (l_return_status <> OKC_API.G_TRUE) THEN
143 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
144 p_msg_name => g_invalid_value,
145 p_token1 => g_col_name_token,
146 p_token1_value => 'currency_code');
147 -- halt further validation of this column
148 RAISE G_EXCEPTION_HALT_VALIDATION;
149 END IF;
150 EXCEPTION
151 WHEN G_EXCEPTION_HALT_VALIDATION THEN
152 x_return_status := OKC_API.G_RET_STS_ERROR;
153 WHEN OTHERS THEN
154 -- store SQL error message on message stack for caller
155 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
156 p_msg_name => g_unexpected_error,
157 p_token1 => g_sqlcode_token,
158 p_token1_value => sqlcode,
159 p_token2 => g_sqlerrm_token,
160 p_token2_value => sqlerrm);
161 -- notify caller of an UNEXPECTED error
162 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
163 END validate_currency_code;
164 ---------------------------------------------------------------------------------
165 -- Start of comments
166 --
167 -- Procedure Name : validate_currency_con_code
168 -- Description : Validation of Currency Conversion Code
169 -- Business Rules :
170 -- Parameters :
171 -- Version : 1.0
172 -- History : SPILLAIP 12-DEC-2002 2667636:Added new procedure
173 -- End of comments
174
175 PROCEDURE validate_currency_con_code(p_rpcv_rec IN rpcv_rec_type,
176 x_return_status OUT NOCOPY VARCHAR2) IS
177 l_return_status VARCHAR2(3) := OKC_API.G_TRUE;
178 BEGIN
179 -- initialize return status
180 x_return_status := OKC_API.G_RET_STS_SUCCESS;
181 -- data is required
182 IF (p_rpcv_rec.currency_conversion_code IS NULL) OR
183 (p_rpcv_rec.currency_conversion_code = OKC_API.G_MISS_CHAR) THEN
184 OKC_API.SET_MESSAGE( p_app_name => G_APP_NAME
185 ,p_msg_name => G_REQUIRED_VALUE
186 ,p_token1 => G_COL_NAME_TOKEN
187 ,p_token1_value => 'currency_conversion_code');
188 -- halt further validation of this column
189 RAISE G_EXCEPTION_HALT_VALIDATION;
190 END IF;
191 -- check from currency values using the generic okl_util.validate_currency_code
192 l_return_status := OKL_ACCOUNTING_UTIL.validate_currency_code(p_rpcv_rec.currency_conversion_code);
193 IF (l_return_status <> OKC_API.G_TRUE) THEN
194 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
195 p_msg_name => g_invalid_value,
196 p_token1 => g_col_name_token,
197 p_token1_value => 'currency_conversion_code');
198 -- halt further validation of this column
199 RAISE G_EXCEPTION_HALT_VALIDATION;
200 END IF;
201 EXCEPTION
202 WHEN G_EXCEPTION_HALT_VALIDATION THEN
203 x_return_status := OKC_API.G_RET_STS_ERROR;
204 WHEN OTHERS THEN
205 -- store SQL error message on message stack for caller
206 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
207 p_msg_name => g_unexpected_error,
208 p_token1 => g_sqlcode_token,
209 p_token1_value => sqlcode,
210 p_token2 => g_sqlerrm_token,
211 p_token2_value => sqlerrm);
212
213 -- notify caller of an UNEXPECTED error
214 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
215 END validate_currency_con_code;
216 ---------------------------------------------------------------------------------
217 -- Start of comments
218 --
219 -- Procedure Name : validate_currency_con_type
220 -- Description : Validation of Currency Conversion type
221 -- Business Rules :
222 -- Parameters :
223 -- Version : 1.0
224 -- History : SPILLAIP 12-DEC-2002 2667636:Added new procedure
225 -- End of comments
226
227 PROCEDURE validate_currency_con_type(p_rpcv_rec IN rpcv_rec_type,
228 x_return_status OUT NOCOPY VARCHAR2) IS
229 l_return_status VARCHAR2(3) := OKC_API.G_TRUE;
230 BEGIN
231 -- initialize return status
232 x_return_status := OKC_API.G_RET_STS_SUCCESS;
233 IF (p_rpcv_rec.currency_conversion_type <> OKL_API.G_MISS_CHAR AND
234 p_rpcv_rec.currency_conversion_type IS NOT NULL) THEN
235 -- check from currency values using the generic okl_util.validate_currency_code
236 l_return_status := OKL_ACCOUNTING_UTIL.validate_currency_con_type(p_rpcv_rec.currency_conversion_type);
237 IF (l_return_status <> OKC_API.G_TRUE) THEN
238 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
239 p_msg_name => g_invalid_value,
240 p_token1 => g_col_name_token,
241 p_token1_value => 'currency_conversion_type');
242 -- halt further validation of this column
243 RAISE G_EXCEPTION_HALT_VALIDATION;
244 END IF;
245 END IF;
246 EXCEPTION
247 WHEN G_EXCEPTION_HALT_VALIDATION THEN
248 x_return_status := OKC_API.G_RET_STS_ERROR;
249 WHEN OTHERS THEN
250 -- store SQL error message on message stack for caller
251 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
252 p_msg_name => g_unexpected_error,
253 p_token1 => g_sqlcode_token,
254 p_token1_value => sqlcode,
255 p_token2 => g_sqlerrm_token,
256 p_token2_value => sqlerrm);
257 -- notify caller of an UNEXPECTED error
258 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
259 END validate_currency_con_type;
260
261 ------------------------------------------------------------------------
262 -- PROCEDURE validate_id
263 -- Post-Generation Change
264 -- By RMUNJULU on 27-SEP-2001
265 ------------------------------------------------------------------------
266 PROCEDURE validate_id(
267 x_return_status OUT NOCOPY VARCHAR2,
268 p_rpcv_rec IN rpcv_rec_type) IS
269
270 BEGIN
271 -- initialize return status
272 x_return_status := OKC_API.G_RET_STS_SUCCESS;
273
274 -- data is required
275 IF (p_rpcv_rec.id = OKC_API.G_MISS_NUM OR p_rpcv_rec.id IS NULL) THEN
276 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
277 p_msg_name => g_required_value,
278 p_token1 => g_col_name_token,
279 p_token1_value => 'id');
280
281 -- notify caller of an error
282 x_return_status := OKC_API.G_RET_STS_ERROR;
283
284 -- halt further validation of this column
285 RAISE G_EXCEPTION_HALT_VALIDATION;
286
287 END IF;
288
289 EXCEPTION
290 WHEN G_EXCEPTION_HALT_VALIDATION THEN
291 -- no processing necessary; validation can continue
292 -- with the next column
293 NULL;
294 WHEN OTHERS THEN
295 -- store SQL error message on message stack for caller
296 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
297 p_msg_name => g_unexpected_error,
298 p_token1 => g_sqlcode_token,
299 p_token1_value => sqlcode,
300 p_token2 => g_sqlerrm_token,
301 p_token2_value => sqlerrm);
302
303 -- notify caller of an UNEXPECTED error
304 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
305
306 END validate_id;
307
308 ------------------------------------------------------------------------
309 -- PROCEDURE validate_object_version_number
310 -- Post-Generation Change
311 -- By RMUNJULU on 27-SEP-2001
312 ------------------------------------------------------------------------
313 PROCEDURE validate_object_version_number(
314 x_return_status OUT NOCOPY VARCHAR2,
315 p_rpcv_rec IN rpcv_rec_type) IS
316
317 BEGIN
318 -- initialize return status
319 x_return_status := OKC_API.G_RET_STS_SUCCESS;
320
321 -- data is required
322 IF (p_rpcv_rec.object_version_number IS NULL)
323 OR (p_rpcv_rec.object_version_number = OKC_API.G_MISS_NUM) THEN
324 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
325 p_msg_name => g_required_value,
326 p_token1 => g_col_name_token,
327 p_token1_value => 'object_version_number');
328
329 -- notify caller of an error
330 x_return_status := OKC_API.G_RET_STS_ERROR;
331
332 -- halt further validation of this column
333 RAISE G_EXCEPTION_HALT_VALIDATION;
334
335 END IF;
336
337 EXCEPTION
338 WHEN G_EXCEPTION_HALT_VALIDATION THEN
339 -- no processing necessary; validation can continue
340 -- with the next column
341 NULL;
342 WHEN OTHERS THEN
343 -- store SQL error message on message stack for caller
344 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
345 p_msg_name => g_unexpected_error,
346 p_token1 => g_sqlcode_token,
347 p_token1_value => sqlcode,
348 p_token2 => g_sqlerrm_token,
349 p_token2_value => sqlerrm);
350
351 -- notify caller of an UNEXPECTED error
352 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
353
354 END validate_object_version_number;
355
356 ------------------------------------------------------------------------
357 -- PROCEDURE validate_sfwt_flag
358 -- Post-Generation Change
359 -- By RMUNJULU on 27-SEP-2001
360 ------------------------------------------------------------------------
361 PROCEDURE validate_sfwt_flag(
362 x_return_status OUT NOCOPY VARCHAR2,
363 p_rpcv_rec IN rpcv_rec_type) IS
364
365 BEGIN
366 -- initialize return status
367 x_return_status := OKC_API.G_RET_STS_SUCCESS;
368
369 -- data is required
370 IF (p_rpcv_rec.sfwt_flag IS NULL)
371 OR (p_rpcv_rec.sfwt_flag = OKC_API.G_MISS_CHAR) THEN
372 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
373 p_msg_name => g_required_value,
374 p_token1 => g_col_name_token,
375 p_token1_value => 'sfwt_flag');
376
377 -- notify caller of an error
378 x_return_status := OKC_API.G_RET_STS_ERROR;
379
380 -- halt further validation of this column
381 RAISE G_EXCEPTION_HALT_VALIDATION;
382
383 END IF;
384
385 EXCEPTION
386 WHEN G_EXCEPTION_HALT_VALIDATION THEN
387 -- no processing necessary; validation can continue
388 -- with the next column
389 NULL;
390 WHEN OTHERS THEN
391 -- store SQL error message on message stack for caller
392 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
393 p_msg_name => g_unexpected_error,
394 p_token1 => g_sqlcode_token,
395 p_token1_value => sqlcode,
396 p_token2 => g_sqlerrm_token,
397 p_token2_value => sqlerrm);
398
399 -- notify caller of an UNEXPECTED error
400 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
401
402 END validate_sfwt_flag;
403
404
405
406 ------------------------------------------------------------------------
407 -- PROCEDURE validate_cost
408 -- Post-Generation Change
409 -- By RMUNJULU on 27-SEP-2001
410 ------------------------------------------------------------------------
411 PROCEDURE validate_cost(
412 x_return_status OUT NOCOPY VARCHAR2,
413 p_rpcv_rec IN rpcv_rec_type) IS
414
415 BEGIN
416 -- initialize return status
417 x_return_status := OKC_API.G_RET_STS_SUCCESS;
418
419 -- data is required
420 IF (p_rpcv_rec.cost IS NULL)
421 OR (p_rpcv_rec.cost = OKC_API.G_MISS_NUM) THEN
422 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
423 p_msg_name => g_required_value,
424 p_token1 => g_col_name_token,
425 p_token1_value => 'cost');
426
427 -- notify caller of an error
428 x_return_status := OKC_API.G_RET_STS_ERROR;
429
430 -- halt further validation of this column
431 RAISE G_EXCEPTION_HALT_VALIDATION;
432
433 END IF;
434
435 EXCEPTION
436 WHEN G_EXCEPTION_HALT_VALIDATION THEN
437 -- no processing necessary; validation can continue
438 -- with the next column
439 NULL;
440 WHEN OTHERS THEN
441 -- store SQL error message on message stack for caller
442 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
443 p_msg_name => g_unexpected_error,
444 p_token1 => g_sqlcode_token,
445 p_token1_value => sqlcode,
446 p_token2 => g_sqlerrm_token,
447 p_token2_value => sqlerrm);
448
449 -- notify caller of an UNEXPECTED error
450 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
451
452 END validate_cost;
453
454
455
456
457 ------------------------------------------------------------------------
458 -- PROCEDURE validate_repair_type
459 -- Post-Generation Change
460 -- By RMUNJULU on 27-SEP-2001
461 ------------------------------------------------------------------------
462 PROCEDURE validate_repair_type(
463 x_return_status OUT NOCOPY VARCHAR2,
464 p_rpcv_rec IN rpcv_rec_type) IS
465
466 BEGIN
467 -- initialize return status
468 x_return_status := OKC_API.G_RET_STS_SUCCESS;
469
470 -- data is required
471 IF (p_rpcv_rec.repair_type IS NULL)
472 OR (p_rpcv_rec.repair_type = OKC_API.G_MISS_CHAR) THEN
473 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
474 p_msg_name => g_required_value,
475 p_token1 => g_col_name_token,
476 p_token1_value => 'repair_type');
477
478 -- notify caller of an error
479 x_return_status := OKC_API.G_RET_STS_ERROR;
480
481 -- halt further validation of this column
482 RAISE G_EXCEPTION_HALT_VALIDATION;
483
484 END IF;
485
486 EXCEPTION
487 WHEN G_EXCEPTION_HALT_VALIDATION THEN
488 -- no processing necessary; validation can continue
489 -- with the next column
490 NULL;
491 WHEN OTHERS THEN
492 -- store SQL error message on message stack for caller
493 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
494 p_msg_name => g_unexpected_error,
495 p_token1 => g_sqlcode_token,
496 p_token1_value => sqlcode,
497 p_token2 => g_sqlerrm_token,
498 p_token2_value => sqlerrm);
499
500 -- notify caller of an UNEXPECTED error
501 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
502
503 END validate_repair_type;
504
505
506
507 ------------------------------------------------------------------------
508 -- PROCEDURE validate_description
509 -- Post-Generation Change
510 -- By RMUNJULU on 27-SEP-2001
511 ------------------------------------------------------------------------
512 PROCEDURE validate_description(
513 x_return_status OUT NOCOPY VARCHAR2,
514 p_rpcv_rec IN rpcv_rec_type) IS
515
516 BEGIN
517 -- initialize return status
518 x_return_status := OKC_API.G_RET_STS_SUCCESS;
519
520 -- data is required
521 IF (p_rpcv_rec.description IS NULL)
522 OR (p_rpcv_rec.description = OKC_API.G_MISS_CHAR) THEN
523 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
524 p_msg_name => g_required_value,
525 p_token1 => g_col_name_token,
526 p_token1_value => 'description');
527
528 -- notify caller of an error
529 x_return_status := OKC_API.G_RET_STS_ERROR;
530
531 -- halt further validation of this column
532 RAISE G_EXCEPTION_HALT_VALIDATION;
533
534 END IF;
535
536 EXCEPTION
537 WHEN G_EXCEPTION_HALT_VALIDATION THEN
538 -- no processing necessary; validation can continue
539 -- with the next column
540 NULL;
541 WHEN OTHERS THEN
542 -- store SQL error message on message stack for caller
543 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
544 p_msg_name => g_unexpected_error,
545 p_token1 => g_sqlcode_token,
546 p_token1_value => sqlcode,
547 p_token2 => g_sqlerrm_token,
548 p_token2_value => sqlerrm);
549
550 -- notify caller of an UNEXPECTED error
551 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
552
553 END validate_description;
554
555
556
557 ------------------------------------------------------------------------
558 -- PROCEDURE validate_enabled_yn
559 -- Post-Generation Change
560 -- By RMUNJULU on 27-SEP-2001
561 ------------------------------------------------------------------------
562 PROCEDURE validate_enabled_yn (
563 x_return_status OUT NOCOPY VARCHAR2,
564 p_rpcv_rec IN rpcv_rec_type ) IS
565 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
566 BEGIN
567 -- intialize return status
568 x_return_status := OKC_API.G_RET_STS_SUCCESS;
569
570 -- check from domain values using the generic okl_util.check_domain_yn
571 l_return_status := OKL_UTIL.check_domain_yn(p_rpcv_rec.enabled_yn);
572
573 IF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
574 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
575 p_msg_name => g_invalid_value,
576 p_token1 => g_col_name_token,
577 p_token1_value => 'enabled_yn');
578
579 -- notify caller of an error
580 x_return_status := OKC_API.G_RET_STS_ERROR;
581 raise G_EXCEPTION_HALT_VALIDATION;
582
583 ELSIF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
584
585 -- notify caller of an error
586 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
587 raise G_EXCEPTION_HALT_VALIDATION;
588
589 END IF;
590
591 EXCEPTION
592 WHEN G_EXCEPTION_HALT_VALIDATION then
593 -- No action necessary. Validation can continue to next attribute/column
594 null;
595
596 WHEN OTHERS THEN
597 -- store SQL error message on message stack for caller
598 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
599 p_msg_name => g_unexpected_error,
600 p_token1 => g_sqlcode_token,
601 p_token1_value => sqlcode,
602 p_token2 => g_sqlerrm_token,
603 p_token2_value => sqlerrm);
604
605 -- notify caller of an UNEXPECTED error
606 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
607
608 END validate_enabled_yn;
609
610
611 ---------------------------------------------------------------------------
612 -- FUNCTION get_seq_id
613 ---------------------------------------------------------------------------
614 FUNCTION get_seq_id RETURN NUMBER IS
615 BEGIN
616 RETURN(okc_p_util.raw_to_number(sys_guid()));
617 END get_seq_id;
618
619 ---------------------------------------------------------------------------
620 -- PROCEDURE qc
621 ---------------------------------------------------------------------------
622 PROCEDURE qc IS
623 BEGIN
624 null;
625 END qc;
626
627 ---------------------------------------------------------------------------
628 -- PROCEDURE change_version
629 ---------------------------------------------------------------------------
630 PROCEDURE change_version IS
631 BEGIN
632 null;
633 END change_version;
634
635 ---------------------------------------------------------------------------
636 -- PROCEDURE api_copy
637 ---------------------------------------------------------------------------
638 PROCEDURE api_copy IS
639 BEGIN
640 null;
641 END api_copy;
642
643 ---------------------------------------------------------------------------
644 -- PROCEDURE add_language
645 ---------------------------------------------------------------------------
646 PROCEDURE add_language IS
647 BEGIN
648 DELETE FROM OKL_REPAIR_COSTS_TL T
649 WHERE NOT EXISTS (
650 SELECT NULL
651 FROM OKL_REPAIR_COSTS_ALL_B B
652 WHERE B.ID = T.ID
653 );
654
655 UPDATE OKL_REPAIR_COSTS_TL T SET (
656 REPAIR_TYPE,
657 DESCRIPTION) = (SELECT
658 B.REPAIR_TYPE,
659 B.DESCRIPTION
660 FROM OKL_REPAIR_COSTS_TL B
661 WHERE B.ID = T.ID
662 AND B.LANGUAGE = T.SOURCE_LANG)
663 WHERE (
664 T.ID,
665 T.LANGUAGE)
666 IN (SELECT
667 SUBT.ID,
668 SUBT.LANGUAGE
669 FROM OKL_REPAIR_COSTS_TL SUBB, OKL_REPAIR_COSTS_TL SUBT
670 WHERE SUBB.ID = SUBT.ID
671 AND SUBB.LANGUAGE = SUBT.SOURCE_LANG
672 AND (SUBB.REPAIR_TYPE <> SUBT.REPAIR_TYPE
673 OR SUBB.DESCRIPTION <> SUBT.DESCRIPTION
674 ));
675
676 INSERT INTO OKL_REPAIR_COSTS_TL (
677 ID,
678 LANGUAGE,
679 SOURCE_LANG,
680 SFWT_FLAG,
681 REPAIR_TYPE,
682 DESCRIPTION,
683 CREATED_BY,
684 CREATION_DATE,
685 LAST_UPDATED_BY,
686 LAST_UPDATE_DATE,
687 LAST_UPDATE_LOGIN)
688 SELECT
689 B.ID,
690 L.LANGUAGE_CODE,
691 B.SOURCE_LANG,
692 B.SFWT_FLAG,
693 B.REPAIR_TYPE,
694 B.DESCRIPTION,
695 B.CREATED_BY,
696 B.CREATION_DATE,
697 B.LAST_UPDATED_BY,
698 B.LAST_UPDATE_DATE,
699 B.LAST_UPDATE_LOGIN
700 FROM OKL_REPAIR_COSTS_TL B, FND_LANGUAGES L
701 WHERE L.INSTALLED_FLAG IN ('I', 'B')
702 AND B.LANGUAGE = USERENV('LANG')
703 AND NOT EXISTS(
704 SELECT NULL
705 FROM OKL_REPAIR_COSTS_TL T
706 WHERE T.ID = B.ID
707 AND T.LANGUAGE = L.LANGUAGE_CODE
708 );
709
710 END add_language;
711
712 ---------------------------------------------------------------------------
713 -- FUNCTION get_rec for: OKL_REPAIR_COSTS_TL
714 ---------------------------------------------------------------------------
715 FUNCTION get_rec (
716 p_okl_repair_costs_tl_rec IN okl_repair_costs_tl_rec_type,
717 x_no_data_found OUT NOCOPY BOOLEAN
718 ) RETURN okl_repair_costs_tl_rec_type IS
719 CURSOR okl_repair_costs_tl_pk_csr (p_id IN NUMBER,
720 p_language IN VARCHAR2) IS
721 SELECT
722 ID,
723 LANGUAGE,
724 SOURCE_LANG,
725 SFWT_FLAG,
726 REPAIR_TYPE,
727 DESCRIPTION,
728 CREATED_BY,
729 CREATION_DATE,
730 LAST_UPDATED_BY,
731 LAST_UPDATE_DATE,
732 LAST_UPDATE_LOGIN
733 FROM Okl_Repair_Costs_Tl
734 WHERE okl_repair_costs_tl.id = p_id
735 AND okl_repair_costs_tl.language = p_language;
736 l_okl_repair_costs_tl_pk okl_repair_costs_tl_pk_csr%ROWTYPE;
737 l_okl_repair_costs_tl_rec okl_repair_costs_tl_rec_type;
738 BEGIN
739 x_no_data_found := TRUE;
740 -- Get current database values
741 OPEN okl_repair_costs_tl_pk_csr (p_okl_repair_costs_tl_rec.id,
742 p_okl_repair_costs_tl_rec.language);
743 FETCH okl_repair_costs_tl_pk_csr INTO
744 l_okl_repair_costs_tl_rec.ID,
745 l_okl_repair_costs_tl_rec.LANGUAGE,
746 l_okl_repair_costs_tl_rec.SOURCE_LANG,
747 l_okl_repair_costs_tl_rec.SFWT_FLAG,
748 l_okl_repair_costs_tl_rec.REPAIR_TYPE,
749 l_okl_repair_costs_tl_rec.DESCRIPTION,
750 l_okl_repair_costs_tl_rec.CREATED_BY,
751 l_okl_repair_costs_tl_rec.CREATION_DATE,
752 l_okl_repair_costs_tl_rec.LAST_UPDATED_BY,
753 l_okl_repair_costs_tl_rec.LAST_UPDATE_DATE,
754 l_okl_repair_costs_tl_rec.LAST_UPDATE_LOGIN;
755 x_no_data_found := okl_repair_costs_tl_pk_csr%NOTFOUND;
756 CLOSE okl_repair_costs_tl_pk_csr;
757 RETURN(l_okl_repair_costs_tl_rec);
758 END get_rec;
759
760 FUNCTION get_rec (
761 p_okl_repair_costs_tl_rec IN okl_repair_costs_tl_rec_type
762 ) RETURN okl_repair_costs_tl_rec_type IS
763 l_row_notfound BOOLEAN := TRUE;
764 BEGIN
765 RETURN(get_rec(p_okl_repair_costs_tl_rec, l_row_notfound));
766 END get_rec;
767 ---------------------------------------------------------------------------
768 -- FUNCTION get_rec for: OKL_REPAIR_COSTS_B
769 ---------------------------------------------------------------------------
770 -- Start of comments
771 --
772 -- Function Name : get_rec
773 -- Description : for: OKL_REPAIR_COSTS_B
774 -- Business Rules :
775 -- Parameters :
776 -- Version : 1.0
777 -- History : SPILLAIP 12-DEC-2002 2667636
778 -- :modified for multicurrency changes
779 -- End of comments
780 FUNCTION get_rec (
781 p_rpc_rec IN rpc_rec_type,
782 x_no_data_found OUT NOCOPY BOOLEAN
783 ) RETURN rpc_rec_type IS
784 CURSOR okl_repair_costs_b_pk_csr (p_id IN NUMBER) IS
785 SELECT
786 ID,
787 OBJECT_VERSION_NUMBER,
788 ENABLED_YN,
789 ORG_ID,
790 COST,
791 CREATED_BY,
792 CREATION_DATE,
793 LAST_UPDATED_BY,
794 LAST_UPDATE_DATE,
795 LAST_UPDATE_LOGIN,
796 -- SPILLAIP - 2667636 - Start
797 CURRENCY_CODE,
798 CURRENCY_CONVERSION_CODE,
799 CURRENCY_CONVERSION_TYPE,
800 CURRENCY_CONVERSION_RATE,
801 CURRENCY_CONVERSION_DATE
802 -- SPILLAIP - 2667636 - End
803 FROM Okl_Repair_Costs_B
804 WHERE okl_repair_costs_b.id = p_id;
805 l_okl_repair_costs_b_pk okl_repair_costs_b_pk_csr%ROWTYPE;
806 l_rpc_rec rpc_rec_type;
807 BEGIN
808 x_no_data_found := TRUE;
809 -- Get current database values
810 OPEN okl_repair_costs_b_pk_csr (p_rpc_rec.id);
811 FETCH okl_repair_costs_b_pk_csr INTO
812 l_rpc_rec.ID,
813 l_rpc_rec.OBJECT_VERSION_NUMBER,
814 l_rpc_rec.ENABLED_YN,
815 l_rpc_rec.ORG_ID,
816 l_rpc_rec.COST,
817 l_rpc_rec.CREATED_BY,
818 l_rpc_rec.CREATION_DATE,
819 l_rpc_rec.LAST_UPDATED_BY,
820 l_rpc_rec.LAST_UPDATE_DATE,
821 l_rpc_rec.LAST_UPDATE_LOGIN,
822 -- SPILLAIP - 2667636 - Start
823 l_rpc_rec.CURRENCY_CODE,
824 l_rpc_rec.CURRENCY_CONVERSION_CODE,
825 l_rpc_rec.CURRENCY_CONVERSION_TYPE,
826 l_rpc_rec.CURRENCY_CONVERSION_RATE,
827 l_rpc_rec.CURRENCY_CONVERSION_DATE;
828 -- SPILLAIP - 2667636 - End
829 x_no_data_found := okl_repair_costs_b_pk_csr%NOTFOUND;
830 CLOSE okl_repair_costs_b_pk_csr;
831 RETURN(l_rpc_rec);
832 END get_rec;
833
834 FUNCTION get_rec (
835 p_rpc_rec IN rpc_rec_type
836 ) RETURN rpc_rec_type IS
837 l_row_notfound BOOLEAN := TRUE;
838 BEGIN
839 RETURN(get_rec(p_rpc_rec, l_row_notfound));
840 END get_rec;
841 ---------------------------------------------------------------------------
842 -- FUNCTION get_rec for: OKL_REPAIR_COSTS_V
843 ---------------------------------------------------------------------------
844 -- Start of comments
845 --
846 -- Function Name : get_rec
847 -- Description : for: OKL_REPAIR_COSTS_V
848 -- Business Rules :
849 -- Parameters :
850 -- Version : 1.0
851 -- History : SPILLAIP 12-DEC-2002 2667636
852 -- :modified for multicurrency changes
853 -- End of comments
854 FUNCTION get_rec (
855 p_rpcv_rec IN rpcv_rec_type,
856 x_no_data_found OUT NOCOPY BOOLEAN
857 ) RETURN rpcv_rec_type IS
858 CURSOR okl_rpcv_pk_csr (p_id IN NUMBER) IS
859 SELECT
860 ID,
861 OBJECT_VERSION_NUMBER,
862 SFWT_FLAG,
863 ENABLED_YN,
864 ORG_ID,
865 COST,
866 REPAIR_TYPE,
867 DESCRIPTION,
868 CREATED_BY,
869 CREATION_DATE,
870 LAST_UPDATED_BY,
871 LAST_UPDATE_DATE,
872 LAST_UPDATE_LOGIN,
873 -- SPILLAIP - 2667636 - Start
874 CURRENCY_CODE,
875 CURRENCY_CONVERSION_CODE,
876 CURRENCY_CONVERSION_TYPE,
877 CURRENCY_CONVERSION_RATE,
878 CURRENCY_CONVERSION_DATE
879 -- SPILLAIP - 2667636 - End
880 FROM Okl_Repair_Costs_V
881 WHERE okl_repair_costs_v.id = p_id;
882 l_okl_rpcv_pk okl_rpcv_pk_csr%ROWTYPE;
883 l_rpcv_rec rpcv_rec_type;
884 BEGIN
885 x_no_data_found := TRUE;
886 -- Get current database values
887 OPEN okl_rpcv_pk_csr (p_rpcv_rec.id);
888 FETCH okl_rpcv_pk_csr INTO
889 l_rpcv_rec.ID,
890 l_rpcv_rec.OBJECT_VERSION_NUMBER,
891 l_rpcv_rec.SFWT_FLAG,
892 l_rpcv_rec.ENABLED_YN,
893 l_rpcv_rec.ORG_ID,
894 l_rpcv_rec.COST,
895 l_rpcv_rec.REPAIR_TYPE,
896 l_rpcv_rec.DESCRIPTION,
897 l_rpcv_rec.CREATED_BY,
898 l_rpcv_rec.CREATION_DATE,
899 l_rpcv_rec.LAST_UPDATED_BY,
900 l_rpcv_rec.LAST_UPDATE_DATE,
901 l_rpcv_rec.LAST_UPDATE_LOGIN,
902 -- SPILLAIP - 2667636 -Start
903 l_rpcv_rec.CURRENCY_CODE,
904 l_rpcv_rec.CURRENCY_CONVERSION_CODE,
905 l_rpcv_rec.CURRENCY_CONVERSION_TYPE,
906 l_rpcv_rec.CURRENCY_CONVERSION_RATE,
907 l_rpcv_rec.CURRENCY_CONVERSION_DATE;
908 -- SPILLAIP - 2667636 -End
909 x_no_data_found := okl_rpcv_pk_csr%NOTFOUND;
910 CLOSE okl_rpcv_pk_csr;
911 RETURN(l_rpcv_rec);
912 END get_rec;
913
914 FUNCTION get_rec (
915 p_rpcv_rec IN rpcv_rec_type
916 ) RETURN rpcv_rec_type IS
917 l_row_notfound BOOLEAN := TRUE;
918 BEGIN
919 RETURN(get_rec(p_rpcv_rec, l_row_notfound));
920 END get_rec;
921
922 --------------------------------------------------------
923 -- FUNCTION null_out_defaults for: OKL_REPAIR_COSTS_V --
924 --------------------------------------------------------
925 -- Start of comments
926 --
927 -- Function Name : null_out_defaults
928 -- Description : for: OKL_REPAIR_COSTS_V
929 -- Business Rules :
930 -- Parameters :
931 -- Version : 1.0
932 -- History : SPILLAIP 12-DEC-2002 2667636
933 -- :modified for multicurrency changes
934 -- End of comments
935 FUNCTION null_out_defaults (
936 p_rpcv_rec IN rpcv_rec_type
937 ) RETURN rpcv_rec_type IS
938 l_rpcv_rec rpcv_rec_type := p_rpcv_rec;
939 BEGIN
940 IF (l_rpcv_rec.object_version_number = OKC_API.G_MISS_NUM) THEN
941 l_rpcv_rec.object_version_number := NULL;
942 END IF;
943 IF (l_rpcv_rec.sfwt_flag = OKC_API.G_MISS_CHAR) THEN
944 l_rpcv_rec.sfwt_flag := NULL;
945 END IF;
946 IF (l_rpcv_rec.enabled_yn = OKC_API.G_MISS_CHAR) THEN
947 l_rpcv_rec.enabled_yn := NULL;
948 END IF;
949 IF (l_rpcv_rec.org_id = OKC_API.G_MISS_NUM) THEN
950 l_rpcv_rec.org_id := NULL;
951 END IF;
952 IF (l_rpcv_rec.cost = OKC_API.G_MISS_NUM) THEN
953 l_rpcv_rec.cost := NULL;
954 END IF;
955 IF (l_rpcv_rec.repair_type = OKC_API.G_MISS_CHAR) THEN
956 l_rpcv_rec.repair_type := NULL;
957 END IF;
958 IF (l_rpcv_rec.description = OKC_API.G_MISS_CHAR) THEN
959 l_rpcv_rec.description := NULL;
960 END IF;
961 IF (l_rpcv_rec.created_by = OKC_API.G_MISS_NUM) THEN
962 l_rpcv_rec.created_by := NULL;
963 END IF;
964 IF (l_rpcv_rec.creation_date = OKC_API.G_MISS_DATE) THEN
965 l_rpcv_rec.creation_date := NULL;
966 END IF;
967 IF (l_rpcv_rec.last_updated_by = OKC_API.G_MISS_NUM) THEN
968 l_rpcv_rec.last_updated_by := NULL;
969 END IF;
970 IF (l_rpcv_rec.last_update_date = OKC_API.G_MISS_DATE) THEN
971 l_rpcv_rec.last_update_date := NULL;
972 END IF;
973 IF (l_rpcv_rec.last_update_login = OKC_API.G_MISS_NUM) THEN
974 l_rpcv_rec.last_update_login := NULL;
975 END IF;
976 -- SPILLAIP - 2667636 -Start
977 IF (l_rpcv_rec.currency_code = OKC_API.G_MISS_CHAR) THEN
978 l_rpcv_rec.currency_code := NULL;
979 END IF;
980 IF (l_rpcv_rec.currency_conversion_code = OKC_API.G_MISS_CHAR) THEN
981 l_rpcv_rec.currency_conversion_code := NULL;
982 END IF;
983 IF (l_rpcv_rec.currency_conversion_type = OKC_API.G_MISS_CHAR) THEN
984 l_rpcv_rec.currency_conversion_type := NULL;
985 END IF;
986 IF (l_rpcv_rec.currency_conversion_rate = OKC_API.G_MISS_NUM) THEN
987 l_rpcv_rec.currency_conversion_rate := NULL;
988 END IF;
989 IF (l_rpcv_rec.currency_conversion_date = OKC_API.G_MISS_DATE) THEN
990 l_rpcv_rec.currency_conversion_date := NULL;
991 END IF;
992 -- SPILLAIP - 2667636 -End
993 RETURN(l_rpcv_rec);
994 END null_out_defaults;
995 ---------------------------------------------------------------------------
996 -- PROCEDURE Validate_Attributes
997 -- Post-Generation Change
998 -- By RMUNJULU on 16-APR-2001
999 ---------------------------------------------------------------------------
1000
1001 ---------------------------------------------------
1002 -- Validate_Attributes for:OKL_RELOCATE_ASSETS_V --
1003 ---------------------------------------------------
1004 -- Start of comments
1005 --
1006 -- Procedure Name : validate_attributes
1007 -- Description : for:OKL_REMARKTNG_COSTS_V
1008 -- Business Rules :
1009 -- Parameters :
1010 -- Version : 1.0
1011 -- History : Modified by : RMUNJULU on 16-APR-2001
1012 -- : SPILLAIP 12-DEC-2002 2667636
1013 -- : modified for multicurrency changes
1014 -- End of comments
1015
1016
1017 FUNCTION validate_attributes(p_rpcv_rec IN rpcv_rec_type)
1018 RETURN VARCHAR2 IS
1019
1020 x_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1021 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1022
1023 BEGIN
1024 -- call column-level validation for 'id'
1025 validate_id(x_return_status => l_return_status,
1026 p_rpcv_rec => p_rpcv_rec);
1027
1028 -- store the highest degree of error
1029 IF (l_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1030 IF (x_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1031 x_return_status := l_return_status;
1032 END IF;
1033 END IF;
1034
1035 -- call column-level validation for 'object_version_number'
1036 validate_object_version_number(x_return_status => l_return_status,
1037 p_rpcv_rec => p_rpcv_rec);
1038
1039 -- store the highest degree of error
1040 IF (l_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1041 IF (x_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1042 x_return_status := l_return_status;
1043 END IF;
1044 END IF;
1045
1046 -- call column-level validation for 'sfwt_flag'
1047 validate_sfwt_flag(x_return_status => l_return_status,
1048 p_rpcv_rec => p_rpcv_rec);
1049
1050 -- store the highest degree of error
1051 IF (l_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1052 IF (x_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1053 x_return_status := l_return_status;
1054 END IF;
1055 END IF;
1056
1057
1058 -- call column-level validation for 'cost'
1059 validate_cost(x_return_status => l_return_status,
1060 p_rpcv_rec => p_rpcv_rec);
1061
1062 -- store the highest degree of error
1063 IF (l_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1064 IF (x_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1065 x_return_status := l_return_status;
1066 END IF;
1067 END IF;
1068
1069
1070 -- call column-level validation for 'repair_type'
1071 validate_repair_type(x_return_status => l_return_status,
1072 p_rpcv_rec => p_rpcv_rec);
1073
1074 -- store the highest degree of error
1075 IF (l_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1076 IF (x_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1077 x_return_status := l_return_status;
1078 END IF;
1079 END IF;
1080
1081 -- call column-level validation for 'description'
1082 validate_description(x_return_status => l_return_status,
1083 p_rpcv_rec => p_rpcv_rec);
1084
1085 -- store the highest degree of error
1086 IF (l_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1087 IF (x_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1088 x_return_status := l_return_status;
1089 END IF;
1090 END IF;
1091
1092
1093 -- call column-level validation for 'enabled_yn'
1094 validate_enabled_yn(x_return_status => l_return_status,
1095 p_rpcv_rec => p_rpcv_rec);
1096
1097 -- store the highest degree of error
1098 IF (l_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1099 IF (x_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1100 x_return_status := l_return_status;
1101 END IF;
1102 END IF;
1103
1104 -- SPILLAIP - 2667636 - Start
1105 validate_currency_code(p_rpcv_rec => p_rpcv_rec,
1106 x_return_status => l_return_status);
1107 -- store the highest degree of error
1108 IF (l_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1109 IF (x_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1110 x_return_status := l_return_status;
1111 END IF;
1112 END IF;
1113 validate_currency_con_code(p_rpcv_rec => p_rpcv_rec,
1114 x_return_status => l_return_status);
1115 -- store the highest degree of error
1116 IF (l_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1117 IF (x_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1118 x_return_status := l_return_status;
1119 END IF;
1120 END IF;
1121 validate_currency_con_type(p_rpcv_rec => p_rpcv_rec,
1122 x_return_status => l_return_status);
1123 -- store the highest degree of error
1124 IF (l_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1125 IF (x_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1126 x_return_status := l_return_status;
1127 END IF;
1128 END IF;
1129 -- SPILLAIP - 2667636 - End
1130
1131 -- return status to caller
1132 RETURN x_return_status;
1133
1134 EXCEPTION
1135 WHEN OTHERS THEN
1136 -- store SQL error message on message stack for caller
1137 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
1138 p_msg_name => g_unexpected_error,
1139 p_token1 => g_sqlcode_token,
1140 p_token1_value => sqlcode,
1141 p_token2 => g_sqlerrm_token,
1142 p_token2_value => sqlerrm);
1143
1144 -- notify caller of an UNEXPECTED error
1145 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1146
1147 -- return status to caller
1148 RETURN x_return_status;
1149
1150 END validate_attributes;
1151
1152 ---------------------------------------------------------------------------
1153 -- PROCEDURE Validate_Record
1154 ---------------------------------------------------------------------------
1155 --------------------------------------------
1156 -- Validate_Record for:OKL_REPAIR_COSTS_V --
1157 --------------------------------------------
1158 -- Start of comments
1159 --
1160 -- Function Name : Validate_Record
1161 -- Description : for:OKL_REPAIR_COSTS_V
1162 -- Business Rules :
1163 -- Parameters :
1164 -- Version : 1.0
1165 -- History : SPILLAIP 12-DEC-2002 2667636
1166 -- :modified for multicurrency changes
1167 -- End of comments
1168 FUNCTION Validate_Record (
1169 p_rpcv_rec IN rpcv_rec_type
1170 ) RETURN VARCHAR2 IS
1171 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1172 x_return_status VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1173 BEGIN
1174 -- SPILLAIP - 2667636 - Start
1175 -- Validate Currency conversion Code,type,rate and Date
1176
1177 validate_currency_record(p_rpcv_rec => p_rpcv_rec,
1178 x_return_status => l_return_status);
1179 -- store the highest degree of error
1180 IF (l_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1181 IF (x_return_status <> OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1182 x_return_status := l_return_status;
1183 END IF;
1184 END IF;
1185 -- SPILLAIP - 2667636 - End
1186 RETURN (x_return_status);
1187 END Validate_Record;
1188
1189 ---------------------------------------------------------------------------
1190 -- PROCEDURE Migrate
1191 ---------------------------------------------------------------------------
1192
1193 PROCEDURE migrate (
1194 p_from IN rpcv_rec_type,
1195 p_to IN OUT NOCOPY okl_repair_costs_tl_rec_type
1196 ) IS
1197 BEGIN
1198 p_to.id := p_from.id;
1199 p_to.sfwt_flag := p_from.sfwt_flag;
1200 p_to.repair_type := p_from.repair_type;
1201 p_to.description := p_from.description;
1202 p_to.created_by := p_from.created_by;
1203 p_to.creation_date := p_from.creation_date;
1204 p_to.last_updated_by := p_from.last_updated_by;
1205 p_to.last_update_date := p_from.last_update_date;
1206 p_to.last_update_login := p_from.last_update_login;
1207 END migrate;
1208 PROCEDURE migrate (
1209 p_from IN okl_repair_costs_tl_rec_type,
1210 p_to IN OUT NOCOPY rpcv_rec_type
1211 ) IS
1212 BEGIN
1213 p_to.id := p_from.id;
1214 p_to.sfwt_flag := p_from.sfwt_flag;
1215 p_to.repair_type := p_from.repair_type;
1216 p_to.description := p_from.description;
1217 p_to.created_by := p_from.created_by;
1218 p_to.creation_date := p_from.creation_date;
1219 p_to.last_updated_by := p_from.last_updated_by;
1220 p_to.last_update_date := p_from.last_update_date;
1221 p_to.last_update_login := p_from.last_update_login;
1222 END migrate;
1223 -- Start of comments
1224 --
1225 -- Procedure Name : Migrate
1226 -- Description : from _V to _B
1227 -- Business Rules :
1228 -- Parameters :
1229 -- Version : 1.0
1230 -- History : SPILLAIP 12-DEC-2002 2667636
1231 -- : modified for multicurrency changes
1232 -- End of comments
1233
1234 PROCEDURE migrate (
1235 p_from IN rpcv_rec_type,
1236 p_to IN OUT NOCOPY rpc_rec_type
1237 ) IS
1238 BEGIN
1239 p_to.id := p_from.id;
1240 p_to.object_version_number := p_from.object_version_number;
1241 p_to.enabled_yn := p_from.enabled_yn;
1242 p_to.org_id := p_from.org_id;
1243 p_to.cost := p_from.cost;
1244 p_to.created_by := p_from.created_by;
1245 p_to.creation_date := p_from.creation_date;
1246 p_to.last_updated_by := p_from.last_updated_by;
1247 p_to.last_update_date := p_from.last_update_date;
1248 p_to.last_update_login := p_from.last_update_login;
1249 -- SPILLAIP - 2667636 - Start
1250 p_to.currency_code := p_from.currency_code;
1251 p_to.currency_conversion_code := p_from.currency_conversion_code;
1252 p_to.currency_conversion_type := p_from.currency_conversion_type;
1253 p_to.currency_conversion_rate := p_from.currency_conversion_rate;
1254 p_to.currency_conversion_date := p_from.currency_conversion_date;
1255 -- SPILLAIP - 2667636 - End
1256 END migrate;
1257
1258 -- Start of comments
1259 --
1260 -- Procedure Name : Migrate
1261 -- Description : from _B to _V
1262 -- Business Rules :
1263 -- Parameters :
1264 -- Version : 1.0
1265 -- History : SPILLAIP 12-DEC-2002 2667636
1266 -- : modified for multicurrency changes
1267 -- End of comments
1268 PROCEDURE migrate (
1269 p_from IN rpc_rec_type,
1270 p_to IN OUT NOCOPY rpcv_rec_type
1271 ) IS
1272 BEGIN
1273 p_to.id := p_from.id;
1274 p_to.object_version_number := p_from.object_version_number;
1275 p_to.enabled_yn := p_from.enabled_yn;
1276 p_to.org_id := p_from.org_id;
1277 p_to.cost := p_from.cost;
1278 p_to.created_by := p_from.created_by;
1279 p_to.creation_date := p_from.creation_date;
1280 p_to.last_updated_by := p_from.last_updated_by;
1281 p_to.last_update_date := p_from.last_update_date;
1282 p_to.last_update_login := p_from.last_update_login;
1283 -- SPILLAIP - 2667636 - Start
1284 p_to.currency_code := p_from.currency_code;
1285 p_to.currency_conversion_code := p_from.currency_conversion_code;
1286 p_to.currency_conversion_type := p_from.currency_conversion_type;
1287 p_to.currency_conversion_rate := p_from.currency_conversion_rate;
1288 p_to.currency_conversion_date := p_from.currency_conversion_date;
1289 -- SPILLAIP - 2667636 - End
1290 END migrate;
1291
1292 ---------------------------------------------------------------------------
1293 -- PROCEDURE validate_row
1294 ---------------------------------------------------------------------------
1295 -----------------------------------------
1296 -- validate_row for:OKL_REPAIR_COSTS_V --
1297 -----------------------------------------
1298 PROCEDURE validate_row(
1299 p_api_version IN NUMBER,
1300 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
1301 x_return_status OUT NOCOPY VARCHAR2,
1302 x_msg_count OUT NOCOPY NUMBER,
1303 x_msg_data OUT NOCOPY VARCHAR2,
1304 p_rpcv_rec IN rpcv_rec_type) IS
1305
1306 l_api_version CONSTANT NUMBER := 1;
1307 l_api_name CONSTANT VARCHAR2(30) := 'V_validate_row';
1308 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1309 l_rpcv_rec rpcv_rec_type := p_rpcv_rec;
1310 l_okl_repair_costs_tl_rec okl_repair_costs_tl_rec_type;
1311 l_rpc_rec rpc_rec_type;
1312 BEGIN
1313 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1314 G_PKG_NAME,
1315 p_init_msg_list,
1316 l_api_version,
1317 p_api_version,
1318 '_PVT',
1319 x_return_status);
1320 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1321 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1322 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1323 RAISE OKC_API.G_EXCEPTION_ERROR;
1324 END IF;
1325 --- Validate all non-missing attributes (Item Level Validation)
1326 l_return_status := Validate_Attributes(l_rpcv_rec);
1327 --- If any errors happen abort API
1328 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1329 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1330 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1331 RAISE OKC_API.G_EXCEPTION_ERROR;
1332 END IF;
1333 l_return_status := Validate_Record(l_rpcv_rec);
1334 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1335 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1336 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1337 RAISE OKC_API.G_EXCEPTION_ERROR;
1338 END IF;
1339 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1340 EXCEPTION
1341 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1342 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1343 (
1344 l_api_name,
1345 G_PKG_NAME,
1346 'OKC_API.G_RET_STS_ERROR',
1347 x_msg_count,
1348 x_msg_data,
1349 '_PVT'
1350 );
1351 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1352 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1353 (
1354 l_api_name,
1355 G_PKG_NAME,
1356 'OKC_API.G_RET_STS_UNEXP_ERROR',
1357 x_msg_count,
1358 x_msg_data,
1359 '_PVT'
1360 );
1361 WHEN OTHERS THEN
1362 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1363 (
1364 l_api_name,
1365 G_PKG_NAME,
1366 'OTHERS',
1367 x_msg_count,
1368 x_msg_data,
1369 '_PVT'
1370 );
1371 END validate_row;
1372 ------------------------------------------
1373 -- PL/SQL TBL validate_row for:RPCV_TBL --
1374 ------------------------------------------
1375 PROCEDURE validate_row(
1376 p_api_version IN NUMBER,
1377 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
1378 x_return_status OUT NOCOPY VARCHAR2,
1379 x_msg_count OUT NOCOPY NUMBER,
1380 x_msg_data OUT NOCOPY VARCHAR2,
1381 p_rpcv_tbl IN rpcv_tbl_type) IS
1382
1383 l_api_version CONSTANT NUMBER := 1;
1384 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_validate_row';
1385 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1386 i NUMBER := 0;
1387 -- Begin Post-Generation Change
1388 -- overall error status
1389 l_overall_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1390 -- End Post-Generation Change
1391 BEGIN
1392 OKC_API.init_msg_list(p_init_msg_list);
1393 -- Make sure PL/SQL table has records in it before passing
1394 IF (p_rpcv_tbl.COUNT > 0) THEN
1395 i := p_rpcv_tbl.FIRST;
1396 LOOP
1397 validate_row (
1398 p_api_version => p_api_version,
1399 p_init_msg_list => OKC_API.G_FALSE,
1400 x_return_status => x_return_status,
1401 x_msg_count => x_msg_count,
1402 x_msg_data => x_msg_data,
1403 p_rpcv_rec => p_rpcv_tbl(i));
1404 -- Begin Post-Generation Change
1405 -- store the highest degree of error
1406 IF x_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
1407 IF l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR THEN
1408 l_overall_status := x_return_status;
1409 END IF;
1410 END IF;
1411 -- End Post-Generation Change
1412 EXIT WHEN (i = p_rpcv_tbl.LAST);
1413 i := p_rpcv_tbl.NEXT(i);
1414 END LOOP;
1415 -- Begin Post-Generation Change
1416 -- return overall status
1417 x_return_status := l_overall_status;
1418 -- End Post-Generation Change
1419 END IF;
1420 EXCEPTION
1421 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1422 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1423 (
1424 l_api_name,
1425 G_PKG_NAME,
1426 'OKC_API.G_RET_STS_ERROR',
1427 x_msg_count,
1428 x_msg_data,
1429 '_PVT'
1430 );
1431 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1432 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1433 (
1434 l_api_name,
1435 G_PKG_NAME,
1436 'OKC_API.G_RET_STS_UNEXP_ERROR',
1437 x_msg_count,
1438 x_msg_data,
1439 '_PVT'
1440 );
1441 WHEN OTHERS THEN
1442 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1443 (
1444 l_api_name,
1445 G_PKG_NAME,
1446 'OTHERS',
1447 x_msg_count,
1448 x_msg_data,
1449 '_PVT'
1450 );
1451 END validate_row;
1452
1453 ---------------------------------------------------------------------------
1454 -- PROCEDURE insert_row
1455 ---------------------------------------------------------------------------
1456 ----------------------------------------
1457 -- insert_row for:OKL_REPAIR_COSTS_TL --
1458 ----------------------------------------
1459 PROCEDURE insert_row(
1460 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
1461 x_return_status OUT NOCOPY VARCHAR2,
1462 x_msg_count OUT NOCOPY NUMBER,
1463 x_msg_data OUT NOCOPY VARCHAR2,
1464 p_okl_repair_costs_tl_rec IN okl_repair_costs_tl_rec_type,
1465 x_okl_repair_costs_tl_rec OUT NOCOPY okl_repair_costs_tl_rec_type) IS
1466
1467 l_api_version CONSTANT NUMBER := 1;
1468 l_api_name CONSTANT VARCHAR2(30) := 'TL_insert_row';
1469 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1470 l_okl_repair_costs_tl_rec okl_repair_costs_tl_rec_type := p_okl_repair_costs_tl_rec;
1471 ldefoklrepaircoststlrec okl_repair_costs_tl_rec_type;
1472 CURSOR get_languages IS
1473 SELECT *
1474 FROM FND_LANGUAGES
1475 WHERE INSTALLED_FLAG IN ('I', 'B');
1476 --------------------------------------------
1477 -- Set_Attributes for:OKL_REPAIR_COSTS_TL --
1478 --------------------------------------------
1479 FUNCTION Set_Attributes (
1480 p_okl_repair_costs_tl_rec IN okl_repair_costs_tl_rec_type,
1481 x_okl_repair_costs_tl_rec OUT NOCOPY okl_repair_costs_tl_rec_type
1482 ) RETURN VARCHAR2 IS
1483 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1484 BEGIN
1485 x_okl_repair_costs_tl_rec := p_okl_repair_costs_tl_rec;
1486 x_okl_repair_costs_tl_rec.LANGUAGE := USERENV('LANG');
1487 x_okl_repair_costs_tl_rec.SOURCE_LANG := USERENV('LANG');
1488 RETURN(l_return_status);
1489 END Set_Attributes;
1490 BEGIN
1491 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1492 p_init_msg_list,
1493 '_PVT',
1494 x_return_status);
1495 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1496 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1497 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1498 RAISE OKC_API.G_EXCEPTION_ERROR;
1499 END IF;
1500 --- Setting item attributes
1501 l_return_status := Set_Attributes(
1502 p_okl_repair_costs_tl_rec, -- IN
1503 l_okl_repair_costs_tl_rec); -- OUT
1504 --- If any errors happen abort API
1505 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1506 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1507 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1508 RAISE OKC_API.G_EXCEPTION_ERROR;
1509 END IF;
1510 FOR l_lang_rec IN get_languages LOOP
1511 l_okl_repair_costs_tl_rec.language := l_lang_rec.language_code;
1512 INSERT INTO OKL_REPAIR_COSTS_TL(
1513 id,
1514 language,
1515 source_lang,
1516 sfwt_flag,
1517 repair_type,
1518 description,
1519 created_by,
1520 creation_date,
1521 last_updated_by,
1522 last_update_date,
1523 last_update_login)
1524 VALUES (
1525 l_okl_repair_costs_tl_rec.id,
1526 l_okl_repair_costs_tl_rec.language,
1527 l_okl_repair_costs_tl_rec.source_lang,
1528 l_okl_repair_costs_tl_rec.sfwt_flag,
1529 l_okl_repair_costs_tl_rec.repair_type,
1530 l_okl_repair_costs_tl_rec.description,
1531 l_okl_repair_costs_tl_rec.created_by,
1532 l_okl_repair_costs_tl_rec.creation_date,
1533 l_okl_repair_costs_tl_rec.last_updated_by,
1534 l_okl_repair_costs_tl_rec.last_update_date,
1535 l_okl_repair_costs_tl_rec.last_update_login);
1536 END LOOP;
1537 -- Set OUT values
1538 x_okl_repair_costs_tl_rec := l_okl_repair_costs_tl_rec;
1539 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1540 EXCEPTION
1541 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1542 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1543 (
1544 l_api_name,
1545 G_PKG_NAME,
1546 'OKC_API.G_RET_STS_ERROR',
1547 x_msg_count,
1548 x_msg_data,
1549 '_PVT'
1550 );
1551 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1552 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1553 (
1554 l_api_name,
1555 G_PKG_NAME,
1556 'OKC_API.G_RET_STS_UNEXP_ERROR',
1557 x_msg_count,
1558 x_msg_data,
1559 '_PVT'
1560 );
1561 WHEN OTHERS THEN
1562 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1563 (
1564 l_api_name,
1565 G_PKG_NAME,
1566 'OTHERS',
1567 x_msg_count,
1568 x_msg_data,
1569 '_PVT'
1570 );
1571 END insert_row;
1572 ---------------------------------------
1573 -- insert_row for:OKL_REPAIR_COSTS_B --
1574 ---------------------------------------
1575 -- Start of comments
1576 --
1577 -- Procedure Name : insert_row
1578 -- Description : for OKL_REPAIR_COSTS_B
1579 -- Business Rules :
1580 -- Parameters :
1581 -- Version : 1.0
1582 -- History : SPILLAIP 12-DEC-2002 2667636
1583 -- : modified for multicurrency changes
1584 -- End of comments
1585 PROCEDURE insert_row(
1586 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
1587 x_return_status OUT NOCOPY VARCHAR2,
1588 x_msg_count OUT NOCOPY NUMBER,
1589 x_msg_data OUT NOCOPY VARCHAR2,
1590 p_rpc_rec IN rpc_rec_type,
1591 x_rpc_rec OUT NOCOPY rpc_rec_type) IS
1592
1593 l_api_version CONSTANT NUMBER := 1;
1594 l_api_name CONSTANT VARCHAR2(30) := 'B_insert_row';
1595 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1596 l_rpc_rec rpc_rec_type := p_rpc_rec;
1597 l_def_rpc_rec rpc_rec_type;
1598 -------------------------------------------
1599 -- Set_Attributes for:OKL_REPAIR_COSTS_B --
1600 -------------------------------------------
1601 FUNCTION Set_Attributes (
1602 p_rpc_rec IN rpc_rec_type,
1603 x_rpc_rec OUT NOCOPY rpc_rec_type
1604 ) RETURN VARCHAR2 IS
1605 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1606 BEGIN
1607 x_rpc_rec := p_rpc_rec;
1608 RETURN(l_return_status);
1609 END Set_Attributes;
1610 BEGIN
1611 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1612 p_init_msg_list,
1613 '_PVT',
1614 x_return_status);
1615 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1616 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1617 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1618 RAISE OKC_API.G_EXCEPTION_ERROR;
1619 END IF;
1620 --- Setting item attributes
1621 l_return_status := Set_Attributes(
1622 p_rpc_rec, -- IN
1623 l_rpc_rec); -- OUT
1624 --- If any errors happen abort API
1625 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1626 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1627 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1628 RAISE OKC_API.G_EXCEPTION_ERROR;
1629 END IF;
1630 INSERT INTO OKL_REPAIR_COSTS_B(
1631 id,
1632 object_version_number,
1633 enabled_yn,
1634 org_id,
1635 cost,
1636 created_by,
1637 creation_date,
1638 last_updated_by,
1639 last_update_date,
1640 last_update_login,
1641 -- SPILLAIP - 2667636 - Start
1642 currency_code,
1643 currency_conversion_code,
1644 currency_conversion_type,
1645 currency_conversion_rate,
1646 currency_conversion_date)
1647 -- SPILLAIP - 2667636 - End
1648 VALUES (
1649 l_rpc_rec.id,
1650 l_rpc_rec.object_version_number,
1651 l_rpc_rec.enabled_yn,
1652 l_rpc_rec.org_id,
1653 l_rpc_rec.cost,
1654 l_rpc_rec.created_by,
1655 l_rpc_rec.creation_date,
1656 l_rpc_rec.last_updated_by,
1657 l_rpc_rec.last_update_date,
1658 l_rpc_rec.last_update_login,
1659 -- SPILLAIP - 2667636 - Start
1660 l_rpc_rec.currency_code,
1661 l_rpc_rec.currency_conversion_code,
1662 l_rpc_rec.currency_conversion_type,
1663 l_rpc_rec.currency_conversion_rate,
1664 l_rpc_rec.currency_conversion_date);
1665 -- SPILLAIP - 2667636 - End
1666 -- Set OUT values
1667 x_rpc_rec := l_rpc_rec;
1668 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1669 EXCEPTION
1670 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1671 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1672 (
1673 l_api_name,
1674 G_PKG_NAME,
1675 'OKC_API.G_RET_STS_ERROR',
1676 x_msg_count,
1677 x_msg_data,
1678 '_PVT'
1679 );
1680 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1681 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1682 (
1683 l_api_name,
1684 G_PKG_NAME,
1685 'OKC_API.G_RET_STS_UNEXP_ERROR',
1686 x_msg_count,
1687 x_msg_data,
1688 '_PVT'
1689 );
1690 WHEN OTHERS THEN
1691 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1692 (
1693 l_api_name,
1694 G_PKG_NAME,
1695 'OTHERS',
1696 x_msg_count,
1697 x_msg_data,
1698 '_PVT'
1699 );
1700 END insert_row;
1701 ---------------------------------------
1702 -- insert_row for:OKL_REPAIR_COSTS_V --
1703 ---------------------------------------
1704 -- Start of comments
1705 --
1706 -- Procedure Name : insert_row
1707 -- Description : for OKL_REPAIR_COSTS_V
1708 -- Business Rules :
1709 -- Parameters :
1710 -- Version : 1.0
1711 -- History : SPILLAIP 12-DEC-2002 2667636
1712 -- : modified for multicurrency changes
1713 -- End of comments
1714 PROCEDURE insert_row(
1715 p_api_version IN NUMBER,
1716 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
1717 x_return_status OUT NOCOPY VARCHAR2,
1718 x_msg_count OUT NOCOPY NUMBER,
1719 x_msg_data OUT NOCOPY VARCHAR2,
1720 p_rpcv_rec IN rpcv_rec_type,
1721 x_rpcv_rec OUT NOCOPY rpcv_rec_type) IS
1722
1723 l_api_version CONSTANT NUMBER := 1;
1724 l_api_name CONSTANT VARCHAR2(30) := 'V_insert_row';
1725 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1726 l_rpcv_rec rpcv_rec_type;
1727 l_def_rpcv_rec rpcv_rec_type;
1728 l_okl_repair_costs_tl_rec okl_repair_costs_tl_rec_type;
1729 lx_okl_repair_costs_tl_rec okl_repair_costs_tl_rec_type;
1730 l_rpc_rec rpc_rec_type;
1731 lx_rpc_rec rpc_rec_type;
1732 -------------------------------
1733 -- FUNCTION fill_who_columns --
1734 -------------------------------
1735 FUNCTION fill_who_columns (
1736 p_rpcv_rec IN rpcv_rec_type
1737 ) RETURN rpcv_rec_type IS
1738 l_rpcv_rec rpcv_rec_type := p_rpcv_rec;
1739 BEGIN
1740 l_rpcv_rec.CREATION_DATE := SYSDATE;
1741 l_rpcv_rec.CREATED_BY := FND_GLOBAL.USER_ID;
1742 l_rpcv_rec.LAST_UPDATE_DATE := SYSDATE;
1743 l_rpcv_rec.LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
1744 l_rpcv_rec.LAST_UPDATE_LOGIN := FND_GLOBAL.LOGIN_ID;
1745 RETURN(l_rpcv_rec);
1746 END fill_who_columns;
1747 -------------------------------------------
1748 -- Set_Attributes for:OKL_REPAIR_COSTS_V --
1749 -------------------------------------------
1750 FUNCTION Set_Attributes (
1751 p_rpcv_rec IN rpcv_rec_type,
1752 x_rpcv_rec OUT NOCOPY rpcv_rec_type
1753 ) RETURN VARCHAR2 IS
1754 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1755 BEGIN
1756 x_rpcv_rec := p_rpcv_rec;
1757 x_rpcv_rec.OBJECT_VERSION_NUMBER := 1;
1758 x_rpcv_rec.SFWT_FLAG := 'N';
1759
1760 IF (x_rpcv_rec.enabled_yn = OKL_API.G_MISS_CHAR OR x_rpcv_rec.enabled_yn IS NULL) THEN
1761 x_rpcv_rec.enabled_yn := 'N';
1762 END IF;
1763
1764 -- Default the ORG ID if a value is not passed
1765 IF p_rpcv_rec.org_id IS NULL
1766 OR p_rpcv_rec.org_id = OKC_API.G_MISS_NUM THEN
1767 x_rpcv_rec.org_id := MO_GLOBAL.GET_CURRENT_ORG_ID();
1768 END IF;
1769
1770 -- SPILLAIP - 2667636 - Start
1771 x_rpcv_rec.currency_conversion_code := OKL_AM_UTIL_PVT.get_functional_currency;
1772
1773 IF p_rpcv_rec.currency_code IS NULL
1774 OR p_rpcv_rec.currency_code = OKC_API.G_MISS_CHAR THEN
1775 x_rpcv_rec.currency_code := x_rpcv_rec.currency_conversion_code;
1776 END IF;
1777 -- SPILLAIP - 2667636 - End
1778
1779 RETURN(l_return_status);
1780 END Set_Attributes;
1781 BEGIN
1782 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1783 G_PKG_NAME,
1784 p_init_msg_list,
1785 l_api_version,
1786 p_api_version,
1787 '_PVT',
1788 x_return_status);
1789 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1790 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1791 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1792 RAISE OKC_API.G_EXCEPTION_ERROR;
1793 END IF;
1794 l_rpcv_rec := null_out_defaults(p_rpcv_rec);
1795 -- Set primary key value
1796 l_rpcv_rec.ID := get_seq_id;
1797 --- Setting item attributes
1798 l_return_status := Set_Attributes(
1799 l_rpcv_rec, -- IN
1800 l_def_rpcv_rec); -- OUT
1801 --- If any errors happen abort API
1802 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1803 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1804 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1805 RAISE OKC_API.G_EXCEPTION_ERROR;
1806 END IF;
1807 l_def_rpcv_rec := fill_who_columns(l_def_rpcv_rec);
1808 --- Validate all non-missing attributes (Item Level Validation)
1809 l_return_status := Validate_Attributes(l_def_rpcv_rec);
1810 --- If any errors happen abort API
1811 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1812 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1813 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1814 RAISE OKC_API.G_EXCEPTION_ERROR;
1815 END IF;
1816 --gkadarka Fixes for 3559327
1817 l_def_rpcv_rec.currency_conversion_type := NULL;
1818 l_def_rpcv_rec.currency_conversion_rate := NULL;
1819 l_def_rpcv_rec.currency_conversion_date := NULL;
1820 --gkdarka
1821 l_return_status := Validate_Record(l_def_rpcv_rec);
1822 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1823 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1824 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1825 RAISE OKC_API.G_EXCEPTION_ERROR;
1826 END IF;
1827 --------------------------------------
1828 -- Move VIEW record to "Child" records
1829 --------------------------------------
1830 migrate(l_def_rpcv_rec, l_okl_repair_costs_tl_rec);
1831 migrate(l_def_rpcv_rec, l_rpc_rec);
1832 --------------------------------------------
1833 -- Call the INSERT_ROW for each child record
1834 --------------------------------------------
1835 insert_row(
1836 p_init_msg_list,
1837 x_return_status,
1838 x_msg_count,
1839 x_msg_data,
1840 l_okl_repair_costs_tl_rec,
1841 lx_okl_repair_costs_tl_rec
1842 );
1843 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1844 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1845 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
1846 RAISE OKC_API.G_EXCEPTION_ERROR;
1847 END IF;
1848 migrate(lx_okl_repair_costs_tl_rec, l_def_rpcv_rec);
1849 insert_row(
1850 p_init_msg_list,
1851 x_return_status,
1852 x_msg_count,
1853 x_msg_data,
1854 l_rpc_rec,
1855 lx_rpc_rec
1856 );
1857 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1858 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1859 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
1860 RAISE OKC_API.G_EXCEPTION_ERROR;
1861 END IF;
1862 migrate(lx_rpc_rec, l_def_rpcv_rec);
1863 -- Set OUT values
1864 x_rpcv_rec := l_def_rpcv_rec;
1865 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1866 EXCEPTION
1867 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1868 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1869 (
1870 l_api_name,
1871 G_PKG_NAME,
1872 'OKC_API.G_RET_STS_ERROR',
1873 x_msg_count,
1874 x_msg_data,
1875 '_PVT'
1876 );
1877 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1878 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1879 (
1880 l_api_name,
1881 G_PKG_NAME,
1882 'OKC_API.G_RET_STS_UNEXP_ERROR',
1883 x_msg_count,
1884 x_msg_data,
1885 '_PVT'
1886 );
1887 WHEN OTHERS THEN
1888 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1889 (
1890 l_api_name,
1891 G_PKG_NAME,
1892 'OTHERS',
1893 x_msg_count,
1894 x_msg_data,
1895 '_PVT'
1896 );
1897 END insert_row;
1898 ----------------------------------------
1899 -- PL/SQL TBL insert_row for:RPCV_TBL --
1900 ----------------------------------------
1901 PROCEDURE insert_row(
1902 p_api_version IN NUMBER,
1903 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
1904 x_return_status OUT NOCOPY VARCHAR2,
1905 x_msg_count OUT NOCOPY NUMBER,
1906 x_msg_data OUT NOCOPY VARCHAR2,
1907 p_rpcv_tbl IN rpcv_tbl_type,
1908 x_rpcv_tbl OUT NOCOPY rpcv_tbl_type) IS
1909
1910 l_api_version CONSTANT NUMBER := 1;
1911 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_insert_row';
1912 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1913 i NUMBER := 0;
1914 -- Begin Post-Generation Change
1915 -- overall error status
1916 l_overall_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1917 -- End Post-Generation Change
1918 BEGIN
1919 OKC_API.init_msg_list(p_init_msg_list);
1920 -- Make sure PL/SQL table has records in it before passing
1921 IF (p_rpcv_tbl.COUNT > 0) THEN
1922 i := p_rpcv_tbl.FIRST;
1923 LOOP
1924 insert_row (
1925 p_api_version => p_api_version,
1926 p_init_msg_list => OKC_API.G_FALSE,
1927 x_return_status => x_return_status,
1928 x_msg_count => x_msg_count,
1929 x_msg_data => x_msg_data,
1930 p_rpcv_rec => p_rpcv_tbl(i),
1931 x_rpcv_rec => x_rpcv_tbl(i));
1932 -- Begin Post-Generation Change
1933 -- store the highest degree of error
1934 IF x_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
1935 IF l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR THEN
1936 l_overall_status := x_return_status;
1937 END IF;
1938 END IF;
1939 -- End Post-Generation Change
1940 EXIT WHEN (i = p_rpcv_tbl.LAST);
1941 i := p_rpcv_tbl.NEXT(i);
1942 END LOOP;
1943 -- Begin Post-Generation Change
1944 -- return overall status
1945 x_return_status := l_overall_status;
1946 -- End Post-Generation Change
1947 END IF;
1948 EXCEPTION
1949 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1950 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1951 (
1952 l_api_name,
1953 G_PKG_NAME,
1954 'OKC_API.G_RET_STS_ERROR',
1955 x_msg_count,
1956 x_msg_data,
1957 '_PVT'
1958 );
1959 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1960 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1961 (
1962 l_api_name,
1963 G_PKG_NAME,
1964 'OKC_API.G_RET_STS_UNEXP_ERROR',
1965 x_msg_count,
1966 x_msg_data,
1967 '_PVT'
1968 );
1969 WHEN OTHERS THEN
1970 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1971 (
1972 l_api_name,
1973 G_PKG_NAME,
1974 'OTHERS',
1975 x_msg_count,
1976 x_msg_data,
1977 '_PVT'
1978 );
1979 END insert_row;
1980
1981 ---------------------------------------------------------------------------
1982 -- PROCEDURE lock_row
1983 ---------------------------------------------------------------------------
1984 --------------------------------------
1985 -- lock_row for:OKL_REPAIR_COSTS_TL --
1986 --------------------------------------
1987 PROCEDURE lock_row(
1988 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
1989 x_return_status OUT NOCOPY VARCHAR2,
1990 x_msg_count OUT NOCOPY NUMBER,
1991 x_msg_data OUT NOCOPY VARCHAR2,
1992 p_okl_repair_costs_tl_rec IN okl_repair_costs_tl_rec_type) IS
1993
1994 E_Resource_Busy EXCEPTION;
1995 PRAGMA EXCEPTION_INIT(E_Resource_Busy, -00054);
1996 CURSOR lock_csr (p_okl_repair_costs_tl_rec IN okl_repair_costs_tl_rec_type) IS
1997 SELECT *
1998 FROM OKL_REPAIR_COSTS_TL
1999 WHERE ID = p_okl_repair_costs_tl_rec.id
2000 FOR UPDATE NOWAIT;
2001
2002 l_api_version CONSTANT NUMBER := 1;
2003 l_api_name CONSTANT VARCHAR2(30) := 'TL_lock_row';
2004 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2005 l_lock_var lock_csr%ROWTYPE;
2006 l_row_notfound BOOLEAN := FALSE;
2007 lc_row_notfound BOOLEAN := FALSE;
2008 BEGIN
2009 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2010 p_init_msg_list,
2011 '_PVT',
2012 x_return_status);
2013 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2014 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2015 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2016 RAISE OKC_API.G_EXCEPTION_ERROR;
2017 END IF;
2018 BEGIN
2019 OPEN lock_csr(p_okl_repair_costs_tl_rec);
2020 FETCH lock_csr INTO l_lock_var;
2021 l_row_notfound := lock_csr%NOTFOUND;
2022 CLOSE lock_csr;
2023 EXCEPTION
2024 WHEN E_Resource_Busy THEN
2025 IF (lock_csr%ISOPEN) THEN
2026 CLOSE lock_csr;
2027 END IF;
2028 OKC_API.set_message(G_FND_APP,G_FORM_UNABLE_TO_RESERVE_REC);
2029 RAISE APP_EXCEPTIONS.RECORD_LOCK_EXCEPTION;
2030 END;
2031
2032 IF ( l_row_notfound ) THEN
2033 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_DELETED);
2034 RAISE OKC_API.G_EXCEPTION_ERROR;
2035 END IF;
2036 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2037 EXCEPTION
2038 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2039 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2040 (
2041 l_api_name,
2042 G_PKG_NAME,
2043 'OKC_API.G_RET_STS_ERROR',
2044 x_msg_count,
2045 x_msg_data,
2046 '_PVT'
2047 );
2048 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2049 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2050 (
2051 l_api_name,
2052 G_PKG_NAME,
2053 'OKC_API.G_RET_STS_UNEXP_ERROR',
2054 x_msg_count,
2055 x_msg_data,
2056 '_PVT'
2057 );
2058 WHEN OTHERS THEN
2059 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2060 (
2061 l_api_name,
2062 G_PKG_NAME,
2063 'OTHERS',
2064 x_msg_count,
2065 x_msg_data,
2066 '_PVT'
2067 );
2068 END lock_row;
2069 -------------------------------------
2070 -- lock_row for:OKL_REPAIR_COSTS_B --
2071 -------------------------------------
2072 PROCEDURE lock_row(
2073 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2074 x_return_status OUT NOCOPY VARCHAR2,
2075 x_msg_count OUT NOCOPY NUMBER,
2076 x_msg_data OUT NOCOPY VARCHAR2,
2077 p_rpc_rec IN rpc_rec_type) IS
2078
2079 E_Resource_Busy EXCEPTION;
2080 PRAGMA EXCEPTION_INIT(E_Resource_Busy, -00054);
2081 CURSOR lock_csr (p_rpc_rec IN rpc_rec_type) IS
2082 SELECT OBJECT_VERSION_NUMBER
2083 FROM OKL_REPAIR_COSTS_B
2084 WHERE ID = p_rpc_rec.id
2085 AND OBJECT_VERSION_NUMBER = p_rpc_rec.object_version_number
2086 FOR UPDATE OF OBJECT_VERSION_NUMBER NOWAIT;
2087
2088 CURSOR lchk_csr (p_rpc_rec IN rpc_rec_type) IS
2089 SELECT OBJECT_VERSION_NUMBER
2090 FROM OKL_REPAIR_COSTS_B
2091 WHERE ID = p_rpc_rec.id;
2092 l_api_version CONSTANT NUMBER := 1;
2093 l_api_name CONSTANT VARCHAR2(30) := 'B_lock_row';
2094 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2095 l_object_version_number OKL_REPAIR_COSTS_B.OBJECT_VERSION_NUMBER%TYPE;
2096 lc_object_version_number OKL_REPAIR_COSTS_B.OBJECT_VERSION_NUMBER%TYPE;
2097 l_row_notfound BOOLEAN := FALSE;
2098 lc_row_notfound BOOLEAN := FALSE;
2099 BEGIN
2100 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2101 p_init_msg_list,
2102 '_PVT',
2103 x_return_status);
2104 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2105 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2106 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2107 RAISE OKC_API.G_EXCEPTION_ERROR;
2108 END IF;
2109 BEGIN
2110 OPEN lock_csr(p_rpc_rec);
2111 FETCH lock_csr INTO l_object_version_number;
2112 l_row_notfound := lock_csr%NOTFOUND;
2113 CLOSE lock_csr;
2114 EXCEPTION
2115 WHEN E_Resource_Busy THEN
2116 IF (lock_csr%ISOPEN) THEN
2117 CLOSE lock_csr;
2118 END IF;
2119 OKC_API.set_message(G_FND_APP,G_FORM_UNABLE_TO_RESERVE_REC);
2120 RAISE APP_EXCEPTIONS.RECORD_LOCK_EXCEPTION;
2121 END;
2122
2123 IF ( l_row_notfound ) THEN
2124 OPEN lchk_csr(p_rpc_rec);
2125 FETCH lchk_csr INTO lc_object_version_number;
2126 lc_row_notfound := lchk_csr%NOTFOUND;
2127 CLOSE lchk_csr;
2128 END IF;
2129 IF (lc_row_notfound) THEN
2130 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_DELETED);
2131 RAISE OKC_API.G_EXCEPTION_ERROR;
2132 ELSIF lc_object_version_number > p_rpc_rec.object_version_number THEN
2133 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
2134 RAISE OKC_API.G_EXCEPTION_ERROR;
2135 ELSIF lc_object_version_number <> p_rpc_rec.object_version_number THEN
2136 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
2137 RAISE OKC_API.G_EXCEPTION_ERROR;
2138 ELSIF lc_object_version_number = -1 THEN
2139 OKC_API.set_message(G_APP_NAME,G_RECORD_LOGICALLY_DELETED);
2140 RAISE OKC_API.G_EXCEPTION_ERROR;
2141 END IF;
2142 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2143 EXCEPTION
2144 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2145 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2146 (
2147 l_api_name,
2148 G_PKG_NAME,
2149 'OKC_API.G_RET_STS_ERROR',
2150 x_msg_count,
2151 x_msg_data,
2152 '_PVT'
2153 );
2154 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2155 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2156 (
2157 l_api_name,
2158 G_PKG_NAME,
2159 'OKC_API.G_RET_STS_UNEXP_ERROR',
2160 x_msg_count,
2161 x_msg_data,
2162 '_PVT'
2163 );
2164 WHEN OTHERS THEN
2165 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2166 (
2167 l_api_name,
2168 G_PKG_NAME,
2169 'OTHERS',
2170 x_msg_count,
2171 x_msg_data,
2172 '_PVT'
2173 );
2174 END lock_row;
2175 -------------------------------------
2176 -- lock_row for:OKL_REPAIR_COSTS_V --
2177 -------------------------------------
2178 PROCEDURE lock_row(
2179 p_api_version IN NUMBER,
2180 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2181 x_return_status OUT NOCOPY VARCHAR2,
2182 x_msg_count OUT NOCOPY NUMBER,
2183 x_msg_data OUT NOCOPY VARCHAR2,
2184 p_rpcv_rec IN rpcv_rec_type) IS
2185
2186 l_api_version CONSTANT NUMBER := 1;
2187 l_api_name CONSTANT VARCHAR2(30) := 'V_lock_row';
2188 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2189 l_okl_repair_costs_tl_rec okl_repair_costs_tl_rec_type;
2190 l_rpc_rec rpc_rec_type;
2191 BEGIN
2192 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2193 G_PKG_NAME,
2194 p_init_msg_list,
2195 l_api_version,
2196 p_api_version,
2197 '_PVT',
2198 x_return_status);
2199 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2200 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2201 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2202 RAISE OKC_API.G_EXCEPTION_ERROR;
2203 END IF;
2204 --------------------------------------
2205 -- Move VIEW record to "Child" records
2206 --------------------------------------
2207 migrate(p_rpcv_rec, l_okl_repair_costs_tl_rec);
2208 migrate(p_rpcv_rec, l_rpc_rec);
2209 --------------------------------------------
2210 -- Call the LOCK_ROW for each child record
2211 --------------------------------------------
2212 lock_row(
2213 p_init_msg_list,
2214 x_return_status,
2215 x_msg_count,
2216 x_msg_data,
2217 l_okl_repair_costs_tl_rec
2218 );
2219 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2220 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2221 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
2222 RAISE OKC_API.G_EXCEPTION_ERROR;
2223 END IF;
2224 lock_row(
2225 p_init_msg_list,
2226 x_return_status,
2227 x_msg_count,
2228 x_msg_data,
2229 l_rpc_rec
2230 );
2231 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2232 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2233 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
2234 RAISE OKC_API.G_EXCEPTION_ERROR;
2235 END IF;
2236 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2237 EXCEPTION
2238 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2239 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2240 (
2241 l_api_name,
2242 G_PKG_NAME,
2243 'OKC_API.G_RET_STS_ERROR',
2244 x_msg_count,
2245 x_msg_data,
2246 '_PVT'
2247 );
2248 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2249 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2250 (
2251 l_api_name,
2252 G_PKG_NAME,
2253 'OKC_API.G_RET_STS_UNEXP_ERROR',
2254 x_msg_count,
2255 x_msg_data,
2256 '_PVT'
2257 );
2258 WHEN OTHERS THEN
2259 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2260 (
2261 l_api_name,
2262 G_PKG_NAME,
2263 'OTHERS',
2264 x_msg_count,
2265 x_msg_data,
2266 '_PVT'
2267 );
2268 END lock_row;
2269 --------------------------------------
2270 -- PL/SQL TBL lock_row for:RPCV_TBL --
2271 --------------------------------------
2272 PROCEDURE lock_row(
2273 p_api_version IN NUMBER,
2274 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2275 x_return_status OUT NOCOPY VARCHAR2,
2276 x_msg_count OUT NOCOPY NUMBER,
2277 x_msg_data OUT NOCOPY VARCHAR2,
2278 p_rpcv_tbl IN rpcv_tbl_type) IS
2279
2280 l_api_version CONSTANT NUMBER := 1;
2281 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_lock_row';
2282 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2283 i NUMBER := 0;
2284 -- Begin Post-Generation Change
2285 -- overall error status
2286 l_overall_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2287 -- End Post-Generation Change
2288 BEGIN
2289 OKC_API.init_msg_list(p_init_msg_list);
2290 -- Make sure PL/SQL table has records in it before passing
2291 IF (p_rpcv_tbl.COUNT > 0) THEN
2292 i := p_rpcv_tbl.FIRST;
2293 LOOP
2294 lock_row (
2295 p_api_version => p_api_version,
2296 p_init_msg_list => OKC_API.G_FALSE,
2297 x_return_status => x_return_status,
2298 x_msg_count => x_msg_count,
2299 x_msg_data => x_msg_data,
2300 p_rpcv_rec => p_rpcv_tbl(i));
2301 -- Begin Post-Generation Change
2302 -- store the highest degree of error
2303 IF x_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
2304 IF l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR THEN
2305 l_overall_status := x_return_status;
2306 END IF;
2307 END IF;
2308 -- End Post-Generation Change
2309 EXIT WHEN (i = p_rpcv_tbl.LAST);
2310 i := p_rpcv_tbl.NEXT(i);
2311 END LOOP;
2312 -- Begin Post-Generation Change
2313 -- return overall status
2314 x_return_status := l_overall_status;
2315 -- End Post-Generation Change
2316 END IF;
2317 EXCEPTION
2318 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2319 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2320 (
2321 l_api_name,
2322 G_PKG_NAME,
2323 'OKC_API.G_RET_STS_ERROR',
2324 x_msg_count,
2325 x_msg_data,
2326 '_PVT'
2327 );
2328 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2329 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2330 (
2331 l_api_name,
2332 G_PKG_NAME,
2333 'OKC_API.G_RET_STS_UNEXP_ERROR',
2334 x_msg_count,
2335 x_msg_data,
2336 '_PVT'
2337 );
2338 WHEN OTHERS THEN
2339 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2340 (
2341 l_api_name,
2342 G_PKG_NAME,
2343 'OTHERS',
2344 x_msg_count,
2345 x_msg_data,
2346 '_PVT'
2347 );
2348 END lock_row;
2349
2350 ---------------------------------------------------------------------------
2351 -- PROCEDURE update_row
2352 ---------------------------------------------------------------------------
2353 ----------------------------------------
2354 -- update_row for:OKL_REPAIR_COSTS_TL --
2355 ----------------------------------------
2356 PROCEDURE update_row(
2357 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2358 x_return_status OUT NOCOPY VARCHAR2,
2359 x_msg_count OUT NOCOPY NUMBER,
2360 x_msg_data OUT NOCOPY VARCHAR2,
2361 p_okl_repair_costs_tl_rec IN okl_repair_costs_tl_rec_type,
2362 x_okl_repair_costs_tl_rec OUT NOCOPY okl_repair_costs_tl_rec_type) IS
2363
2364 l_api_version CONSTANT NUMBER := 1;
2365 l_api_name CONSTANT VARCHAR2(30) := 'TL_update_row';
2366 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2367 l_okl_repair_costs_tl_rec okl_repair_costs_tl_rec_type := p_okl_repair_costs_tl_rec;
2368 ldefoklrepaircoststlrec okl_repair_costs_tl_rec_type;
2369 l_row_notfound BOOLEAN := TRUE;
2370 ----------------------------------
2371 -- FUNCTION populate_new_record --
2372 ----------------------------------
2373 FUNCTION populate_new_record (
2374 p_okl_repair_costs_tl_rec IN okl_repair_costs_tl_rec_type,
2375 x_okl_repair_costs_tl_rec OUT NOCOPY okl_repair_costs_tl_rec_type
2376 ) RETURN VARCHAR2 IS
2377 l_okl_repair_costs_tl_rec okl_repair_costs_tl_rec_type;
2378 l_row_notfound BOOLEAN := TRUE;
2379 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2380 BEGIN
2381 x_okl_repair_costs_tl_rec := p_okl_repair_costs_tl_rec;
2382 -- Get current database values
2383 l_okl_repair_costs_tl_rec := get_rec(p_okl_repair_costs_tl_rec, l_row_notfound);
2384 IF (l_row_notfound) THEN
2385 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2386 END IF;
2387 IF (x_okl_repair_costs_tl_rec.id = OKC_API.G_MISS_NUM)
2388 THEN
2389 x_okl_repair_costs_tl_rec.id := l_okl_repair_costs_tl_rec.id;
2390 END IF;
2391 IF (x_okl_repair_costs_tl_rec.language = OKC_API.G_MISS_CHAR)
2392 THEN
2393 x_okl_repair_costs_tl_rec.language := l_okl_repair_costs_tl_rec.language;
2394 END IF;
2395 IF (x_okl_repair_costs_tl_rec.source_lang = OKC_API.G_MISS_CHAR)
2396 THEN
2397 x_okl_repair_costs_tl_rec.source_lang := l_okl_repair_costs_tl_rec.source_lang;
2398 END IF;
2399 IF (x_okl_repair_costs_tl_rec.sfwt_flag = OKC_API.G_MISS_CHAR)
2400 THEN
2401 x_okl_repair_costs_tl_rec.sfwt_flag := l_okl_repair_costs_tl_rec.sfwt_flag;
2402 END IF;
2403 IF (x_okl_repair_costs_tl_rec.repair_type = OKC_API.G_MISS_CHAR)
2404 THEN
2405 x_okl_repair_costs_tl_rec.repair_type := l_okl_repair_costs_tl_rec.repair_type;
2406 END IF;
2407 IF (x_okl_repair_costs_tl_rec.description = OKC_API.G_MISS_CHAR)
2408 THEN
2409 x_okl_repair_costs_tl_rec.description := l_okl_repair_costs_tl_rec.description;
2410 END IF;
2411 IF (x_okl_repair_costs_tl_rec.created_by = OKC_API.G_MISS_NUM)
2412 THEN
2413 x_okl_repair_costs_tl_rec.created_by := l_okl_repair_costs_tl_rec.created_by;
2414 END IF;
2415 IF (x_okl_repair_costs_tl_rec.creation_date = OKC_API.G_MISS_DATE)
2416 THEN
2417 x_okl_repair_costs_tl_rec.creation_date := l_okl_repair_costs_tl_rec.creation_date;
2418 END IF;
2419 IF (x_okl_repair_costs_tl_rec.last_updated_by = OKC_API.G_MISS_NUM)
2420 THEN
2421 x_okl_repair_costs_tl_rec.last_updated_by := l_okl_repair_costs_tl_rec.last_updated_by;
2422 END IF;
2423 IF (x_okl_repair_costs_tl_rec.last_update_date = OKC_API.G_MISS_DATE)
2424 THEN
2425 x_okl_repair_costs_tl_rec.last_update_date := l_okl_repair_costs_tl_rec.last_update_date;
2426 END IF;
2427 IF (x_okl_repair_costs_tl_rec.last_update_login = OKC_API.G_MISS_NUM)
2428 THEN
2429 x_okl_repair_costs_tl_rec.last_update_login := l_okl_repair_costs_tl_rec.last_update_login;
2430 END IF;
2431 RETURN(l_return_status);
2432 END populate_new_record;
2433 --------------------------------------------
2434 -- Set_Attributes for:OKL_REPAIR_COSTS_TL --
2435 --------------------------------------------
2436 FUNCTION Set_Attributes (
2437 p_okl_repair_costs_tl_rec IN okl_repair_costs_tl_rec_type,
2438 x_okl_repair_costs_tl_rec OUT NOCOPY okl_repair_costs_tl_rec_type
2439 ) RETURN VARCHAR2 IS
2440 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2441 BEGIN
2442 x_okl_repair_costs_tl_rec := p_okl_repair_costs_tl_rec;
2443 x_okl_repair_costs_tl_rec.LANGUAGE := USERENV('LANG');
2444 x_okl_repair_costs_tl_rec.SOURCE_LANG := USERENV('LANG');
2445 RETURN(l_return_status);
2446 END Set_Attributes;
2447 BEGIN
2448 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2449 p_init_msg_list,
2450 '_PVT',
2451 x_return_status);
2452 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2453 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2454 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2455 RAISE OKC_API.G_EXCEPTION_ERROR;
2456 END IF;
2457 --- Setting item attributes
2458 l_return_status := Set_Attributes(
2459 p_okl_repair_costs_tl_rec, -- IN
2460 l_okl_repair_costs_tl_rec); -- OUT
2461 --- If any errors happen abort API
2462 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2463 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2464 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2465 RAISE OKC_API.G_EXCEPTION_ERROR;
2466 END IF;
2467 l_return_status := populate_new_record(l_okl_repair_costs_tl_rec, ldefoklrepaircoststlrec);
2468 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2469 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2470 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2471 RAISE OKC_API.G_EXCEPTION_ERROR;
2472 END IF;
2473 UPDATE OKL_REPAIR_COSTS_TL
2474 SET REPAIR_TYPE = ldefoklrepaircoststlrec.repair_type,
2475 DESCRIPTION = ldefoklrepaircoststlrec.description,
2476 SOURCE_LANG = ldefoklrepaircoststlrec.source_lang, --Fix fro bug 3637102
2477 CREATED_BY = ldefoklrepaircoststlrec.created_by,
2478 CREATION_DATE = ldefoklrepaircoststlrec.creation_date,
2479 LAST_UPDATED_BY = ldefoklrepaircoststlrec.last_updated_by,
2480 LAST_UPDATE_DATE = ldefoklrepaircoststlrec.last_update_date,
2481 LAST_UPDATE_LOGIN = ldefoklrepaircoststlrec.last_update_login
2482 WHERE ID = ldefoklrepaircoststlrec.id
2483 AND USERENV('LANG') in (SOURCE_LANG,LANGUAGE);--Fix for bug 3637102
2484 --AND SOURCE_LANG = USERENV('LANG');
2485
2486 UPDATE OKL_REPAIR_COSTS_TL
2487 SET SFWT_FLAG = 'Y'
2488 WHERE ID = ldefoklrepaircoststlrec.id
2489 AND SOURCE_LANG <> USERENV('LANG');
2490
2491 x_okl_repair_costs_tl_rec := ldefoklrepaircoststlrec;
2492 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2493 EXCEPTION
2494 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2495 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2496 (
2497 l_api_name,
2498 G_PKG_NAME,
2499 'OKC_API.G_RET_STS_ERROR',
2500 x_msg_count,
2501 x_msg_data,
2502 '_PVT'
2503 );
2504 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2505 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2506 (
2507 l_api_name,
2508 G_PKG_NAME,
2509 'OKC_API.G_RET_STS_UNEXP_ERROR',
2510 x_msg_count,
2511 x_msg_data,
2512 '_PVT'
2513 );
2514 WHEN OTHERS THEN
2515 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2516 (
2517 l_api_name,
2518 G_PKG_NAME,
2519 'OTHERS',
2520 x_msg_count,
2521 x_msg_data,
2522 '_PVT'
2523 );
2524 END update_row;
2525 ---------------------------------------
2526 -- update_row for:OKL_REPAIR_COSTS_B --
2527 ---------------------------------------
2528 -- Start of comments
2529 --
2530 -- Procedure Name : update_row
2531 -- Description : for OKL_REPAIR_COSTS_B
2532 -- Business Rules :
2533 -- Parameters :
2534 -- Version : 1.0
2535 -- History : SPILLAIP 12-DEC-2002 2667636
2536 -- : modified for multicurrency changes
2537 -- End of comments
2538 PROCEDURE update_row(
2539 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2540 x_return_status OUT NOCOPY VARCHAR2,
2541 x_msg_count OUT NOCOPY NUMBER,
2542 x_msg_data OUT NOCOPY VARCHAR2,
2543 p_rpc_rec IN rpc_rec_type,
2544 x_rpc_rec OUT NOCOPY rpc_rec_type) IS
2545
2546 l_api_version CONSTANT NUMBER := 1;
2547 l_api_name CONSTANT VARCHAR2(30) := 'B_update_row';
2548 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2549 l_rpc_rec rpc_rec_type := p_rpc_rec;
2550 l_def_rpc_rec rpc_rec_type;
2551 l_row_notfound BOOLEAN := TRUE;
2552 ----------------------------------
2553 -- FUNCTION populate_new_record --
2554 ----------------------------------
2555 FUNCTION populate_new_record (
2556 p_rpc_rec IN rpc_rec_type,
2557 x_rpc_rec OUT NOCOPY rpc_rec_type
2558 ) RETURN VARCHAR2 IS
2559 l_rpc_rec rpc_rec_type;
2560 l_row_notfound BOOLEAN := TRUE;
2561 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2562 BEGIN
2563 x_rpc_rec := p_rpc_rec;
2564 -- Get current database values
2565 l_rpc_rec := get_rec(p_rpc_rec, l_row_notfound);
2566 IF (l_row_notfound) THEN
2567 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2568 END IF;
2569 IF (x_rpc_rec.id = OKC_API.G_MISS_NUM)
2570 THEN
2571 x_rpc_rec.id := l_rpc_rec.id;
2572 END IF;
2573 IF (x_rpc_rec.object_version_number = OKC_API.G_MISS_NUM)
2574 THEN
2575 x_rpc_rec.object_version_number := l_rpc_rec.object_version_number;
2576 END IF;
2577 IF (x_rpc_rec.enabled_yn = OKC_API.G_MISS_CHAR)
2578 THEN
2579 x_rpc_rec.enabled_yn := l_rpc_rec.enabled_yn;
2580 END IF;
2581 IF (x_rpc_rec.org_id = OKC_API.G_MISS_NUM)
2582 THEN
2583 x_rpc_rec.org_id := l_rpc_rec.org_id;
2584 END IF;
2585 IF (x_rpc_rec.cost = OKC_API.G_MISS_NUM)
2586 THEN
2587 x_rpc_rec.cost := l_rpc_rec.cost;
2588 END IF;
2589 IF (x_rpc_rec.created_by = OKC_API.G_MISS_NUM)
2590 THEN
2591 x_rpc_rec.created_by := l_rpc_rec.created_by;
2592 END IF;
2593 IF (x_rpc_rec.creation_date = OKC_API.G_MISS_DATE)
2594 THEN
2595 x_rpc_rec.creation_date := l_rpc_rec.creation_date;
2596 END IF;
2597 IF (x_rpc_rec.last_updated_by = OKC_API.G_MISS_NUM)
2598 THEN
2599 x_rpc_rec.last_updated_by := l_rpc_rec.last_updated_by;
2600 END IF;
2601 IF (x_rpc_rec.last_update_date = OKC_API.G_MISS_DATE)
2602 THEN
2603 x_rpc_rec.last_update_date := l_rpc_rec.last_update_date;
2604 END IF;
2605 IF (x_rpc_rec.last_update_login = OKC_API.G_MISS_NUM)
2606 THEN
2607 x_rpc_rec.last_update_login := l_rpc_rec.last_update_login;
2608 END IF;
2609 -- SPILLAIP - 2667636 - Start
2610 IF (x_rpc_rec.currency_code = OKC_API.G_MISS_CHAR)
2611 THEN
2612 x_rpc_rec.currency_code := l_rpc_rec.currency_code;
2613 END IF;
2614 IF (x_rpc_rec.currency_conversion_code = OKC_API.G_MISS_CHAR)
2615 THEN
2616 x_rpc_rec.currency_conversion_code := l_rpc_rec.currency_conversion_code;
2617 END IF;
2618 IF (x_rpc_rec.currency_conversion_type = OKC_API.G_MISS_CHAR)
2619 THEN
2620 x_rpc_rec.currency_conversion_type := l_rpc_rec.currency_conversion_type;
2621 END IF;
2622 IF (x_rpc_rec.currency_conversion_rate = OKC_API.G_MISS_NUM)
2623 THEN
2624 x_rpc_rec.currency_conversion_rate := l_rpc_rec.currency_conversion_rate;
2625 END IF;
2626 IF (x_rpc_rec.currency_conversion_date = OKC_API.G_MISS_DATE)
2627 THEN
2628 x_rpc_rec.currency_conversion_date := l_rpc_rec.currency_conversion_date;
2629 END IF;
2630 -- SPILLAIP - 2667636 - End
2631 RETURN(l_return_status);
2632 END populate_new_record;
2633 -------------------------------------------
2634 -- Set_Attributes for:OKL_REPAIR_COSTS_B --
2635 -------------------------------------------
2636 FUNCTION Set_Attributes (
2637 p_rpc_rec IN rpc_rec_type,
2638 x_rpc_rec OUT NOCOPY rpc_rec_type
2639 ) RETURN VARCHAR2 IS
2640 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2641 BEGIN
2642 x_rpc_rec := p_rpc_rec;
2643 RETURN(l_return_status);
2644 END Set_Attributes;
2645 BEGIN
2646 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2647 p_init_msg_list,
2648 '_PVT',
2649 x_return_status);
2650 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2651 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2652 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2653 RAISE OKC_API.G_EXCEPTION_ERROR;
2654 END IF;
2655 --- Setting item attributes
2656 l_return_status := Set_Attributes(
2657 p_rpc_rec, -- IN
2658 l_rpc_rec); -- OUT
2659 --- If any errors happen abort API
2660 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2661 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2662 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2663 RAISE OKC_API.G_EXCEPTION_ERROR;
2664 END IF;
2665 l_return_status := populate_new_record(l_rpc_rec, l_def_rpc_rec);
2666 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2667 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2668 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2669 RAISE OKC_API.G_EXCEPTION_ERROR;
2670 END IF;
2671 UPDATE OKL_REPAIR_COSTS_B
2672 SET OBJECT_VERSION_NUMBER = l_def_rpc_rec.object_version_number,
2673 ENABLED_YN = l_def_rpc_rec.enabled_yn,
2674 ORG_ID = l_def_rpc_rec.org_id,
2675 COST = l_def_rpc_rec.cost,
2676 CREATED_BY = l_def_rpc_rec.created_by,
2677 CREATION_DATE = l_def_rpc_rec.creation_date,
2678 LAST_UPDATED_BY = l_def_rpc_rec.last_updated_by,
2679 LAST_UPDATE_DATE = l_def_rpc_rec.last_update_date,
2680 LAST_UPDATE_LOGIN = l_def_rpc_rec.last_update_login,
2681 -- SPILLAIP - 2667636 - Start
2682 CURRENCY_CODE = l_def_rpc_rec.currency_code,
2683 CURRENCY_CONVERSION_CODE = l_def_rpc_rec.currency_conversion_code,
2684 CURRENCY_CONVERSION_TYPE = l_def_rpc_rec.currency_conversion_type,
2685 CURRENCY_CONVERSION_RATE = l_def_rpc_rec.currency_conversion_rate,
2686 CURRENCY_CONVERSION_DATE = l_def_rpc_rec.currency_conversion_date
2687 -- SPILLAIP - 2667636 - End
2688
2689 WHERE ID = l_def_rpc_rec.id;
2690
2691 x_rpc_rec := l_def_rpc_rec;
2692 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2693 EXCEPTION
2694 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2695 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2696 (
2697 l_api_name,
2698 G_PKG_NAME,
2699 'OKC_API.G_RET_STS_ERROR',
2700 x_msg_count,
2701 x_msg_data,
2702 '_PVT'
2703 );
2704 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2705 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2706 (
2707 l_api_name,
2708 G_PKG_NAME,
2709 'OKC_API.G_RET_STS_UNEXP_ERROR',
2710 x_msg_count,
2711 x_msg_data,
2712 '_PVT'
2713 );
2714 WHEN OTHERS THEN
2715 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2716 (
2717 l_api_name,
2718 G_PKG_NAME,
2719 'OTHERS',
2720 x_msg_count,
2721 x_msg_data,
2722 '_PVT'
2723 );
2724 END update_row;
2725 ---------------------------------------
2726 -- update_row for:OKL_REPAIR_COSTS_V --
2727 ---------------------------------------
2728 -- Start of comments
2729 --
2730 -- Procedure Name : update_row
2731 -- Description : for OKL_REPAIR_COSTS_V
2732 -- Business Rules :
2733 -- Parameters :
2734 -- Version : 1.0
2735 -- History : SPILLAIP 12-DEC-2002 2667636
2736 -- : modified for multicurrency changes
2737 -- End of comments
2738 PROCEDURE update_row(
2739 p_api_version IN NUMBER,
2740 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2741 x_return_status OUT NOCOPY VARCHAR2,
2742 x_msg_count OUT NOCOPY NUMBER,
2743 x_msg_data OUT NOCOPY VARCHAR2,
2744 p_rpcv_rec IN rpcv_rec_type,
2745 x_rpcv_rec OUT NOCOPY rpcv_rec_type) IS
2746
2747 l_api_version CONSTANT NUMBER := 1;
2748 l_api_name CONSTANT VARCHAR2(30) := 'V_update_row';
2749 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2750 l_rpcv_rec rpcv_rec_type := p_rpcv_rec;
2751 l_def_rpcv_rec rpcv_rec_type;
2752 l_rpc_rec rpc_rec_type;
2753 lx_rpc_rec rpc_rec_type;
2754 l_okl_repair_costs_tl_rec okl_repair_costs_tl_rec_type;
2755 lx_okl_repair_costs_tl_rec okl_repair_costs_tl_rec_type;
2756 -------------------------------
2757 -- FUNCTION fill_who_columns --
2758 -------------------------------
2759 FUNCTION fill_who_columns (
2760 p_rpcv_rec IN rpcv_rec_type
2761 ) RETURN rpcv_rec_type IS
2762 l_rpcv_rec rpcv_rec_type := p_rpcv_rec;
2763 BEGIN
2764 l_rpcv_rec.LAST_UPDATE_DATE := SYSDATE;
2765 l_rpcv_rec.LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
2766 l_rpcv_rec.LAST_UPDATE_LOGIN := FND_GLOBAL.LOGIN_ID;
2767 RETURN(l_rpcv_rec);
2768 END fill_who_columns;
2769 ----------------------------------
2770 -- FUNCTION populate_new_record --
2771 ----------------------------------
2772 FUNCTION populate_new_record (
2773 p_rpcv_rec IN rpcv_rec_type,
2774 x_rpcv_rec OUT NOCOPY rpcv_rec_type
2775 ) RETURN VARCHAR2 IS
2776 l_rpcv_rec rpcv_rec_type;
2777 l_row_notfound BOOLEAN := TRUE;
2778 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2779 BEGIN
2780 x_rpcv_rec := p_rpcv_rec;
2781 -- Get current database values
2782 l_rpcv_rec := get_rec(p_rpcv_rec, l_row_notfound);
2783 IF (l_row_notfound) THEN
2784 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2785 END IF;
2786 IF (x_rpcv_rec.id = OKC_API.G_MISS_NUM)
2787 THEN
2788 x_rpcv_rec.id := l_rpcv_rec.id;
2789 END IF;
2790 IF (x_rpcv_rec.object_version_number = OKC_API.G_MISS_NUM)
2791 THEN
2792 x_rpcv_rec.object_version_number := l_rpcv_rec.object_version_number;
2793 END IF;
2794 IF (x_rpcv_rec.sfwt_flag = OKC_API.G_MISS_CHAR)
2795 THEN
2796 x_rpcv_rec.sfwt_flag := l_rpcv_rec.sfwt_flag;
2797 END IF;
2798 IF (x_rpcv_rec.enabled_yn = OKC_API.G_MISS_CHAR)
2799 THEN
2800 x_rpcv_rec.enabled_yn := l_rpcv_rec.enabled_yn;
2801 END IF;
2802 IF (x_rpcv_rec.org_id = OKC_API.G_MISS_NUM)
2803 THEN
2804 x_rpcv_rec.org_id := l_rpcv_rec.org_id;
2805 END IF;
2806 IF (x_rpcv_rec.cost = OKC_API.G_MISS_NUM)
2807 THEN
2808 x_rpcv_rec.cost := l_rpcv_rec.cost;
2809 END IF;
2810 IF (x_rpcv_rec.repair_type = OKC_API.G_MISS_CHAR)
2811 THEN
2812 x_rpcv_rec.repair_type := l_rpcv_rec.repair_type;
2813 END IF;
2814 IF (x_rpcv_rec.description = OKC_API.G_MISS_CHAR)
2815 THEN
2816 x_rpcv_rec.description := l_rpcv_rec.description;
2817 END IF;
2818 IF (x_rpcv_rec.created_by = OKC_API.G_MISS_NUM)
2819 THEN
2820 x_rpcv_rec.created_by := l_rpcv_rec.created_by;
2821 END IF;
2822 IF (x_rpcv_rec.creation_date = OKC_API.G_MISS_DATE)
2823 THEN
2824 x_rpcv_rec.creation_date := l_rpcv_rec.creation_date;
2825 END IF;
2826 IF (x_rpcv_rec.last_updated_by = OKC_API.G_MISS_NUM)
2827 THEN
2828 x_rpcv_rec.last_updated_by := l_rpcv_rec.last_updated_by;
2829 END IF;
2830 IF (x_rpcv_rec.last_update_date = OKC_API.G_MISS_DATE)
2831 THEN
2832 x_rpcv_rec.last_update_date := l_rpcv_rec.last_update_date;
2833 END IF;
2834 IF (x_rpcv_rec.last_update_login = OKC_API.G_MISS_NUM)
2835 THEN
2836 x_rpcv_rec.last_update_login := l_rpcv_rec.last_update_login;
2837 END IF;
2838 -- SPILLAIP - 2667636 - Start
2839 IF (x_rpcv_rec.currency_code = OKC_API.G_MISS_CHAR)
2840 THEN
2841 x_rpcv_rec.currency_code := l_rpcv_rec.currency_code;
2842 END IF;
2843 IF (x_rpcv_rec.currency_conversion_code = OKC_API.G_MISS_CHAR)
2844 THEN
2845 x_rpcv_rec.currency_conversion_code := l_rpcv_rec.currency_conversion_code;
2846 END IF;
2847 IF (x_rpcv_rec.currency_conversion_type = OKC_API.G_MISS_CHAR)
2848 THEN
2849 x_rpcv_rec.currency_conversion_type := l_rpcv_rec.currency_conversion_type;
2850 END IF;
2851 IF (x_rpcv_rec.currency_conversion_rate = OKC_API.G_MISS_NUM)
2852 THEN
2853 x_rpcv_rec.currency_conversion_rate := l_rpcv_rec.currency_conversion_rate;
2854 END IF;
2855 IF (x_rpcv_rec.currency_conversion_date = OKC_API.G_MISS_DATE)
2856 THEN
2857 x_rpcv_rec.currency_conversion_date := l_rpcv_rec.currency_conversion_date;
2858 END IF;
2859 -- SPILLAIP - 2667636 - End
2860 RETURN(l_return_status);
2861 END populate_new_record;
2862 -------------------------------------------
2863 -- Set_Attributes for:OKL_REPAIR_COSTS_V --
2864 -------------------------------------------
2865 FUNCTION Set_Attributes (
2866 p_rpcv_rec IN rpcv_rec_type,
2867 x_rpcv_rec OUT NOCOPY rpcv_rec_type
2868 ) RETURN VARCHAR2 IS
2869 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2870 BEGIN
2871 x_rpcv_rec := p_rpcv_rec;
2872 x_rpcv_rec.OBJECT_VERSION_NUMBER := NVL(x_rpcv_rec.OBJECT_VERSION_NUMBER, 0) + 1;
2873 RETURN(l_return_status);
2874 END Set_Attributes;
2875 BEGIN
2876 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2877 G_PKG_NAME,
2878 p_init_msg_list,
2879 l_api_version,
2880 p_api_version,
2881 '_PVT',
2882 x_return_status);
2883 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2884 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2885 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2886 RAISE OKC_API.G_EXCEPTION_ERROR;
2887 END IF;
2888 --- Setting item attributes
2889 l_return_status := Set_Attributes(
2890 p_rpcv_rec, -- IN
2891 l_rpcv_rec); -- OUT
2892 --- If any errors happen abort API
2893 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2894 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2895 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2896 RAISE OKC_API.G_EXCEPTION_ERROR;
2897 END IF;
2898 l_return_status := populate_new_record(l_rpcv_rec, l_def_rpcv_rec);
2899 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2900 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2901 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2902 RAISE OKC_API.G_EXCEPTION_ERROR;
2903 END IF;
2904 l_def_rpcv_rec := fill_who_columns(l_def_rpcv_rec);
2905 --- Validate all non-missing attributes (Item Level Validation)
2906 l_return_status := Validate_Attributes(l_def_rpcv_rec);
2907 --- If any errors happen abort API
2908 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2909 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2910 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2911 RAISE OKC_API.G_EXCEPTION_ERROR;
2912 END IF;
2913 --gkadarka Fixes for 3559327
2914 l_def_rpcv_rec.currency_conversion_type := NULL;
2915 l_def_rpcv_rec.currency_conversion_rate := NULL;
2916 l_def_rpcv_rec.currency_conversion_date := NULL;
2917 --gkdarka
2918 l_return_status := Validate_Record(l_def_rpcv_rec);
2919 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2920 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2921 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2922 RAISE OKC_API.G_EXCEPTION_ERROR;
2923 END IF;
2924
2925 --------------------------------------
2926 -- Move VIEW record to "Child" records
2927 --------------------------------------
2928 migrate(l_def_rpcv_rec, l_rpc_rec);
2929 migrate(l_def_rpcv_rec, l_okl_repair_costs_tl_rec);
2930 --------------------------------------------
2931 -- Call the UPDATE_ROW for each child record
2932 --------------------------------------------
2933 update_row(
2934 p_init_msg_list,
2935 x_return_status,
2936 x_msg_count,
2937 x_msg_data,
2938 l_rpc_rec,
2939 lx_rpc_rec
2940 );
2941 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2942 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2943 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
2944 RAISE OKC_API.G_EXCEPTION_ERROR;
2945 END IF;
2946 migrate(lx_rpc_rec, l_def_rpcv_rec);
2947 update_row(
2948 p_init_msg_list,
2949 x_return_status,
2950 x_msg_count,
2951 x_msg_data,
2952 l_okl_repair_costs_tl_rec,
2953 lx_okl_repair_costs_tl_rec
2954 );
2955 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2956 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2957 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
2958 RAISE OKC_API.G_EXCEPTION_ERROR;
2959 END IF;
2960 migrate(lx_okl_repair_costs_tl_rec, l_def_rpcv_rec);
2961 x_rpcv_rec := l_def_rpcv_rec;
2962 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2963 EXCEPTION
2964 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2965 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2966 (
2967 l_api_name,
2968 G_PKG_NAME,
2969 'OKC_API.G_RET_STS_ERROR',
2970 x_msg_count,
2971 x_msg_data,
2972 '_PVT'
2973 );
2974 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2975 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2976 (
2977 l_api_name,
2978 G_PKG_NAME,
2979 'OKC_API.G_RET_STS_UNEXP_ERROR',
2980 x_msg_count,
2981 x_msg_data,
2982 '_PVT'
2983 );
2984 WHEN OTHERS THEN
2985 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2986 (
2987 l_api_name,
2988 G_PKG_NAME,
2989 'OTHERS',
2990 x_msg_count,
2991 x_msg_data,
2992 '_PVT'
2993 );
2994 END update_row;
2995 ----------------------------------------
2996 -- PL/SQL TBL update_row for:RPCV_TBL --
2997 ----------------------------------------
2998 PROCEDURE update_row(
2999 p_api_version IN NUMBER,
3000 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3001 x_return_status OUT NOCOPY VARCHAR2,
3002 x_msg_count OUT NOCOPY NUMBER,
3003 x_msg_data OUT NOCOPY VARCHAR2,
3004 p_rpcv_tbl IN rpcv_tbl_type,
3005 x_rpcv_tbl OUT NOCOPY rpcv_tbl_type) IS
3006
3007 l_api_version CONSTANT NUMBER := 1;
3008 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_update_row';
3009 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3010 i NUMBER := 0;
3011 -- Begin Post-Generation Change
3012 -- overall error status
3013 l_overall_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3014 -- End Post-Generation Change
3015 BEGIN
3016 OKC_API.init_msg_list(p_init_msg_list);
3017 -- Make sure PL/SQL table has records in it before passing
3018 IF (p_rpcv_tbl.COUNT > 0) THEN
3019 i := p_rpcv_tbl.FIRST;
3020 LOOP
3021 update_row (
3022 p_api_version => p_api_version,
3023 p_init_msg_list => OKC_API.G_FALSE,
3024 x_return_status => x_return_status,
3025 x_msg_count => x_msg_count,
3026 x_msg_data => x_msg_data,
3027 p_rpcv_rec => p_rpcv_tbl(i),
3028 x_rpcv_rec => x_rpcv_tbl(i));
3029 -- Begin Post-Generation Change
3030 -- store the highest degree of error
3031 IF x_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
3032 IF l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR THEN
3033 l_overall_status := x_return_status;
3034 END IF;
3035 END IF;
3036 -- End Post-Generation Change
3037 EXIT WHEN (i = p_rpcv_tbl.LAST);
3038 i := p_rpcv_tbl.NEXT(i);
3039 END LOOP;
3040 -- Begin Post-Generation Change
3041 -- return overall status
3042 x_return_status := l_overall_status;
3043 -- End Post-Generation Change
3044 END IF;
3045 EXCEPTION
3046 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3047 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3048 (
3049 l_api_name,
3050 G_PKG_NAME,
3051 'OKC_API.G_RET_STS_ERROR',
3052 x_msg_count,
3053 x_msg_data,
3054 '_PVT'
3055 );
3056 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3057 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3058 (
3059 l_api_name,
3060 G_PKG_NAME,
3061 'OKC_API.G_RET_STS_UNEXP_ERROR',
3062 x_msg_count,
3063 x_msg_data,
3064 '_PVT'
3065 );
3066 WHEN OTHERS THEN
3067 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3068 (
3069 l_api_name,
3070 G_PKG_NAME,
3071 'OTHERS',
3072 x_msg_count,
3073 x_msg_data,
3074 '_PVT'
3075 );
3076 END update_row;
3077
3078 ---------------------------------------------------------------------------
3079 -- PROCEDURE delete_row
3080 ---------------------------------------------------------------------------
3081 ----------------------------------------
3082 -- delete_row for:OKL_REPAIR_COSTS_TL --
3083 ----------------------------------------
3084 PROCEDURE delete_row(
3085 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3086 x_return_status OUT NOCOPY VARCHAR2,
3087 x_msg_count OUT NOCOPY NUMBER,
3088 x_msg_data OUT NOCOPY VARCHAR2,
3089 p_okl_repair_costs_tl_rec IN okl_repair_costs_tl_rec_type) IS
3090
3091 l_api_version CONSTANT NUMBER := 1;
3092 l_api_name CONSTANT VARCHAR2(30) := 'TL_delete_row';
3093 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3094 l_okl_repair_costs_tl_rec okl_repair_costs_tl_rec_type:= p_okl_repair_costs_tl_rec;
3095 l_row_notfound BOOLEAN := TRUE;
3096 --------------------------------------------
3097 -- Set_Attributes for:OKL_REPAIR_COSTS_TL --
3098 --------------------------------------------
3099 FUNCTION Set_Attributes (
3100 p_okl_repair_costs_tl_rec IN okl_repair_costs_tl_rec_type,
3101 x_okl_repair_costs_tl_rec OUT NOCOPY okl_repair_costs_tl_rec_type
3102 ) RETURN VARCHAR2 IS
3103 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3104 BEGIN
3105 x_okl_repair_costs_tl_rec := p_okl_repair_costs_tl_rec;
3106 x_okl_repair_costs_tl_rec.LANGUAGE := USERENV('LANG');
3107 RETURN(l_return_status);
3108 END Set_Attributes;
3109 BEGIN
3110 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3111 p_init_msg_list,
3112 '_PVT',
3113 x_return_status);
3114 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3115 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3116 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3117 RAISE OKC_API.G_EXCEPTION_ERROR;
3118 END IF;
3119 --- Setting item attributes
3120 l_return_status := Set_Attributes(
3121 p_okl_repair_costs_tl_rec, -- IN
3122 l_okl_repair_costs_tl_rec); -- OUT
3123 --- If any errors happen abort API
3124 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3125 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3126 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3127 RAISE OKC_API.G_EXCEPTION_ERROR;
3128 END IF;
3129 DELETE FROM OKL_REPAIR_COSTS_TL
3130 WHERE ID = l_okl_repair_costs_tl_rec.id;
3131
3132 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3133 EXCEPTION
3134 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3135 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3136 (
3137 l_api_name,
3138 G_PKG_NAME,
3139 'OKC_API.G_RET_STS_ERROR',
3140 x_msg_count,
3141 x_msg_data,
3142 '_PVT'
3143 );
3144 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3145 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3146 (
3147 l_api_name,
3148 G_PKG_NAME,
3149 'OKC_API.G_RET_STS_UNEXP_ERROR',
3150 x_msg_count,
3151 x_msg_data,
3152 '_PVT'
3153 );
3154 WHEN OTHERS THEN
3155 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3156 (
3157 l_api_name,
3158 G_PKG_NAME,
3159 'OTHERS',
3160 x_msg_count,
3161 x_msg_data,
3162 '_PVT'
3163 );
3164 END delete_row;
3165 ---------------------------------------
3166 -- delete_row for:OKL_REPAIR_COSTS_B --
3167 ---------------------------------------
3168 PROCEDURE delete_row(
3169 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3170 x_return_status OUT NOCOPY VARCHAR2,
3171 x_msg_count OUT NOCOPY NUMBER,
3172 x_msg_data OUT NOCOPY VARCHAR2,
3173 p_rpc_rec IN rpc_rec_type) IS
3174
3175 l_api_version CONSTANT NUMBER := 1;
3176 l_api_name CONSTANT VARCHAR2(30) := 'B_delete_row';
3177 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3178 l_rpc_rec rpc_rec_type:= p_rpc_rec;
3179 l_row_notfound BOOLEAN := TRUE;
3180 BEGIN
3181 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3182 p_init_msg_list,
3183 '_PVT',
3184 x_return_status);
3185 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3186 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3187 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3188 RAISE OKC_API.G_EXCEPTION_ERROR;
3189 END IF;
3190 DELETE FROM OKL_REPAIR_COSTS_B
3191 WHERE ID = l_rpc_rec.id;
3192
3193 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3194 EXCEPTION
3195 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3196 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3197 (
3198 l_api_name,
3199 G_PKG_NAME,
3200 'OKC_API.G_RET_STS_ERROR',
3201 x_msg_count,
3202 x_msg_data,
3203 '_PVT'
3204 );
3205 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3206 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3207 (
3208 l_api_name,
3209 G_PKG_NAME,
3210 'OKC_API.G_RET_STS_UNEXP_ERROR',
3211 x_msg_count,
3212 x_msg_data,
3213 '_PVT'
3214 );
3215 WHEN OTHERS THEN
3216 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3217 (
3218 l_api_name,
3219 G_PKG_NAME,
3220 'OTHERS',
3221 x_msg_count,
3222 x_msg_data,
3223 '_PVT'
3224 );
3225 END delete_row;
3226 ---------------------------------------
3227 -- delete_row for:OKL_REPAIR_COSTS_V --
3228 ---------------------------------------
3229 PROCEDURE delete_row(
3230 p_api_version IN NUMBER,
3231 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3232 x_return_status OUT NOCOPY VARCHAR2,
3233 x_msg_count OUT NOCOPY NUMBER,
3234 x_msg_data OUT NOCOPY VARCHAR2,
3235 p_rpcv_rec IN rpcv_rec_type) IS
3236
3237 l_api_version CONSTANT NUMBER := 1;
3238 l_api_name CONSTANT VARCHAR2(30) := 'V_delete_row';
3239 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3240 l_rpcv_rec rpcv_rec_type := p_rpcv_rec;
3241 l_rpc_rec rpc_rec_type;
3242 l_okl_repair_costs_tl_rec okl_repair_costs_tl_rec_type;
3243 BEGIN
3244 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3245 G_PKG_NAME,
3246 p_init_msg_list,
3247 l_api_version,
3248 p_api_version,
3249 '_PVT',
3250 x_return_status);
3251 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3252 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3253 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3254 RAISE OKC_API.G_EXCEPTION_ERROR;
3255 END IF;
3256 --------------------------------------
3257 -- Move VIEW record to "Child" records
3258 --------------------------------------
3259 migrate(l_rpcv_rec, l_rpc_rec);
3260 migrate(l_rpcv_rec, l_okl_repair_costs_tl_rec);
3261 --------------------------------------------
3262 -- Call the DELETE_ROW for each child record
3263 --------------------------------------------
3264 delete_row(
3265 p_init_msg_list,
3266 x_return_status,
3267 x_msg_count,
3268 x_msg_data,
3269 l_rpc_rec
3270 );
3271 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3272 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3273 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
3274 RAISE OKC_API.G_EXCEPTION_ERROR;
3275 END IF;
3276 delete_row(
3277 p_init_msg_list,
3278 x_return_status,
3279 x_msg_count,
3280 x_msg_data,
3281 l_okl_repair_costs_tl_rec
3282 );
3283 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3284 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3285 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
3286 RAISE OKC_API.G_EXCEPTION_ERROR;
3287 END IF;
3288 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3289 EXCEPTION
3290 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3291 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3292 (
3293 l_api_name,
3294 G_PKG_NAME,
3295 'OKC_API.G_RET_STS_ERROR',
3296 x_msg_count,
3297 x_msg_data,
3298 '_PVT'
3299 );
3300 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3301 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3302 (
3303 l_api_name,
3304 G_PKG_NAME,
3305 'OKC_API.G_RET_STS_UNEXP_ERROR',
3306 x_msg_count,
3307 x_msg_data,
3308 '_PVT'
3309 );
3310 WHEN OTHERS THEN
3311 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3312 (
3313 l_api_name,
3314 G_PKG_NAME,
3315 'OTHERS',
3316 x_msg_count,
3317 x_msg_data,
3318 '_PVT'
3319 );
3320 END delete_row;
3321 ----------------------------------------
3322 -- PL/SQL TBL delete_row for:RPCV_TBL --
3323 ----------------------------------------
3324 PROCEDURE delete_row(
3325 p_api_version IN NUMBER,
3326 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3327 x_return_status OUT NOCOPY VARCHAR2,
3328 x_msg_count OUT NOCOPY NUMBER,
3329 x_msg_data OUT NOCOPY VARCHAR2,
3330 p_rpcv_tbl IN rpcv_tbl_type) IS
3331
3332 l_api_version CONSTANT NUMBER := 1;
3333 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_delete_row';
3334 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3335 i NUMBER := 0;
3336 -- Begin Post-Generation Change
3337 -- overall error status
3338 l_overall_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3339 -- End Post-Generation Change
3340 BEGIN
3341 OKC_API.init_msg_list(p_init_msg_list);
3342 -- Make sure PL/SQL table has records in it before passing
3343 IF (p_rpcv_tbl.COUNT > 0) THEN
3344 i := p_rpcv_tbl.FIRST;
3345 LOOP
3346 delete_row (
3347 p_api_version => p_api_version,
3348 p_init_msg_list => OKC_API.G_FALSE,
3349 x_return_status => x_return_status,
3350 x_msg_count => x_msg_count,
3351 x_msg_data => x_msg_data,
3352 p_rpcv_rec => p_rpcv_tbl(i));
3353 -- Begin Post-Generation Change
3354 -- store the highest degree of error
3355 IF x_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
3356 IF l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR THEN
3357 l_overall_status := x_return_status;
3358 END IF;
3359 END IF;
3360 -- End Post-Generation Change
3361 EXIT WHEN (i = p_rpcv_tbl.LAST);
3362 i := p_rpcv_tbl.NEXT(i);
3363 END LOOP;
3364 -- Begin Post-Generation Change
3365 -- return overall status
3366 x_return_status := l_overall_status;
3367 -- End Post-Generation Change
3368 END IF; EXCEPTION
3369 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3370 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3371 (
3372 l_api_name,
3373 G_PKG_NAME,
3374 'OKC_API.G_RET_STS_ERROR',
3375 x_msg_count,
3376 x_msg_data,
3377 '_PVT'
3378 );
3379 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3380 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3381 (
3382 l_api_name,
3383 G_PKG_NAME,
3384 'OKC_API.G_RET_STS_UNEXP_ERROR',
3385 x_msg_count,
3386 x_msg_data,
3387 '_PVT'
3388 );
3389 WHEN OTHERS THEN
3390 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3391 (
3392 l_api_name,
3393 G_PKG_NAME,
3394 'OTHERS',
3395 x_msg_count,
3396 x_msg_data,
3397 '_PVT'
3398 );
3399 END delete_row;
3400 END OKL_RPC_PVT;