[Home] [Help]
PACKAGE BODY: APPS.OKL_TCL_PVT
Source
1 PACKAGE BODY OKL_TCL_PVT AS
2 /* $Header: OKLSTCLB.pls 120.10 2007/04/19 12:45:30 nikshah noship $ */
3 ---------------------------------------------------------------------------
4 -- FUNCTION get_seq_id
5 ---------------------------------------------------------------------------
6 FUNCTION get_seq_id RETURN NUMBER IS
7 l_seq NUMBER;
8 BEGIN
9 -- Changed by nikshah for SLA project (Bug 5707866) 16-Apr-2007
10 SELECT OKL_TXL_CNTRCT_LNS_ALL_S.NEXTVAL INTO l_seq FROM DUAL;
11 RETURN l_seq;
12 END get_seq_id;
13
14 ---------------------------------------------------------------------------
15 -- PROCEDURE qc
16 ---------------------------------------------------------------------------
17 PROCEDURE qc IS
18 BEGIN
19 null;
20 END qc;
21
22 ---------------------------------------------------------------------------
23 -- PROCEDURE change_version
24 ---------------------------------------------------------------------------
25 PROCEDURE change_version IS
26 BEGIN
27 null;
28 END change_version;
29
30 ---------------------------------------------------------------------------
31 -- PROCEDURE api_copy
32 ---------------------------------------------------------------------------
33 PROCEDURE api_copy IS
34 BEGIN
35 null;
36 END api_copy;
37
38 ---------------------------------------------------------------------------
39 -- FUNCTION get_rec for: OKL_TXL_CNTRCT_LNS
40 ---------------------------------------------------------------------------
41 FUNCTION get_rec (
42 p_tcl_rec IN tcl_rec_type,
43 x_no_data_found OUT NOCOPY BOOLEAN
44 ) RETURN tcl_rec_type IS
45 CURSOR okl_txl_cntrct_lns_pk_csr (p_id IN NUMBER) IS
46 SELECT
47 ID,
48 KHR_ID,
49 KLE_ID,
50 BEFORE_TRANSFER_YN,
51 TCN_ID,
52 RCT_ID,
53 BTC_ID,
54 STY_ID,
55 LINE_NUMBER,
56 TCL_TYPE,
57 OBJECT_VERSION_NUMBER,
58 CREATED_BY,
59 CREATION_DATE,
60 LAST_UPDATED_BY,
61 LAST_UPDATE_DATE,
62 ORG_ID,
63 DESCRIPTION,
64 PROGRAM_ID,
65 GL_REVERSAL_YN,
66 AMOUNT,
67 PROGRAM_APPLICATION_ID,
68 CURRENCY_CODE,
69 REQUEST_ID,
70 PROGRAM_UPDATE_DATE,
71 ATTRIBUTE_CATEGORY,
72 ATTRIBUTE1,
73 ATTRIBUTE2,
74 ATTRIBUTE3,
75 ATTRIBUTE4,
76 ATTRIBUTE5,
77 ATTRIBUTE6,
78 ATTRIBUTE7,
79 ATTRIBUTE8,
80 ATTRIBUTE9,
81 ATTRIBUTE10,
82 ATTRIBUTE11,
83 ATTRIBUTE12,
84 ATTRIBUTE13,
85 ATTRIBUTE14,
86 ATTRIBUTE15,
87 LAST_UPDATE_LOGIN,
88 AVL_ID,
89 BKT_ID,
90 KLE_ID_NEW,
91 PERCENTAGE,
92 -- Added by hkpatel on 17-Sep-2003
93 ACCRUAL_RULE_YN,
94 -- 21 Oct 2004 PAGARG Bug# 3964726
95 SOURCE_COLUMN_1,
96 SOURCE_VALUE_1,
97 SOURCE_COLUMN_2,
98 SOURCE_VALUE_2,
99 SOURCE_COLUMN_3,
100 SOURCE_VALUE_3,
101 CANCELED_DATE,
102 TAX_LINE_ID,
103 -- Added by zrehman for SLA project (Bug 5707866) 9-Feb-2007
104 STREAM_TYPE_CODE,
105 STREAM_TYPE_PURPOSE,
106 ASSET_BOOK_TYPE_NAME,
107 -- Added by nikshah for SLA project (Bug 5707866) 16-Apr-2007
108 UPGRADE_STATUS_FLAG
109 FROM Okl_Txl_Cntrct_Lns
110 WHERE okl_txl_cntrct_lns.id = p_id;
111 l_okl_txl_cntrct_lns_pk okl_txl_cntrct_lns_pk_csr%ROWTYPE;
112 l_tcl_rec tcl_rec_type;
113 BEGIN
114 x_no_data_found := TRUE;
115 -- Get current database values
116 OPEN okl_txl_cntrct_lns_pk_csr (p_tcl_rec.id);
117 FETCH okl_txl_cntrct_lns_pk_csr INTO
118 l_tcl_rec.ID,
119 l_tcl_rec.KHR_ID,
120 l_tcl_rec.KLE_ID,
121 l_tcl_rec.BEFORE_TRANSFER_YN,
122 l_tcl_rec.TCN_ID,
123 l_tcl_rec.RCT_ID,
124 l_tcl_rec.BTC_ID,
125 l_tcl_rec.STY_ID,
126 l_tcl_rec.LINE_NUMBER,
127 l_tcl_rec.TCL_TYPE,
128 l_tcl_rec.OBJECT_VERSION_NUMBER,
129 l_tcl_rec.CREATED_BY,
130 l_tcl_rec.CREATION_DATE,
131 l_tcl_rec.LAST_UPDATED_BY,
132 l_tcl_rec.LAST_UPDATE_DATE,
133 l_tcl_rec.ORG_ID,
134 l_tcl_rec.DESCRIPTION,
135 l_tcl_rec.PROGRAM_ID,
136 l_tcl_rec.GL_REVERSAL_YN,
137 l_tcl_rec.AMOUNT,
138 l_tcl_rec.PROGRAM_APPLICATION_ID,
139 l_tcl_rec.CURRENCY_CODE,
140 l_tcl_rec.REQUEST_ID,
141 l_tcl_rec.PROGRAM_UPDATE_DATE,
142 l_tcl_rec.ATTRIBUTE_CATEGORY,
143 l_tcl_rec.ATTRIBUTE1,
144 l_tcl_rec.ATTRIBUTE2,
145 l_tcl_rec.ATTRIBUTE3,
146 l_tcl_rec.ATTRIBUTE4,
147 l_tcl_rec.ATTRIBUTE5,
148 l_tcl_rec.ATTRIBUTE6,
149 l_tcl_rec.ATTRIBUTE7,
150 l_tcl_rec.ATTRIBUTE8,
151 l_tcl_rec.ATTRIBUTE9,
152 l_tcl_rec.ATTRIBUTE10,
153 l_tcl_rec.ATTRIBUTE11,
154 l_tcl_rec.ATTRIBUTE12,
155 l_tcl_rec.ATTRIBUTE13,
156 l_tcl_rec.ATTRIBUTE14,
157 l_tcl_rec.ATTRIBUTE15,
158 l_tcl_rec.LAST_UPDATE_LOGIN,
159 l_tcl_rec.AVL_ID,
160 l_tcl_rec.BKT_ID,
161 l_tcl_rec.KLE_ID_NEW,
162 l_tcl_rec.PERCENTAGE,
163 -- Added by hkpatel on 17-Sep-2003
164 l_tcl_rec.ACCRUAL_RULE_YN,
165 --21 Oct 2004 PAGARG Bug# 3964726
166 l_tcl_rec.SOURCE_COLUMN_1,
167 l_tcl_rec.SOURCE_VALUE_1,
168 l_tcl_rec.SOURCE_COLUMN_2,
169 l_tcl_rec.SOURCE_VALUE_2,
170 l_tcl_rec.SOURCE_COLUMN_3,
171 l_tcl_rec.SOURCE_VALUE_3,
172 l_tcl_rec.CANCELED_DATE,
173 l_tcl_rec.TAX_LINE_ID,
174 -- Added by zrehman for SLA project (Bug 5707866) 9-Feb-2007
175 l_tcl_rec.STREAM_TYPE_CODE,
176 l_tcl_rec.STREAM_TYPE_PURPOSE,
177 l_tcl_rec.ASSET_BOOK_TYPE_NAME,
178 -- Added by nikshah for SLA project (Bug 5707866) 16-Apr-2007
179 l_tcl_rec.UPGRADE_STATUS_FLAG;
180
181 x_no_data_found := okl_txl_cntrct_lns_pk_csr%NOTFOUND;
182 CLOSE okl_txl_cntrct_lns_pk_csr;
183 RETURN(l_tcl_rec);
184 END get_rec;
185
186 FUNCTION get_rec (
187 p_tcl_rec IN tcl_rec_type
188 ) RETURN tcl_rec_type IS
189 l_row_notfound BOOLEAN := TRUE;
190 BEGIN
191 RETURN(get_rec(p_tcl_rec, l_row_notfound));
192 END get_rec;
193 ---------------------------------------------------------------------------
194 -- FUNCTION get_rec for: OKL_TXL_CNTRCT_LNS_V
195 ---------------------------------------------------------------------------
196 FUNCTION get_rec (
197 p_tclv_rec IN tclv_rec_type,
198 x_no_data_found OUT NOCOPY BOOLEAN
199 ) RETURN tclv_rec_type IS
200 CURSOR okl_tclv_pk_csr (p_id IN NUMBER) IS
201 SELECT
202 ID,
203 OBJECT_VERSION_NUMBER,
204 STY_ID,
205 RCT_ID,
206 BTC_ID,
207 TCN_ID,
208 KHR_ID,
209 KLE_ID,
210 BEFORE_TRANSFER_YN,
211 LINE_NUMBER,
212 DESCRIPTION,
213 AMOUNT,
214 CURRENCY_CODE,
215 GL_REVERSAL_YN,
216 ATTRIBUTE_CATEGORY,
217 ATTRIBUTE1,
218 ATTRIBUTE2,
219 ATTRIBUTE3,
220 ATTRIBUTE4,
221 ATTRIBUTE5,
222 ATTRIBUTE6,
223 ATTRIBUTE7,
224 ATTRIBUTE8,
225 ATTRIBUTE9,
226 ATTRIBUTE10,
227 ATTRIBUTE11,
228 ATTRIBUTE12,
229 ATTRIBUTE13,
230 ATTRIBUTE14,
231 ATTRIBUTE15,
232 TCL_TYPE,
233 CREATED_BY,
234 CREATION_DATE,
235 LAST_UPDATED_BY,
236 LAST_UPDATE_DATE,
237 ORG_ID,
238 PROGRAM_ID,
239 PROGRAM_APPLICATION_ID,
240 REQUEST_ID,
241 PROGRAM_UPDATE_DATE,
242 LAST_UPDATE_LOGIN,
243 AVL_ID,
244 BKT_ID,
245 KLE_ID_NEW,
246 PERCENTAGE,
247 -- Added by hkpatel on 17-Sep-2003
248 ACCRUAL_RULE_YN,
249 -- 21 Oct 2004 PAGARG Bug# 3964726
250 SOURCE_COLUMN_1,
251 SOURCE_VALUE_1,
252 SOURCE_COLUMN_2,
253 SOURCE_VALUE_2,
254 SOURCE_COLUMN_3,
255 SOURCE_VALUE_3,
256 CANCELED_DATE,
257 TAX_LINE_ID,
258 -- Added by zrehman for SLA project (Bug 5707866) 9-Feb-2007
259 STREAM_TYPE_CODE,
260 STREAM_TYPE_PURPOSE,
261 ASSET_BOOK_TYPE_NAME,
262 -- Added by nikshah for SLA project (Bug 5707866) 16-Apr-2007
263 UPGRADE_STATUS_FLAG
264 FROM OKL_TXL_CNTRCT_LNS
265 WHERE OKL_TXL_CNTRCT_LNS.id = p_id;
266 l_okl_tclv_pk okl_tclv_pk_csr%ROWTYPE;
267 l_tclv_rec tclv_rec_type;
268 BEGIN
269 x_no_data_found := TRUE;
270 -- Get current database values
271 OPEN okl_tclv_pk_csr (p_tclv_rec.id);
272 FETCH okl_tclv_pk_csr INTO
273 l_tclv_rec.ID,
274 l_tclv_rec.OBJECT_VERSION_NUMBER,
275 l_tclv_rec.STY_ID,
276 l_tclv_rec.RCT_ID,
277 l_tclv_rec.BTC_ID,
278 l_tclv_rec.TCN_ID,
279 l_tclv_rec.KHR_ID,
280 l_tclv_rec.KLE_ID,
281 l_tclv_rec.BEFORE_TRANSFER_YN,
282 l_tclv_rec.LINE_NUMBER,
283 l_tclv_rec.DESCRIPTION,
284 l_tclv_rec.AMOUNT,
285 l_tclv_rec.CURRENCY_CODE,
286 l_tclv_rec.GL_REVERSAL_YN,
287 l_tclv_rec.ATTRIBUTE_CATEGORY,
288 l_tclv_rec.ATTRIBUTE1,
289 l_tclv_rec.ATTRIBUTE2,
290 l_tclv_rec.ATTRIBUTE3,
291 l_tclv_rec.ATTRIBUTE4,
292 l_tclv_rec.ATTRIBUTE5,
293 l_tclv_rec.ATTRIBUTE6,
294 l_tclv_rec.ATTRIBUTE7,
295 l_tclv_rec.ATTRIBUTE8,
296 l_tclv_rec.ATTRIBUTE9,
297 l_tclv_rec.ATTRIBUTE10,
298 l_tclv_rec.ATTRIBUTE11,
299 l_tclv_rec.ATTRIBUTE12,
300 l_tclv_rec.ATTRIBUTE13,
301 l_tclv_rec.ATTRIBUTE14,
302 l_tclv_rec.ATTRIBUTE15,
303 l_tclv_rec.TCL_TYPE,
304 l_tclv_rec.CREATED_BY,
305 l_tclv_rec.CREATION_DATE,
306 l_tclv_rec.LAST_UPDATED_BY,
307 l_tclv_rec.LAST_UPDATE_DATE,
308 l_tclv_rec.ORG_ID,
309 l_tclv_rec.PROGRAM_ID,
310 l_tclv_rec.PROGRAM_APPLICATION_ID,
311 l_tclv_rec.REQUEST_ID,
312 l_tclv_rec.PROGRAM_UPDATE_DATE,
313 l_tclv_rec.LAST_UPDATE_LOGIN,
314 l_tclv_rec.AVL_ID,
315 l_tclv_rec.BKT_ID,
316 l_tclv_rec.KLE_ID_NEW,
317 l_tclv_rec.PERCENTAGE,
318 -- Added by hkpatel on 17-Sep-2003
319 l_tclv_rec.ACCRUAL_RULE_YN,
320 --21 Oct 2004 PAGARG Bug# 3964726
321 l_tclv_rec.SOURCE_COLUMN_1,
322 l_tclv_rec.SOURCE_VALUE_1,
323 l_tclv_rec.SOURCE_COLUMN_2,
324 l_tclv_rec.SOURCE_VALUE_2,
325 l_tclv_rec.SOURCE_COLUMN_3,
326 l_tclv_rec.SOURCE_VALUE_3,
327 l_tclv_rec.CANCELED_DATE,
328 l_tclv_rec.TAX_LINE_ID,
329 -- Added by zrehman for SLA project (Bug 5707866) 9-Feb-2007
330 l_tclv_rec.STREAM_TYPE_CODE,
331 l_tclv_rec.STREAM_TYPE_PURPOSE,
332 l_tclv_rec.ASSET_BOOK_TYPE_NAME,
333 -- Added by nikshah for SLA project (Bug 5707866) 16-Apr-2007
334 l_tclv_rec.UPGRADE_STATUS_FLAG;
335
336 x_no_data_found := okl_tclv_pk_csr%NOTFOUND;
337 CLOSE okl_tclv_pk_csr;
338 RETURN(l_tclv_rec);
339 END get_rec;
340
341 FUNCTION get_rec (
342 p_tclv_rec IN tclv_rec_type
343 ) RETURN tclv_rec_type IS
344 l_row_notfound BOOLEAN := TRUE;
345 BEGIN
346 RETURN(get_rec(p_tclv_rec, l_row_notfound));
347 END get_rec;
348
349 ----------------------------------------------------------
350 -- FUNCTION null_out_defaults for: OKL_TXL_CNTRCT_LNS_V --
351 ----------------------------------------------------------
352 FUNCTION null_out_defaults (
353 p_tclv_rec IN tclv_rec_type
354 ) RETURN tclv_rec_type IS
355 l_tclv_rec tclv_rec_type := p_tclv_rec;
356 BEGIN
357 IF (l_tclv_rec.object_version_number = OKC_API.G_MISS_NUM) THEN
358 l_tclv_rec.object_version_number := NULL;
359 END IF;
360 IF (l_tclv_rec.sty_id = OKC_API.G_MISS_NUM) THEN
361 l_tclv_rec.sty_id := NULL;
362 END IF;
363 IF (l_tclv_rec.rct_id = OKC_API.G_MISS_NUM) THEN
364 l_tclv_rec.rct_id := NULL;
365 END IF;
366 IF (l_tclv_rec.btc_id = OKC_API.G_MISS_NUM) THEN
367 l_tclv_rec.btc_id := NULL;
368 END IF;
369 IF (l_tclv_rec.tcn_id = OKC_API.G_MISS_NUM) THEN
370 l_tclv_rec.tcn_id := NULL;
371 END IF;
372 IF (l_tclv_rec.khr_id = OKC_API.G_MISS_NUM) THEN
373 l_tclv_rec.khr_id := NULL;
374 END IF;
375 IF (l_tclv_rec.kle_id = OKC_API.G_MISS_NUM) THEN
376 l_tclv_rec.kle_id := NULL;
377 END IF;
378 IF (l_tclv_rec.before_transfer_yn = OKC_API.G_MISS_CHAR) THEN
379 l_tclv_rec.before_transfer_yn := NULL;
380 END IF;
381 IF (l_tclv_rec.line_number = OKC_API.G_MISS_NUM) THEN
382 l_tclv_rec.line_number := NULL;
383 END IF;
384 IF (l_tclv_rec.description = OKC_API.G_MISS_CHAR) THEN
385 l_tclv_rec.description := NULL;
386 END IF;
387 IF (l_tclv_rec.amount = OKC_API.G_MISS_NUM) THEN
388 l_tclv_rec.amount := NULL;
389 END IF;
390 IF (l_tclv_rec.currency_code = OKC_API.G_MISS_CHAR) THEN
391 l_tclv_rec.currency_code := NULL;
392 END IF;
393 IF (l_tclv_rec.gl_reversal_yn = OKC_API.G_MISS_CHAR) THEN
394 l_tclv_rec.gl_reversal_yn := NULL;
395 END IF;
396 IF (l_tclv_rec.attribute_category = OKC_API.G_MISS_CHAR) THEN
397 l_tclv_rec.attribute_category := NULL;
398 END IF;
399 IF (l_tclv_rec.attribute1 = OKC_API.G_MISS_CHAR) THEN
400 l_tclv_rec.attribute1 := NULL;
401 END IF;
402 IF (l_tclv_rec.attribute2 = OKC_API.G_MISS_CHAR) THEN
403 l_tclv_rec.attribute2 := NULL;
404 END IF;
405 IF (l_tclv_rec.attribute3 = OKC_API.G_MISS_CHAR) THEN
406 l_tclv_rec.attribute3 := NULL;
407 END IF;
408 IF (l_tclv_rec.attribute4 = OKC_API.G_MISS_CHAR) THEN
409 l_tclv_rec.attribute4 := NULL;
410 END IF;
411 IF (l_tclv_rec.attribute5 = OKC_API.G_MISS_CHAR) THEN
412 l_tclv_rec.attribute5 := NULL;
413 END IF;
414 IF (l_tclv_rec.attribute6 = OKC_API.G_MISS_CHAR) THEN
415 l_tclv_rec.attribute6 := NULL;
416 END IF;
417 IF (l_tclv_rec.attribute7 = OKC_API.G_MISS_CHAR) THEN
418 l_tclv_rec.attribute7 := NULL;
419 END IF;
420 IF (l_tclv_rec.attribute8 = OKC_API.G_MISS_CHAR) THEN
421 l_tclv_rec.attribute8 := NULL;
422 END IF;
423 IF (l_tclv_rec.attribute9 = OKC_API.G_MISS_CHAR) THEN
424 l_tclv_rec.attribute9 := NULL;
425 END IF;
426 IF (l_tclv_rec.attribute10 = OKC_API.G_MISS_CHAR) THEN
427 l_tclv_rec.attribute10 := NULL;
428 END IF;
429 IF (l_tclv_rec.attribute11 = OKC_API.G_MISS_CHAR) THEN
430 l_tclv_rec.attribute11 := NULL;
431 END IF;
432 IF (l_tclv_rec.attribute12 = OKC_API.G_MISS_CHAR) THEN
433 l_tclv_rec.attribute12 := NULL;
434 END IF;
435 IF (l_tclv_rec.attribute13 = OKC_API.G_MISS_CHAR) THEN
436 l_tclv_rec.attribute13 := NULL;
437 END IF;
438 IF (l_tclv_rec.attribute14 = OKC_API.G_MISS_CHAR) THEN
439 l_tclv_rec.attribute14 := NULL;
440 END IF;
441 IF (l_tclv_rec.attribute15 = OKC_API.G_MISS_CHAR) THEN
442 l_tclv_rec.attribute15 := NULL;
443 END IF;
444 IF (l_tclv_rec.tcl_type = OKC_API.G_MISS_CHAR) THEN
445 l_tclv_rec.tcl_type := NULL;
446 END IF;
447 IF (l_tclv_rec.created_by = OKC_API.G_MISS_NUM) THEN
448 l_tclv_rec.created_by := NULL;
449 END IF;
450 IF (l_tclv_rec.creation_date = OKC_API.G_MISS_DATE) THEN
451 l_tclv_rec.creation_date := NULL;
452 END IF;
453 IF (l_tclv_rec.last_updated_by = OKC_API.G_MISS_NUM) THEN
454 l_tclv_rec.last_updated_by := NULL;
455 END IF;
456 IF (l_tclv_rec.last_update_date = OKC_API.G_MISS_DATE) THEN
457 l_tclv_rec.last_update_date := NULL;
458 END IF;
459 IF (l_tclv_rec.org_id = OKC_API.G_MISS_NUM) THEN
460 l_tclv_rec.org_id := NULL;
461 END IF;
462 IF (l_tclv_rec.request_id = OKC_API.G_MISS_NUM) THEN
463 l_tclv_rec.request_id := NULL;
464 END IF;
465 IF (l_tclv_rec.program_application_id = OKC_API.G_MISS_NUM) THEN
466 l_tclv_rec.program_application_id := NULL;
467 END IF;
468 IF (l_tclv_rec.program_id = OKC_API.G_MISS_NUM) THEN
469 l_tclv_rec.program_id := NULL;
470 END IF;
471 IF (l_tclv_rec.program_update_date = OKC_API.G_MISS_DATE) THEN
472 l_tclv_rec.program_update_date := NULL;
473 END IF;
474 IF (l_tclv_rec.last_update_login = OKC_API.G_MISS_NUM) THEN
475 l_tclv_rec.last_update_login := NULL;
476 END IF;
477 IF (l_tclv_rec.avl_id = OKC_API.G_MISS_NUM) THEN
478 l_tclv_rec.avl_id := NULL;
479 END IF;
480 IF (l_tclv_rec.bkt_id = OKC_API.G_MISS_NUM) THEN
481 l_tclv_rec.bkt_id := NULL;
482 END IF;
483 IF (l_tclv_rec.kle_id_new = OKC_API.G_MISS_NUM) THEN
484 l_tclv_rec.kle_id_new := NULL;
485 END IF;
486 IF (l_tclv_rec.percentage = OKC_API.G_MISS_NUM) THEN
487 l_tclv_rec.percentage := NULL;
488 END IF;
489 -- Added by hkpatel on 17-Sep-2003
490 IF (l_tclv_rec.accrual_rule_yn = OKC_API.G_MISS_CHAR) THEN
491 l_tclv_rec.accrual_rule_yn := NULL;
492 END IF;
493 --21 Oct 2004 PAGARG Bug# 3964726
494 IF (l_tclv_rec.SOURCE_COLUMN_1 = OKC_API.G_MISS_CHAR) THEN
495 l_tclv_rec.SOURCE_COLUMN_1 := NULL;
496 END IF;
497 IF (l_tclv_rec.SOURCE_VALUE_1 = OKC_API.G_MISS_NUM) THEN
498 l_tclv_rec.SOURCE_VALUE_1 := NULL;
499 END IF;
500 IF (l_tclv_rec.SOURCE_COLUMN_2 = OKC_API.G_MISS_CHAR) THEN
501 l_tclv_rec.SOURCE_COLUMN_2 := NULL;
502 END IF;
503 IF (l_tclv_rec.SOURCE_VALUE_2 = OKC_API.G_MISS_NUM) THEN
504 l_tclv_rec.SOURCE_VALUE_2 := NULL;
505 END IF;
506 IF (l_tclv_rec.SOURCE_COLUMN_3 = OKC_API.G_MISS_CHAR) THEN
507 l_tclv_rec.SOURCE_COLUMN_3 := NULL;
508 END IF;
509 IF (l_tclv_rec.SOURCE_VALUE_3 = OKC_API.G_MISS_NUM) THEN
510 l_tclv_rec.SOURCE_VALUE_3 := NULL;
511 END IF;
512 IF (l_tclv_rec.CANCELED_DATE = OKC_API.G_MISS_DATE) THEN
513 l_tclv_rec.CANCELED_DATE := NULL;
514 END IF;
515 IF (l_tclv_rec.TAX_LINE_ID = OKC_API.G_MISS_NUM) THEN
516 l_tclv_rec.TAX_LINE_ID := NULL;
517 END IF;
518 -- Added by zrehman for SLA project (Bug 5707866) 9-Feb-2007
519 IF (l_tclv_rec.STREAM_TYPE_CODE = OKC_API.G_MISS_CHAR) THEN
520 l_tclv_rec.STREAM_TYPE_CODE := NULL;
521 END IF;
522 IF (l_tclv_rec.STREAM_TYPE_PURPOSE = OKC_API.G_MISS_CHAR) THEN
523 l_tclv_rec.STREAM_TYPE_PURPOSE := NULL;
524 END IF;
525 IF (l_tclv_rec.ASSET_BOOK_TYPE_NAME = OKC_API.G_MISS_CHAR) THEN
526 l_tclv_rec.ASSET_BOOK_TYPE_NAME := NULL;
527 END IF;
528 -- Added by nikshah for SLA project (Bug 5707866) 16-Apr-2007
529 IF (l_tclv_rec.UPGRADE_STATUS_FLAG = OKC_API.G_MISS_CHAR) THEN
530 l_tclv_rec.UPGRADE_STATUS_FLAG := NULL;
531 END IF;
532 RETURN(l_tclv_rec);
533 END null_out_defaults;
534
535 /* Renu Gurudev 4/17/2001 - Commented out generated code in favor of manually written code
536 ---------------------------------------------------------------------------
537 -- PROCEDURE Validate_Attributes
538 ---------------------------------------------------------------------------
539 --------------------------------------------------
540 -- Validate_Attributes for:OKL_TXL_CNTRCT_LNS_V --
541 --------------------------------------------------
542 FUNCTION Validate_Attributes (
543 p_tclv_rec IN tclv_rec_type
544 ) RETURN VARCHAR2 IS
545 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
546 BEGIN
547 IF p_tclv_rec.id = OKC_API.G_MISS_NUM OR
548 p_tclv_rec.id IS NULL
549 THEN
550 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'id');
551 l_return_status := OKC_API.G_RET_STS_ERROR;
552 ELSIF p_tclv_rec.object_version_number = OKC_API.G_MISS_NUM OR
553 p_tclv_rec.object_version_number IS NULL
554 THEN
555 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'object_version_number');
556 l_return_status := OKC_API.G_RET_STS_ERROR;
557 ELSIF p_tclv_rec.tcn_id = OKC_API.G_MISS_NUM OR
558 p_tclv_rec.tcn_id IS NULL
559 THEN
560 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'tcn_id');
561 l_return_status := OKC_API.G_RET_STS_ERROR;
562 ELSIF p_tclv_rec.khr_id = OKC_API.G_MISS_NUM OR
563 p_tclv_rec.khr_id IS NULL
564 THEN
565 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'khr_id');
566 l_return_status := OKC_API.G_RET_STS_ERROR;
567 ELSIF p_tclv_rec.line_number = OKC_API.G_MISS_NUM OR
568 p_tclv_rec.line_number IS NULL
569 THEN
570 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'line_number');
571 l_return_status := OKC_API.G_RET_STS_ERROR;
572 ELSIF p_tclv_rec.tcl_type = OKC_API.G_MISS_CHAR OR
573 p_tclv_rec.tcl_type IS NULL
574 THEN
575 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'tcl_type');
576 l_return_status := OKC_API.G_RET_STS_ERROR;
577 END IF;
578 RETURN(l_return_status);
579 END Validate_Attributes;
580
581 ---------------------------------------------------------------------------
582 -- PROCEDURE Validate_Record
583 ---------------------------------------------------------------------------
584 ----------------------------------------------
585 -- Validate_Record for:OKL_TXL_CNTRCT_LNS_V --
586 ----------------------------------------------
587 FUNCTION Validate_Record (
588 p_tclv_rec IN tclv_rec_type
589 ) RETURN VARCHAR2 IS
590 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
591 BEGIN
592 RETURN (l_return_status);
593 END Validate_Record;
594
595 */
596 /*********** begin manual coding *****************/
597
598
599 -- Added by santonyr on 11-Jun-2003 to fix bug 2999776
600 ---------------------------------------------------------------------------
601 -- PROCEDURE Validate_Unique_Tcl_Record
602 ---------------------------------------------------------------------------
603 -- Start of comments
604 --
605 -- Procedure Name : Validate_Unique_Tcl_Record
606 -- Description :
607 -- Business Rules :
608 -- Parameters :
609 -- line_number : 1.0
610 -- End of comments
611 ---------------------------------------------------------------------------
612
613 Procedure Validate_Unique_Tcl_Record(x_return_status OUT NOCOPY VARCHAR2
614 ,p_tclv_rec IN tclv_rec_type)
615 IS
616
617 l_dummy VARCHAR2(1);
618 l_row_found BOOLEAN := FALSE;
619
620 CURSOR unique_tcl_csr(p_tcn_id OKL_TXL_CNTRCT_LNS.tcn_id%TYPE
621 ,p_line_number OKL_TXL_CNTRCT_LNS.line_number%TYPE
622 ,p_id OKL_TXL_CNTRCT_LNS.id%TYPE) IS
623 SELECT 1
624 FROM OKL_TXL_CNTRCT_LNS
625 WHERE tcn_id = p_tcn_id
626 AND line_number = p_line_number
627 AND id <> p_id;
628
629 BEGIN
630
631 -- initialize return status
632 x_return_status := Okc_Api.G_RET_STS_SUCCESS;
633
634 OPEN unique_tcl_csr(p_tclv_rec.tcn_id,
635 p_tclv_rec.line_number,
636 p_tclv_rec.id);
637 FETCH unique_tcl_csr INTO l_dummy;
638 l_row_found := unique_tcl_csr%FOUND;
639 CLOSE unique_tcl_csr;
640
641 IF l_row_found THEN
642 Okc_Api.set_message('OKL','OKL_TCN_LINE_NUMBER_UNIQUE');
643 x_return_status := Okc_Api.G_RET_STS_ERROR;
644 END IF;
645
646 EXCEPTION
647 WHEN G_EXCEPTION_HALT_VALIDATION THEN
648 -- no processing necessary; validation can continue
649 -- with the next column
650 NULL;
651
652 WHEN OTHERS THEN
653 -- store SQL error message on message stack for caller
654 Okc_Api.SET_MESSAGE(p_app_name => g_app_name,
655 p_msg_name => g_unexpected_error,
656 p_token1 => g_sqlcode_token,
657 p_token1_value => SQLCODE,
658 p_token2 => g_sqlerrm_token,
659 p_token2_value => SQLERRM);
660
661 -- notify caller of an UNEXPECTED error
662 x_return_status := Okc_Api.G_RET_STS_UNEXP_ERROR;
663
664 END Validate_Unique_Tcl_Record;
665
666
667
668 ---------------------------------------------------------------------------
669 -- PROCEDURE Validate_Id
670 ---------------------------------------------------------------------------
671 -- Start of comments
672 --
673 -- Procedure Name : Validate_Id
674 -- Description :
675 -- Business Rules :
676 -- Parameters :
677 -- Version : 1.0
678 -- End of comments
679 ---------------------------------------------------------------------------
680 PROCEDURE Validate_Id (p_tclv_rec IN tclv_rec_type
681 ,x_return_status OUT NOCOPY VARCHAR2)
682 IS
683 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
684
685 BEGIN
686 -- initialize return status
687 x_return_status := OKC_API.G_RET_STS_SUCCESS;
688
689 -- check for data before processing
690 IF (p_tclv_rec.id IS NULL) OR
691 (p_tclv_rec.id = OKC_API.G_MISS_NUM) THEN
692 OKC_API.SET_MESSAGE(p_app_name => g_app_name
693 ,p_msg_name => g_required_value
694 ,p_token1 => g_col_name_token
695 ,p_token1_value => 'id');
696 x_return_status := OKC_API.G_RET_STS_ERROR;
697 RAISE G_EXCEPTION_HALT_VALIDATION;
698 END IF;
699
700 EXCEPTION
701 WHEN G_EXCEPTION_HALT_VALIDATION THEN
702 -- no processing necessary; validation can continue
703 -- with the next column
704 NULL;
705
706 WHEN OTHERS THEN
707 -- store SQL error message on message stack for caller
708 OKC_API.SET_MESSAGE(p_app_name => g_app_name
709 ,p_msg_name => g_unexpected_error
710 ,p_token1 => g_sqlcode_token
711 ,p_token1_value => sqlcode
712 ,p_token2 => g_sqlerrm_token
713 ,p_token2_value => sqlerrm);
714
715 -- notify caller of an UNEXPECTED error
716 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
717
718 END Validate_Id;
719
720 ---------------------------------------------------------------------------
721 -- PROCEDURE Validate_Khr_Id
722 ---------------------------------------------------------------------------
723 -- Start of comments
724 --
725 -- Procedure Name : Validate_Khr_Id
726 -- Description :
727 -- Business Rules :
728 -- Parameters :
729 -- Version : 1.0
730 -- End of comments
731 ---------------------------------------------------------------------------
732 PROCEDURE Validate_Khr_Id (p_tclv_rec IN tclv_rec_type
733 ,x_return_status OUT NOCOPY VARCHAR2)
734 IS
735 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
736 l_dummy_var VARCHAR2(1);
737 l_row_notfound BOOLEAN := TRUE;
738 item_not_found_error EXCEPTION;
739
740 CURSOR okl_tclv_fk_csr (p_id IN NUMBER) IS
741 SELECT '1'
742 FROM Okl_K_Headers_V
743 WHERE okl_k_headers_v.id = p_id;
744
745
746 BEGIN
747 -- initialize return status
748 x_return_status := OKC_API.G_RET_STS_SUCCESS;
749
750 -- check for data before processing
751 IF (p_tclv_rec.khr_id IS NULL) OR
752 (p_tclv_rec.khr_id = OKC_API.G_MISS_NUM) THEN
753 OKC_API.SET_MESSAGE(p_app_name => g_app_name
754 ,p_msg_name => g_required_value
755 ,p_token1 => g_col_name_token
756 ,p_token1_value => 'khr_id');
757 x_return_status := OKC_API.G_RET_STS_ERROR;
758 RAISE G_EXCEPTION_HALT_VALIDATION;
759 ELSE
760 OPEN okl_tclv_fk_csr(p_tclv_rec.KHR_ID);
761 FETCH okl_tclv_fk_csr INTO l_dummy_var;
762 l_row_notfound := okl_tclv_fk_csr%NOTFOUND;
763 CLOSE okl_tclv_fk_csr;
764 IF (l_row_notfound) THEN
765 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE,G_COL_NAME_TOKEN,'KHR_ID');
766 RAISE item_not_found_error;
767 END IF;
768 END IF;
769
770 EXCEPTION
771 WHEN G_EXCEPTION_HALT_VALIDATION THEN
772 -- no processing necessary; validation can continue
773 -- with the next column
774 NULL;
775
776 WHEN item_not_found_error THEN
777 x_return_status := OKC_API.G_RET_STS_ERROR;
778
779 WHEN OTHERS THEN
780 -- store SQL error message on message stack for caller
781 OKC_API.SET_MESSAGE(p_app_name => g_app_name
782 ,p_msg_name => g_unexpected_error
783 ,p_token1 => g_sqlcode_token
784 ,p_token1_value => sqlcode
785 ,p_token2 => g_sqlerrm_token
786 ,p_token2_value => sqlerrm);
787
788 -- notify caller of an UNEXPECTED error
789 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
790
791 END Validate_Khr_Id;
792
793 ---------------------------------------------------------------------------
794 -- PROCEDURE Validate_Tcn_Id
795 ---------------------------------------------------------------------------
796 -- Start of comments
797 --
798 -- Procedure Name : Validate_Tcn_Id
799 -- Description :
800 -- Business Rules :
801 -- Parameters :
802 -- Version : 1.0
803 -- End of comments
804 ---------------------------------------------------------------------------
805 PROCEDURE Validate_Tcn_Id (p_tclv_rec IN tclv_rec_type
806 ,x_return_status OUT NOCOPY VARCHAR2)
807 IS
808 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
809 l_dummy_var VARCHAR2(1);
810 l_row_notfound BOOLEAN := TRUE;
811 item_not_found_error EXCEPTION;
812
813 CURSOR okl_tclv_fk_csr (p_id IN NUMBER) IS
814 SELECT '1'
815 FROM OKL_TRX_CONTRACTS
816 WHERE OKL_TRX_CONTRACTS.id = p_id;
817
818
819 BEGIN
820 -- initialize return status
821 x_return_status := OKC_API.G_RET_STS_SUCCESS;
822
823 -- check for data before processing
824 IF (p_tclv_rec.tcn_id IS NULL) OR
825 (p_tclv_rec.tcn_id = OKC_API.G_MISS_NUM) THEN
826 OKC_API.SET_MESSAGE(p_app_name => g_app_name
827 ,p_msg_name => g_required_value
828 ,p_token1 => g_col_name_token
829 ,p_token1_value => 'tcn_id');
830 x_return_status := OKC_API.G_RET_STS_ERROR;
831 RAISE G_EXCEPTION_HALT_VALIDATION;
832 ELSE
833 OPEN okl_tclv_fk_csr(p_tclv_rec.TCN_ID);
834 FETCH okl_tclv_fk_csr INTO l_dummy_var;
835 l_row_notfound := okl_tclv_fk_csr%NOTFOUND;
836 CLOSE okl_tclv_fk_csr;
837 IF (l_row_notfound) THEN
838 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE,G_COL_NAME_TOKEN,'TCN_ID');
839 RAISE item_not_found_error;
840 END IF;
841 END IF;
842
843 EXCEPTION
844 WHEN G_EXCEPTION_HALT_VALIDATION THEN
845 -- no processing necessary; validation can continue
846 -- with the next column
847 NULL;
848
849 WHEN item_not_found_error THEN
850 x_return_status := OKC_API.G_RET_STS_ERROR;
851
852 WHEN OTHERS THEN
853 -- store SQL error message on message stack for caller
854 OKC_API.SET_MESSAGE(p_app_name => g_app_name
855 ,p_msg_name => g_unexpected_error
856 ,p_token1 => g_sqlcode_token
857 ,p_token1_value => sqlcode
858 ,p_token2 => g_sqlerrm_token
859 ,p_token2_value => sqlerrm);
860
861 -- notify caller of an UNEXPECTED error
862 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
863
864 END Validate_Tcn_Id;
865
866
867 ---------------------------------------------------------------------------
868 -- PROCEDURE Validate_Rct_Id
869 ---------------------------------------------------------------------------
870 -- Start of comments
871 --
872 -- Procedure Name : Validate_Rct_Id
873 -- Description :
874 -- Business Rules :
875 -- Parameters :
876 -- Version : 1.0
877 -- End of comments
878 ---------------------------------------------------------------------------
879 PROCEDURE Validate_Rct_Id (p_tclv_rec IN tclv_rec_type
880 ,x_return_status OUT NOCOPY VARCHAR2)
881 IS
882 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
883 l_dummy_var VARCHAR2(1);
884 l_row_notfound BOOLEAN := TRUE;
885 item_not_found_error EXCEPTION;
886
887 CURSOR rct_csr (v_rct_id IN NUMBER) IS
888 SELECT '1'
889 FROM OKL_STRM_TYPE_V
890 WHERE id = v_rct_id;
891
892
893 BEGIN
894 -- initialize return status
895 x_return_status := OKC_API.G_RET_STS_SUCCESS;
896
897 IF (p_tclv_rec.rct_id IS NOT NULL) AND
898 (p_tclv_rec.rct_id <> OKC_API.G_MISS_NUM) THEN
899
900 OPEN rct_csr(p_tclv_rec.RCT_ID);
901 FETCH rct_csr INTO l_dummy_var;
902 l_row_notfound := rct_csr%NOTFOUND;
903 CLOSE rct_csr;
904
905 IF (l_row_notfound) THEN
906 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE,G_COL_NAME_TOKEN,'RCT_ID');
907 RAISE item_not_found_error;
908 END IF;
909
910 END IF;
911
912 EXCEPTION
913 WHEN G_EXCEPTION_HALT_VALIDATION THEN
914 -- no processing necessary; validation can continue
915 -- with the next column
916 NULL;
917
918 WHEN item_not_found_error THEN
919 x_return_status := OKC_API.G_RET_STS_ERROR;
920
921 WHEN OTHERS THEN
922 -- store SQL error message on message stack for caller
923 OKC_API.SET_MESSAGE(p_app_name => g_app_name
924 ,p_msg_name => g_unexpected_error
925 ,p_token1 => g_sqlcode_token
926 ,p_token1_value => sqlcode
927 ,p_token2 => g_sqlerrm_token
928 ,p_token2_value => sqlerrm);
929
930 -- notify caller of an UNEXPECTED error
931 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
932
933 END Validate_RCT_ID;
934
935
936 ---------------------------------------------------------------------------
937 -- PROCEDURE Validate_Btc_Id
938 ---------------------------------------------------------------------------
939 -- Start of comments
940 --
941 -- Procedure Name : Validate_Btc_Id
942 -- Description :
943 -- Business Rules :
944 -- Parameters :
945 -- Version : 1.0
946 -- End of comments
947 ---------------------------------------------------------------------------
948 PROCEDURE Validate_Btc_Id (p_tclv_rec IN tclv_rec_type
949 ,x_return_status OUT NOCOPY VARCHAR2)
950 IS
951 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
952 l_dummy_var VARCHAR2(1);
953 l_row_notfound BOOLEAN := TRUE;
954 item_not_found_error EXCEPTION;
955
956 CURSOR btc_csr (v_btc_id IN NUMBER) IS
957 SELECT '1'
958 FROM OKL_TRX_CSH_BATCH_V
959 WHERE id = v_btc_id;
960
961
962 BEGIN
963 -- initialize return status
964 x_return_status := OKC_API.G_RET_STS_SUCCESS;
965
966 IF (p_tclv_rec.btc_id IS NOT NULL) AND
967 (p_tclv_rec.btc_id <> OKC_API.G_MISS_NUM) THEN
968
969 OPEN btc_csr(p_tclv_rec.BTC_ID);
970 FETCH btc_csr INTO l_dummy_var;
971 l_row_notfound := btc_csr%NOTFOUND;
972 CLOSE btc_csr;
973
974 IF (l_row_notfound) THEN
975 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE,G_COL_NAME_TOKEN,'BTC_ID');
976 RAISE item_not_found_error;
977 END IF;
978
979 END IF;
980
981 EXCEPTION
982 WHEN G_EXCEPTION_HALT_VALIDATION THEN
983 -- no processing necessary; validation can continue
984 -- with the next column
985 NULL;
986
987 WHEN item_not_found_error THEN
988 x_return_status := OKC_API.G_RET_STS_ERROR;
989
990 WHEN OTHERS THEN
991 -- store SQL error message on message stack for caller
992 OKC_API.SET_MESSAGE(p_app_name => g_app_name
993 ,p_msg_name => g_unexpected_error
994 ,p_token1 => g_sqlcode_token
995 ,p_token1_value => sqlcode
996 ,p_token2 => g_sqlerrm_token
997 ,p_token2_value => sqlerrm);
998
999 -- notify caller of an UNEXPECTED error
1000 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1001
1002 END Validate_BTC_ID;
1003
1004
1005 ---------------------------------------------------------------------------
1006 -- PROCEDURE Validate_Sty_Id
1007 ---------------------------------------------------------------------------
1008 -- Start of comments
1009 --
1010 -- Procedure Name : Validate_Sty_Id
1011 -- Description :
1012 -- Business Rules :
1013 -- Parameters :
1014 -- Version : 1.0
1015 -- End of comments
1016 ---------------------------------------------------------------------------
1017 PROCEDURE Validate_Sty_Id (p_tclv_rec IN tclv_rec_type
1018 ,x_return_status OUT NOCOPY VARCHAR2)
1019 IS
1020 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1021 l_dummy_var VARCHAR2(1);
1022 l_row_notfound BOOLEAN := TRUE;
1023 item_not_found_error EXCEPTION;
1024
1025 CURSOR okl_tclv_fk_csr (p_id IN NUMBER) IS
1026 SELECT '1'
1027 FROM Okl_Strm_Type_V
1028 WHERE okl_strm_type_v.id = p_id;
1029
1030
1031 BEGIN
1032 -- initialize return status
1033 x_return_status := OKC_API.G_RET_STS_SUCCESS;
1034
1035 -- check for data before processing
1036 IF (p_tclv_rec.sty_id IS NOT NULL) AND
1037 (p_tclv_rec.sty_id <> OKC_API.G_MISS_NUM) THEN
1038 OPEN okl_tclv_fk_csr(p_tclv_rec.STY_ID);
1039 FETCH okl_tclv_fk_csr INTO l_dummy_var;
1040 l_row_notfound := okl_tclv_fk_csr%NOTFOUND;
1041 CLOSE okl_tclv_fk_csr;
1042 IF (l_row_notfound) THEN
1043 OKC_API.set_message(G_APP_NAME,
1044 G_INVALID_VALUE,
1045 G_COL_NAME_TOKEN,
1046 'STY_ID');
1047 RAISE item_not_found_error;
1048 END IF;
1049 END IF;
1050
1051 EXCEPTION
1052 WHEN G_EXCEPTION_HALT_VALIDATION THEN
1053 -- no processing necessary; validation can continue
1054 -- with the next column
1055 NULL;
1056
1057 WHEN item_not_found_error THEN
1058 x_return_status := OKC_API.G_RET_STS_ERROR;
1059
1060 WHEN OTHERS THEN
1061 -- store SQL error message on message stack for caller
1062 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1063 ,p_msg_name => g_unexpected_error
1064 ,p_token1 => g_sqlcode_token
1065 ,p_token1_value => sqlcode
1066 ,p_token2 => g_sqlerrm_token
1067 ,p_token2_value => sqlerrm);
1068
1069 -- notify caller of an UNEXPECTED error
1070 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1071
1072 END Validate_Sty_Id;
1073
1074 ---------------------------------------------------------------------------
1075 -- PROCEDURE Validate_Line_Number
1076 ---------------------------------------------------------------------------
1077 -- Start of comments
1078 --
1079 -- Procedure Name : Validate_Line_Number
1080 -- Description :
1081 -- Business Rules :
1082 -- Parameters :
1083 -- Version : 1.0
1084 -- End of comments
1085 ---------------------------------------------------------------------------
1086 PROCEDURE Validate_Line_Number (p_tclv_rec IN tclv_rec_type
1087 ,x_return_status OUT NOCOPY VARCHAR2)
1088 IS
1089 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1090
1091 BEGIN
1092 -- initialize return status
1093 x_return_status := OKC_API.G_RET_STS_SUCCESS;
1094
1095 -- check for data before processing
1096 IF (p_tclv_rec.line_number IS NULL) OR
1097 (p_tclv_rec.line_number = OKC_API.G_MISS_NUM) THEN
1098 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1099 ,p_msg_name => g_required_value
1100 ,p_token1 => g_col_name_token
1101 ,p_token1_value => 'line_number');
1102 x_return_status := OKC_API.G_RET_STS_ERROR;
1103 RAISE G_EXCEPTION_HALT_VALIDATION;
1104 END IF;
1105
1106 EXCEPTION
1107 WHEN G_EXCEPTION_HALT_VALIDATION THEN
1108 -- no processing necessary; validation can continue
1109 -- with the next column
1110 NULL;
1111
1112 WHEN OTHERS THEN
1113 -- store SQL error message on message stack for caller
1114 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1115 ,p_msg_name => g_unexpected_error
1116 ,p_token1 => g_sqlcode_token
1117 ,p_token1_value => sqlcode
1118 ,p_token2 => g_sqlerrm_token
1119 ,p_token2_value => sqlerrm);
1120
1121 -- notify caller of an UNEXPECTED error
1122 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1123
1124 END Validate_Line_Number;
1125
1126
1127 ---------------------------------------------------------------------------
1128 -- PROCEDURE Validate_Object_Version_Number
1129 ---------------------------------------------------------------------------
1130 -- Start of comments
1131 --
1132 -- Procedure Name : Validate_Object_Version_Number
1133 -- Description :
1134 -- Business Rules :
1135 -- Parameters :
1136 -- Version : 1.0
1137 -- End of comments
1138 ---------------------------------------------------------------------------
1139 PROCEDURE Validate_Object_Version_Number (p_tclv_rec IN tclv_rec_type
1140 ,x_return_status OUT NOCOPY VARCHAR2)
1141 IS
1142 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1143
1144 BEGIN
1145 -- initialize return status
1146 x_return_status := OKC_API.G_RET_STS_SUCCESS;
1147
1148 -- check for data before processing
1149 IF (p_tclv_rec.object_version_number IS NULL) OR
1150 (p_tclv_rec.object_version_number = OKC_API.G_MISS_NUM) THEN
1151 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1152 ,p_msg_name => g_required_value
1153 ,p_token1 => g_col_name_token
1154 ,p_token1_value => 'object_version_number');
1155 x_return_status := OKC_API.G_RET_STS_ERROR;
1156 RAISE G_EXCEPTION_HALT_VALIDATION;
1157 END IF;
1158
1159 EXCEPTION
1160 WHEN G_EXCEPTION_HALT_VALIDATION THEN
1161 -- no processing necessary; validation can continue
1162 -- with the next column
1163 NULL;
1164
1165 WHEN OTHERS THEN
1166 -- store SQL error message on message stack for caller
1167 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1168 ,p_msg_name => g_unexpected_error
1169 ,p_token1 => g_sqlcode_token
1170 ,p_token1_value => sqlcode
1171 ,p_token2 => g_sqlerrm_token
1172 ,p_token2_value => sqlerrm);
1173
1174 -- notify caller of an UNEXPECTED error
1175 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1176
1177 END Validate_Object_Version_Number;
1178
1179 ---------------------------------------------------------------------------
1180 -- PROCEDURE Validate_Tcl_Type
1181 ---------------------------------------------------------------------------
1182 -- Start of comments
1183 --
1184 -- Procedure Name : Validate_Tcl_Type
1185 -- Description :
1186 -- Business Rules :
1187 -- Parameters :
1188 -- Version : 1.0
1189 -- End of comments
1190 ---------------------------------------------------------------------------
1191 PROCEDURE Validate_Tcl_Type (p_tclv_rec IN tclv_rec_type
1192 ,x_return_status OUT NOCOPY VARCHAR2)
1193 IS
1194 l_dummy VARCHAR2(1) := OKC_API.G_FALSE;
1195
1196 BEGIN
1197 -- initialize return status
1198 x_return_status := OKC_API.G_RET_STS_SUCCESS;
1199
1200 -- check for data before processing
1201 IF (p_tclv_rec.tcl_type IS NULL) OR
1202 (p_tclv_rec.tcl_type = OKC_API.G_MISS_CHAR) THEN
1203 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1204 ,p_msg_name => g_required_value
1205 ,p_token1 => g_col_name_token
1206 ,p_token1_value => 'tcl_type');
1207 x_return_status := OKC_API.G_RET_STS_ERROR;
1208 RAISE G_EXCEPTION_HALT_VALIDATION;
1209 END IF;
1210
1211 l_dummy := OKL_ACCOUNTING_UTIL.VALIDATE_LOOKUP_CODE
1212 (p_lookup_type => 'OKL_TCL_TYPE',
1213 p_lookup_code => p_tclv_rec.tcl_type);
1214 --dbms_output.put_line('TCL TYpe Is ' || p_tclv_rec.tcl_type);
1215 --dbms_output.put_line('l_dummy is ' || l_dummy);
1216
1217 IF (l_dummy = OKC_API.G_FALSE) THEN
1218 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1219 ,p_msg_name => g_invalid_value
1220 ,p_token1 => g_col_name_token
1221 ,p_token1_value => 'tcl_type');
1222 x_return_status := OKC_API.G_RET_STS_ERROR;
1223 RAISE G_EXCEPTION_HALT_VALIDATION;
1224
1225 END IF;
1226
1227
1228 EXCEPTION
1229 WHEN G_EXCEPTION_HALT_VALIDATION THEN
1230 -- no processing necessary; validation can continue
1231 -- with the next column
1232 NULL;
1233
1234 WHEN OTHERS THEN
1235 -- store SQL error message on message stack for caller
1236 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1237 ,p_msg_name => g_unexpected_error
1238 ,p_token1 => g_sqlcode_token
1239 ,p_token1_value => sqlcode
1240 ,p_token2 => g_sqlerrm_token
1241 ,p_token2_value => sqlerrm);
1242
1243 -- notify caller of an UNEXPECTED error
1244 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1245
1246 END Validate_tcl_Type;
1247
1248 ---------------------------------------------------------------------------
1249 -- PROCEDURE Validate_GL_Reversal_YN
1250 ---------------------------------------------------------------------------
1251 -- Start of comments
1252 --
1253 -- Procedure Name : Validate_GL_Reversal_YN
1254 -- Description :
1255 -- Business Rules :
1256 -- Parameters :
1257 -- Version : 1.0
1258 -- End of comments
1259 ---------------------------------------------------------------------------
1260 PROCEDURE Validate_GL_Reversal_YN(p_tclv_rec IN tclv_rec_type
1261 ,x_return_status OUT NOCOPY VARCHAR2)
1262 IS
1263
1264 l_dummy VARCHAR2(1) := OKL_API.G_FALSE;
1265 l_app_id NUMBER := 0;
1266 l_view_app_id NUMBER := 0;
1267
1268 BEGIN
1269 -- initialize return status
1270 x_return_status := OKC_API.G_RET_STS_SUCCESS;
1271
1272 -- check for data before processing
1273 IF (p_tclv_rec.gl_reversal_yn IS NOT NULL) AND
1274 (p_tclv_rec.gl_reversal_yn <> OKC_API.G_MISS_CHAR) THEN
1275 -- check in fnd_lookups for validity
1276
1277 l_dummy := OKL_ACCOUNTING_UTIL.VALIDATE_LOOKUP_CODE(
1278 p_lookup_type => 'YES_NO',
1279 p_lookup_code => p_tclv_rec.gl_reversal_yn,
1280 p_app_id => l_app_id,
1281 p_view_app_id => l_view_app_id);
1282
1283 IF (l_dummy = OKL_API.G_FALSE) THEN
1284 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1285 ,p_msg_name => g_invalid_value
1286 ,p_token1 => g_col_name_token
1287 ,p_token1_value => 'gl_reversal_yn');
1288 x_return_status := OKC_API.G_RET_STS_ERROR;
1289 RAISE G_EXCEPTION_HALT_VALIDATION;
1290 END IF;
1291
1292 END IF;
1293
1294
1295 EXCEPTION
1296 WHEN G_EXCEPTION_HALT_VALIDATION THEN
1297 -- no processing neccessary; validation can continue
1298 -- with the next column
1299 NULL;
1300
1301 WHEN OTHERS THEN
1302 -- store SQL error message on message stack for caller
1303 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
1304 p_msg_name => g_unexpected_error,
1305 p_token1 => g_sqlcode_token,
1306 p_token1_value => sqlcode,
1307 p_token2 => g_sqlerrm_token,
1308 p_token2_value => sqlerrm);
1309
1310 -- notify caller of an UNEXPECTED error
1311 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1312
1313 END Validate_GL_Reversal_YN;
1314
1315 ---------------------------------------------------------------------------
1316 -- PROCEDURE Validate_currency_code
1317 ---------------------------------------------------------------------------
1318 -- Start of comments
1319 --
1320 -- Procedure Name : Validate_currency_code
1321 -- Description :
1322 -- Business Rules :
1323 -- Parameters :
1324 -- Version : 1.0
1325 -- End of comments
1326 ---------------------------------------------------------------------------
1327 PROCEDURE Validate_currency_code(p_tclv_rec IN tclv_rec_type
1328 ,x_return_status OUT NOCOPY VARCHAR2)
1329 IS
1330
1331 l_return_status VARCHAR2(1) := OKL_API.G_TRUE;
1332
1333 BEGIN
1334 -- initialize return status
1335 x_return_status := OKC_API.G_RET_STS_SUCCESS;
1336
1337 -- check for data before processing
1338 IF (p_tclv_rec.currency_code IS NULL) OR
1339 (p_tclv_rec.currency_code = OKC_API.G_MISS_CHAR) THEN
1340 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1341 ,p_msg_name => g_required_value
1342 ,p_token1 => g_col_name_token
1343 ,p_token1_value => 'currency_code');
1344 x_return_status := Okc_Api.G_RET_STS_ERROR;
1345 RAISE G_EXCEPTION_HALT_VALIDATION;
1346 ELSE
1347 l_return_status := OKL_ACCOUNTING_UTIL.VALIDATE_CURRENCY_CODE (
1348 p_tclv_rec.currency_code);
1349
1350 IF l_return_status = okl_api.g_false THEN
1351 Okc_Api.SET_MESSAGE(p_app_name => g_app_name,
1352 p_msg_name => g_invalid_value,
1353 p_token1 => g_col_name_token,
1354 p_token1_value => 'CURRENCY_CODE');
1355 x_return_status := Okc_Api.G_RET_STS_ERROR;
1356 RAISE G_EXCEPTION_HALT_VALIDATION;
1357 END IF;
1358 END IF;
1359
1360 EXCEPTION
1361 WHEN G_EXCEPTION_HALT_VALIDATION THEN
1362 -- no processing neccessary; validation can continue
1363 -- with the next column
1364 NULL;
1365
1366 WHEN OTHERS THEN
1367 -- store SQL error message on message stack for caller
1368 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
1369 p_msg_name => g_unexpected_error,
1370 p_token1 => g_sqlcode_token,
1371 p_token1_value => sqlcode,
1372 p_token2 => g_sqlerrm_token,
1373 p_token2_value => sqlerrm);
1374
1375 -- notify caller of an UNEXPECTED error
1376 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1377
1378 END Validate_currency_code;
1379
1380 ---------------------------------------------------------------------------
1381 -- PROCEDURE Validate_Amount
1382 ---------------------------------------------------------------------------
1383 -- Start of comments
1384 --
1385 -- Procedure Name : Validate_Amount
1386 -- Description :
1387 -- Business Rules :
1388 -- Parameters :
1389 -- Version : 1.0
1390 -- End of comments
1391 ---------------------------------------------------------------------------
1392 PROCEDURE Validate_Amount (p_tclv_rec IN tclv_rec_type
1393 ,x_return_status OUT NOCOPY VARCHAR2)
1394 IS
1395 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1396
1397 BEGIN
1398 -- initialize return status
1399 x_return_status := OKC_API.G_RET_STS_SUCCESS;
1400
1401 -- check for data before processing
1402 IF (p_tclv_rec.amount IS NULL) OR
1403 (p_tclv_rec.amount = OKC_API.G_MISS_NUM) THEN
1404 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1405 ,p_msg_name => g_required_value
1406 ,p_token1 => g_col_name_token
1407 ,p_token1_value => 'amount');
1408 x_return_status := OKC_API.G_RET_STS_ERROR;
1409 RAISE G_EXCEPTION_HALT_VALIDATION;
1410 END IF;
1411
1412 EXCEPTION
1413 WHEN G_EXCEPTION_HALT_VALIDATION THEN
1414 -- no processing necessary; validation can continue
1415 -- with the next column
1416 NULL;
1417
1418 WHEN OTHERS THEN
1419 -- store SQL error message on message stack for caller
1420 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1421 ,p_msg_name => g_unexpected_error
1422 ,p_token1 => g_sqlcode_token
1423 ,p_token1_value => sqlcode
1424 ,p_token2 => g_sqlerrm_token
1425 ,p_token2_value => sqlerrm);
1426
1427 -- notify caller of an UNEXPECTED error
1428 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1429
1430 END Validate_Amount;
1431
1432
1433 ---------------------------------------------------------------------------
1434 -- PROCEDURE Validate_AVL_ID
1435 ---------------------------------------------------------------------------
1436 -- Start of comments
1437 --
1438 -- Procedure Name : Validate_AVL_ID
1439 -- Description :
1440 -- Business Rules :
1441 -- Parameters :
1442 -- Version : 1.0
1443 -- End of comments
1444 ---------------------------------------------------------------------------
1445 PROCEDURE Validate_AVL_Id (p_tclv_rec IN tclv_rec_type
1446 ,x_return_status OUT NOCOPY VARCHAR2)
1447 IS
1448 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1449 l_dummy_var VARCHAR2(1);
1450 l_row_notfound BOOLEAN := TRUE;
1451 item_not_found_error EXCEPTION;
1452
1453 CURSOR avl_csr (v_avl_id IN NUMBER) IS
1454 SELECT '1'
1455 FROM OKL_AE_TEMPLATES
1456 WHERE id = v_avl_id;
1457
1458
1459 BEGIN
1460 -- initialize return status
1461 x_return_status := OKC_API.G_RET_STS_SUCCESS;
1462
1463 IF (p_tclv_rec.avl_id IS NOT NULL) AND
1464 (p_tclv_rec.avl_id <> OKC_API.G_MISS_NUM) THEN
1465
1466 OPEN avl_csr(p_tclv_rec.AVL_ID);
1467 FETCH avl_csr INTO l_dummy_var;
1468 l_row_notfound := avl_csr%NOTFOUND;
1469 CLOSE avl_csr;
1470
1471 IF (l_row_notfound) THEN
1472 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE,G_COL_NAME_TOKEN,'AVL_ID');
1473 RAISE item_not_found_error;
1474 END IF;
1475
1476 END IF;
1477
1478 EXCEPTION
1479 WHEN G_EXCEPTION_HALT_VALIDATION THEN
1480 -- no processing necessary; validation can continue
1481 -- with the next column
1482 NULL;
1483
1484 WHEN item_not_found_error THEN
1485 x_return_status := OKC_API.G_RET_STS_ERROR;
1486
1487 WHEN OTHERS THEN
1488 -- store SQL error message on message stack for caller
1489 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1490 ,p_msg_name => g_unexpected_error
1491 ,p_token1 => g_sqlcode_token
1492 ,p_token1_value => sqlcode
1493 ,p_token2 => g_sqlerrm_token
1494 ,p_token2_value => sqlerrm);
1495
1496 -- notify caller of an UNEXPECTED error
1497 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1498
1499 END Validate_AVL_ID;
1500
1501 ---------------------------------------------------------------------------
1502 -- PROCEDURE Validate_BKT_ID
1503 ---------------------------------------------------------------------------
1504 -- Start of comments
1505 --
1506 -- Procedure Name : Validate_BKT_ID
1507 -- Description :
1508 -- Business Rules :
1509 -- Parameters :
1510 -- Version : 1.0
1511 -- End of comments
1512 ---------------------------------------------------------------------------
1513 PROCEDURE Validate_BKT_Id (p_tclv_rec IN tclv_rec_type
1514 ,x_return_status OUT NOCOPY VARCHAR2)
1515 IS
1516 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1517 l_dummy_var VARCHAR2(1);
1518 l_row_notfound BOOLEAN := TRUE;
1519 item_not_found_error EXCEPTION;
1520
1521 CURSOR bkt_csr (v_bkt_id IN NUMBER) IS
1522 SELECT '1'
1523 FROM OKL_BUCKETS_V
1524 WHERE id = v_bkt_id;
1525
1526
1527 BEGIN
1528 -- initialize return status
1529 x_return_status := OKC_API.G_RET_STS_SUCCESS;
1530
1531 IF (p_tclv_rec.bkt_id IS NOT NULL) AND
1532 (p_tclv_rec.bkt_id <> OKC_API.G_MISS_NUM) THEN
1533
1534 OPEN bkt_csr(p_tclv_rec.BKT_ID);
1535 FETCH bkt_csr INTO l_dummy_var;
1536 l_row_notfound := bkt_csr%NOTFOUND;
1537 CLOSE bkt_csr;
1538
1539 IF (l_row_notfound) THEN
1540 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE,G_COL_NAME_TOKEN,'BKT_ID');
1541 RAISE item_not_found_error;
1542 END IF;
1543
1544 END IF;
1545
1546 EXCEPTION
1547 WHEN G_EXCEPTION_HALT_VALIDATION THEN
1548 -- no processing necessary; validation can continue
1549 -- with the next column
1550 NULL;
1551
1552 WHEN item_not_found_error THEN
1553 x_return_status := OKC_API.G_RET_STS_ERROR;
1554
1555 WHEN OTHERS THEN
1556 -- store SQL error message on message stack for caller
1557 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1558 ,p_msg_name => g_unexpected_error
1559 ,p_token1 => g_sqlcode_token
1560 ,p_token1_value => sqlcode
1561 ,p_token2 => g_sqlerrm_token
1562 ,p_token2_value => sqlerrm);
1563
1564 -- notify caller of an UNEXPECTED error
1565 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1566
1567 END Validate_BKT_ID;
1568
1569
1570 -- Added by Santonyr Bug : 2305542
1571 ---------------------------------------------------------------------------
1572 -- PROCEDURE Validate_Kle_Id_New
1573 ---------------------------------------------------------------------------
1574 -- Start of comments
1575 --
1576 -- Procedure Name : Validate_Kle_Id_New
1577 -- Description :
1578 -- Business Rules :
1579 -- Parameters :
1580 -- Version : 1.0
1581 -- End of comments
1582 ---------------------------------------------------------------------------
1583 PROCEDURE Validate_Kle_Id_New (p_tclv_rec IN tclv_rec_type
1584 ,x_return_status OUT NOCOPY VARCHAR2)
1585 IS
1586 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1587 l_dummy_var VARCHAR2(1);
1588 l_row_notfound BOOLEAN := TRUE;
1589 item_not_found_error EXCEPTION;
1590
1591 CURSOR okl_tclv_fk_csr (p_id IN NUMBER) IS
1592 SELECT '1'
1593 FROM okl_k_lines_v
1594 WHERE okl_k_lines_v.id = p_id;
1595
1596
1597 BEGIN
1598 -- initialize return status
1599 x_return_status := OKC_API.G_RET_STS_SUCCESS;
1600
1601 -- check for data before processing
1602 IF (p_tclv_rec.kle_id_new IS NOT NULL) AND
1603 (p_tclv_rec.kle_id_new <> OKC_API.G_MISS_NUM) THEN
1604 OPEN okl_tclv_fk_csr(p_tclv_rec.kle_id_new);
1605 FETCH okl_tclv_fk_csr INTO l_dummy_var;
1606 l_row_notfound := okl_tclv_fk_csr%NOTFOUND;
1607 CLOSE okl_tclv_fk_csr;
1608 IF (l_row_notfound) THEN
1609 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE, G_COL_NAME_TOKEN,'KLE_ID_NEW');
1610 RAISE item_not_found_error;
1611 END IF;
1612 END IF;
1613
1614 EXCEPTION
1615 WHEN G_EXCEPTION_HALT_VALIDATION THEN
1616 -- no processing necessary; validation can continue
1617 -- with the next column
1618 NULL;
1619
1620 WHEN item_not_found_error THEN
1621 x_return_status := OKC_API.G_RET_STS_ERROR;
1622
1623 WHEN OTHERS THEN
1624 -- store SQL error message on message stack for caller
1625 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1626 ,p_msg_name => g_unexpected_error
1627 ,p_token1 => g_sqlcode_token
1628 ,p_token1_value => sqlcode
1629 ,p_token2 => g_sqlerrm_token
1630 ,p_token2_value => sqlerrm);
1631
1632 -- notify caller of an UNEXPECTED error
1633 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1634
1635 END Validate_Kle_Id_New;
1636
1637 -- Added by Santonyr Bug : 2305542
1638 ---------------------------------------------------------------------------
1639 -- PROCEDURE Validate_Percentage
1640 ---------------------------------------------------------------------------
1641 -- Start of comments
1642 --
1643 -- Procedure Name : Validate_Percentage
1644 -- Description :
1645 -- Business Rules :
1646 -- Parameters :
1647 -- Version : 1.0
1648 -- End of comments
1649 ---------------------------------------------------------------------------
1650 PROCEDURE Validate_Percentage (p_tclv_rec IN tclv_rec_type
1651 ,x_return_status OUT NOCOPY VARCHAR2)
1652 IS
1653 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1654 l_dummy_var VARCHAR2(1);
1655 l_row_notfound BOOLEAN := TRUE;
1656 item_not_found_error EXCEPTION;
1657
1658 BEGIN
1659 -- initialize return status
1660 x_return_status := OKC_API.G_RET_STS_SUCCESS;
1661
1662 -- check for data before processing
1663 IF (p_tclv_rec.percentage IS NOT NULL) AND
1664 (p_tclv_rec.percentage <> OKC_API.G_MISS_NUM) THEN
1665 IF ((p_tclv_rec.percentage < 0) OR
1666 (p_tclv_rec.percentage > 100)) THEN
1667 OKC_API.set_message(G_APP_NAME, 'OKL_LLA_PERCENT');
1668 RAISE item_not_found_error;
1669 END IF;
1670 END IF;
1671
1672 EXCEPTION
1673 WHEN G_EXCEPTION_HALT_VALIDATION THEN
1674 -- no processing necessary; validation can continue
1675 -- with the next column
1676 NULL;
1677
1678 WHEN item_not_found_error THEN
1679 x_return_status := OKC_API.G_RET_STS_ERROR;
1680
1681 WHEN OTHERS THEN
1682 -- store SQL error message on message stack for caller
1683 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1684 ,p_msg_name => g_unexpected_error
1685 ,p_token1 => g_sqlcode_token
1686 ,p_token1_value => sqlcode
1687 ,p_token2 => g_sqlerrm_token
1688 ,p_token2_value => sqlerrm);
1689
1690 -- notify caller of an UNEXPECTED error
1691 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1692
1693 END Validate_Percentage;
1694
1695 ---------------------------------------------------------------------------
1696 -- PROCEDURE Validate_Accrual_Rule_YN
1697 ---------------------------------------------------------------------------
1698 -- Start of comments
1699 --
1700 -- Procedure Name : Validate_Accrual_Rule_YN
1701 -- Description :
1702 -- Business Rules :
1703 -- Parameters :
1704 -- Version : 1.0
1705 -- End of comments
1706 ---------------------------------------------------------------------------
1707 PROCEDURE Validate_Accrual_Rule_YN(p_tclv_rec IN tclv_rec_type
1708 ,x_return_status OUT NOCOPY VARCHAR2)
1709 IS
1710
1711 l_dummy VARCHAR2(1) := OKL_API.G_FALSE;
1712 l_app_id NUMBER := 0;
1713 l_view_app_id NUMBER := 0;
1714
1715 BEGIN
1716 -- initialize return status
1717 x_return_status := OKC_API.G_RET_STS_SUCCESS;
1718
1719 -- check for data before processing
1720 IF (p_tclv_rec.accrual_rule_yn IS NOT NULL) AND
1721 (p_tclv_rec.accrual_rule_yn <> OKC_API.G_MISS_CHAR) THEN
1722 -- check in fnd_lookups for validity
1723
1724 l_dummy := OKL_ACCOUNTING_UTIL.VALIDATE_LOOKUP_CODE(
1725 p_lookup_type => 'YES_NO',
1726 p_lookup_code => p_tclv_rec.accrual_rule_yn,
1727 p_app_id => l_app_id,
1728 p_view_app_id => l_view_app_id);
1729
1730 IF (l_dummy = OKL_API.G_FALSE) THEN
1731 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1732 ,p_msg_name => g_invalid_value
1733 ,p_token1 => g_col_name_token
1734 ,p_token1_value => 'accrual_rule_yn');
1735 x_return_status := OKC_API.G_RET_STS_ERROR;
1736 RAISE G_EXCEPTION_HALT_VALIDATION;
1737 END IF;
1738
1739 END IF;
1740
1741
1742 EXCEPTION
1743 WHEN G_EXCEPTION_HALT_VALIDATION THEN
1744 -- no processing neccessary; validation can continue
1745 -- with the next column
1746 NULL;
1747
1748 WHEN OTHERS THEN
1749 -- store SQL error message on message stack for caller
1750 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
1751 p_msg_name => g_unexpected_error,
1752 p_token1 => g_sqlcode_token,
1753 p_token1_value => sqlcode,
1754 p_token2 => g_sqlerrm_token,
1755 p_token2_value => sqlerrm);
1756
1757 -- notify caller of an UNEXPECTED error
1758 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1759
1760 END Validate_Accrual_Rule_YN;
1761
1762 -- Added by zrehman for SLA project (Bug 5707866) 16-Feb-2007 start
1763 ---------------------------------------------------------------------------
1764 -- PROCEDURE Validate_Asset_Book_Type_Name
1765 ---------------------------------------------------------------------------
1766 -- Start of comments
1767 -- Procedure Name : Validate_Asset_Book_Type_Name
1768 -- Description :
1769 -- Business Rules :
1770 -- Parameters :
1771 -- Version : 1.0
1772 -- End of comments
1773 ---------------------------------------------------------------------------
1774 PROCEDURE Validate_Asset_Book_Type_Name(p_tclv_rec IN tclv_rec_type
1775 ,x_return_status OUT NOCOPY VARCHAR2)
1776 IS
1777
1778 l_found VARCHAR2(1);
1779 l_app_id NUMBER := 0;
1780 l_view_app_id NUMBER := 0;
1781
1782 CURSOR book_type_csr(bk_type_name fa_book_controls.BOOK_TYPE_NAME%TYPE) IS
1783 SELECT '1'
1784 FROM fa_book_controls
1785 WHERE BOOK_TYPE_NAME = bk_type_name;
1786
1787 BEGIN
1788 -- initialize return status
1789 x_return_status := OKC_API.G_RET_STS_SUCCESS;
1790
1791 -- check for data before processing
1792 IF (p_tclv_rec.asset_book_type_name IS NOT NULL) AND
1793 (p_tclv_rec.asset_book_type_name <> OKC_API.G_MISS_CHAR) THEN
1794
1795 OPEN book_type_csr(p_tclv_rec.asset_book_type_name);
1796 FETCH book_type_csr into l_found;
1797 CLOSE book_type_csr;
1798
1799 IF l_found IS NULL THEN
1800 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1801 ,p_msg_name => g_invalid_value
1802 ,p_token1 => g_col_name_token
1803 ,p_token1_value => 'asset_book_type_name');
1804 x_return_status := OKC_API.G_RET_STS_ERROR;
1805 RAISE G_EXCEPTION_HALT_VALIDATION;
1806 END IF;
1807
1808 END IF;
1809
1810
1811 EXCEPTION
1812 WHEN G_EXCEPTION_HALT_VALIDATION THEN
1813 -- no processing neccessary; validation can continue
1814 -- with the next column
1815 NULL;
1816
1817 WHEN OTHERS THEN
1818 -- store SQL error message on message stack for caller
1819 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
1820 p_msg_name => g_unexpected_error,
1821 p_token1 => g_sqlcode_token,
1822 p_token1_value => sqlcode,
1823 p_token2 => g_sqlerrm_token,
1824 p_token2_value => sqlerrm);
1825
1826 -- notify caller of an UNEXPECTED error
1827 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1828
1829 END Validate_Asset_Book_Type_Name;
1830
1831 -- Added by zrehman for SLA project (Bug 5707866) 20-Mar-2007 start
1832 ---------------------------------------------------------------------------
1833 -- PROCEDURE Validate_Tax_Line_Id
1834 ---------------------------------------------------------------------------
1835 -- Start of comments
1836 -- Procedure Name : Validate_Tax_Line_Id
1837 -- Description :
1838 -- Business Rules :
1839 -- Parameters :
1840 -- Version : 1.0
1841 -- End of comments
1842 ---------------------------------------------------------------------------
1843 PROCEDURE Validate_Tax_Line_Id(p_tclv_rec IN tclv_rec_type
1844 ,x_return_status OUT NOCOPY VARCHAR2)
1845 IS
1846
1847 l_found VARCHAR2(1);
1848 l_app_id NUMBER := 0;
1849 l_view_app_id NUMBER := 0;
1850
1851 CURSOR tax_line_id_csr(p_tax_line_id zx_lines.TAX_LINE_ID%TYPE) IS
1852 SELECT '1'
1853 FROM zx_lines
1854 WHERE TAX_LINE_ID = p_tax_line_id;
1855
1856 BEGIN
1857 -- initialize return status
1858 x_return_status := OKC_API.G_RET_STS_SUCCESS;
1859
1860 -- check for data before processing
1861 IF (p_tclv_rec.tax_line_id IS NOT NULL) AND
1862 (p_tclv_rec.tax_line_id <> OKC_API.G_MISS_NUM) THEN
1863
1864 OPEN tax_line_id_csr(p_tclv_rec.tax_line_id);
1865 FETCH tax_line_id_csr into l_found;
1866 CLOSE tax_line_id_csr;
1867
1868 IF l_found IS NULL THEN
1869 OKC_API.SET_MESSAGE(p_app_name => g_app_name
1870 ,p_msg_name => g_invalid_value
1871 ,p_token1 => g_col_name_token
1872 ,p_token1_value => 'tax_line_id');
1873 x_return_status := OKC_API.G_RET_STS_ERROR;
1874 RAISE G_EXCEPTION_HALT_VALIDATION;
1875 END IF;
1876
1877 END IF;
1878
1879
1880 EXCEPTION
1881 WHEN G_EXCEPTION_HALT_VALIDATION THEN
1882 -- no processing neccessary; validation can continue
1883 -- with the next column
1884 NULL;
1885
1886 WHEN OTHERS THEN
1887 -- store SQL error message on message stack for caller
1888 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
1889 p_msg_name => g_unexpected_error,
1890 p_token1 => g_sqlcode_token,
1891 p_token1_value => sqlcode,
1892 p_token2 => g_sqlerrm_token,
1893 p_token2_value => sqlerrm);
1894
1895 -- notify caller of an UNEXPECTED error
1896 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1897
1898 END Validate_Tax_Line_Id;
1899 -- Added by zrehman for SLA project (Bug 5707866) 20-Mar-2007 end
1900
1901 -- Added by nikshah for SLA project (Bug 5707866) 17-Apr-2007
1902 ---------------------------------------------------------------------------
1903 -- PROCEDURE Validate_Upgrade_Status_Flag
1904 ---------------------------------------------------------------------------
1905 -- Start of comments
1906 --
1907 -- Procedure Name : Validate_Upgrade_Status_Flag
1908 -- Description :
1909 -- Business Rules :
1910 -- Parameters :
1911 -- Version : 1.0
1912 -- End of comments
1913 ---------------------------------------------------------------------------
1914 PROCEDURE Validate_Upgrade_Status_Flag (p_tclv_rec IN tclv_rec_type, x_return_status OUT NOCOPY VARCHAR2)
1915 IS
1916
1917 l_return_status VARCHAR2(1) := Okc_Api.G_RET_STS_SUCCESS;
1918 l_dummy VARCHAR2(1) := OKC_API.G_FALSE;
1919
1920 BEGIN
1921 -- initialize return status
1922 x_return_status := Okc_Api.G_RET_STS_SUCCESS;
1923
1924 -- check for data before processing
1925 IF (p_tclv_rec.UPGRADE_STATUS_FLAG IS NOT NULL) AND
1926 (p_tclv_rec.UPGRADE_STATUS_FLAG <> Okc_Api.G_MISS_CHAR) THEN
1927 -- check in fnd_lookups for validity
1928 l_dummy := OKL_ACCOUNTING_UTIL.VALIDATE_LOOKUP_CODE
1929 (p_lookup_type => 'OKL_YES_NO',
1930 p_lookup_code => p_tclv_rec.UPGRADE_STATUS_FLAG);
1931
1932 IF (l_dummy = OKL_API.G_FALSE) THEN
1933 Okc_Api.SET_MESSAGE(p_app_name => g_app_name
1934 ,p_msg_name => g_invalid_value
1935 ,p_token1 => g_col_name_token
1936 ,p_token1_value => 'UPGRADE_STATUS_FLAG');
1937 x_return_status := Okc_Api.G_RET_STS_ERROR;
1938 RAISE G_EXCEPTION_HALT_VALIDATION;
1939 END IF;
1940
1941 END IF;
1942
1943
1944 EXCEPTION
1945 WHEN G_EXCEPTION_HALT_VALIDATION THEN
1946 -- no processing neccessary; validation can continue
1947 -- with the next column
1948 NULL;
1949
1950 WHEN OTHERS THEN
1951 -- store SQL error message on message stack for caller
1952 Okc_Api.SET_MESSAGE(p_app_name => g_app_name,
1953 p_msg_name => g_unexpected_error,
1954 p_token1 => g_sqlcode_token,
1955 p_token1_value => SQLCODE,
1956 p_token2 => g_sqlerrm_token,
1957 p_token2_value => SQLERRM);
1958
1959 -- notify caller of an UNEXPECTED error
1960 x_return_status := Okc_Api.G_RET_STS_UNEXP_ERROR;
1961
1962 END Validate_Upgrade_Status_Flag;
1963
1964
1965 ---------------------------------------------------------------------------
1966 -- FUNCTION Validate_Attributes
1967 ---------------------------------------------------------------------------
1968 -- Start of comments
1969 --
1970 -- Procedure Name : Validate_Attributes
1971 -- Description :
1972 -- Business Rules :
1973 -- Parameters :
1974 -- Version : 1.0
1975 -- End of comments
1976 ---------------------------------------------------------------------------
1977
1978 FUNCTION Validate_Attributes (
1979 p_tclv_rec IN tclv_rec_type
1980 ) RETURN VARCHAR2 IS
1981
1982 x_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1983 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1984 BEGIN
1985
1986 -- call each column-level validation
1987
1988 -- Validate_Id
1989 Validate_Id(p_tclv_rec, x_return_status);
1990 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
1991 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1992 -- need to exit
1993 l_return_status := x_return_status;
1994 RAISE G_EXCEPTION_HALT_VALIDATION;
1995 ELSE
1996 -- there was an error
1997 l_return_status := x_return_status;
1998 END IF;
1999 END IF;
2000
2001 -- Validate_Khr_Id
2002 Validate_Khr_Id(p_tclv_rec, x_return_status);
2003 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2004 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2005 -- need to exit
2006 l_return_status := x_return_status;
2007 RAISE G_EXCEPTION_HALT_VALIDATION;
2008 ELSE
2009 -- there was an error
2010 l_return_status := x_return_status;
2011 END IF;
2012 END IF;
2013
2014 -- Validate_Tcn_Id
2015 Validate_Tcn_Id(p_tclv_rec, x_return_status);
2016 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2017 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2018 -- need to exit
2019 l_return_status := x_return_status;
2020 RAISE G_EXCEPTION_HALT_VALIDATION;
2021 ELSE
2022 -- there was an error
2023 l_return_status := x_return_status;
2024 END IF;
2025 END IF;
2026
2027 -- Validate_Rct_Id
2028 Validate_Rct_Id(p_tclv_rec, x_return_status);
2029 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2030 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2031 -- need to exit
2032 l_return_status := x_return_status;
2033 RAISE G_EXCEPTION_HALT_VALIDATION;
2034 ELSE
2035 -- there was an error
2036 l_return_status := x_return_status;
2037 END IF;
2038 END IF;
2039
2040 -- Validate_Btc_Id
2041 Validate_Btc_Id(p_tclv_rec, x_return_status);
2042 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2043 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2044 -- need to exit
2045 l_return_status := x_return_status;
2046 RAISE G_EXCEPTION_HALT_VALIDATION;
2047 ELSE
2048 -- there was an error
2049 l_return_status := x_return_status;
2050 END IF;
2051 END IF;
2052
2053
2054 -- Validate_Sty_Id
2055 Validate_Sty_Id(p_tclv_rec, x_return_status);
2056 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2057 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2058 -- need to exit
2059 l_return_status := x_return_status;
2060 RAISE G_EXCEPTION_HALT_VALIDATION;
2061 ELSE
2062 -- there was an error
2063 l_return_status := x_return_status;
2064 END IF;
2065 END IF;
2066
2067 -- Validate_Line_Number
2068 Validate_Line_Number(p_tclv_rec, x_return_status);
2069 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2070 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2071 -- need to exit
2072 l_return_status := x_return_status;
2073 RAISE G_EXCEPTION_HALT_VALIDATION;
2074 ELSE
2075 -- there was an error
2076 l_return_status := x_return_status;
2077 END IF;
2078 END IF;
2079
2080 -- Validate_Object_Version_Number
2081 Validate_Object_Version_Number(p_tclv_rec, x_return_status);
2082 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2083 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2084 -- need to exit
2085 l_return_status := x_return_status;
2086 RAISE G_EXCEPTION_HALT_VALIDATION;
2087 ELSE
2088 -- there was an error
2089 l_return_status := x_return_status;
2090 END IF;
2091 END IF;
2092
2093 -- Validate_Object_Tcl_Type
2094 Validate_Tcl_Type(p_tclv_rec, x_return_status);
2095 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2096 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2097 -- need to exit
2098 l_return_status := x_return_status;
2099 RAISE G_EXCEPTION_HALT_VALIDATION;
2100 ELSE
2101 -- there was an error
2102 l_return_status := x_return_status;
2103 END IF;
2104 END IF;
2105
2106 -- Validate_GL_Reversal_YN
2107 Validate_GL_Reversal_YN(p_tclv_rec, x_return_status);
2108 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2109 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2110 -- need to exit
2111 l_return_status := x_return_status;
2112 RAISE G_EXCEPTION_HALT_VALIDATION;
2113 ELSE
2114 -- there was an error
2115 l_return_status := x_return_status;
2116 END IF;
2117 END IF;
2118
2119 -- Validate_Amount
2120 /* This validation Removed, since in some cases lines are created without Amount
2121 Amount may be plugged in later
2122 Validate_Amount(p_tclv_rec, x_return_status);
2123 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2124 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2125 -- need to exit
2126 l_return_status := x_return_status;
2127 RAISE G_EXCEPTION_HALT_VALIDATION;
2128 ELSE
2129 -- there was an error
2130 l_return_status := x_return_status;
2131 END IF;
2132 END IF;
2133 */
2134
2135 -- Validate_currency_code
2136 Validate_currency_code(p_tclv_rec, x_return_status);
2137 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2138 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2139 -- need to exit
2140 l_return_status := x_return_status;
2141 RAISE G_EXCEPTION_HALT_VALIDATION;
2142 ELSE
2143 -- there was an error
2144 l_return_status := x_return_status;
2145 END IF;
2146 END IF;
2147
2148 -- Validate_avl_id
2149 Validate_avl_id(p_tclv_rec, x_return_status);
2150 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2151 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2152 -- need to exit
2153 l_return_status := x_return_status;
2154 RAISE G_EXCEPTION_HALT_VALIDATION;
2155 ELSE
2156 -- there was an error
2157 l_return_status := x_return_status;
2158 END IF;
2159 END IF;
2160
2161 -- Validate_bkt_id
2162 Validate_bkt_id(p_tclv_rec, x_return_status);
2163 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2164 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2165 -- need to exit
2166 l_return_status := x_return_status;
2167 RAISE G_EXCEPTION_HALT_VALIDATION;
2168 ELSE
2169 -- there was an error
2170 l_return_status := x_return_status;
2171 END IF;
2172 END IF;
2173
2174 -- Validate_Kle_Id_New
2175 -- Added by Santonyr Bug : 2305542
2176 Validate_Kle_Id_New(p_tclv_rec, x_return_status);
2177 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2178 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2179 -- need to exit
2180 l_return_status := x_return_status;
2181 RAISE G_EXCEPTION_HALT_VALIDATION;
2182 ELSE
2183 -- there was an error
2184 l_return_status := x_return_status;
2185 END IF;
2186 END IF;
2187
2188 -- Validate_Percentage
2189 -- Added by Santonyr Bug : 2305542
2190 Validate_Percentage(p_tclv_rec, x_return_status);
2191 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2192 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2193 -- need to exit
2194 l_return_status := x_return_status;
2195 RAISE G_EXCEPTION_HALT_VALIDATION;
2196 ELSE
2197 -- there was an error
2198 l_return_status := x_return_status;
2199 END IF;
2200 END IF;
2201
2202 -- Validate_Accrual_Rule_YN
2203 Validate_Accrual_Rule_YN(p_tclv_rec, x_return_status);
2204 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2205 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2206 -- need to exit
2207 l_return_status := x_return_status;
2208 RAISE G_EXCEPTION_HALT_VALIDATION;
2209 ELSE
2210 -- there was an error
2211 l_return_status := x_return_status;
2212 END IF;
2213 END IF;
2214
2215 -- Added by zrehman for SLA project (Bug 5707866) 16-Feb-2007
2216 Validate_Asset_Book_Type_Name(p_tclv_rec, x_return_status);
2217 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2218 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2219 -- need to exit
2220 l_return_status := x_return_status;
2221 RAISE G_EXCEPTION_HALT_VALIDATION;
2222 ELSE
2223 -- there was an error
2224 l_return_status := x_return_status;
2225 END IF;
2226 END IF;
2227
2228 -- Added by zrehman for SLA project (Bug 5707866) 20-Mar-2007
2229 Validate_Tax_Line_Id(p_tclv_rec, x_return_status);
2230 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2231 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2232 -- need to exit
2233 l_return_status := x_return_status;
2234 RAISE G_EXCEPTION_HALT_VALIDATION;
2235 ELSE
2236 -- there was an error
2237 l_return_status := x_return_status;
2238 END IF;
2239 END IF;
2240 -- Added by nikshah for SLA project (Bug 5707866) 17-Apr-2007
2241 Validate_Upgrade_Status_Flag(p_tclv_rec, x_return_status);
2242 IF (x_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
2243 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2244 -- need to exit
2245 l_return_status := x_return_status;
2246 RAISE G_EXCEPTION_HALT_VALIDATION;
2247 ELSE
2248 -- there was an error
2249 l_return_status := x_return_status;
2250 END IF;
2251 END IF;
2252
2253
2254 RETURN(l_return_status);
2255 EXCEPTION
2256 WHEN G_EXCEPTION_HALT_VALIDATION THEN
2257 -- exit with return status
2258 NULL;
2259 RETURN (l_return_status);
2260
2261 WHEN OTHERS THEN
2262 -- store SQL error message on message stack for caller
2263 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
2264 p_msg_name => g_unexpected_error,
2265 p_token1 => g_sqlcode_token,
2266 p_token1_value => sqlcode,
2267 p_token2 => g_sqlerrm_token,
2268 p_token2_value => sqlerrm);
2269 -- notify caller of an UNEXPECTED error
2270 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2271 RETURN(l_return_status);
2272
2273 END Validate_Attributes;
2274
2275 ---------------------------------------------------------------------------
2276 -- PROCEDURE Validate_Record
2277 ---------------------------------------------------------------------------
2278 -- Start of comments
2279 --
2280 -- Procedure Name : Validate_Record
2281 -- Description :
2282 -- Business Rules :
2283 -- Parameters :
2284 -- Version : 1.0
2285 -- End of comments
2286 ---------------------------------------------------------------------------
2287
2288 FUNCTION Validate_Record (
2289 p_tclv_rec IN tclv_rec_type
2290 ) RETURN VARCHAR2 IS
2291 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2292 x_return_status VARCHAR2(1) := Okc_Api.G_RET_STS_SUCCESS;
2293 BEGIN
2294
2295 -- Added by santonyr on 11-Jun-2003 to fix bug 2999776
2296 -- Validate_Unique_Bkt_Record
2297 Validate_Unique_Tcl_Record(x_return_status, p_tclv_rec );
2298 -- store the highest degree of error
2299 IF (x_return_status <> Okc_Api.G_RET_STS_SUCCESS) THEN
2300 IF (x_return_status <> Okc_Api.G_RET_STS_UNEXP_ERROR) THEN
2301 -- need to leave
2302 l_return_status := x_return_status;
2303 RAISE G_EXCEPTION_HALT_VALIDATION;
2304 ELSE
2305 -- record that there was an error
2306 l_return_status := x_return_status;
2307 END IF;
2308 END IF;
2309
2310 RETURN(l_return_status);
2311 EXCEPTION
2312 WHEN G_EXCEPTION_HALT_VALIDATION THEN
2313 -- no processing necessary; validation can continue
2314 -- with the next column
2315 NULL;
2316 RETURN (l_return_status);
2317
2318 WHEN OTHERS THEN
2319 -- store SQL error message on message stack for caller
2320 OKC_API.SET_MESSAGE(p_app_name => g_app_name,
2321 p_msg_name => g_unexpected_error,
2322 p_token1 => g_sqlcode_token,
2323 p_token1_value => sqlcode,
2324 p_token2 => g_sqlerrm_token,
2325 p_token2_value => sqlerrm);
2326 -- notify caller of an UNEXPECTED error
2327 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2328 RETURN(l_return_status);
2329
2330 END Validate_Record;
2331
2332 /*********************** END MANUAL CODE **********************************/
2333
2334 ---------------------------------------------------------------------------
2335 -- PROCEDURE Migrate
2336 ---------------------------------------------------------------------------
2337 PROCEDURE migrate (
2338 p_from IN tclv_rec_type,
2339 p_to IN OUT NOCOPY tcl_rec_type
2340 ) IS
2341 BEGIN
2342 p_to.id := p_from.id;
2343 p_to.khr_id := p_from.khr_id;
2344 p_to.kle_id := p_from.kle_id;
2345 p_to.before_transfer_yn := p_from.before_transfer_yn;
2346 p_to.tcn_id := p_from.tcn_id;
2347 p_to.rct_id := p_from.rct_id;
2348 p_to.btc_id := p_from.btc_id;
2349 p_to.sty_id := p_from.sty_id;
2350 p_to.line_number := p_from.line_number;
2351 p_to.tcl_type := p_from.tcl_type;
2352 p_to.object_version_number := p_from.object_version_number;
2353 p_to.created_by := p_from.created_by;
2354 p_to.creation_date := p_from.creation_date;
2355 p_to.last_updated_by := p_from.last_updated_by;
2356 p_to.last_update_date := p_from.last_update_date;
2357 p_to.org_id := p_from.org_id;
2358 p_to.description := p_from.description;
2359 p_to.program_id := p_from.program_id;
2360 p_to.gl_reversal_yn := p_from.gl_reversal_yn;
2361 p_to.amount := p_from.amount;
2362 p_to.program_application_id := p_from.program_application_id;
2363 p_to.currency_code := p_from.currency_code;
2364 p_to.request_id := p_from.request_id;
2365 p_to.program_update_date := p_from.program_update_date;
2366 p_to.attribute_category := p_from.attribute_category;
2367 p_to.attribute1 := p_from.attribute1;
2368 p_to.attribute2 := p_from.attribute2;
2369 p_to.attribute3 := p_from.attribute3;
2370 p_to.attribute4 := p_from.attribute4;
2371 p_to.attribute5 := p_from.attribute5;
2372 p_to.attribute6 := p_from.attribute6;
2373 p_to.attribute7 := p_from.attribute7;
2374 p_to.attribute8 := p_from.attribute8;
2375 p_to.attribute9 := p_from.attribute9;
2376 p_to.attribute10 := p_from.attribute10;
2377 p_to.attribute11 := p_from.attribute11;
2378 p_to.attribute12 := p_from.attribute12;
2379 p_to.attribute13 := p_from.attribute13;
2380 p_to.attribute14 := p_from.attribute14;
2381 p_to.attribute15 := p_from.attribute15;
2382 p_to.last_update_login := p_from.last_update_login;
2383 p_to.avl_id := p_from.avl_id;
2384 p_to.bkt_id := p_from.bkt_id;
2385 p_to.kle_id_new := p_from.kle_id_new;
2386 p_to.percentage := p_from.percentage;
2387 p_to.accrual_rule_yn := p_from.accrual_rule_yn;
2388 --21 Oct 2004 PAGARG Bug# 3964726
2389 p_to.source_column_1 := p_from.source_column_1;
2390 p_to.source_value_1 := p_from.source_value_1;
2391 p_to.source_column_2 := p_from.source_column_2;
2392 p_to.source_value_2 := p_from.source_value_2;
2393 p_to.source_column_3 := p_from.source_column_3;
2394 p_to.source_value_3 := p_from.source_value_3;
2395 p_to.canceled_date := p_from.canceled_date;
2396 p_to.tax_line_id := p_from.tax_line_id;
2397 -- Added by zrehman for SLA project (Bug 5707866) 9-Feb-2007
2398 p_to.stream_type_code := p_from.stream_type_code;
2399 p_to.stream_type_purpose := p_from.stream_type_purpose;
2400 p_to.asset_book_type_name := p_from.asset_book_type_name;
2401 -- Added by nikshah for SLA project (Bug 5707866) 16-Apr-2007
2402 p_to.UPGRADE_STATUS_FLAG := p_from.UPGRADE_STATUS_FLAG;
2403 END migrate;
2404 PROCEDURE migrate (
2405 p_from IN tcl_rec_type,
2406 p_to IN OUT NOCOPY tclv_rec_type
2407 ) IS
2408 BEGIN
2409 p_to.id := p_from.id;
2410 p_to.khr_id := p_from.khr_id;
2411 p_to.kle_id := p_from.kle_id;
2412 p_to.before_transfer_yn := p_from.before_transfer_yn;
2413 p_to.tcn_id := p_from.tcn_id;
2414 p_to.rct_id := p_from.rct_id;
2415 p_to.btc_id := p_from.btc_id;
2416 p_to.sty_id := p_from.sty_id;
2417 p_to.line_number := p_from.line_number;
2418 p_to.tcl_type := p_from.tcl_type;
2419 p_to.object_version_number := p_from.object_version_number;
2420 p_to.created_by := p_from.created_by;
2421 p_to.creation_date := p_from.creation_date;
2422 p_to.last_updated_by := p_from.last_updated_by;
2423 p_to.last_update_date := p_from.last_update_date;
2424 p_to.org_id := p_from.org_id;
2425 p_to.description := p_from.description;
2426 p_to.program_id := p_from.program_id;
2427 p_to.gl_reversal_yn := p_from.gl_reversal_yn;
2428 p_to.amount := p_from.amount;
2429 p_to.program_application_id := p_from.program_application_id;
2430 p_to.currency_code := p_from.currency_code;
2431 p_to.request_id := p_from.request_id;
2432 p_to.program_update_date := p_from.program_update_date;
2433 p_to.attribute_category := p_from.attribute_category;
2434 p_to.attribute1 := p_from.attribute1;
2435 p_to.attribute2 := p_from.attribute2;
2436 p_to.attribute3 := p_from.attribute3;
2437 p_to.attribute4 := p_from.attribute4;
2438 p_to.attribute5 := p_from.attribute5;
2439 p_to.attribute6 := p_from.attribute6;
2440 p_to.attribute7 := p_from.attribute7;
2441 p_to.attribute8 := p_from.attribute8;
2442 p_to.attribute9 := p_from.attribute9;
2443 p_to.attribute10 := p_from.attribute10;
2444 p_to.attribute11 := p_from.attribute11;
2445 p_to.attribute12 := p_from.attribute12;
2446 p_to.attribute13 := p_from.attribute13;
2447 p_to.attribute14 := p_from.attribute14;
2448 p_to.attribute15 := p_from.attribute15;
2449 p_to.last_update_login := p_from.last_update_login;
2450 p_to.avl_id := p_from.avl_id;
2451 p_to.bkt_id := p_from.bkt_id;
2452 p_to.kle_id_new := p_from.kle_id_new;
2453 p_to.percentage := p_from.percentage;
2454 p_to.accrual_rule_yn := p_from.accrual_rule_yn;
2455 --21 Oct 2004 PAGARG Bug# 3964726
2456 p_to.source_column_1 := p_from.source_column_1;
2457 p_to.source_value_1 := p_from.source_value_1;
2458 p_to.source_column_2 := p_from.source_column_2;
2459 p_to.source_value_2 := p_from.source_value_2;
2460 p_to.source_column_3 := p_from.source_column_3;
2461 p_to.source_value_3 := p_from.source_value_3;
2462 p_to.canceled_date := p_from.canceled_date;
2463 p_to.tax_line_id := p_from.tax_line_id;
2464 -- Added by zrehman for SLA project (Bug 5707866) 8-Feb-2007
2465 p_to.stream_type_code := p_from.stream_type_code;
2466 p_to.stream_type_purpose := p_from.stream_type_purpose;
2467 p_to.asset_book_type_name := p_from.asset_book_type_name;
2468 -- Added by nikshah for SLA project (Bug 5707866) 16-Apr-2007
2469 p_to.UPGRADE_STATUS_FLAG := p_from.UPGRADE_STATUS_FLAG;
2470 END migrate;
2471
2472 ---------------------------------------------------------------------------
2473 -- PROCEDURE validate_row
2474 ---------------------------------------------------------------------------
2475 -------------------------------------------
2476 -- validate_row for:OKL_TXL_CNTRCT_LNS_V --
2477 -------------------------------------------
2478 PROCEDURE validate_row(
2479 p_api_version IN NUMBER,
2480 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2481 x_return_status OUT NOCOPY VARCHAR2,
2482 x_msg_count OUT NOCOPY NUMBER,
2483 x_msg_data OUT NOCOPY VARCHAR2,
2484 p_tclv_rec IN tclv_rec_type) IS
2485
2486 l_api_version CONSTANT NUMBER := 1;
2487 l_api_name CONSTANT VARCHAR2(30) := 'V_validate_row';
2488 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2489 l_tclv_rec tclv_rec_type := p_tclv_rec;
2490 l_tcl_rec tcl_rec_type;
2491 BEGIN
2492 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2493 G_PKG_NAME,
2494 p_init_msg_list,
2495 l_api_version,
2496 p_api_version,
2497 '_PVT',
2498 x_return_status);
2499 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2500 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2501 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2502 RAISE OKC_API.G_EXCEPTION_ERROR;
2503 END IF;
2504 --- Validate all non-missing attributes (Item Level Validation)
2505 l_return_status := Validate_Attributes(l_tclv_rec);
2506 --- If any errors happen abort API
2507 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2508 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2509 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2510 RAISE OKC_API.G_EXCEPTION_ERROR;
2511 END IF;
2512 l_return_status := Validate_Record(l_tclv_rec);
2513 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2514 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2515 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2516 RAISE OKC_API.G_EXCEPTION_ERROR;
2517 END IF;
2518 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2519 EXCEPTION
2520 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2521 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2522 (
2523 l_api_name,
2524 G_PKG_NAME,
2525 'OKC_API.G_RET_STS_ERROR',
2526 x_msg_count,
2527 x_msg_data,
2528 '_PVT'
2529 );
2530 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2531 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2532 (
2533 l_api_name,
2534 G_PKG_NAME,
2535 'OKC_API.G_RET_STS_UNEXP_ERROR',
2536 x_msg_count,
2537 x_msg_data,
2538 '_PVT'
2539 );
2540 WHEN OTHERS THEN
2541 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2542 (
2543 l_api_name,
2544 G_PKG_NAME,
2545 'OTHERS',
2546 x_msg_count,
2547 x_msg_data,
2548 '_PVT'
2549 );
2550 END validate_row;
2551 ------------------------------------------
2552 -- PL/SQL TBL validate_row for:TCLV_TBL --
2553 ------------------------------------------
2554 PROCEDURE validate_row(
2555 p_api_version IN NUMBER,
2556 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2557 x_return_status OUT NOCOPY VARCHAR2,
2558 x_msg_count OUT NOCOPY NUMBER,
2559 x_msg_data OUT NOCOPY VARCHAR2,
2560 p_tclv_tbl IN tclv_tbl_type) IS
2561
2562 l_api_version CONSTANT NUMBER := 1;
2563 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_validate_row';
2564 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2565 i NUMBER := 0;
2566 l_overall_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2567
2568 BEGIN
2569 OKC_API.init_msg_list(p_init_msg_list);
2570 -- Make sure PL/SQL table has records in it before passing
2571 IF (p_tclv_tbl.COUNT > 0) THEN
2572 i := p_tclv_tbl.FIRST;
2573 LOOP
2574 validate_row (
2575 p_api_version => p_api_version,
2576 p_init_msg_list => OKC_API.G_FALSE,
2577 x_return_status => x_return_status,
2578 x_msg_count => x_msg_count,
2579 x_msg_data => x_msg_data,
2580 p_tclv_rec => p_tclv_tbl(i));
2581
2582 -- store the highest degree of error
2583 IF x_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
2584 IF l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR THEN
2585 l_overall_status := x_return_status;
2586 END IF;
2587 END IF;
2588
2589 EXIT WHEN (i = p_tclv_tbl.LAST);
2590 i := p_tclv_tbl.NEXT(i);
2591 END LOOP;
2592 -- return overall status
2593 x_return_status := l_overall_status;
2594
2595 END IF;
2596 EXCEPTION
2597 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2598 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2599 (
2600 l_api_name,
2601 G_PKG_NAME,
2602 'OKC_API.G_RET_STS_ERROR',
2603 x_msg_count,
2604 x_msg_data,
2605 '_PVT'
2606 );
2607 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2608 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2609 (
2610 l_api_name,
2611 G_PKG_NAME,
2612 'OKC_API.G_RET_STS_UNEXP_ERROR',
2613 x_msg_count,
2614 x_msg_data,
2615 '_PVT'
2616 );
2617 WHEN OTHERS THEN
2618 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2619 (
2620 l_api_name,
2621 G_PKG_NAME,
2622 'OTHERS',
2623 x_msg_count,
2624 x_msg_data,
2625 '_PVT'
2626 );
2627 END validate_row;
2628
2629 ---------------------------------------------------------------------------
2630 -- PROCEDURE insert_row
2631 ---------------------------------------------------------------------------
2632 ---------------------------------------
2633 -- insert_row for:OKL_TXL_CNTRCT_LNS --
2634 ---------------------------------------
2635 PROCEDURE insert_row(
2636 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2637 x_return_status OUT NOCOPY VARCHAR2,
2638 x_msg_count OUT NOCOPY NUMBER,
2639 x_msg_data OUT NOCOPY VARCHAR2,
2640 p_tcl_rec IN tcl_rec_type,
2641 x_tcl_rec OUT NOCOPY tcl_rec_type) IS
2642
2643 l_api_version CONSTANT NUMBER := 1;
2644 l_api_name CONSTANT VARCHAR2(30) := 'LNS_insert_row';
2645 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2646 l_tcl_rec tcl_rec_type := p_tcl_rec;
2647 l_def_tcl_rec tcl_rec_type;
2648 -------------------------------------------
2649 -- Set_Attributes for:OKL_TXL_CNTRCT_LNS --
2650 -------------------------------------------
2651 FUNCTION Set_Attributes (
2652 p_tcl_rec IN tcl_rec_type,
2653 x_tcl_rec OUT NOCOPY tcl_rec_type
2654 ) RETURN VARCHAR2 IS
2655 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2656 BEGIN
2657 x_tcl_rec := p_tcl_rec;
2658 RETURN(l_return_status);
2659 END Set_Attributes;
2660 BEGIN
2661 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2662 p_init_msg_list,
2663 '_PVT',
2664 x_return_status);
2665 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2666 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2667 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2668 RAISE OKC_API.G_EXCEPTION_ERROR;
2669 END IF;
2670 --- Setting item attributes
2671 l_return_status := Set_Attributes(
2672 p_tcl_rec, -- IN
2673 l_tcl_rec); -- OUT
2674 --- If any errors happen abort API
2675 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2676 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2677 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2678 RAISE OKC_API.G_EXCEPTION_ERROR;
2679 END IF;
2680 INSERT INTO OKL_TXL_CNTRCT_LNS(
2681 id,
2682 khr_id,
2683 kle_id,
2684 before_transfer_yn,
2685 tcn_id,
2686 rct_id,
2687 btc_id,
2688 sty_id,
2689 line_number,
2690 tcl_type,
2691 object_version_number,
2692 created_by,
2693 creation_date,
2694 last_updated_by,
2695 last_update_date,
2696 org_id,
2697 description,
2698 program_id,
2699 gl_reversal_yn,
2700 amount,
2701 program_application_id,
2702 currency_code,
2703 request_id,
2704 program_update_date,
2705 attribute_category,
2706 attribute1,
2707 attribute2,
2708 attribute3,
2709 attribute4,
2710 attribute5,
2711 attribute6,
2712 attribute7,
2713 attribute8,
2714 attribute9,
2715 attribute10,
2716 attribute11,
2717 attribute12,
2718 attribute13,
2719 attribute14,
2720 attribute15,
2721 last_update_login,
2722 avl_id,
2723 bkt_id,
2724 kle_id_new,
2725 percentage,
2726 accrual_rule_yn,
2727 --21 Oct 2004 PAGARG Bug# 3964726
2728 source_column_1,
2729 source_value_1,
2730 source_column_2,
2731 source_value_2,
2732 source_column_3,
2733 source_value_3,
2734 canceled_date,
2735 tax_line_id,
2736 -- Added by zrehman for SLA project (Bug 5707866) 9-Feb-2007
2737 stream_type_code,
2738 stream_type_purpose,
2739 asset_book_type_name,
2740 -- Added by nikshah for SLA project (Bug 5707866) 13-Apr-2007
2741 UPGRADE_STATUS_FLAG)
2742 VALUES (
2743 l_tcl_rec.id,
2744 l_tcl_rec.khr_id,
2745 l_tcl_rec.kle_id,
2746 l_tcl_rec.before_transfer_yn,
2747 l_tcl_rec.tcn_id,
2748 l_tcl_rec.rct_id,
2749 l_tcl_rec.btc_id,
2750 l_tcl_rec.sty_id,
2751 l_tcl_rec.line_number,
2752 l_tcl_rec.tcl_type,
2753 l_tcl_rec.object_version_number,
2754 l_tcl_rec.created_by,
2755 l_tcl_rec.creation_date,
2756 l_tcl_rec.last_updated_by,
2757 l_tcl_rec.last_update_date,
2758 l_tcl_rec.org_id,
2759 l_tcl_rec.description,
2760 l_tcl_rec.program_id,
2761 l_tcl_rec.gl_reversal_yn,
2762 l_tcl_rec.amount,
2763 l_tcl_rec.program_application_id,
2764 l_tcl_rec.currency_code,
2765 l_tcl_rec.request_id,
2766 l_tcl_rec.program_update_date,
2767 l_tcl_rec.attribute_category,
2768 l_tcl_rec.attribute1,
2769 l_tcl_rec.attribute2,
2770 l_tcl_rec.attribute3,
2771 l_tcl_rec.attribute4,
2772 l_tcl_rec.attribute5,
2773 l_tcl_rec.attribute6,
2774 l_tcl_rec.attribute7,
2775 l_tcl_rec.attribute8,
2776 l_tcl_rec.attribute9,
2777 l_tcl_rec.attribute10,
2778 l_tcl_rec.attribute11,
2779 l_tcl_rec.attribute12,
2780 l_tcl_rec.attribute13,
2781 l_tcl_rec.attribute14,
2782 l_tcl_rec.attribute15,
2783 l_tcl_rec.last_update_login,
2784 l_tcl_rec.avl_id,
2785 l_tcl_rec.bkt_id,
2786 l_tcl_rec.kle_id_new,
2787 l_tcl_rec.percentage,
2788 l_tcl_rec.accrual_rule_yn,
2789 --21 Oct 2004 PAGARG Bug# 3964726
2790 l_tcl_rec.source_column_1,
2791 l_tcl_rec.source_value_1,
2792 l_tcl_rec.source_column_2,
2793 l_tcl_rec.source_value_2,
2794 l_tcl_rec.source_column_3,
2795 l_tcl_rec.source_value_3,
2796 l_tcl_rec.canceled_date,
2797 l_tcl_rec.tax_line_id,
2798 -- Added by zrehman for SLA project (Bug 5707866) 9-Feb-2007
2799 l_tcl_rec.stream_type_code,
2800 l_tcl_rec.stream_type_purpose,
2801 l_tcl_rec.asset_book_type_name,
2802 -- Added by nikshah for SLA project (Bug 5707866) 13-Apr-2007
2803 l_tcl_rec.UPGRADE_STATUS_FLAG);
2804 -- Set OUT values
2805 x_tcl_rec := l_tcl_rec;
2806 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2807 EXCEPTION
2808 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2809 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2810 (
2811 l_api_name,
2812 G_PKG_NAME,
2813 'OKC_API.G_RET_STS_ERROR',
2814 x_msg_count,
2815 x_msg_data,
2816 '_PVT'
2817 );
2818 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2819 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2820 (
2821 l_api_name,
2822 G_PKG_NAME,
2823 'OKC_API.G_RET_STS_UNEXP_ERROR',
2824 x_msg_count,
2825 x_msg_data,
2826 '_PVT'
2827 );
2828 WHEN OTHERS THEN
2829 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2830 (
2831 l_api_name,
2832 G_PKG_NAME,
2833 'OTHERS',
2834 x_msg_count,
2835 x_msg_data,
2836 '_PVT'
2837 );
2838 END insert_row;
2839 -----------------------------------------
2840 -- insert_row for:OKL_TXL_CNTRCT_LNS_V --
2841 -----------------------------------------
2842 PROCEDURE insert_row(
2843 p_api_version IN NUMBER,
2844 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
2845 x_return_status OUT NOCOPY VARCHAR2,
2846 x_msg_count OUT NOCOPY NUMBER,
2847 x_msg_data OUT NOCOPY VARCHAR2,
2848 p_tclv_rec IN tclv_rec_type,
2849 x_tclv_rec OUT NOCOPY tclv_rec_type) IS
2850
2851 l_api_version CONSTANT NUMBER := 1;
2852 l_api_name CONSTANT VARCHAR2(30) := 'V_insert_row';
2853 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2854 l_tclv_rec tclv_rec_type;
2855 l_def_tclv_rec tclv_rec_type;
2856 l_tcl_rec tcl_rec_type;
2857 lx_tcl_rec tcl_rec_type;
2858 -------------------------------
2859 -- FUNCTION fill_who_columns --
2860 -------------------------------
2861 FUNCTION fill_who_columns (
2862 p_tclv_rec IN tclv_rec_type
2863 ) RETURN tclv_rec_type IS
2864 l_tclv_rec tclv_rec_type := p_tclv_rec;
2865 BEGIN
2866 l_tclv_rec.CREATION_DATE := SYSDATE;
2867 l_tclv_rec.CREATED_BY := FND_GLOBAL.USER_ID;
2868 l_tclv_rec.LAST_UPDATE_DATE := SYSDATE;
2869 l_tclv_rec.LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
2870 l_tclv_rec.LAST_UPDATE_LOGIN := FND_GLOBAL.LOGIN_ID;
2871 RETURN(l_tclv_rec);
2872 END fill_who_columns;
2873 ---------------------------------------------
2874 -- Set_Attributes for:OKL_TXL_CNTRCT_LNS_V --
2875 ---------------------------------------------
2876 FUNCTION Set_Attributes (
2877 p_tclv_rec IN tclv_rec_type,
2878 x_tclv_rec OUT NOCOPY tclv_rec_type
2879 ) RETURN VARCHAR2 IS
2880 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2881 l_request_id NUMBER := Fnd_Global.CONC_REQUEST_ID;
2882 l_prog_app_id NUMBER := Fnd_Global.PROG_APPL_ID;
2883 l_program_id NUMBER := Fnd_Global.CONC_PROGRAM_ID;
2884
2885
2886 -- Added by Santonyr on 25-Nov-2002
2887 -- Cursor to fetch the currency code of a transaction
2888
2889 CURSOR trx_curr_csr (l_id NUMBER) IS
2890 SELECT currency_code
2891 FROM okl_trx_contracts
2892 WHERE id = l_id;
2893
2894 BEGIN
2895 x_tclv_rec := p_tclv_rec;
2896 x_tclv_rec.OBJECT_VERSION_NUMBER := 1;
2897
2898 x_tclv_rec.ORG_ID := MO_GLOBAL.GET_CURRENT_ORG_ID();
2899
2900 SELECT DECODE(l_request_id, -1, NULL, l_request_id),
2901 DECODE(l_prog_app_id, -1, NULL, l_prog_app_id),
2902 DECODE(Fnd_Global.CONC_PROGRAM_ID, -1, NULL, Fnd_Global.CONC_PROGRAM_ID),
2903 DECODE(l_request_id, -1, NULL, SYSDATE)
2904 INTO x_tclv_rec.REQUEST_ID
2905 ,x_tclv_rec.PROGRAM_APPLICATION_ID
2906 ,x_tclv_rec.PROGRAM_ID
2907 ,x_tclv_rec.PROGRAM_UPDATE_DATE
2908 FROM DUAL;
2909
2910 -- Commented out by Santonyr on 25-Nov-2002
2911 -- Multi-Currency Changes - The currency code of the transaction line will
2912 -- be the currency code of the transaction.
2913
2914 /*
2915 IF (x_tclv_rec.currency_code IS NULL) OR
2916 (x_tclv_rec.currency_code = OKL_API.G_MISS_CHAR) THEN
2917 x_tclv_rec.currency_code := OKL_ACCOUNTING_UTIL.GET_FUNC_CURR_CODE;
2918 END IF;
2919 */
2920
2921 -- Added by Santonyr on 25-Nov-2002
2922 -- If the passed currency code is null get the code from contract transactions
2923
2924 IF (x_tclv_rec.currency_code IS NULL) OR (x_tclv_rec.currency_code = OKL_API.G_MISS_CHAR) THEN
2925 FOR trx_curr_rec IN trx_curr_csr (p_tclv_rec.tcn_id) LOOP
2926 x_tclv_rec.currency_code := trx_curr_rec.currency_code;
2927 END LOOP;
2928 END IF;
2929 -- Added by nikshah for SLA project (Bug 5707866) 17-Apr-2007
2930 x_tclv_rec.UPGRADE_STATUS_FLAG := 'N';
2931 RETURN(l_return_status);
2932 END Set_Attributes;
2933 BEGIN
2934 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2935 G_PKG_NAME,
2936 p_init_msg_list,
2937 l_api_version,
2938 p_api_version,
2939 '_PVT',
2940 x_return_status);
2941 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2942 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2943 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2944 RAISE OKC_API.G_EXCEPTION_ERROR;
2945 END IF;
2946 l_tclv_rec := null_out_defaults(p_tclv_rec);
2947 -- Set primary key value
2948 l_tclv_rec.ID := get_seq_id;
2949 --- Setting item attributes
2950 l_return_status := Set_Attributes(
2951 l_tclv_rec, -- IN
2952 l_def_tclv_rec); -- OUT
2953 --- If any errors happen abort API
2954 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2955 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2956 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2957 RAISE OKC_API.G_EXCEPTION_ERROR;
2958 END IF;
2959 l_def_tclv_rec := fill_who_columns(l_def_tclv_rec);
2960 --- Validate all non-missing attributes (Item Level Validation)
2961 l_return_status := Validate_Attributes(l_def_tclv_rec);
2962 --- If any errors happen abort API
2963 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2964 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2965 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2966 RAISE OKC_API.G_EXCEPTION_ERROR;
2967 END IF;
2968 l_return_status := Validate_Record(l_def_tclv_rec);
2969 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2970 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2971 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2972 RAISE OKC_API.G_EXCEPTION_ERROR;
2973 END IF;
2974 --------------------------------------
2975 -- Move VIEW record to "Child" records
2976 --------------------------------------
2977 migrate(l_def_tclv_rec, l_tcl_rec);
2978 --------------------------------------------
2979 -- Call the INSERT_ROW for each child record
2980 --------------------------------------------
2981 insert_row(
2982 p_init_msg_list,
2983 x_return_status,
2984 x_msg_count,
2985 x_msg_data,
2986 l_tcl_rec,
2987 lx_tcl_rec
2988 );
2989 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2990 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2991 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
2992 RAISE OKC_API.G_EXCEPTION_ERROR;
2993 END IF;
2994 migrate(lx_tcl_rec, l_def_tclv_rec);
2995 -- Set OUT values
2996 x_tclv_rec := l_def_tclv_rec;
2997 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2998 EXCEPTION
2999 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3000 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3001 (
3002 l_api_name,
3003 G_PKG_NAME,
3004 'OKC_API.G_RET_STS_ERROR',
3005 x_msg_count,
3006 x_msg_data,
3007 '_PVT'
3008 );
3009 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3010 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3011 (
3012 l_api_name,
3013 G_PKG_NAME,
3014 'OKC_API.G_RET_STS_UNEXP_ERROR',
3015 x_msg_count,
3016 x_msg_data,
3017 '_PVT'
3018 );
3019 WHEN OTHERS THEN
3020 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3021 (
3022 l_api_name,
3023 G_PKG_NAME,
3024 'OTHERS',
3025 x_msg_count,
3026 x_msg_data,
3027 '_PVT'
3028 );
3029 END insert_row;
3030 ----------------------------------------
3031 -- PL/SQL TBL insert_row for:TCLV_TBL --
3032 ----------------------------------------
3033 PROCEDURE insert_row(
3034 p_api_version IN NUMBER,
3035 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3036 x_return_status OUT NOCOPY VARCHAR2,
3037 x_msg_count OUT NOCOPY NUMBER,
3038 x_msg_data OUT NOCOPY VARCHAR2,
3039 p_tclv_tbl IN tclv_tbl_type,
3040 x_tclv_tbl OUT NOCOPY tclv_tbl_type) IS
3041
3042 l_api_version CONSTANT NUMBER := 1;
3043 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_insert_row';
3044 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3045 i NUMBER := 0;
3046 l_overall_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3047
3048 BEGIN
3049 OKC_API.init_msg_list(p_init_msg_list);
3050 -- Make sure PL/SQL table has records in it before passing
3051 IF (p_tclv_tbl.COUNT > 0) THEN
3052 i := p_tclv_tbl.FIRST;
3053 LOOP
3054 insert_row (
3055 p_api_version => p_api_version,
3056 p_init_msg_list => OKC_API.G_FALSE,
3057 x_return_status => x_return_status,
3058 x_msg_count => x_msg_count,
3059 x_msg_data => x_msg_data,
3060 p_tclv_rec => p_tclv_tbl(i),
3061 x_tclv_rec => x_tclv_tbl(i));
3062
3063 -- store the highest degree of error
3064 IF x_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
3065 IF l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR THEN
3066 l_overall_status := x_return_status;
3067 END IF;
3068 END IF;
3069
3070 EXIT WHEN (i = p_tclv_tbl.LAST);
3071 i := p_tclv_tbl.NEXT(i);
3072 END LOOP;
3073 -- return overall status
3074 x_return_status := l_overall_status;
3075
3076 END IF;
3077 EXCEPTION
3078 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3079 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3080 (
3081 l_api_name,
3082 G_PKG_NAME,
3083 'OKC_API.G_RET_STS_ERROR',
3084 x_msg_count,
3085 x_msg_data,
3086 '_PVT'
3087 );
3088 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3089 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3090 (
3091 l_api_name,
3092 G_PKG_NAME,
3093 'OKC_API.G_RET_STS_UNEXP_ERROR',
3094 x_msg_count,
3095 x_msg_data,
3096 '_PVT'
3097 );
3098 WHEN OTHERS THEN
3099 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3100 (
3101 l_api_name,
3102 G_PKG_NAME,
3103 'OTHERS',
3104 x_msg_count,
3105 x_msg_data,
3106 '_PVT'
3107 );
3108 END insert_row;
3109
3110 ---------------------------------------------------------------------------
3111 -- PROCEDURE lock_row
3112 ---------------------------------------------------------------------------
3113 -------------------------------------
3114 -- lock_row for:OKL_TXL_CNTRCT_LNS --
3115 -------------------------------------
3116 PROCEDURE lock_row(
3117 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3118 x_return_status OUT NOCOPY VARCHAR2,
3119 x_msg_count OUT NOCOPY NUMBER,
3120 x_msg_data OUT NOCOPY VARCHAR2,
3121 p_tcl_rec IN tcl_rec_type) IS
3122
3123 E_Resource_Busy EXCEPTION;
3124 PRAGMA EXCEPTION_INIT(E_Resource_Busy, -00054);
3125 CURSOR lock_csr (p_tcl_rec IN tcl_rec_type) IS
3126 SELECT OBJECT_VERSION_NUMBER
3127 FROM OKL_TXL_CNTRCT_LNS
3128 WHERE ID = p_tcl_rec.id
3129 AND OBJECT_VERSION_NUMBER = p_tcl_rec.object_version_number
3130 FOR UPDATE OF OBJECT_VERSION_NUMBER NOWAIT;
3131
3132 CURSOR lchk_csr (p_tcl_rec IN tcl_rec_type) IS
3133 SELECT OBJECT_VERSION_NUMBER
3134 FROM OKL_TXL_CNTRCT_LNS
3135 WHERE ID = p_tcl_rec.id;
3136 l_api_version CONSTANT NUMBER := 1;
3137 l_api_name CONSTANT VARCHAR2(30) := 'LNS_lock_row';
3138 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3139 l_object_version_number OKL_TXL_CNTRCT_LNS.OBJECT_VERSION_NUMBER%TYPE;
3140 lc_object_version_number OKL_TXL_CNTRCT_LNS.OBJECT_VERSION_NUMBER%TYPE;
3141 l_row_notfound BOOLEAN := FALSE;
3142 lc_row_notfound BOOLEAN := FALSE;
3143 BEGIN
3144 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3145 p_init_msg_list,
3146 '_PVT',
3147 x_return_status);
3148 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3149 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3150 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3151 RAISE OKC_API.G_EXCEPTION_ERROR;
3152 END IF;
3153 BEGIN
3154 OPEN lock_csr(p_tcl_rec);
3155 FETCH lock_csr INTO l_object_version_number;
3156 l_row_notfound := lock_csr%NOTFOUND;
3157 CLOSE lock_csr;
3158 EXCEPTION
3159 WHEN E_Resource_Busy THEN
3160 IF (lock_csr%ISOPEN) THEN
3161 CLOSE lock_csr;
3162 END IF;
3163 OKC_API.set_message(G_FND_APP,G_FORM_UNABLE_TO_RESERVE_REC);
3164 RAISE APP_EXCEPTIONS.RECORD_LOCK_EXCEPTION;
3165 END;
3166
3167 IF ( l_row_notfound ) THEN
3168 OPEN lchk_csr(p_tcl_rec);
3169 FETCH lchk_csr INTO lc_object_version_number;
3170 lc_row_notfound := lchk_csr%NOTFOUND;
3171 CLOSE lchk_csr;
3172 END IF;
3173 IF (lc_row_notfound) THEN
3174 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_DELETED);
3175 RAISE OKC_API.G_EXCEPTION_ERROR;
3176 ELSIF lc_object_version_number > p_tcl_rec.object_version_number THEN
3177 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
3178 RAISE OKC_API.G_EXCEPTION_ERROR;
3179 ELSIF lc_object_version_number <> p_tcl_rec.object_version_number THEN
3180 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
3181 RAISE OKC_API.G_EXCEPTION_ERROR;
3182 ELSIF lc_object_version_number = -1 THEN
3183 OKC_API.set_message(G_APP_NAME,G_RECORD_LOGICALLY_DELETED);
3184 RAISE OKC_API.G_EXCEPTION_ERROR;
3185 END IF;
3186 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3187 EXCEPTION
3188 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3189 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3190 (
3191 l_api_name,
3192 G_PKG_NAME,
3193 'OKC_API.G_RET_STS_ERROR',
3194 x_msg_count,
3195 x_msg_data,
3196 '_PVT'
3197 );
3198 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3199 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3200 (
3201 l_api_name,
3202 G_PKG_NAME,
3203 'OKC_API.G_RET_STS_UNEXP_ERROR',
3204 x_msg_count,
3205 x_msg_data,
3206 '_PVT'
3207 );
3208 WHEN OTHERS THEN
3209 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3210 (
3211 l_api_name,
3212 G_PKG_NAME,
3213 'OTHERS',
3214 x_msg_count,
3215 x_msg_data,
3216 '_PVT'
3217 );
3218 END lock_row;
3219 ---------------------------------------
3220 -- lock_row for:OKL_TXL_CNTRCT_LNS_V --
3221 ---------------------------------------
3222 PROCEDURE lock_row(
3223 p_api_version IN NUMBER,
3224 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3225 x_return_status OUT NOCOPY VARCHAR2,
3226 x_msg_count OUT NOCOPY NUMBER,
3227 x_msg_data OUT NOCOPY VARCHAR2,
3228 p_tclv_rec IN tclv_rec_type) IS
3229
3230 l_api_version CONSTANT NUMBER := 1;
3231 l_api_name CONSTANT VARCHAR2(30) := 'V_lock_row';
3232 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3233 l_tcl_rec tcl_rec_type;
3234 BEGIN
3235 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3236 G_PKG_NAME,
3237 p_init_msg_list,
3238 l_api_version,
3239 p_api_version,
3240 '_PVT',
3241 x_return_status);
3242 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3243 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3244 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3245 RAISE OKC_API.G_EXCEPTION_ERROR;
3246 END IF;
3247 --------------------------------------
3248 -- Move VIEW record to "Child" records
3249 --------------------------------------
3250 migrate(p_tclv_rec, l_tcl_rec);
3251 --------------------------------------------
3252 -- Call the LOCK_ROW for each child record
3253 --------------------------------------------
3254 lock_row(
3255 p_init_msg_list,
3256 x_return_status,
3257 x_msg_count,
3258 x_msg_data,
3259 l_tcl_rec
3260 );
3261 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3262 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3263 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
3264 RAISE OKC_API.G_EXCEPTION_ERROR;
3265 END IF;
3266 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3267 EXCEPTION
3268 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3269 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3270 (
3271 l_api_name,
3272 G_PKG_NAME,
3273 'OKC_API.G_RET_STS_ERROR',
3274 x_msg_count,
3275 x_msg_data,
3276 '_PVT'
3277 );
3278 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3279 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3280 (
3281 l_api_name,
3282 G_PKG_NAME,
3283 'OKC_API.G_RET_STS_UNEXP_ERROR',
3284 x_msg_count,
3285 x_msg_data,
3286 '_PVT'
3287 );
3288 WHEN OTHERS THEN
3289 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3290 (
3291 l_api_name,
3292 G_PKG_NAME,
3293 'OTHERS',
3294 x_msg_count,
3295 x_msg_data,
3296 '_PVT'
3297 );
3298 END lock_row;
3299 --------------------------------------
3300 -- PL/SQL TBL lock_row for:TCLV_TBL --
3301 --------------------------------------
3302 PROCEDURE lock_row(
3303 p_api_version IN NUMBER,
3304 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3305 x_return_status OUT NOCOPY VARCHAR2,
3306 x_msg_count OUT NOCOPY NUMBER,
3307 x_msg_data OUT NOCOPY VARCHAR2,
3308 p_tclv_tbl IN tclv_tbl_type) IS
3309
3310 l_api_version CONSTANT NUMBER := 1;
3311 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_lock_row';
3312 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3313 i NUMBER := 0;
3314 l_overall_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3315
3316 BEGIN
3317 OKC_API.init_msg_list(p_init_msg_list);
3318 -- Make sure PL/SQL table has records in it before passing
3319 IF (p_tclv_tbl.COUNT > 0) THEN
3320 i := p_tclv_tbl.FIRST;
3321 LOOP
3322 lock_row (
3323 p_api_version => p_api_version,
3324 p_init_msg_list => OKC_API.G_FALSE,
3325 x_return_status => x_return_status,
3326 x_msg_count => x_msg_count,
3327 x_msg_data => x_msg_data,
3328 p_tclv_rec => p_tclv_tbl(i));
3329
3330 -- store the highest degree of error
3331 IF x_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
3332 IF l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR THEN
3333 l_overall_status := x_return_status;
3334 END IF;
3335 END IF;
3336
3337 EXIT WHEN (i = p_tclv_tbl.LAST);
3338 i := p_tclv_tbl.NEXT(i);
3339 END LOOP;
3340 -- return overall status
3341 x_return_status := l_overall_status;
3342
3343 END IF;
3344 EXCEPTION
3345 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3346 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3347 (
3348 l_api_name,
3349 G_PKG_NAME,
3350 'OKC_API.G_RET_STS_ERROR',
3351 x_msg_count,
3352 x_msg_data,
3353 '_PVT'
3354 );
3355 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3356 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3357 (
3358 l_api_name,
3359 G_PKG_NAME,
3360 'OKC_API.G_RET_STS_UNEXP_ERROR',
3361 x_msg_count,
3362 x_msg_data,
3363 '_PVT'
3364 );
3365 WHEN OTHERS THEN
3366 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3367 (
3368 l_api_name,
3369 G_PKG_NAME,
3370 'OTHERS',
3371 x_msg_count,
3372 x_msg_data,
3373 '_PVT'
3374 );
3375 END lock_row;
3376
3377 ---------------------------------------------------------------------------
3378 -- PROCEDURE update_row
3379 ---------------------------------------------------------------------------
3380 ---------------------------------------
3381 -- update_row for:OKL_TXL_CNTRCT_LNS --
3382 ---------------------------------------
3383 PROCEDURE update_row(
3384 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3385 x_return_status OUT NOCOPY VARCHAR2,
3386 x_msg_count OUT NOCOPY NUMBER,
3387 x_msg_data OUT NOCOPY VARCHAR2,
3388 p_tcl_rec IN tcl_rec_type,
3389 x_tcl_rec OUT NOCOPY tcl_rec_type) IS
3390
3391 l_api_version CONSTANT NUMBER := 1;
3392 l_api_name CONSTANT VARCHAR2(30) := 'LNS_update_row';
3393 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3394 l_tcl_rec tcl_rec_type := p_tcl_rec;
3395 l_def_tcl_rec tcl_rec_type;
3396 l_row_notfound BOOLEAN := TRUE;
3397 ----------------------------------
3398 -- FUNCTION populate_new_record --
3399 ----------------------------------
3400 FUNCTION populate_new_record (
3401 p_tcl_rec IN tcl_rec_type,
3402 x_tcl_rec OUT NOCOPY tcl_rec_type
3403 ) RETURN VARCHAR2 IS
3404 l_tcl_rec tcl_rec_type;
3405 l_row_notfound BOOLEAN := TRUE;
3406 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3407 BEGIN
3408 x_tcl_rec := p_tcl_rec;
3409 -- Get current database values
3410 l_tcl_rec := get_rec(p_tcl_rec, l_row_notfound);
3411 IF (l_row_notfound) THEN
3412 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
3413 END IF;
3414 IF (x_tcl_rec.id = OKC_API.G_MISS_NUM)
3415 THEN
3416 x_tcl_rec.id := l_tcl_rec.id;
3417 END IF;
3418 IF (x_tcl_rec.khr_id = OKC_API.G_MISS_NUM)
3419 THEN
3420 x_tcl_rec.khr_id := l_tcl_rec.khr_id;
3421 END IF;
3422 IF (x_tcl_rec.kle_id = OKC_API.G_MISS_NUM)
3423 THEN
3424 x_tcl_rec.kle_id := l_tcl_rec.kle_id;
3425 END IF;
3426 IF (x_tcl_rec.before_transfer_yn = OKC_API.G_MISS_CHAR)
3427 THEN
3428 x_tcl_rec.before_transfer_yn := l_tcl_rec.before_transfer_yn;
3429 END IF;
3430 IF (x_tcl_rec.tcn_id = OKC_API.G_MISS_NUM)
3431 THEN
3432 x_tcl_rec.tcn_id := l_tcl_rec.tcn_id;
3433 END IF;
3434 IF (x_tcl_rec.rct_id = OKC_API.G_MISS_NUM)
3435 THEN
3436 x_tcl_rec.rct_id := l_tcl_rec.rct_id;
3437 END IF;
3438 IF (x_tcl_rec.btc_id = OKC_API.G_MISS_NUM)
3439 THEN
3440 x_tcl_rec.btc_id := l_tcl_rec.btc_id;
3441 END IF;
3442 IF (x_tcl_rec.sty_id = OKC_API.G_MISS_NUM)
3443 THEN
3444 x_tcl_rec.sty_id := l_tcl_rec.sty_id;
3445 END IF;
3446 IF (x_tcl_rec.line_number = OKC_API.G_MISS_NUM)
3447 THEN
3448 x_tcl_rec.line_number := l_tcl_rec.line_number;
3449 END IF;
3450 IF (x_tcl_rec.tcl_type = OKC_API.G_MISS_CHAR)
3451 THEN
3452 x_tcl_rec.tcl_type := l_tcl_rec.tcl_type;
3453 END IF;
3454 IF (x_tcl_rec.object_version_number = OKC_API.G_MISS_NUM)
3455 THEN
3456 x_tcl_rec.object_version_number := l_tcl_rec.object_version_number;
3457 END IF;
3458 IF (x_tcl_rec.created_by = OKC_API.G_MISS_NUM)
3459 THEN
3460 x_tcl_rec.created_by := l_tcl_rec.created_by;
3461 END IF;
3462 IF (x_tcl_rec.creation_date = OKC_API.G_MISS_DATE)
3463 THEN
3464 x_tcl_rec.creation_date := l_tcl_rec.creation_date;
3465 END IF;
3466 IF (x_tcl_rec.last_updated_by = OKC_API.G_MISS_NUM)
3467 THEN
3468 x_tcl_rec.last_updated_by := l_tcl_rec.last_updated_by;
3469 END IF;
3470 IF (x_tcl_rec.last_update_date = OKC_API.G_MISS_DATE)
3471 THEN
3472 x_tcl_rec.last_update_date := l_tcl_rec.last_update_date;
3473 END IF;
3474 IF (x_tcl_rec.org_id = OKC_API.G_MISS_NUM)
3475 THEN
3476 x_tcl_rec.org_id := l_tcl_rec.org_id;
3477 END IF;
3478 IF (x_tcl_rec.description = OKC_API.G_MISS_CHAR)
3479 THEN
3480 x_tcl_rec.description := l_tcl_rec.description;
3481 END IF;
3482 IF (x_tcl_rec.program_id = OKC_API.G_MISS_NUM)
3483 THEN
3484 x_tcl_rec.program_id := l_tcl_rec.program_id;
3485 END IF;
3486 IF (x_tcl_rec.gl_reversal_yn = OKC_API.G_MISS_CHAR)
3487 THEN
3488 x_tcl_rec.gl_reversal_yn := l_tcl_rec.gl_reversal_yn;
3489 END IF;
3490 IF (x_tcl_rec.amount = OKC_API.G_MISS_NUM)
3491 THEN
3492 x_tcl_rec.amount := l_tcl_rec.amount;
3493 END IF;
3494 IF (x_tcl_rec.program_application_id = OKC_API.G_MISS_NUM)
3495 THEN
3496 x_tcl_rec.program_application_id := l_tcl_rec.program_application_id;
3497 END IF;
3498 IF (x_tcl_rec.currency_code = OKC_API.G_MISS_CHAR)
3499 THEN
3500 x_tcl_rec.currency_code := l_tcl_rec.currency_code;
3501 END IF;
3502 IF (x_tcl_rec.request_id = OKC_API.G_MISS_NUM)
3503 THEN
3504 x_tcl_rec.request_id := l_tcl_rec.request_id;
3505 END IF;
3506 IF (x_tcl_rec.program_update_date = OKC_API.G_MISS_DATE)
3507 THEN
3508 x_tcl_rec.program_update_date := l_tcl_rec.program_update_date;
3509 END IF;
3510 IF (x_tcl_rec.attribute_category = OKC_API.G_MISS_CHAR)
3511 THEN
3512 x_tcl_rec.attribute_category := l_tcl_rec.attribute_category;
3513 END IF;
3514 IF (x_tcl_rec.attribute1 = OKC_API.G_MISS_CHAR)
3515 THEN
3516 x_tcl_rec.attribute1 := l_tcl_rec.attribute1;
3517 END IF;
3518 IF (x_tcl_rec.attribute2 = OKC_API.G_MISS_CHAR)
3519 THEN
3520 x_tcl_rec.attribute2 := l_tcl_rec.attribute2;
3521 END IF;
3522 IF (x_tcl_rec.attribute3 = OKC_API.G_MISS_CHAR)
3523 THEN
3524 x_tcl_rec.attribute3 := l_tcl_rec.attribute3;
3525 END IF;
3526 IF (x_tcl_rec.attribute4 = OKC_API.G_MISS_CHAR)
3527 THEN
3528 x_tcl_rec.attribute4 := l_tcl_rec.attribute4;
3529 END IF;
3530 IF (x_tcl_rec.attribute5 = OKC_API.G_MISS_CHAR)
3531 THEN
3532 x_tcl_rec.attribute5 := l_tcl_rec.attribute5;
3533 END IF;
3534 IF (x_tcl_rec.attribute6 = OKC_API.G_MISS_CHAR)
3535 THEN
3536 x_tcl_rec.attribute6 := l_tcl_rec.attribute6;
3537 END IF;
3538 IF (x_tcl_rec.attribute7 = OKC_API.G_MISS_CHAR)
3539 THEN
3540 x_tcl_rec.attribute7 := l_tcl_rec.attribute7;
3541 END IF;
3542 IF (x_tcl_rec.attribute8 = OKC_API.G_MISS_CHAR)
3543 THEN
3544 x_tcl_rec.attribute8 := l_tcl_rec.attribute8;
3545 END IF;
3546 IF (x_tcl_rec.attribute9 = OKC_API.G_MISS_CHAR)
3547 THEN
3548 x_tcl_rec.attribute9 := l_tcl_rec.attribute9;
3549 END IF;
3550 IF (x_tcl_rec.attribute10 = OKC_API.G_MISS_CHAR)
3551 THEN
3552 x_tcl_rec.attribute10 := l_tcl_rec.attribute10;
3553 END IF;
3554 IF (x_tcl_rec.attribute11 = OKC_API.G_MISS_CHAR)
3555 THEN
3556 x_tcl_rec.attribute11 := l_tcl_rec.attribute11;
3557 END IF;
3558 IF (x_tcl_rec.attribute12 = OKC_API.G_MISS_CHAR)
3559 THEN
3560 x_tcl_rec.attribute12 := l_tcl_rec.attribute12;
3561 END IF;
3562 IF (x_tcl_rec.attribute13 = OKC_API.G_MISS_CHAR)
3563 THEN
3564 x_tcl_rec.attribute13 := l_tcl_rec.attribute13;
3565 END IF;
3566 IF (x_tcl_rec.attribute14 = OKC_API.G_MISS_CHAR)
3567 THEN
3568 x_tcl_rec.attribute14 := l_tcl_rec.attribute14;
3569 END IF;
3570 IF (x_tcl_rec.attribute15 = OKC_API.G_MISS_CHAR)
3571 THEN
3572 x_tcl_rec.attribute15 := l_tcl_rec.attribute15;
3573 END IF;
3574 IF (x_tcl_rec.last_update_login = OKC_API.G_MISS_NUM)
3575 THEN
3576 x_tcl_rec.last_update_login := l_tcl_rec.last_update_login;
3577 END IF;
3578 IF (x_tcl_rec.avl_id = OKC_API.G_MISS_NUM)
3579 THEN
3580 x_tcl_rec.avl_id := l_tcl_rec.avl_id;
3581 END IF;
3582 IF (x_tcl_rec.bkt_id = OKC_API.G_MISS_NUM)
3583 THEN
3584 x_tcl_rec.bkt_id := l_tcl_rec.bkt_id;
3585 END IF;
3586 IF (x_tcl_rec.kle_id_new = OKC_API.G_MISS_NUM)
3587 THEN
3588 x_tcl_rec.kle_id_new := l_tcl_rec.kle_id_new;
3589 END IF;
3590 IF (x_tcl_rec.percentage = OKC_API.G_MISS_NUM)
3591 THEN
3592 x_tcl_rec.percentage := l_tcl_rec.percentage;
3593 END IF;
3594 IF (x_tcl_rec.accrual_rule_yn = OKC_API.G_MISS_CHAR)
3595 THEN
3596 x_tcl_rec.accrual_rule_yn := l_tcl_rec.accrual_rule_yn;
3597 END IF;
3598 --21 Oct 2004 PAGARG Bug# 3964726
3599 IF (x_tcl_rec.source_column_1 = OKC_API.G_MISS_CHAR)
3600 THEN
3601 x_tcl_rec.source_column_1 := l_tcl_rec.source_column_1;
3602 END IF;
3603 IF (x_tcl_rec.source_value_1 = OKC_API.G_MISS_NUM)
3604 THEN
3605 x_tcl_rec.source_value_1 := l_tcl_rec.source_value_1;
3606 END IF;
3607 IF (x_tcl_rec.source_column_2 = OKC_API.G_MISS_CHAR)
3608 THEN
3609 x_tcl_rec.source_column_2 := l_tcl_rec.source_column_2;
3610 END IF;
3611 IF (x_tcl_rec.source_value_2 = OKC_API.G_MISS_NUM)
3612 THEN
3613 x_tcl_rec.source_value_2 := l_tcl_rec.source_value_2;
3614 END IF;
3615 IF (x_tcl_rec.source_column_3 = OKC_API.G_MISS_CHAR)
3616 THEN
3617 x_tcl_rec.source_column_3 := l_tcl_rec.source_column_3;
3618 END IF;
3619 IF (x_tcl_rec.source_value_3 = OKC_API.G_MISS_NUM)
3620 THEN
3621 x_tcl_rec.source_value_3 := l_tcl_rec.source_value_3;
3622 END IF;
3623 IF (x_tcl_rec.canceled_date = OKC_API.G_MISS_DATE)
3624 THEN
3625 x_tcl_rec.canceled_date := l_tcl_rec.canceled_date;
3626 END IF;
3627 IF (x_tcl_rec.tax_line_id = OKC_API.G_MISS_NUM)
3628 THEN
3629 x_tcl_rec.tax_line_id := l_tcl_rec.tax_line_id;
3630 END IF;
3631 -- Added by zrehman for SLA project (Bug 5707866) 9-Feb-2007
3632 IF (x_tcl_rec.stream_type_purpose = OKC_API.G_MISS_CHAR)
3633 THEN
3634 x_tcl_rec.stream_type_purpose := l_tcl_rec.stream_type_purpose;
3635 END IF;
3636 IF (x_tcl_rec.stream_type_code = OKC_API.G_MISS_CHAR)
3637 THEN
3638 x_tcl_rec.stream_type_code := l_tcl_rec.stream_type_code;
3639 END IF;
3640 IF (x_tcl_rec.asset_book_type_name = OKC_API.G_MISS_CHAR)
3641 THEN
3642 x_tcl_rec.asset_book_type_name := l_tcl_rec.asset_book_type_name;
3643 END IF;
3644 -- Added by nikshah for SLA project (Bug 5707866) 16-Apr-2007
3645 IF (x_tcl_rec.UPGRADE_STATUS_FLAG = OKC_API.G_MISS_CHAR)
3646 THEN
3647 x_tcl_rec.UPGRADE_STATUS_FLAG := l_tcl_rec.UPGRADE_STATUS_FLAG;
3648 END IF;
3649
3650 RETURN(l_return_status);
3651 END populate_new_record;
3652 -------------------------------------------
3653 -- Set_Attributes for:OKL_TXL_CNTRCT_LNS --
3654 -------------------------------------------
3655 FUNCTION Set_Attributes (
3656 p_tcl_rec IN tcl_rec_type,
3657 x_tcl_rec OUT NOCOPY tcl_rec_type
3658 ) RETURN VARCHAR2 IS
3659 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3660 BEGIN
3661 x_tcl_rec := p_tcl_rec;
3662 RETURN(l_return_status);
3663 END Set_Attributes;
3664 BEGIN
3665 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
3666 p_init_msg_list,
3667 '_PVT',
3668 x_return_status);
3669 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3670 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3671 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3672 RAISE OKC_API.G_EXCEPTION_ERROR;
3673 END IF;
3674 --- Setting item attributes
3675 l_return_status := Set_Attributes(
3676 p_tcl_rec, -- IN
3677 l_tcl_rec); -- OUT
3678 --- If any errors happen abort API
3679 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3680 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3681 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3682 RAISE OKC_API.G_EXCEPTION_ERROR;
3683 END IF;
3684 l_return_status := populate_new_record(l_tcl_rec, l_def_tcl_rec);
3685 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
3686 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
3687 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
3688 RAISE OKC_API.G_EXCEPTION_ERROR;
3689 END IF;
3690 UPDATE OKL_TXL_CNTRCT_LNS
3691 SET KHR_ID = l_def_tcl_rec.khr_id,
3692 KLE_ID = l_def_tcl_rec.kle_id,
3693 BEFORE_TRANSFER_YN = l_def_tcl_rec.before_transfer_yn,
3694 TCN_ID = l_def_tcl_rec.tcn_id,
3695 RCT_ID = l_def_tcl_rec.rct_id,
3696 BTC_ID = l_def_tcl_rec.btc_id,
3697 STY_ID = l_def_tcl_rec.sty_id,
3698 LINE_NUMBER = l_def_tcl_rec.line_number,
3699 TCL_TYPE = l_def_tcl_rec.tcl_type,
3700 OBJECT_VERSION_NUMBER = l_def_tcl_rec.object_version_number,
3701 CREATED_BY = l_def_tcl_rec.created_by,
3702 CREATION_DATE = l_def_tcl_rec.creation_date,
3703 LAST_UPDATED_BY = l_def_tcl_rec.last_updated_by,
3704 LAST_UPDATE_DATE = l_def_tcl_rec.last_update_date,
3705 ORG_ID = l_def_tcl_rec.org_id,
3706 DESCRIPTION = l_def_tcl_rec.description,
3707 PROGRAM_ID = l_def_tcl_rec.program_id,
3708 GL_REVERSAL_YN = l_def_tcl_rec.gl_reversal_yn,
3709 AMOUNT = l_def_tcl_rec.amount,
3710 PROGRAM_APPLICATION_ID = l_def_tcl_rec.program_application_id,
3711 currency_code = l_def_tcl_rec.currency_code,
3712 REQUEST_ID = l_def_tcl_rec.request_id,
3713 PROGRAM_UPDATE_DATE = l_def_tcl_rec.program_update_date,
3714 ATTRIBUTE_CATEGORY = l_def_tcl_rec.attribute_category,
3715 ATTRIBUTE1 = l_def_tcl_rec.attribute1,
3716 ATTRIBUTE2 = l_def_tcl_rec.attribute2,
3717 ATTRIBUTE3 = l_def_tcl_rec.attribute3,
3718 ATTRIBUTE4 = l_def_tcl_rec.attribute4,
3719 ATTRIBUTE5 = l_def_tcl_rec.attribute5,
3720 ATTRIBUTE6 = l_def_tcl_rec.attribute6,
3721 ATTRIBUTE7 = l_def_tcl_rec.attribute7,
3722 ATTRIBUTE8 = l_def_tcl_rec.attribute8,
3723 ATTRIBUTE9 = l_def_tcl_rec.attribute9,
3724 ATTRIBUTE10 = l_def_tcl_rec.attribute10,
3725 ATTRIBUTE11 = l_def_tcl_rec.attribute11,
3726 ATTRIBUTE12 = l_def_tcl_rec.attribute12,
3727 ATTRIBUTE13 = l_def_tcl_rec.attribute13,
3728 ATTRIBUTE14 = l_def_tcl_rec.attribute14,
3729 ATTRIBUTE15 = l_def_tcl_rec.attribute15,
3730 LAST_UPDATE_LOGIN = l_def_tcl_rec.last_update_login,
3731 AVL_ID = l_def_tcl_rec.avl_id,
3732 BKT_ID = l_def_tcl_rec.bkt_id,
3733 KLE_ID_NEW = l_def_tcl_rec.kle_id_new,
3734 PERCENTAGE = l_def_tcl_rec.percentage,
3735 ACCRUAL_RULE_YN = l_def_tcl_rec.accrual_rule_yn,
3736 --21 Oct 2004 PAGARG Bug# 3964726
3737 SOURCE_COLUMN_1 = l_def_tcl_rec.SOURCE_COLUMN_1,
3738 SOURCE_VALUE_1 = l_def_tcl_rec.SOURCE_VALUE_1,
3739 SOURCE_COLUMN_2 = l_def_tcl_rec.SOURCE_COLUMN_2,
3740 SOURCE_VALUE_2 = l_def_tcl_rec.SOURCE_VALUE_2,
3741 SOURCE_COLUMN_3 = l_def_tcl_rec.SOURCE_COLUMN_3,
3742 SOURCE_VALUE_3 = l_def_tcl_rec.SOURCE_VALUE_3,
3743 CANCELED_DATE = l_def_tcl_rec.CANCELED_DATE,
3744 TAX_LINE_ID = l_def_tcl_rec.TAX_LINE_ID,
3745 -- Added by zrehman for SLA project (Bug 5707866) 9-Feb-2007
3746 STREAM_TYPE_PURPOSE = l_def_tcl_rec.STREAM_TYPE_PURPOSE,
3747 STREAM_TYPE_CODE = l_def_tcl_rec.STREAM_TYPE_CODE,
3748 ASSET_BOOK_TYPE_NAME = l_def_tcl_rec.ASSET_BOOK_TYPE_NAME,
3749 -- Added by nikshah for SLA project (Bug 5707866) 16-Apr-2007
3750 UPGRADE_STATUS_FLAG = l_def_tcl_rec.UPGRADE_STATUS_FLAG
3751 WHERE ID = l_def_tcl_rec.id;
3752
3753 x_tcl_rec := l_def_tcl_rec;
3754 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
3755 EXCEPTION
3756 WHEN OKC_API.G_EXCEPTION_ERROR THEN
3757 x_return_status := OKC_API.HANDLE_EXCEPTIONS
3758 (
3759 l_api_name,
3760 G_PKG_NAME,
3761 'OKC_API.G_RET_STS_ERROR',
3762 x_msg_count,
3763 x_msg_data,
3764 '_PVT'
3765 );
3766 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3767 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3768 (
3769 l_api_name,
3770 G_PKG_NAME,
3771 'OKC_API.G_RET_STS_UNEXP_ERROR',
3772 x_msg_count,
3773 x_msg_data,
3774 '_PVT'
3775 );
3776 WHEN OTHERS THEN
3777 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
3778 (
3779 l_api_name,
3780 G_PKG_NAME,
3781 'OTHERS',
3782 x_msg_count,
3783 x_msg_data,
3784 '_PVT'
3785 );
3786 END update_row;
3787 -----------------------------------------
3788 -- update_row for:OKL_TXL_CNTRCT_LNS_V --
3789 -----------------------------------------
3790 PROCEDURE update_row(
3791 p_api_version IN NUMBER,
3792 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
3793 x_return_status OUT NOCOPY VARCHAR2,
3794 x_msg_count OUT NOCOPY NUMBER,
3795 x_msg_data OUT NOCOPY VARCHAR2,
3796 p_tclv_rec IN tclv_rec_type,
3797 x_tclv_rec OUT NOCOPY tclv_rec_type) IS
3798
3799 l_api_version CONSTANT NUMBER := 1;
3800 l_api_name CONSTANT VARCHAR2(30) := 'V_update_row';
3801 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3802 l_tclv_rec tclv_rec_type := p_tclv_rec;
3803 l_def_tclv_rec tclv_rec_type;
3804 l_tcl_rec tcl_rec_type;
3805 lx_tcl_rec tcl_rec_type;
3806 -------------------------------
3807 -- FUNCTION fill_who_columns --
3808 -------------------------------
3809 FUNCTION fill_who_columns (
3810 p_tclv_rec IN tclv_rec_type
3811 ) RETURN tclv_rec_type IS
3812 l_tclv_rec tclv_rec_type := p_tclv_rec;
3813 BEGIN
3814 l_tclv_rec.LAST_UPDATE_DATE := SYSDATE;
3815 l_tclv_rec.LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
3816 l_tclv_rec.LAST_UPDATE_LOGIN := FND_GLOBAL.LOGIN_ID;
3817 RETURN(l_tclv_rec);
3818 END fill_who_columns;
3819 ----------------------------------
3820 -- FUNCTION populate_new_record --
3821 ----------------------------------
3822 FUNCTION populate_new_record (
3823 p_tclv_rec IN tclv_rec_type,
3824 x_tclv_rec OUT NOCOPY tclv_rec_type
3825 ) RETURN VARCHAR2 IS
3826 l_tclv_rec tclv_rec_type;
3827 l_row_notfound BOOLEAN := TRUE;
3828 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
3829 BEGIN
3830 x_tclv_rec := p_tclv_rec;
3831 -- Get current database values
3832 l_tclv_rec := get_rec(p_tclv_rec, l_row_notfound);
3833 IF (l_row_notfound) THEN
3834 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
3835 END IF;
3836 IF (x_tclv_rec.id = OKC_API.G_MISS_NUM)
3837 THEN
3838 x_tclv_rec.id := l_tclv_rec.id;
3839 END IF;
3840 IF (x_tclv_rec.object_version_number = OKC_API.G_MISS_NUM)
3841 THEN
3842 x_tclv_rec.object_version_number := l_tclv_rec.object_version_number;
3843 END IF;
3844 IF (x_tclv_rec.sty_id = OKC_API.G_MISS_NUM)
3845 THEN
3846 x_tclv_rec.sty_id := l_tclv_rec.sty_id;
3847 END IF;
3848 IF (x_tclv_rec.rct_id = OKC_API.G_MISS_NUM)
3849 THEN
3850 x_tclv_rec.rct_id := l_tclv_rec.rct_id;
3851 END IF;
3852 IF (x_tclv_rec.btc_id = OKC_API.G_MISS_NUM)
3853 THEN
3854 x_tclv_rec.btc_id := l_tclv_rec.btc_id;
3855 END IF;
3856 IF (x_tclv_rec.tcn_id = OKC_API.G_MISS_NUM)
3857 THEN
3858 x_tclv_rec.tcn_id := l_tclv_rec.tcn_id;
3859 END IF;
3860 IF (x_tclv_rec.khr_id = OKC_API.G_MISS_NUM)
3861 THEN
3862 x_tclv_rec.khr_id := l_tclv_rec.khr_id;
3863 END IF;
3864 IF (x_tclv_rec.kle_id = OKC_API.G_MISS_NUM)
3865 THEN
3866 x_tclv_rec.kle_id := l_tclv_rec.kle_id;
3867 END IF;
3868 IF (x_tclv_rec.before_transfer_yn = OKC_API.G_MISS_CHAR)
3869 THEN
3870 x_tclv_rec.before_transfer_yn := l_tclv_rec.before_transfer_yn;
3871 END IF;
3872 IF (x_tclv_rec.line_number = OKC_API.G_MISS_NUM)
3873 THEN
3874 x_tclv_rec.line_number := l_tclv_rec.line_number;
3875 END IF;
3876 IF (x_tclv_rec.description = OKC_API.G_MISS_CHAR)
3877 THEN
3878 x_tclv_rec.description := l_tclv_rec.description;
3879 END IF;
3880 IF (x_tclv_rec.amount = OKC_API.G_MISS_NUM)
3881 THEN
3882 x_tclv_rec.amount := l_tclv_rec.amount;
3883 END IF;
3884 IF (x_tclv_rec.currency_code = OKC_API.G_MISS_CHAR)
3885 THEN
3886 x_tclv_rec.currency_code := l_tclv_rec.currency_code;
3887 END IF;
3888 IF (x_tclv_rec.gl_reversal_yn = OKC_API.G_MISS_CHAR)
3889 THEN
3890 x_tclv_rec.gl_reversal_yn := l_tclv_rec.gl_reversal_yn;
3891 END IF;
3892 IF (x_tclv_rec.attribute_category = OKC_API.G_MISS_CHAR)
3893 THEN
3894 x_tclv_rec.attribute_category := l_tclv_rec.attribute_category;
3895 END IF;
3896 IF (x_tclv_rec.attribute1 = OKC_API.G_MISS_CHAR)
3897 THEN
3898 x_tclv_rec.attribute1 := l_tclv_rec.attribute1;
3899 END IF;
3900 IF (x_tclv_rec.attribute2 = OKC_API.G_MISS_CHAR)
3901 THEN
3902 x_tclv_rec.attribute2 := l_tclv_rec.attribute2;
3903 END IF;
3904 IF (x_tclv_rec.attribute3 = OKC_API.G_MISS_CHAR)
3905 THEN
3906 x_tclv_rec.attribute3 := l_tclv_rec.attribute3;
3907 END IF;
3908 IF (x_tclv_rec.attribute4 = OKC_API.G_MISS_CHAR)
3909 THEN
3910 x_tclv_rec.attribute4 := l_tclv_rec.attribute4;
3911 END IF;
3912 IF (x_tclv_rec.attribute5 = OKC_API.G_MISS_CHAR)
3913 THEN
3914 x_tclv_rec.attribute5 := l_tclv_rec.attribute5;
3915 END IF;
3916 IF (x_tclv_rec.attribute6 = OKC_API.G_MISS_CHAR)
3917 THEN
3918 x_tclv_rec.attribute6 := l_tclv_rec.attribute6;
3919 END IF;
3920 IF (x_tclv_rec.attribute7 = OKC_API.G_MISS_CHAR)
3921 THEN
3922 x_tclv_rec.attribute7 := l_tclv_rec.attribute7;
3923 END IF;
3924 IF (x_tclv_rec.attribute8 = OKC_API.G_MISS_CHAR)
3925 THEN
3926 x_tclv_rec.attribute8 := l_tclv_rec.attribute8;
3927 END IF;
3928 IF (x_tclv_rec.attribute9 = OKC_API.G_MISS_CHAR)
3929 THEN
3930 x_tclv_rec.attribute9 := l_tclv_rec.attribute9;
3931 END IF;
3932 IF (x_tclv_rec.attribute10 = OKC_API.G_MISS_CHAR)
3933 THEN
3934 x_tclv_rec.attribute10 := l_tclv_rec.attribute10;
3935 END IF;
3936 IF (x_tclv_rec.attribute11 = OKC_API.G_MISS_CHAR)
3937 THEN
3938 x_tclv_rec.attribute11 := l_tclv_rec.attribute11;
3939 END IF;
3940 IF (x_tclv_rec.attribute12 = OKC_API.G_MISS_CHAR)
3941 THEN
3942 x_tclv_rec.attribute12 := l_tclv_rec.attribute12;
3943 END IF;
3944 IF (x_tclv_rec.attribute13 = OKC_API.G_MISS_CHAR)
3945 THEN
3946 x_tclv_rec.attribute13 := l_tclv_rec.attribute13;
3947 END IF;
3948 IF (x_tclv_rec.attribute14 = OKC_API.G_MISS_CHAR)
3949 THEN
3950 x_tclv_rec.attribute14 := l_tclv_rec.attribute14;
3951 END IF;
3952 IF (x_tclv_rec.attribute15 = OKC_API.G_MISS_CHAR)
3953 THEN
3954 x_tclv_rec.attribute15 := l_tclv_rec.attribute15;
3955 END IF;
3956 IF (x_tclv_rec.tcl_type = OKC_API.G_MISS_CHAR)
3957 THEN
3958 x_tclv_rec.tcl_type := l_tclv_rec.tcl_type;
3959 END IF;
3960 IF (x_tclv_rec.created_by = OKC_API.G_MISS_NUM)
3961 THEN
3962 x_tclv_rec.created_by := l_tclv_rec.created_by;
3963 END IF;
3964 IF (x_tclv_rec.creation_date = OKC_API.G_MISS_DATE)
3965 THEN
3966 x_tclv_rec.creation_date := l_tclv_rec.creation_date;
3967 END IF;
3968 IF (x_tclv_rec.last_updated_by = OKC_API.G_MISS_NUM)
3969 THEN
3970 x_tclv_rec.last_updated_by := l_tclv_rec.last_updated_by;
3971 END IF;
3972 IF (x_tclv_rec.last_update_date = OKC_API.G_MISS_DATE)
3973 THEN
3974 x_tclv_rec.last_update_date := l_tclv_rec.last_update_date;
3975 END IF;
3976 IF (x_tclv_rec.org_id = OKC_API.G_MISS_NUM)
3977 THEN
3978 x_tclv_rec.org_id := l_tclv_rec.org_id;
3979 END IF;
3980 IF (x_tclv_rec.program_id = OKC_API.G_MISS_NUM)
3981 THEN
3982 x_tclv_rec.program_id := l_tclv_rec.program_id;
3983 END IF;
3984 IF (x_tclv_rec.program_application_id = OKC_API.G_MISS_NUM)
3985 THEN
3986 x_tclv_rec.program_application_id := l_tclv_rec.program_application_id;
3987 END IF;
3988 IF (x_tclv_rec.request_id = OKC_API.G_MISS_NUM)
3989 THEN
3990 x_tclv_rec.request_id := l_tclv_rec.request_id;
3991 END IF;
3992 IF (x_tclv_rec.program_update_date = OKC_API.G_MISS_DATE)
3993 THEN
3994 x_tclv_rec.program_update_date := l_tclv_rec.program_update_date;
3995 END IF;
3996 IF (x_tclv_rec.last_update_login = OKC_API.G_MISS_NUM)
3997 THEN
3998 x_tclv_rec.last_update_login := l_tclv_rec.last_update_login;
3999 END IF;
4000 IF (x_tclv_rec.avl_id = OKC_API.G_MISS_NUM)
4001 THEN
4002 x_tclv_rec.avl_id := l_tclv_rec.avl_id;
4003 END IF;
4004 IF (x_tclv_rec.bkt_id = OKC_API.G_MISS_NUM)
4005 THEN
4006 x_tclv_rec.bkt_id := l_tclv_rec.bkt_id;
4007 END IF;
4008 IF (x_tclv_rec.kle_id_new = OKC_API.G_MISS_NUM)
4009 THEN
4010 x_tclv_rec.kle_id_new := l_tclv_rec.kle_id_new;
4011 END IF;
4012 IF (x_tclv_rec.percentage = OKC_API.G_MISS_NUM)
4013 THEN
4014 x_tclv_rec.percentage := l_tclv_rec.percentage;
4015 END IF;
4016 IF (x_tclv_rec.accrual_rule_yn = OKC_API.G_MISS_CHAR)
4017 THEN
4018 x_tclv_rec.accrual_rule_yn := l_tclv_rec.accrual_rule_yn;
4019 END IF;
4020 --21 Oct 2004 PAGARG Bug# 3964726
4021 IF (x_tclv_rec.source_column_1 = OKC_API.G_MISS_CHAR)
4022 THEN
4023 x_tclv_rec.source_column_1 := l_tclv_rec.source_column_1;
4024 END IF;
4025 IF (x_tclv_rec.source_value_1 = OKC_API.G_MISS_NUM)
4026 THEN
4027 x_tclv_rec.source_value_1 := l_tclv_rec.source_value_1;
4028 END IF;
4029 IF (x_tclv_rec.source_column_2 = OKC_API.G_MISS_CHAR)
4030 THEN
4031 x_tclv_rec.source_column_2 := l_tclv_rec.source_column_2;
4032 END IF;
4033 IF (x_tclv_rec.source_value_2 = OKC_API.G_MISS_NUM)
4034 THEN
4035 x_tclv_rec.source_value_2 := l_tclv_rec.source_value_2;
4036 END IF;
4037 IF (x_tclv_rec.source_column_3 = OKC_API.G_MISS_CHAR)
4038 THEN
4039 x_tclv_rec.source_column_3 := l_tclv_rec.source_column_3;
4040 END IF;
4041 IF (x_tclv_rec.source_value_3 = OKC_API.G_MISS_NUM)
4042 THEN
4043 x_tclv_rec.source_value_3 := l_tclv_rec.source_value_3;
4044 END IF;
4045 IF (x_tclv_rec.canceled_date = OKC_API.G_MISS_DATE)
4046 THEN
4047 x_tclv_rec.canceled_date := l_tclv_rec.canceled_date;
4048 END IF;
4049 IF (x_tclv_rec.tax_line_id = OKC_API.G_MISS_NUM)
4050 THEN
4051 x_tclv_rec.tax_line_id := l_tclv_rec.tax_line_id;
4052 END IF;
4053 -- Added by zrehman for SLA project (Bug 5707866) 9-Feb-2007
4054 IF (x_tclv_rec.stream_type_purpose = OKC_API.G_MISS_CHAR)
4055 THEN
4056 x_tclv_rec.stream_type_purpose := l_tclv_rec.stream_type_purpose;
4057 END IF;
4058 IF (x_tclv_rec.stream_type_code = OKC_API.G_MISS_CHAR)
4059 THEN
4060 x_tclv_rec.stream_type_code := l_tclv_rec.stream_type_code;
4061 END IF;
4062 IF (x_tclv_rec.asset_book_type_name = OKC_API.G_MISS_CHAR)
4063 THEN
4064 x_tclv_rec.asset_book_type_name := l_tclv_rec.asset_book_type_name;
4065 END IF;
4066 -- Added by nikshah for SLA project (Bug 5707866) 16-Apr-2007
4067 IF (x_tclv_rec.UPGRADE_STATUS_FLAG = OKC_API.G_MISS_CHAR)
4068 THEN
4069 x_tclv_rec.UPGRADE_STATUS_FLAG := l_tclv_rec.UPGRADE_STATUS_FLAG;
4070 END IF;
4071
4072 RETURN(l_return_status);
4073 END populate_new_record;
4074 ---------------------------------------------
4075 -- Set_Attributes for:OKL_TXL_CNTRCT_LNS_V --
4076 ---------------------------------------------
4077 FUNCTION Set_Attributes (
4078 p_tclv_rec IN tclv_rec_type,
4079 x_tclv_rec OUT NOCOPY tclv_rec_type
4080 ) RETURN VARCHAR2 IS
4081 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
4082 l_request_id NUMBER := Fnd_Global.CONC_REQUEST_ID;
4083 l_prog_app_id NUMBER := Fnd_Global.PROG_APPL_ID;
4084 l_program_id NUMBER := Fnd_Global.CONC_PROGRAM_ID;
4085 BEGIN
4086 x_tclv_rec := p_tclv_rec;
4087
4088 SELECT NVL(DECODE(l_request_id, -1, NULL, l_request_id) ,p_tclv_rec.REQUEST_ID)
4089 ,NVL(DECODE(l_prog_app_id, -1, NULL, l_prog_app_id) ,p_tclv_rec.PROGRAM_APPLICATION_ID)
4090 ,NVL(DECODE(l_program_id, -1, NULL, l_program_id) ,p_tclv_rec.PROGRAM_ID)
4091 ,DECODE(DECODE(l_request_id, -1, NULL, SYSDATE) ,NULL, p_tclv_rec.PROGRAM_UPDATE_DATE,SYSDATE)
4092 INTO x_tclv_rec.REQUEST_ID
4093 ,x_tclv_rec.PROGRAM_APPLICATION_ID
4094 ,x_tclv_rec.PROGRAM_ID
4095 ,x_tclv_rec.PROGRAM_UPDATE_DATE
4096 FROM DUAL;
4097
4098 RETURN(l_return_status);
4099 END Set_Attributes;
4100 BEGIN
4101 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
4102 G_PKG_NAME,
4103 p_init_msg_list,
4104 l_api_version,
4105 p_api_version,
4106 '_PVT',
4107 x_return_status);
4108 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
4109 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
4110 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
4111 RAISE OKC_API.G_EXCEPTION_ERROR;
4112 END IF;
4113 --- Setting item attributes
4114 l_return_status := Set_Attributes(
4115 p_tclv_rec, -- IN
4116 l_tclv_rec); -- OUT
4117 --- If any errors happen abort API
4118 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
4119 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
4120 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
4121 RAISE OKC_API.G_EXCEPTION_ERROR;
4122 END IF;
4123 l_return_status := populate_new_record(l_tclv_rec, l_def_tclv_rec);
4124 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
4125 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
4126 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
4127 RAISE OKC_API.G_EXCEPTION_ERROR;
4128 END IF;
4129 l_def_tclv_rec := fill_who_columns(l_def_tclv_rec);
4130 --- Validate all non-missing attributes (Item Level Validation)
4131 l_return_status := Validate_Attributes(l_def_tclv_rec);
4132 --- If any errors happen abort API
4133 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
4134 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
4135 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
4136 RAISE OKC_API.G_EXCEPTION_ERROR;
4137 END IF;
4138 l_return_status := Validate_Record(l_def_tclv_rec);
4139 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
4140 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
4141 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
4142 RAISE OKC_API.G_EXCEPTION_ERROR;
4143 END IF;
4144
4145 --------------------------------------
4146 -- Move VIEW record to "Child" records
4147 --------------------------------------
4148 migrate(l_def_tclv_rec, l_tcl_rec);
4149 --------------------------------------------
4150 -- Call the UPDATE_ROW for each child record
4151 --------------------------------------------
4152 update_row(
4153 p_init_msg_list,
4154 x_return_status,
4155 x_msg_count,
4156 x_msg_data,
4157 l_tcl_rec,
4158 lx_tcl_rec
4159 );
4160 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
4161 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
4162 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
4163 RAISE OKC_API.G_EXCEPTION_ERROR;
4164 END IF;
4165 migrate(lx_tcl_rec, l_def_tclv_rec);
4166 x_tclv_rec := l_def_tclv_rec;
4167 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
4168 EXCEPTION
4169 WHEN OKC_API.G_EXCEPTION_ERROR THEN
4170 x_return_status := OKC_API.HANDLE_EXCEPTIONS
4171 (
4172 l_api_name,
4173 G_PKG_NAME,
4174 'OKC_API.G_RET_STS_ERROR',
4175 x_msg_count,
4176 x_msg_data,
4177 '_PVT'
4178 );
4179 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
4180 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
4181 (
4182 l_api_name,
4183 G_PKG_NAME,
4184 'OKC_API.G_RET_STS_UNEXP_ERROR',
4185 x_msg_count,
4186 x_msg_data,
4187 '_PVT'
4188 );
4189 WHEN OTHERS THEN
4190 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
4191 (
4192 l_api_name,
4193 G_PKG_NAME,
4194 'OTHERS',
4195 x_msg_count,
4196 x_msg_data,
4197 '_PVT'
4198 );
4199 END update_row;
4200 ----------------------------------------
4201 -- PL/SQL TBL update_row for:TCLV_TBL --
4202 ----------------------------------------
4203 PROCEDURE update_row(
4204 p_api_version IN NUMBER,
4205 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
4206 x_return_status OUT NOCOPY VARCHAR2,
4207 x_msg_count OUT NOCOPY NUMBER,
4208 x_msg_data OUT NOCOPY VARCHAR2,
4209 p_tclv_tbl IN tclv_tbl_type,
4210 x_tclv_tbl OUT NOCOPY tclv_tbl_type) IS
4211
4212 l_api_version CONSTANT NUMBER := 1;
4213 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_update_row';
4214 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
4215 i NUMBER := 0;
4216 l_overall_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
4217
4218 BEGIN
4219 OKC_API.init_msg_list(p_init_msg_list);
4220 -- Make sure PL/SQL table has records in it before passing
4221 IF (p_tclv_tbl.COUNT > 0) THEN
4222 i := p_tclv_tbl.FIRST;
4223 LOOP
4224 update_row (
4225 p_api_version => p_api_version,
4226 p_init_msg_list => OKC_API.G_FALSE,
4227 x_return_status => x_return_status,
4228 x_msg_count => x_msg_count,
4229 x_msg_data => x_msg_data,
4230 p_tclv_rec => p_tclv_tbl(i),
4231 x_tclv_rec => x_tclv_tbl(i));
4232
4233 -- store the highest degree of error
4234 IF x_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
4235 IF l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR THEN
4236 l_overall_status := x_return_status;
4237 END IF;
4238 END IF;
4239
4240 EXIT WHEN (i = p_tclv_tbl.LAST);
4241 i := p_tclv_tbl.NEXT(i);
4242 END LOOP;
4243 -- return overall status
4244 x_return_status := l_overall_status;
4245
4246 END IF;
4247 EXCEPTION
4248 WHEN OKC_API.G_EXCEPTION_ERROR THEN
4249 x_return_status := OKC_API.HANDLE_EXCEPTIONS
4250 (
4251 l_api_name,
4252 G_PKG_NAME,
4253 'OKC_API.G_RET_STS_ERROR',
4254 x_msg_count,
4255 x_msg_data,
4256 '_PVT'
4257 );
4258 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
4259 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
4260 (
4261 l_api_name,
4262 G_PKG_NAME,
4263 'OKC_API.G_RET_STS_UNEXP_ERROR',
4264 x_msg_count,
4265 x_msg_data,
4266 '_PVT'
4267 );
4268 WHEN OTHERS THEN
4269 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
4270 (
4271 l_api_name,
4272 G_PKG_NAME,
4273 'OTHERS',
4274 x_msg_count,
4275 x_msg_data,
4276 '_PVT'
4277 );
4278 END update_row;
4279
4280 ---------------------------------------------------------------------------
4281 -- PROCEDURE delete_row
4282 ---------------------------------------------------------------------------
4283 ---------------------------------------
4284 -- delete_row for:OKL_TXL_CNTRCT_LNS --
4285 ---------------------------------------
4286 PROCEDURE delete_row(
4287 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
4288 x_return_status OUT NOCOPY VARCHAR2,
4289 x_msg_count OUT NOCOPY NUMBER,
4290 x_msg_data OUT NOCOPY VARCHAR2,
4291 p_tcl_rec IN tcl_rec_type) IS
4292
4293 l_api_version CONSTANT NUMBER := 1;
4294 l_api_name CONSTANT VARCHAR2(30) := 'LNS_delete_row';
4295 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
4296 l_tcl_rec tcl_rec_type:= p_tcl_rec;
4297 l_row_notfound BOOLEAN := TRUE;
4298 BEGIN
4299 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
4300 p_init_msg_list,
4301 '_PVT',
4302 x_return_status);
4303 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
4304 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
4305 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
4306 RAISE OKC_API.G_EXCEPTION_ERROR;
4307 END IF;
4308 DELETE FROM OKL_TXL_CNTRCT_LNS
4309 WHERE ID = l_tcl_rec.id;
4310
4311 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
4312 EXCEPTION
4313 WHEN OKC_API.G_EXCEPTION_ERROR THEN
4314 x_return_status := OKC_API.HANDLE_EXCEPTIONS
4315 (
4316 l_api_name,
4317 G_PKG_NAME,
4318 'OKC_API.G_RET_STS_ERROR',
4319 x_msg_count,
4320 x_msg_data,
4321 '_PVT'
4322 );
4323 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
4324 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
4325 (
4326 l_api_name,
4327 G_PKG_NAME,
4328 'OKC_API.G_RET_STS_UNEXP_ERROR',
4329 x_msg_count,
4330 x_msg_data,
4331 '_PVT'
4332 );
4333 WHEN OTHERS THEN
4334 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
4335 (
4336 l_api_name,
4337 G_PKG_NAME,
4338 'OTHERS',
4339 x_msg_count,
4340 x_msg_data,
4341 '_PVT'
4342 );
4343 END delete_row;
4344 -----------------------------------------
4345 -- delete_row for:OKL_TXL_CNTRCT_LNS_V --
4346 -----------------------------------------
4347 PROCEDURE delete_row(
4348 p_api_version IN NUMBER,
4349 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
4350 x_return_status OUT NOCOPY VARCHAR2,
4351 x_msg_count OUT NOCOPY NUMBER,
4352 x_msg_data OUT NOCOPY VARCHAR2,
4353 p_tclv_rec IN tclv_rec_type) IS
4354
4355 l_api_version CONSTANT NUMBER := 1;
4356 l_api_name CONSTANT VARCHAR2(30) := 'V_delete_row';
4357 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
4358 l_tclv_rec tclv_rec_type := p_tclv_rec;
4359 l_tcl_rec tcl_rec_type;
4360 BEGIN
4361 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
4362 G_PKG_NAME,
4363 p_init_msg_list,
4364 l_api_version,
4365 p_api_version,
4366 '_PVT',
4367 x_return_status);
4368 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
4369 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
4370 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
4371 RAISE OKC_API.G_EXCEPTION_ERROR;
4372 END IF;
4373 --------------------------------------
4374 -- Move VIEW record to "Child" records
4375 --------------------------------------
4376 migrate(l_tclv_rec, l_tcl_rec);
4377 --------------------------------------------
4378 -- Call the DELETE_ROW for each child record
4379 --------------------------------------------
4380 delete_row(
4381 p_init_msg_list,
4382 x_return_status,
4383 x_msg_count,
4384 x_msg_data,
4385 l_tcl_rec
4386 );
4387 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
4388 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
4389 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
4390 RAISE OKC_API.G_EXCEPTION_ERROR;
4391 END IF;
4392 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
4393 EXCEPTION
4394 WHEN OKC_API.G_EXCEPTION_ERROR THEN
4395 x_return_status := OKC_API.HANDLE_EXCEPTIONS
4396 (
4397 l_api_name,
4398 G_PKG_NAME,
4399 'OKC_API.G_RET_STS_ERROR',
4400 x_msg_count,
4401 x_msg_data,
4402 '_PVT'
4403 );
4404 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
4405 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
4406 (
4407 l_api_name,
4408 G_PKG_NAME,
4409 'OKC_API.G_RET_STS_UNEXP_ERROR',
4410 x_msg_count,
4411 x_msg_data,
4412 '_PVT'
4413 );
4414 WHEN OTHERS THEN
4415 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
4416 (
4417 l_api_name,
4418 G_PKG_NAME,
4419 'OTHERS',
4420 x_msg_count,
4421 x_msg_data,
4422 '_PVT'
4423 );
4424 END delete_row;
4425 ----------------------------------------
4426 -- PL/SQL TBL delete_row for:TCLV_TBL --
4427 ----------------------------------------
4428 PROCEDURE delete_row(
4429 p_api_version IN NUMBER,
4430 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
4431 x_return_status OUT NOCOPY VARCHAR2,
4432 x_msg_count OUT NOCOPY NUMBER,
4433 x_msg_data OUT NOCOPY VARCHAR2,
4434 p_tclv_tbl IN tclv_tbl_type) IS
4435
4436 l_api_version CONSTANT NUMBER := 1;
4437 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_delete_row';
4438 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
4439 i NUMBER := 0;
4440 l_overall_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
4441
4442 BEGIN
4443 OKC_API.init_msg_list(p_init_msg_list);
4444 -- Make sure PL/SQL table has records in it before passing
4445 IF (p_tclv_tbl.COUNT > 0) THEN
4446 i := p_tclv_tbl.FIRST;
4447 LOOP
4448 delete_row (
4449 p_api_version => p_api_version,
4450 p_init_msg_list => OKC_API.G_FALSE,
4451 x_return_status => x_return_status,
4452 x_msg_count => x_msg_count,
4453 x_msg_data => x_msg_data,
4454 p_tclv_rec => p_tclv_tbl(i));
4455
4456 -- store the highest degree of error
4457 IF x_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
4458 IF l_overall_status <> OKC_API.G_RET_STS_UNEXP_ERROR THEN
4459 l_overall_status := x_return_status;
4460 END IF;
4461 END IF;
4462
4463 EXIT WHEN (i = p_tclv_tbl.LAST);
4464 i := p_tclv_tbl.NEXT(i);
4465 END LOOP;
4466 -- return overall status
4467 x_return_status := l_overall_status;
4468
4469 END IF;
4470 EXCEPTION
4471 WHEN OKC_API.G_EXCEPTION_ERROR THEN
4472 x_return_status := OKC_API.HANDLE_EXCEPTIONS
4473 (
4474 l_api_name,
4475 G_PKG_NAME,
4476 'OKC_API.G_RET_STS_ERROR',
4477 x_msg_count,
4478 x_msg_data,
4479 '_PVT'
4480 );
4481 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
4482 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
4483 (
4484 l_api_name,
4485 G_PKG_NAME,
4486 'OKC_API.G_RET_STS_UNEXP_ERROR',
4487 x_msg_count,
4488 x_msg_data,
4489 '_PVT'
4490 );
4491 WHEN OTHERS THEN
4492 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
4493 (
4494 l_api_name,
4495 G_PKG_NAME,
4496 'OTHERS',
4497 x_msg_count,
4498 x_msg_data,
4499 '_PVT'
4500 );
4501 END delete_row;
4502 END OKL_TCL_PVT;