[Home] [Help]
PACKAGE BODY: APPS.OKC_AST_PVT
Source
1 PACKAGE BODY OKC_AST_PVT AS
2 /* $Header: OKCSASTB.pls 120.1 2005/09/13 03:10:29 npalepu noship $ */
3
4 l_debug VARCHAR2(1) := NVL(FND_PROFILE.VALUE('AFLOG_ENABLED'),'N');
5 ---------------------------------------------------------------------------
6 -- FUNCTION get_seq_id
7 ---------------------------------------------------------------------------
8 FUNCTION get_seq_id RETURN NUMBER IS
9 l_id Number;
10 -- for datamerge's data (for seeded date id should be greater than or equal to
11 --11000 and less than 50000)
12 cursor seed_c is
13 select
14 nvl(max(id), 11000) + 1
15 from
16 OKC_ASSENTS_V
17 where
18 id >= 11000 AND id < 50000;
19 BEGIN
20 if fnd_global.user_id = 1 then
21 open seed_c;
22 fetch seed_c into l_id;
23 close seed_c;
24 return(l_id);
25 else
26 RETURN(okc_p_util.raw_to_number(sys_guid()));
27 end if;
28 END get_Seq_id;
29
30 ---------------------------------------------------------------------------
31 -- PROCEDURE qc
32 ---------------------------------------------------------------------------
33 PROCEDURE qc IS
34 BEGIN
35 null;
36 END qc;
37
38 ---------------------------------------------------------------------------
39 -- PROCEDURE change_version
40 ---------------------------------------------------------------------------
41 PROCEDURE change_version IS
42 BEGIN
43 null;
44 END change_version;
45
46 ---------------------------------------------------------------------------
47 -- PROCEDURE api_copy
48 ---------------------------------------------------------------------------
49 PROCEDURE api_copy IS
50 BEGIN
51 null;
52 END api_copy;
53
54 ---------------------------------------------------------------------------
55 -- FUNCTION get_rec for: OKC_ASSENTS
56 ---------------------------------------------------------------------------
57 FUNCTION get_rec (
58 p_ast_rec IN ast_rec_type,
59 x_no_data_found OUT NOCOPY BOOLEAN
60 ) RETURN ast_rec_type IS
61 CURSOR ast_pk_csr (p_id IN NUMBER) IS
62 SELECT
63 ID,
64 STS_CODE,
65 OPN_CODE,
66 STE_CODE,
67 SCS_CODE,
68 ALLOWED_YN,
69 OBJECT_VERSION_NUMBER,
70 CREATED_BY,
71 CREATION_DATE,
72 LAST_UPDATED_BY,
73 LAST_UPDATE_DATE,
74 LAST_UPDATE_LOGIN,
75 ATTRIBUTE_CATEGORY,
76 ATTRIBUTE1,
77 ATTRIBUTE2,
78 ATTRIBUTE3,
79 ATTRIBUTE4,
80 ATTRIBUTE5,
81 ATTRIBUTE6,
82 ATTRIBUTE7,
83 ATTRIBUTE8,
84 ATTRIBUTE9,
85 ATTRIBUTE10,
86 ATTRIBUTE11,
87 ATTRIBUTE12,
88 ATTRIBUTE13,
89 ATTRIBUTE14,
90 ATTRIBUTE15
91 FROM Okc_Assents
92 WHERE okc_assents.id = p_id;
93 l_ast_pk ast_pk_csr%ROWTYPE;
94 l_ast_rec ast_rec_type;
95 BEGIN
96 x_no_data_found := TRUE;
97 -- Get current database values
98 OPEN ast_pk_csr (p_ast_rec.id);
99 FETCH ast_pk_csr INTO
100 l_ast_rec.ID,
101 l_ast_rec.STS_CODE,
102 l_ast_rec.OPN_CODE,
103 l_ast_rec.STE_CODE,
104 l_ast_rec.SCS_CODE,
105 l_ast_rec.ALLOWED_YN,
106 l_ast_rec.OBJECT_VERSION_NUMBER,
107 l_ast_rec.CREATED_BY,
108 l_ast_rec.CREATION_DATE,
109 l_ast_rec.LAST_UPDATED_BY,
110 l_ast_rec.LAST_UPDATE_DATE,
111 l_ast_rec.LAST_UPDATE_LOGIN,
112 l_ast_rec.ATTRIBUTE_CATEGORY,
113 l_ast_rec.ATTRIBUTE1,
114 l_ast_rec.ATTRIBUTE2,
115 l_ast_rec.ATTRIBUTE3,
116 l_ast_rec.ATTRIBUTE4,
117 l_ast_rec.ATTRIBUTE5,
118 l_ast_rec.ATTRIBUTE6,
119 l_ast_rec.ATTRIBUTE7,
120 l_ast_rec.ATTRIBUTE8,
121 l_ast_rec.ATTRIBUTE9,
122 l_ast_rec.ATTRIBUTE10,
123 l_ast_rec.ATTRIBUTE11,
124 l_ast_rec.ATTRIBUTE12,
125 l_ast_rec.ATTRIBUTE13,
126 l_ast_rec.ATTRIBUTE14,
127 l_ast_rec.ATTRIBUTE15;
128 x_no_data_found := ast_pk_csr%NOTFOUND;
129 CLOSE ast_pk_csr;
130 RETURN(l_ast_rec);
131 END get_rec;
132
133 FUNCTION get_rec (
134 p_ast_rec IN ast_rec_type
135 ) RETURN ast_rec_type IS
136 l_row_notfound BOOLEAN := TRUE;
137 BEGIN
138 RETURN(get_rec(p_ast_rec, l_row_notfound));
139 END get_rec;
140 ---------------------------------------------------------------------------
141 -- FUNCTION get_rec for: OKC_ASSENTS_V
142 ---------------------------------------------------------------------------
143 FUNCTION get_rec (
144 p_astv_rec IN astv_rec_type,
145 x_no_data_found OUT NOCOPY BOOLEAN
146 ) RETURN astv_rec_type IS
147 CURSOR okc_astv_pk_csr (p_id IN NUMBER) IS
148 SELECT
149 ID,
150 STS_CODE,
151 OPN_CODE,
152 STE_CODE,
153 SCS_CODE,
154 OBJECT_VERSION_NUMBER,
155 ALLOWED_YN,
156 ATTRIBUTE_CATEGORY,
157 ATTRIBUTE1,
158 ATTRIBUTE2,
159 ATTRIBUTE3,
160 ATTRIBUTE4,
161 ATTRIBUTE5,
162 ATTRIBUTE6,
163 ATTRIBUTE7,
164 ATTRIBUTE8,
165 ATTRIBUTE9,
166 ATTRIBUTE10,
167 ATTRIBUTE11,
168 ATTRIBUTE12,
169 ATTRIBUTE13,
170 ATTRIBUTE14,
171 ATTRIBUTE15,
172 CREATED_BY,
173 CREATION_DATE,
174 LAST_UPDATED_BY,
175 LAST_UPDATE_DATE,
176 LAST_UPDATE_LOGIN
177 FROM Okc_Assents_V
178 WHERE okc_assents_v.id = p_id;
179 l_okc_astv_pk okc_astv_pk_csr%ROWTYPE;
180 l_astv_rec astv_rec_type;
181 BEGIN
182 x_no_data_found := TRUE;
183 -- Get current database values
184 OPEN okc_astv_pk_csr (p_astv_rec.id);
185 FETCH okc_astv_pk_csr INTO
186 l_astv_rec.ID,
187 l_astv_rec.STS_CODE,
188 l_astv_rec.OPN_CODE,
189 l_astv_rec.STE_CODE,
190 l_astv_rec.SCS_CODE,
191 l_astv_rec.OBJECT_VERSION_NUMBER,
192 l_astv_rec.ALLOWED_YN,
193 l_astv_rec.ATTRIBUTE_CATEGORY,
194 l_astv_rec.ATTRIBUTE1,
195 l_astv_rec.ATTRIBUTE2,
196 l_astv_rec.ATTRIBUTE3,
197 l_astv_rec.ATTRIBUTE4,
198 l_astv_rec.ATTRIBUTE5,
199 l_astv_rec.ATTRIBUTE6,
200 l_astv_rec.ATTRIBUTE7,
201 l_astv_rec.ATTRIBUTE8,
202 l_astv_rec.ATTRIBUTE9,
203 l_astv_rec.ATTRIBUTE10,
204 l_astv_rec.ATTRIBUTE11,
205 l_astv_rec.ATTRIBUTE12,
206 l_astv_rec.ATTRIBUTE13,
207 l_astv_rec.ATTRIBUTE14,
208 l_astv_rec.ATTRIBUTE15,
209 l_astv_rec.CREATED_BY,
210 l_astv_rec.CREATION_DATE,
211 l_astv_rec.LAST_UPDATED_BY,
212 l_astv_rec.LAST_UPDATE_DATE,
213 l_astv_rec.LAST_UPDATE_LOGIN;
214 x_no_data_found := okc_astv_pk_csr%NOTFOUND;
215 CLOSE okc_astv_pk_csr;
216 RETURN(l_astv_rec);
217 END get_rec;
218
219 FUNCTION get_rec (
220 p_astv_rec IN astv_rec_type
221 ) RETURN astv_rec_type IS
222 l_row_notfound BOOLEAN := TRUE;
223 BEGIN
224 RETURN(get_rec(p_astv_rec, l_row_notfound));
225 END get_rec;
226
227 ---------------------------------------------------
228 -- FUNCTION null_out_defaults for: OKC_ASSENTS_V --
229 ---------------------------------------------------
230 FUNCTION null_out_defaults (
231 p_astv_rec IN astv_rec_type
232 ) RETURN astv_rec_type IS
233 l_astv_rec astv_rec_type := p_astv_rec;
234 BEGIN
235 IF (l_astv_rec.sts_code = OKC_API.G_MISS_CHAR) THEN
236 l_astv_rec.sts_code := NULL;
237 END IF;
238 IF (l_astv_rec.opn_code = OKC_API.G_MISS_CHAR) THEN
239 l_astv_rec.opn_code := NULL;
240 END IF;
241 IF (l_astv_rec.ste_code = OKC_API.G_MISS_CHAR) THEN
242 l_astv_rec.ste_code := NULL;
243 END IF;
244 IF (l_astv_rec.scs_code = OKC_API.G_MISS_CHAR) THEN
245 l_astv_rec.scs_code := NULL;
246 END IF;
247 IF (l_astv_rec.object_version_number = OKC_API.G_MISS_NUM) THEN
248 l_astv_rec.object_version_number := NULL;
249 END IF;
250 IF (l_astv_rec.allowed_yn = OKC_API.G_MISS_CHAR) THEN
251 l_astv_rec.allowed_yn := NULL;
252 END IF;
253 IF (l_astv_rec.attribute_category = OKC_API.G_MISS_CHAR) THEN
254 l_astv_rec.attribute_category := NULL;
255 END IF;
256 IF (l_astv_rec.attribute1 = OKC_API.G_MISS_CHAR) THEN
257 l_astv_rec.attribute1 := NULL;
258 END IF;
259 IF (l_astv_rec.attribute2 = OKC_API.G_MISS_CHAR) THEN
260 l_astv_rec.attribute2 := NULL;
261 END IF;
262 IF (l_astv_rec.attribute3 = OKC_API.G_MISS_CHAR) THEN
263 l_astv_rec.attribute3 := NULL;
264 END IF;
265 IF (l_astv_rec.attribute4 = OKC_API.G_MISS_CHAR) THEN
266 l_astv_rec.attribute4 := NULL;
267 END IF;
268 IF (l_astv_rec.attribute5 = OKC_API.G_MISS_CHAR) THEN
269 l_astv_rec.attribute5 := NULL;
270 END IF;
271 IF (l_astv_rec.attribute6 = OKC_API.G_MISS_CHAR) THEN
272 l_astv_rec.attribute6 := NULL;
273 END IF;
274 IF (l_astv_rec.attribute7 = OKC_API.G_MISS_CHAR) THEN
275 l_astv_rec.attribute7 := NULL;
276 END IF;
277 IF (l_astv_rec.attribute8 = OKC_API.G_MISS_CHAR) THEN
278 l_astv_rec.attribute8 := NULL;
279 END IF;
280 IF (l_astv_rec.attribute9 = OKC_API.G_MISS_CHAR) THEN
281 l_astv_rec.attribute9 := NULL;
282 END IF;
283 IF (l_astv_rec.attribute10 = OKC_API.G_MISS_CHAR) THEN
284 l_astv_rec.attribute10 := NULL;
285 END IF;
286 IF (l_astv_rec.attribute11 = OKC_API.G_MISS_CHAR) THEN
287 l_astv_rec.attribute11 := NULL;
288 END IF;
289 IF (l_astv_rec.attribute12 = OKC_API.G_MISS_CHAR) THEN
290 l_astv_rec.attribute12 := NULL;
291 END IF;
292 IF (l_astv_rec.attribute13 = OKC_API.G_MISS_CHAR) THEN
293 l_astv_rec.attribute13 := NULL;
294 END IF;
295 IF (l_astv_rec.attribute14 = OKC_API.G_MISS_CHAR) THEN
296 l_astv_rec.attribute14 := NULL;
297 END IF;
298 IF (l_astv_rec.attribute15 = OKC_API.G_MISS_CHAR) THEN
299 l_astv_rec.attribute15 := NULL;
300 END IF;
301 IF (l_astv_rec.created_by = OKC_API.G_MISS_NUM) THEN
302 l_astv_rec.created_by := NULL;
303 END IF;
304 IF (l_astv_rec.creation_date = OKC_API.G_MISS_DATE) THEN
305 l_astv_rec.creation_date := NULL;
306 END IF;
307 IF (l_astv_rec.last_updated_by = OKC_API.G_MISS_NUM) THEN
308 l_astv_rec.last_updated_by := NULL;
309 END IF;
310 IF (l_astv_rec.last_update_date = OKC_API.G_MISS_DATE) THEN
311 l_astv_rec.last_update_date := NULL;
312 END IF;
313 IF (l_astv_rec.last_update_login = OKC_API.G_MISS_NUM) THEN
314 l_astv_rec.last_update_login := NULL;
315 END IF;
316 RETURN(l_astv_rec);
317 END null_out_defaults;
318 ---------------------------------------------------------------------------------------
319 --Attribute Level Validattion Procedures Starts(Modification on TAPI generated Code.)--
320 ---------------------------------------------------------------------------------------
321 ---------------------------------------------------------------------------
322 -- PROCEDURE Validate_id
323 ---------------------------------------------------------------------------
324 PROCEDURE validate_id(
325 p_astv_rec IN astv_rec_type,
326 x_return_status OUT NOCOPY VARCHAR2) IS
327 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
328 BEGIN
329 IF p_astv_rec.id = OKC_API.G_MISS_NUM OR
330 p_astv_rec.id IS NULL
331 THEN
332 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'id');
333 l_return_status := OKC_API.G_RET_STS_ERROR;
334 END IF;
335 x_return_status := l_return_status;
336 EXCEPTION
337 WHEN OTHERS THEN
338 -- store SQL error message on message stack for caller
339 OKC_API.set_message(G_APP_NAME, G_UNEXPECTED_ERROR,G_SQLCODE_TOKEN,SQLCODE,G_SQLERRM_TOKEN,SQLERRM);
340 -- notify caller of an UNEXPECTED error
341 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
342 END validate_id;
343
344 ---------------------------------------------------------------------------
345 -- PROCEDURE Validate_sts_code
346 ---------------------------------------------------------------------------
347 PROCEDURE validate_sts_code(
348 p_astv_rec IN astv_rec_type,
349 x_return_status OUT NOCOPY VARCHAR2) IS
350 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
351 BEGIN
352 IF p_astv_rec.sts_code = OKC_API.G_MISS_CHAR OR
353 p_astv_rec.sts_code IS NULL
354 THEN
355 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'sts_code');
356 l_return_status := OKC_API.G_RET_STS_ERROR;
357 END IF;
358 x_return_status := l_return_status;
359 EXCEPTION
360 WHEN OTHERS THEN
361 -- store SQL error message on message stack for caller
362 OKC_API.set_message(G_APP_NAME, G_UNEXPECTED_ERROR,G_SQLCODE_TOKEN,SQLCODE,G_SQLERRM_TOKEN,SQLERRM);
363 -- notify caller of an UNEXPECTED error
364 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
365 END validate_sts_code;
366
367 ---------------------------------------------------------------------------
368 -- PROCEDURE Validate_opn_code
369 ---------------------------------------------------------------------------
370 PROCEDURE validate_opn_code(
371 p_astv_rec IN astv_rec_type,
372 x_return_status OUT NOCOPY VARCHAR2) IS
373 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
374 BEGIN
375 IF p_astv_rec.opn_code = OKC_API.G_MISS_CHAR OR
376 p_astv_rec.opn_code IS NULL
377 THEN
378 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'opn_code');
379 l_return_status := OKC_API.G_RET_STS_ERROR;
380 END IF;
381 x_return_status := l_return_status;
382 EXCEPTION
383 WHEN OTHERS THEN
384 -- store SQL error message on message stack for caller
385 OKC_API.set_message(G_APP_NAME, G_UNEXPECTED_ERROR,G_SQLCODE_TOKEN,SQLCODE,G_SQLERRM_TOKEN,SQLERRM);
386 -- notify caller of an UNEXPECTED error
387 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
388 END validate_opn_code;
389
390 ---------------------------------------------------------------------------
391 -- PROCEDURE Validate_ste_code
392 ---------------------------------------------------------------------------
393 PROCEDURE validate_ste_code(
394 p_astv_rec IN astv_rec_type,
395 x_return_status OUT NOCOPY VARCHAR2) IS
396 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
397 BEGIN
398 IF p_astv_rec.ste_code = OKC_API.G_MISS_CHAR OR
402 l_return_status := OKC_API.G_RET_STS_ERROR;
399 p_astv_rec.ste_code IS NULL
400 THEN
401 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'ste_code');
403 END IF;
404 x_return_status := l_return_status;
405 EXCEPTION
406 WHEN OTHERS THEN
407 -- store SQL error message on message stack for caller
408 OKC_API.set_message(G_APP_NAME, G_UNEXPECTED_ERROR,G_SQLCODE_TOKEN,SQLCODE,G_SQLERRM_TOKEN,SQLERRM);
409 -- notify caller of an UNEXPECTED error
410 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
411 END validate_ste_code;
412
413 ---------------------------------------------------------------------------
414 -- PROCEDURE Validate_scs_code
415 ---------------------------------------------------------------------------
416 PROCEDURE validate_scs_code(
417 p_astv_rec IN astv_rec_type,
418 x_return_status OUT NOCOPY VARCHAR2) IS
419 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
420 BEGIN
421 IF p_astv_rec.scs_code = OKC_API.G_MISS_CHAR OR
422 p_astv_rec.scs_code IS NULL
423 THEN
424 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'scs_code');
425 l_return_status := OKC_API.G_RET_STS_ERROR;
426 END IF;
427 x_return_status := l_return_status;
428 EXCEPTION
429 WHEN OTHERS THEN
430 -- store SQL error message on message stack for caller
431 OKC_API.set_message(G_APP_NAME, G_UNEXPECTED_ERROR,G_SQLCODE_TOKEN,SQLCODE,G_SQLERRM_TOKEN,SQLERRM);
432 -- notify caller of an UNEXPECTED error
433 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
434 END validate_scs_code;
435
436 ---------------------------------------------------------------------------
437 -- PROCEDURE Validate_object_version_number
438 ---------------------------------------------------------------------------
439 PROCEDURE validate_object_version_number(
440 p_astv_rec IN astv_rec_type,
441 x_return_status OUT NOCOPY VARCHAR2) IS
442 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
443 BEGIN
444 IF p_astv_rec.object_version_number = OKC_API.G_MISS_NUM OR
445 p_astv_rec.object_version_number IS NULL
446 THEN
447 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE,G_COL_NAME_TOKEN,'object_version_number');
448 l_return_status := OKC_API.G_RET_STS_ERROR;
449 END IF;
450 x_return_status := l_return_status;
451 EXCEPTION
452 WHEN G_EXCEPTION_HALT_VALIDATION THEN
453 NULL;
454 WHEN OTHERS THEN
455 -- store SQL error message on message stack for caller
456 OKC_API.set_message(G_APP_NAME, G_UNEXPECTED_ERROR,G_SQLCODE_TOKEN,SQLCODE,G_SQLERRM_TOKEN,SQLERRM);
457 -- notify caller of an UNEXPECTED error
458 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
459 END validate_object_version_number;
460
461 ---------------------------------------------------------------------------
462 -- PROCEDURE Validate_allowed_yn
463 ---------------------------------------------------------------------------
464 PROCEDURE validate_allowed_yn(
465 p_astv_rec IN astv_rec_type,
466 x_return_status OUT NOCOPY VARCHAR2) IS
467 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
468 BEGIN
469 -- Check if allowed_yn is Not null, Y or N, and in upper case.
470 IF p_astv_rec.allowed_yn = OKC_API.G_MISS_CHAR OR
471 p_astv_rec.allowed_yn IS NULL THEN
472 OKC_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'allowed_yn');
473 x_return_status := OKC_API.G_RET_STS_ERROR;
474 RAISE G_EXCEPTION_HALT_VALIDATION;
475 END IF;
476
477 IF (UPPER(p_astv_rec.allowed_yn) IN ('Y', 'N')) THEN
478 IF p_astv_rec.allowed_yn <> UPPER(p_astv_rec.allowed_yn) THEN
479 OKC_API.set_message(G_APP_NAME, G_UPPERCASE_REQUIRED, G_COL_NAME_TOKEN, 'allowed_yn');
480 l_return_status := OKC_API.G_RET_STS_ERROR;
481 END IF;
482 ELSE
483 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE, G_COL_NAME_TOKEN, 'allowed_yn');
484 l_return_status := OKC_API.G_RET_STS_ERROR;
485 END IF;
486 x_return_status := l_return_status;
487
488 EXCEPTION
489 WHEN G_EXCEPTION_HALT_VALIDATION THEN
490 NULL;
491 WHEN OTHERS THEN
492 -- store SQL error message on message stack for caller
493 OKC_API.set_message(G_APP_NAME, G_UNEXPECTED_ERROR,G_SQLCODE_TOKEN,SQLCODE,G_SQLERRM_TOKEN,SQLERRM);
494 -- notify caller of an UNEXPECTED error
495 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
496
497 END validate_allowed_yn;
498
499 ---------------------------------------------------------------------------
500 -- PROCEDURE Validate_Attributes
501 ---------------------------------------------------------------------------
502 -------------------------------------------
503 -- Validate_Attributes for:OKC_ASSENTS_V --
504 -------------------------------------------
505 FUNCTION Validate_Attributes (
506 p_astv_rec IN astv_rec_type
507 ) RETURN VARCHAR2 IS
508 x_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
509 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
510 BEGIN
511 ---------------------------------------------------------------------------------------
515 IF (l_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
512 --Attribute Level Validation Procedure Calls Starts(Modification on TAPI generated Code.)--
513 ---------------------------------------------------------------------------------------
514 VALIDATE_id(p_astv_rec, l_return_status);
516 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN -- need to leave
517 x_return_status := l_return_status;
518 RAISE G_EXCEPTION_HALT_VALIDATION;
519 ELSE
520 x_return_status := l_return_status; -- record that there was an error
521 END IF;
522 END IF;
523
524 VALIDATE_sts_code(p_astv_rec, l_return_status);
525 IF (l_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
526 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN -- need to leave
527 x_return_status := l_return_status;
528 RAISE G_EXCEPTION_HALT_VALIDATION;
529 ELSE
530 x_return_status := l_return_status; -- record that there was an error
531 END IF;
532 END IF;
533
534 VALIDATE_opn_code(p_astv_rec,l_return_status);
535 IF (l_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
536 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN -- need to leave
537 x_return_status := l_return_status;
538 RAISE G_EXCEPTION_HALT_VALIDATION;
539 ELSE
540 x_return_status := l_return_status; -- record that there was an error
541 END IF;
542 END IF;
543
544 VALIDATE_ste_code(p_astv_rec,l_return_status);
545 IF (l_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
546 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN -- need to leave
547 x_return_status := l_return_status;
548 RAISE G_EXCEPTION_HALT_VALIDATION;
549 ELSE
550 x_return_status := l_return_status; -- record that there was an error
551 END IF;
552 END IF;
553
554 VALIDATE_scs_code(p_astv_rec,l_return_status);
555 IF (l_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
556 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN -- need to leave
557 x_return_status := l_return_status;
558 RAISE G_EXCEPTION_HALT_VALIDATION;
559 ELSE
560 x_return_status := l_return_status; -- record that there was an error
561 END IF;
562 END IF;
563
564 VALIDATE_object_version_number(p_astv_rec,l_return_status);
565 IF (l_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
566 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN -- need to leave
567 x_return_status := l_return_status;
568 RAISE G_EXCEPTION_HALT_VALIDATION;
569 ELSE
570 x_return_status := l_return_status; -- record that there was an error
571 END IF;
572 END IF;
573
574 VALIDATE_allowed_yn(p_astv_rec,l_return_status);
575 IF (l_return_status <> OKC_API.G_RET_STS_SUCCESS) THEN
576 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN -- need to leave
577 x_return_status := l_return_status;
578 RAISE G_EXCEPTION_HALT_VALIDATION;
579 ELSE
580 x_return_status := l_return_status; -- record that there was an error
581 END IF;
582 END IF;
583
584 RETURN(x_return_status);
585
586 EXCEPTION
587 WHEN G_EXCEPTION_HALT_VALIDATION THEN
588 return(x_return_status);
589 WHEN OTHERS THEN
590 -- store SQL error message on message stack for caller
591 OKC_API.set_message(G_APP_NAME, G_UNEXPECTED_ERROR,G_SQLCODE_TOKEN,SQLCODE,G_SQLERRM_TOKEN,SQLERRM);
592 -- notify caller of an UNEXPECTED error
593 x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
594 return(x_return_status);
595 ---------------------------------------------------------------------------------------
596 --Attribute Level Validation Procedure Calls Ends(Modification on TAPI generated Code.)--
597 ---------------------------------------------------------------------------------------
598
599 END Validate_Attributes;
600
601 ---------------------------------------------------------------------------
602 -- PROCEDURE Validate_Record
603 ---------------------------------------------------------------------------
604 ---------------------------------------
605 -- Validate_Record for:OKC_ASSENTS_V --
606 ---------------------------------------
607 FUNCTION Validate_Record (
608 p_astv_rec IN astv_rec_type
609 ) RETURN VARCHAR2 IS
610 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
611 ------------------------------------
612 -- FUNCTION validate_foreign_keys --
613 ------------------------------------
614 FUNCTION validate_foreign_keys (
615 p_astv_rec IN astv_rec_type
616 ) RETURN VARCHAR2 IS
617 item_not_found_error EXCEPTION;
618 l_dummy VARCHAR2(1);
619 CURSOR okc_stsv_pk_csr (p_code IN VARCHAR2) IS
620 SELECT 'x'
621 FROM Okc_Statuses_V
622 WHERE okc_statuses_v.code = p_code;
623 CURSOR okc_iopv_pk_csr (p_opn_code IN VARCHAR2,
624 p_ste_code IN VARCHAR2) IS
625 SELECT 'x'
626 FROM Okc_Included_Operations_V
627 WHERE okc_included_operations_v.ste_code = p_ste_code
628 AND okc_included_operations_v.opn_code = p_opn_code;
632 WHERE okc_subclasses_v.code = p_code;
629 CURSOR okc_scsv_pk_csr (p_code IN VARCHAR2) IS
630 SELECT 'x'
631 FROM Okc_Subclasses_V
633 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
634 l_row_notfound BOOLEAN := TRUE;
635 BEGIN
636 IF (p_astv_rec.STS_CODE IS NOT NULL)
637 THEN
638 OPEN okc_stsv_pk_csr(p_astv_rec.STS_CODE);
639 FETCH okc_stsv_pk_csr INTO l_dummy;
640 l_row_notfound := okc_stsv_pk_csr%NOTFOUND;
641 CLOSE okc_stsv_pk_csr;
642 IF (l_row_notfound) THEN
643 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE, G_COL_NAME_TOKEN, 'STS_CODE');
644 RAISE item_not_found_error;
645 END IF;
646 END IF;
647 IF ((p_astv_rec.OPN_CODE IS NOT NULL) AND
648 (p_astv_rec.STE_CODE IS NOT NULL))
649 THEN
650 OPEN okc_iopv_pk_csr(p_astv_rec.OPN_CODE,
651 p_astv_rec.STE_CODE);
652 FETCH okc_iopv_pk_csr INTO l_dummy;
653 l_row_notfound := okc_iopv_pk_csr%NOTFOUND;
654 CLOSE okc_iopv_pk_csr;
655 IF (l_row_notfound) THEN
656 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE, G_COL_NAME_TOKEN, 'OPN_CODE');
657 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE, G_COL_NAME_TOKEN, 'STE_CODE');
658 RAISE item_not_found_error;
659 END IF;
660 END IF;
661 IF (p_astv_rec.SCS_CODE IS NOT NULL)
662 THEN
663 OPEN okc_scsv_pk_csr(p_astv_rec.SCS_CODE);
664 FETCH okc_scsv_pk_csr INTO l_dummy;
665 l_row_notfound := okc_scsv_pk_csr%NOTFOUND;
666 CLOSE okc_scsv_pk_csr;
667 IF (l_row_notfound) THEN
668 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE, G_COL_NAME_TOKEN, 'SCS_CODE');
669 RAISE item_not_found_error;
670 END IF;
671 END IF;
672 RETURN (l_return_status);
673 EXCEPTION
674 WHEN item_not_found_error THEN
675 l_return_status := OKC_API.G_RET_STS_ERROR;
676 RETURN (l_return_status);
677 END validate_foreign_keys;
678 ------------------------------------
679 -- FUNCTION validate_unique_keys --
680 ------------------------------------
681 FUNCTION validate_unique_keys (
682 p_astv_rec IN astv_rec_type
683 ) RETURN VARCHAR2 IS
684 unique_key_error EXCEPTION;
685 l_dummy VARCHAR2(1);
686 l_row_found BOOLEAN;
687 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
688 CURSOR c1 (p_id IN okc_assents_v.id%TYPE,
689 p_scs_code IN okc_assents_v.scs_code%TYPE,
690 p_sts_code IN okc_assents_v.sts_code%TYPE,
691 p_opn_code IN okc_assents_v.opn_code%TYPE,
692 p_ste_code IN okc_assents_v.ste_code%TYPE) IS
693 SELECT 'x'
694 FROM Okc_Assents_V
695 WHERE scs_code = p_scs_code
696 AND sts_code = p_sts_code
697 AND opn_code = p_opn_code
698 AND ste_code = p_ste_code
699 AND ((p_id IS NULL)
700 OR (p_id IS NOT NULL
701 AND id <> p_id));
702 BEGIN
703 OPEN c1(p_astv_rec.id,
704 p_astv_rec.scs_code,
705 p_astv_rec.sts_code,
706 p_astv_rec.opn_code,
707 p_astv_rec.ste_code);
708 FETCH c1 INTO l_dummy;
709 l_row_found := c1%FOUND;
710 CLOSE c1;
711 IF (l_row_found) THEN
712 OKC_API.set_message(G_APP_NAME, 'OKC_DUPLICATE_STS_OPN');
713 --old code OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE, G_COL_NAME_TOKEN, 'SCS_CODE');
714 --old code OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE, G_COL_NAME_TOKEN, 'STS_CODE');
715 --old code OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE, G_COL_NAME_TOKEN, 'OPN_CODE');
716 --old code OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE, G_COL_NAME_TOKEN, 'STE_CODE');
717 RAISE unique_key_error;
718 END IF;
719 RETURN (l_return_status);
720 EXCEPTION
721 WHEN unique_key_error THEN
722 l_return_status := OKC_API.G_RET_STS_ERROR;
723 RETURN (l_return_status);
724 END validate_unique_keys;
725 BEGIN
726 l_return_status := validate_foreign_keys (p_astv_rec);
727 IF l_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
728 raise G_EXCEPTION_HALT_VALIDATION;
729 END IF;
730 l_return_status := validate_unique_keys (p_astv_rec);
731 IF l_return_status <> OKC_API.G_RET_STS_SUCCESS THEN
732 raise G_EXCEPTION_HALT_VALIDATION;
733 END IF;
734 RETURN (l_return_status);
735 EXCEPTION
736 WHEN G_EXCEPTION_HALT_VALIDATION THEN
737 RETURN(l_return_status);
738 WHEN OTHERS THEN
739 OKC_API.set_message(p_app_name => g_app_name,
740 p_msg_name => g_unexpected_error,
741 p_token1 => g_sqlcode_token,
742 p_token1_value => sqlcode,
743 p_token2 => g_sqlerrm_token,
744 p_token2_value => sqlerrm);
745 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
746 RETURN(l_return_status);
747 END Validate_Record;
748
752 PROCEDURE migrate (
749 ---------------------------------------------------------------------------
750 -- PROCEDURE Migrate
751 ---------------------------------------------------------------------------
753 p_from IN astv_rec_type,
754 p_to OUT NOCOPY ast_rec_type
755 ) IS
756 BEGIN
757 p_to.id := p_from.id;
758 p_to.sts_code := p_from.sts_code;
759 p_to.opn_code := p_from.opn_code;
760 p_to.ste_code := p_from.ste_code;
761 p_to.scs_code := p_from.scs_code;
762 p_to.allowed_yn := p_from.allowed_yn;
763 p_to.object_version_number := p_from.object_version_number;
764 p_to.created_by := p_from.created_by;
765 p_to.creation_date := p_from.creation_date;
766 p_to.last_updated_by := p_from.last_updated_by;
767 p_to.last_update_date := p_from.last_update_date;
768 p_to.last_update_login := p_from.last_update_login;
769 p_to.attribute_category := p_from.attribute_category;
770 p_to.attribute1 := p_from.attribute1;
771 p_to.attribute2 := p_from.attribute2;
772 p_to.attribute3 := p_from.attribute3;
773 p_to.attribute4 := p_from.attribute4;
774 p_to.attribute5 := p_from.attribute5;
775 p_to.attribute6 := p_from.attribute6;
776 p_to.attribute7 := p_from.attribute7;
777 p_to.attribute8 := p_from.attribute8;
778 p_to.attribute9 := p_from.attribute9;
779 p_to.attribute10 := p_from.attribute10;
780 p_to.attribute11 := p_from.attribute11;
781 p_to.attribute12 := p_from.attribute12;
782 p_to.attribute13 := p_from.attribute13;
783 p_to.attribute14 := p_from.attribute14;
784 p_to.attribute15 := p_from.attribute15;
785 END migrate;
786 PROCEDURE migrate (
787 p_from IN ast_rec_type,
788 p_to OUT NOCOPY astv_rec_type
789 ) IS
790 BEGIN
791 p_to.id := p_from.id;
792 p_to.sts_code := p_from.sts_code;
793 p_to.opn_code := p_from.opn_code;
794 p_to.ste_code := p_from.ste_code;
795 p_to.scs_code := p_from.scs_code;
796 p_to.allowed_yn := p_from.allowed_yn;
797 p_to.object_version_number := p_from.object_version_number;
798 p_to.created_by := p_from.created_by;
799 p_to.creation_date := p_from.creation_date;
800 p_to.last_updated_by := p_from.last_updated_by;
801 p_to.last_update_date := p_from.last_update_date;
802 p_to.last_update_login := p_from.last_update_login;
803 p_to.attribute_category := p_from.attribute_category;
804 p_to.attribute1 := p_from.attribute1;
805 p_to.attribute2 := p_from.attribute2;
806 p_to.attribute3 := p_from.attribute3;
807 p_to.attribute4 := p_from.attribute4;
808 p_to.attribute5 := p_from.attribute5;
809 p_to.attribute6 := p_from.attribute6;
810 p_to.attribute7 := p_from.attribute7;
811 p_to.attribute8 := p_from.attribute8;
812 p_to.attribute9 := p_from.attribute9;
813 p_to.attribute10 := p_from.attribute10;
814 p_to.attribute11 := p_from.attribute11;
815 p_to.attribute12 := p_from.attribute12;
816 p_to.attribute13 := p_from.attribute13;
817 p_to.attribute14 := p_from.attribute14;
818 p_to.attribute15 := p_from.attribute15;
819 END migrate;
820
821 ---------------------------------------------------------------------------
822 -- PROCEDURE validate_row
823 ---------------------------------------------------------------------------
824 ------------------------------------
825 -- validate_row for:OKC_ASSENTS_V --
826 ------------------------------------
827 PROCEDURE validate_row(
828 p_api_version IN NUMBER,
829 p_init_msg_list IN VARCHAR2 ,
830 x_return_status OUT NOCOPY VARCHAR2,
831 x_msg_count OUT NOCOPY NUMBER,
832 x_msg_data OUT NOCOPY VARCHAR2,
833 p_astv_rec IN astv_rec_type) IS
834
835 l_api_version CONSTANT NUMBER := 1;
836 l_api_name CONSTANT VARCHAR2(30) := 'V_validate_row';
837 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
838 l_astv_rec astv_rec_type := p_astv_rec;
839 l_ast_rec ast_rec_type;
840 BEGIN
841 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
842 G_PKG_NAME,
843 p_init_msg_list,
844 l_api_version,
845 p_api_version,
846 '_PVT',
847 x_return_status);
848 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
849 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
850 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
851 RAISE OKC_API.G_EXCEPTION_ERROR;
852 END IF;
853 --- Validate all non-missing attributes (Item Level Validation)
854 l_return_status := Validate_Attributes(l_astv_rec);
855 --- If any errors happen abort API
856 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
857 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
858 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
859 RAISE OKC_API.G_EXCEPTION_ERROR;
860 END IF;
861 l_return_status := Validate_Record(l_astv_rec);
862 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
866 END IF;
863 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
864 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
865 RAISE OKC_API.G_EXCEPTION_ERROR;
867 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
868 EXCEPTION
869 WHEN OKC_API.G_EXCEPTION_ERROR THEN
870 x_return_status := OKC_API.HANDLE_EXCEPTIONS
871 (
872 l_api_name,
873 G_PKG_NAME,
874 'OKC_API.G_RET_STS_ERROR',
875 x_msg_count,
876 x_msg_data,
877 '_PVT'
878 );
879 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
880 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
881 (
882 l_api_name,
883 G_PKG_NAME,
884 'OKC_API.G_RET_STS_UNEXP_ERROR',
885 x_msg_count,
886 x_msg_data,
887 '_PVT'
888 );
889 WHEN OTHERS THEN
890 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
891 (
892 l_api_name,
893 G_PKG_NAME,
894 'OTHERS',
895 x_msg_count,
896 x_msg_data,
897 '_PVT'
898 );
899 END validate_row;
900 ------------------------------------------
901 -- PL/SQL TBL validate_row for:ASTV_TBL --
902 ------------------------------------------
903 PROCEDURE validate_row(
904 p_api_version IN NUMBER,
905 p_init_msg_list IN VARCHAR2 ,
906 x_return_status OUT NOCOPY VARCHAR2,
907 x_msg_count OUT NOCOPY NUMBER,
908 x_msg_data OUT NOCOPY VARCHAR2,
909 p_astv_tbl IN astv_tbl_type) IS
910
911 l_api_version CONSTANT NUMBER := 1;
912 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_validate_row';
913 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
914 i NUMBER := 0;
915 BEGIN
916 OKC_API.init_msg_list(p_init_msg_list);
917 -- Make sure PL/SQL table has records in it before passing
918 IF (p_astv_tbl.COUNT > 0) THEN
919 i := p_astv_tbl.FIRST;
920 LOOP
921 validate_row (
922 p_api_version => p_api_version,
923 p_init_msg_list => OKC_API.G_FALSE,
924 x_return_status => x_return_status,
925 x_msg_count => x_msg_count,
926 x_msg_data => x_msg_data,
927 p_astv_rec => p_astv_tbl(i));
928 EXIT WHEN (i = p_astv_tbl.LAST);
929 i := p_astv_tbl.NEXT(i);
930 END LOOP;
931 END IF;
932 EXCEPTION
933 WHEN OKC_API.G_EXCEPTION_ERROR THEN
934 x_return_status := OKC_API.HANDLE_EXCEPTIONS
935 (
936 l_api_name,
937 G_PKG_NAME,
938 'OKC_API.G_RET_STS_ERROR',
939 x_msg_count,
940 x_msg_data,
941 '_PVT'
942 );
943 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
944 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
945 (
946 l_api_name,
947 G_PKG_NAME,
948 'OKC_API.G_RET_STS_UNEXP_ERROR',
949 x_msg_count,
950 x_msg_data,
951 '_PVT'
952 );
953 WHEN OTHERS THEN
954 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
955 (
956 l_api_name,
957 G_PKG_NAME,
958 'OTHERS',
959 x_msg_count,
960 x_msg_data,
961 '_PVT'
962 );
963 END validate_row;
964
965 ---------------------------------------------------------------------------
966 -- PROCEDURE insert_row
967 ---------------------------------------------------------------------------
968 --------------------------------
969 -- insert_row for:OKC_ASSENTS --
970 --------------------------------
971 PROCEDURE insert_row(
972 p_init_msg_list IN VARCHAR2 ,
973 x_return_status OUT NOCOPY VARCHAR2,
974 x_msg_count OUT NOCOPY NUMBER,
975 x_msg_data OUT NOCOPY VARCHAR2,
976 p_ast_rec IN ast_rec_type,
977 x_ast_rec OUT NOCOPY ast_rec_type) IS
978
979 l_api_version CONSTANT NUMBER := 1;
980 l_api_name CONSTANT VARCHAR2(30) := 'ASSENTS_insert_row';
981 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
982 l_ast_rec ast_rec_type := p_ast_rec;
983 l_def_ast_rec ast_rec_type;
984 ------------------------------------
985 -- Set_Attributes for:OKC_ASSENTS --
986 ------------------------------------
987 FUNCTION Set_Attributes (
988 p_ast_rec IN ast_rec_type,
989 x_ast_rec OUT NOCOPY ast_rec_type
990 ) RETURN VARCHAR2 IS
991 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
992 BEGIN
993 x_ast_rec := p_ast_rec;
994 RETURN(l_return_status);
995 END Set_Attributes;
996 BEGIN
997 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
998 p_init_msg_list,
1002 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
999 '_PVT',
1000 x_return_status);
1001 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1003 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1004 RAISE OKC_API.G_EXCEPTION_ERROR;
1005 END IF;
1006 --- Setting item attributes
1007 l_return_status := Set_Attributes(
1008 p_ast_rec, -- IN
1009 l_ast_rec); -- OUT
1010 --- If any errors happen abort API
1011 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1012 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1013 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1014 RAISE OKC_API.G_EXCEPTION_ERROR;
1015 END IF;
1016 INSERT INTO OKC_ASSENTS(
1017 id,
1018 sts_code,
1019 opn_code,
1020 ste_code,
1021 scs_code,
1022 allowed_yn,
1023 object_version_number,
1024 created_by,
1025 creation_date,
1026 last_updated_by,
1027 last_update_date,
1028 last_update_login,
1029 attribute_category,
1030 attribute1,
1031 attribute2,
1032 attribute3,
1033 attribute4,
1034 attribute5,
1035 attribute6,
1036 attribute7,
1037 attribute8,
1038 attribute9,
1039 attribute10,
1040 attribute11,
1041 attribute12,
1042 attribute13,
1043 attribute14,
1044 attribute15)
1045 VALUES (
1046 l_ast_rec.id,
1047 l_ast_rec.sts_code,
1048 l_ast_rec.opn_code,
1049 l_ast_rec.ste_code,
1050 l_ast_rec.scs_code,
1051 l_ast_rec.allowed_yn,
1052 l_ast_rec.object_version_number,
1053 l_ast_rec.created_by,
1054 l_ast_rec.creation_date,
1055 l_ast_rec.last_updated_by,
1056 l_ast_rec.last_update_date,
1057 l_ast_rec.last_update_login,
1058 l_ast_rec.attribute_category,
1059 l_ast_rec.attribute1,
1060 l_ast_rec.attribute2,
1061 l_ast_rec.attribute3,
1062 l_ast_rec.attribute4,
1063 l_ast_rec.attribute5,
1064 l_ast_rec.attribute6,
1065 l_ast_rec.attribute7,
1066 l_ast_rec.attribute8,
1067 l_ast_rec.attribute9,
1068 l_ast_rec.attribute10,
1069 l_ast_rec.attribute11,
1070 l_ast_rec.attribute12,
1071 l_ast_rec.attribute13,
1072 l_ast_rec.attribute14,
1073 l_ast_rec.attribute15);
1074 -- Set OUT values
1075 x_ast_rec := l_ast_rec;
1076 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1077 EXCEPTION
1078 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1079 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1080 (
1081 l_api_name,
1082 G_PKG_NAME,
1083 'OKC_API.G_RET_STS_ERROR',
1084 x_msg_count,
1085 x_msg_data,
1086 '_PVT'
1087 );
1088 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1089 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1090 (
1091 l_api_name,
1092 G_PKG_NAME,
1093 'OKC_API.G_RET_STS_UNEXP_ERROR',
1094 x_msg_count,
1095 x_msg_data,
1096 '_PVT'
1097 );
1098 WHEN OTHERS THEN
1099 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1100 (
1101 l_api_name,
1102 G_PKG_NAME,
1103 'OTHERS',
1104 x_msg_count,
1105 x_msg_data,
1106 '_PVT'
1107 );
1108 END insert_row;
1109 ----------------------------------
1110 -- insert_row for:OKC_ASSENTS_V --
1111 ----------------------------------
1112 PROCEDURE insert_row(
1113 p_api_version IN NUMBER,
1114 p_init_msg_list IN VARCHAR2 ,
1115 x_return_status OUT NOCOPY VARCHAR2,
1116 x_msg_count OUT NOCOPY NUMBER,
1117 x_msg_data OUT NOCOPY VARCHAR2,
1118 p_astv_rec IN astv_rec_type,
1119 x_astv_rec OUT NOCOPY astv_rec_type) IS
1120
1121 l_api_version CONSTANT NUMBER := 1;
1122 l_api_name CONSTANT VARCHAR2(30) := 'V_insert_row';
1123 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1124 l_astv_rec astv_rec_type;
1125 l_def_astv_rec astv_rec_type;
1126 l_ast_rec ast_rec_type;
1127 lx_ast_rec ast_rec_type;
1128 -------------------------------
1129 -- FUNCTION fill_who_columns --
1130 -------------------------------
1131 FUNCTION fill_who_columns (
1132 p_astv_rec IN astv_rec_type
1133 ) RETURN astv_rec_type IS
1134 l_astv_rec astv_rec_type := p_astv_rec;
1135 BEGIN
1136 l_astv_rec.CREATION_DATE := SYSDATE;
1137 l_astv_rec.CREATED_BY := FND_GLOBAL.USER_ID;
1138 l_astv_rec.LAST_UPDATE_DATE := l_astv_rec.CREATION_DATE;
1139 l_astv_rec.LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
1140 l_astv_rec.LAST_UPDATE_LOGIN := FND_GLOBAL.LOGIN_ID;
1144 -- Set_Attributes for:OKC_ASSENTS_V --
1141 RETURN(l_astv_rec);
1142 END fill_who_columns;
1143 --------------------------------------
1145 --------------------------------------
1146 FUNCTION Set_Attributes (
1147 p_astv_rec IN astv_rec_type,
1148 x_astv_rec OUT NOCOPY astv_rec_type
1149 ) RETURN VARCHAR2 IS
1150 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1151 BEGIN
1152 x_astv_rec := p_astv_rec;
1153 x_astv_rec.OBJECT_VERSION_NUMBER := 1;
1154 RETURN(l_return_status);
1155 END Set_Attributes;
1156 BEGIN
1157 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1158 G_PKG_NAME,
1159 p_init_msg_list,
1160 l_api_version,
1161 p_api_version,
1162 '_PVT',
1163 x_return_status);
1164 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1165 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1166 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1167 RAISE OKC_API.G_EXCEPTION_ERROR;
1168 END IF;
1169 l_astv_rec := null_out_defaults(p_astv_rec);
1170 -- Set primary key value
1171 l_astv_rec.ID := get_seq_id;
1172 --- Setting item attributes
1173 l_return_status := Set_Attributes(
1174 l_astv_rec, -- IN
1175 l_def_astv_rec); -- OUT
1176 --- If any errors happen abort API
1177 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1178 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1179 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1180 RAISE OKC_API.G_EXCEPTION_ERROR;
1181 END IF;
1182 l_def_astv_rec := fill_who_columns(l_def_astv_rec);
1183 --- Validate all non-missing attributes (Item Level Validation)
1184 l_return_status := Validate_Attributes(l_def_astv_rec);
1185 --- If any errors happen abort API
1186 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1187 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1188 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1189 RAISE OKC_API.G_EXCEPTION_ERROR;
1190 END IF;
1191 l_return_status := Validate_Record(l_def_astv_rec);
1192 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1193 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1194 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1195 RAISE OKC_API.G_EXCEPTION_ERROR;
1196 END IF;
1197 --------------------------------------
1198 -- Move VIEW record to "Child" records
1199 --------------------------------------
1200 migrate(l_def_astv_rec, l_ast_rec);
1201 --------------------------------------------
1202 -- Call the INSERT_ROW for each child record
1203 --------------------------------------------
1204 insert_row(
1205 p_init_msg_list,
1206 x_return_status,
1207 x_msg_count,
1208 x_msg_data,
1209 l_ast_rec,
1210 lx_ast_rec
1211 );
1212 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1213 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1214 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
1215 RAISE OKC_API.G_EXCEPTION_ERROR;
1216 END IF;
1217 migrate(lx_ast_rec, l_def_astv_rec);
1218 -- Set OUT values
1219 x_astv_rec := l_def_astv_rec;
1220 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1221 EXCEPTION
1222 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1223 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1224 (
1225 l_api_name,
1226 G_PKG_NAME,
1227 'OKC_API.G_RET_STS_ERROR',
1228 x_msg_count,
1229 x_msg_data,
1230 '_PVT'
1231 );
1232 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1233 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1234 (
1235 l_api_name,
1236 G_PKG_NAME,
1237 'OKC_API.G_RET_STS_UNEXP_ERROR',
1238 x_msg_count,
1239 x_msg_data,
1240 '_PVT'
1241 );
1242 WHEN OTHERS THEN
1243 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1244 (
1245 l_api_name,
1246 G_PKG_NAME,
1247 'OTHERS',
1248 x_msg_count,
1249 x_msg_data,
1250 '_PVT'
1251 );
1252 END insert_row;
1253 ----------------------------------------
1254 -- PL/SQL TBL insert_row for:ASTV_TBL --
1255 ----------------------------------------
1256 PROCEDURE insert_row(
1257 p_api_version IN NUMBER,
1258 p_init_msg_list IN VARCHAR2 ,
1259 x_return_status OUT NOCOPY VARCHAR2,
1260 x_msg_count OUT NOCOPY NUMBER,
1261 x_msg_data OUT NOCOPY VARCHAR2,
1262 p_astv_tbl IN astv_tbl_type,
1263 x_astv_tbl OUT NOCOPY astv_tbl_type) IS
1264
1265 l_api_version CONSTANT NUMBER := 1;
1266 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_insert_row';
1267 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1268 i NUMBER := 0;
1272 IF (p_astv_tbl.COUNT > 0) THEN
1269 BEGIN
1270 OKC_API.init_msg_list(p_init_msg_list);
1271 -- Make sure PL/SQL table has records in it before passing
1273 i := p_astv_tbl.FIRST;
1274 LOOP
1275 insert_row (
1276 p_api_version => p_api_version,
1277 p_init_msg_list => OKC_API.G_FALSE,
1278 x_return_status => x_return_status,
1279 x_msg_count => x_msg_count,
1280 x_msg_data => x_msg_data,
1281 p_astv_rec => p_astv_tbl(i),
1282 x_astv_rec => x_astv_tbl(i));
1283 EXIT WHEN (i = p_astv_tbl.LAST);
1284 i := p_astv_tbl.NEXT(i);
1285 END LOOP;
1286 END IF;
1287 EXCEPTION
1288 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1289 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1290 (
1291 l_api_name,
1292 G_PKG_NAME,
1293 'OKC_API.G_RET_STS_ERROR',
1294 x_msg_count,
1295 x_msg_data,
1296 '_PVT'
1297 );
1298 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1299 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1300 (
1301 l_api_name,
1302 G_PKG_NAME,
1303 'OKC_API.G_RET_STS_UNEXP_ERROR',
1304 x_msg_count,
1305 x_msg_data,
1306 '_PVT'
1307 );
1308 WHEN OTHERS THEN
1309 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1310 (
1311 l_api_name,
1312 G_PKG_NAME,
1313 'OTHERS',
1314 x_msg_count,
1315 x_msg_data,
1316 '_PVT'
1317 );
1318 END insert_row;
1319
1320 ---------------------------------------------------------------------------
1321 -- PROCEDURE lock_row
1322 ---------------------------------------------------------------------------
1323 ------------------------------
1324 -- lock_row for:OKC_ASSENTS --
1325 ------------------------------
1326 PROCEDURE lock_row(
1327 p_init_msg_list IN VARCHAR2 ,
1328 x_return_status OUT NOCOPY VARCHAR2,
1329 x_msg_count OUT NOCOPY NUMBER,
1330 x_msg_data OUT NOCOPY VARCHAR2,
1331 p_ast_rec IN ast_rec_type) IS
1332
1333 E_Resource_Busy EXCEPTION;
1334 PRAGMA EXCEPTION_INIT(E_Resource_Busy, -00054);
1335 CURSOR lock_csr (p_ast_rec IN ast_rec_type) IS
1336 SELECT OBJECT_VERSION_NUMBER
1337 FROM OKC_ASSENTS
1338 WHERE ID = p_ast_rec.id
1339 AND OBJECT_VERSION_NUMBER = p_ast_rec.object_version_number
1340 FOR UPDATE OF OBJECT_VERSION_NUMBER NOWAIT;
1341
1342 CURSOR lchk_csr (p_ast_rec IN ast_rec_type) IS
1343 SELECT OBJECT_VERSION_NUMBER
1344 FROM OKC_ASSENTS
1345 WHERE ID = p_ast_rec.id;
1346 l_api_version CONSTANT NUMBER := 1;
1347 l_api_name CONSTANT VARCHAR2(30) := 'ASSENTS_lock_row';
1348 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1349 l_object_version_number OKC_ASSENTS.OBJECT_VERSION_NUMBER%TYPE;
1350 lc_object_version_number OKC_ASSENTS.OBJECT_VERSION_NUMBER%TYPE;
1351 l_row_notfound BOOLEAN := FALSE;
1352 lc_row_notfound BOOLEAN := FALSE;
1353 BEGIN
1354 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1355 p_init_msg_list,
1356 '_PVT',
1357 x_return_status);
1358 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1359 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1360 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1361 RAISE OKC_API.G_EXCEPTION_ERROR;
1362 END IF;
1363 BEGIN
1364 OPEN lock_csr(p_ast_rec);
1365 FETCH lock_csr INTO l_object_version_number;
1366 l_row_notfound := lock_csr%NOTFOUND;
1367 CLOSE lock_csr;
1368 EXCEPTION
1369 WHEN E_Resource_Busy THEN
1370 IF (lock_csr%ISOPEN) THEN
1371 CLOSE lock_csr;
1372 END IF;
1373 OKC_API.set_message(G_FND_APP,G_FORM_UNABLE_TO_RESERVE_REC);
1374 RAISE APP_EXCEPTIONS.RECORD_LOCK_EXCEPTION;
1375 END;
1376
1377 IF ( l_row_notfound ) THEN
1378 OPEN lchk_csr(p_ast_rec);
1379 FETCH lchk_csr INTO lc_object_version_number;
1380 lc_row_notfound := lchk_csr%NOTFOUND;
1381 CLOSE lchk_csr;
1382 END IF;
1383 IF (lc_row_notfound) THEN
1384 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_DELETED);
1385 RAISE OKC_API.G_EXCEPTION_ERROR;
1386 ELSIF lc_object_version_number > p_ast_rec.object_version_number THEN
1387 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
1388 RAISE OKC_API.G_EXCEPTION_ERROR;
1389 ELSIF lc_object_version_number <> p_ast_rec.object_version_number THEN
1390 OKC_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
1391 RAISE OKC_API.G_EXCEPTION_ERROR;
1392 ELSIF lc_object_version_number = -1 THEN
1393 OKC_API.set_message(G_APP_NAME,G_RECORD_LOGICALLY_DELETED);
1394 RAISE OKC_API.G_EXCEPTION_ERROR;
1395 END IF;
1396 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1397 EXCEPTION
1401 l_api_name,
1398 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1399 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1400 (
1402 G_PKG_NAME,
1403 'OKC_API.G_RET_STS_ERROR',
1404 x_msg_count,
1405 x_msg_data,
1406 '_PVT'
1407 );
1408 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1409 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1410 (
1411 l_api_name,
1412 G_PKG_NAME,
1413 'OKC_API.G_RET_STS_UNEXP_ERROR',
1414 x_msg_count,
1415 x_msg_data,
1416 '_PVT'
1417 );
1418 WHEN OTHERS THEN
1419 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1420 (
1421 l_api_name,
1422 G_PKG_NAME,
1423 'OTHERS',
1424 x_msg_count,
1425 x_msg_data,
1426 '_PVT'
1427 );
1428 END lock_row;
1429 --------------------------------
1430 -- lock_row for:OKC_ASSENTS_V --
1431 --------------------------------
1432 PROCEDURE lock_row(
1433 p_api_version IN NUMBER,
1434 p_init_msg_list IN VARCHAR2 ,
1435 x_return_status OUT NOCOPY VARCHAR2,
1436 x_msg_count OUT NOCOPY NUMBER,
1437 x_msg_data OUT NOCOPY VARCHAR2,
1438 p_astv_rec IN astv_rec_type) IS
1439
1440 l_api_version CONSTANT NUMBER := 1;
1441 l_api_name CONSTANT VARCHAR2(30) := 'V_lock_row';
1442 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1443 l_ast_rec ast_rec_type;
1444 BEGIN
1445 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1446 G_PKG_NAME,
1447 p_init_msg_list,
1448 l_api_version,
1449 p_api_version,
1450 '_PVT',
1451 x_return_status);
1452 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1453 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1454 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1455 RAISE OKC_API.G_EXCEPTION_ERROR;
1456 END IF;
1457 --------------------------------------
1458 -- Move VIEW record to "Child" records
1459 --------------------------------------
1460 migrate(p_astv_rec, l_ast_rec);
1461 --------------------------------------------
1462 -- Call the LOCK_ROW for each child record
1463 --------------------------------------------
1464 lock_row(
1465 p_init_msg_list,
1466 x_return_status,
1467 x_msg_count,
1468 x_msg_data,
1469 l_ast_rec
1470 );
1471 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1472 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1473 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
1474 RAISE OKC_API.G_EXCEPTION_ERROR;
1475 END IF;
1476 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1477 EXCEPTION
1478 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1479 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1480 (
1481 l_api_name,
1482 G_PKG_NAME,
1483 'OKC_API.G_RET_STS_ERROR',
1484 x_msg_count,
1485 x_msg_data,
1486 '_PVT'
1487 );
1488 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1489 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1490 (
1491 l_api_name,
1492 G_PKG_NAME,
1493 'OKC_API.G_RET_STS_UNEXP_ERROR',
1494 x_msg_count,
1495 x_msg_data,
1496 '_PVT'
1497 );
1498 WHEN OTHERS THEN
1499 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1500 (
1501 l_api_name,
1502 G_PKG_NAME,
1503 'OTHERS',
1504 x_msg_count,
1505 x_msg_data,
1506 '_PVT'
1507 );
1508 END lock_row;
1509 --------------------------------------
1510 -- PL/SQL TBL lock_row for:ASTV_TBL --
1511 --------------------------------------
1512 PROCEDURE lock_row(
1513 p_api_version IN NUMBER,
1514 p_init_msg_list IN VARCHAR2 ,
1515 x_return_status OUT NOCOPY VARCHAR2,
1516 x_msg_count OUT NOCOPY NUMBER,
1517 x_msg_data OUT NOCOPY VARCHAR2,
1518 p_astv_tbl IN astv_tbl_type) IS
1519
1520 l_api_version CONSTANT NUMBER := 1;
1521 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_lock_row';
1522 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1523 i NUMBER := 0;
1524 BEGIN
1525 OKC_API.init_msg_list(p_init_msg_list);
1526 -- Make sure PL/SQL table has records in it before passing
1527 IF (p_astv_tbl.COUNT > 0) THEN
1528 i := p_astv_tbl.FIRST;
1529 LOOP
1530 lock_row (
1531 p_api_version => p_api_version,
1532 p_init_msg_list => OKC_API.G_FALSE,
1533 x_return_status => x_return_status,
1537 EXIT WHEN (i = p_astv_tbl.LAST);
1534 x_msg_count => x_msg_count,
1535 x_msg_data => x_msg_data,
1536 p_astv_rec => p_astv_tbl(i));
1538 i := p_astv_tbl.NEXT(i);
1539 END LOOP;
1540 END IF;
1541 EXCEPTION
1542 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1543 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1544 (
1545 l_api_name,
1546 G_PKG_NAME,
1547 'OKC_API.G_RET_STS_ERROR',
1548 x_msg_count,
1549 x_msg_data,
1550 '_PVT'
1551 );
1552 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1553 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1554 (
1555 l_api_name,
1556 G_PKG_NAME,
1557 'OKC_API.G_RET_STS_UNEXP_ERROR',
1558 x_msg_count,
1559 x_msg_data,
1560 '_PVT'
1561 );
1562 WHEN OTHERS THEN
1563 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1564 (
1565 l_api_name,
1566 G_PKG_NAME,
1567 'OTHERS',
1568 x_msg_count,
1569 x_msg_data,
1570 '_PVT'
1571 );
1572 END lock_row;
1573
1574 ---------------------------------------------------------------------------
1575 -- PROCEDURE update_row
1576 ---------------------------------------------------------------------------
1577 --------------------------------
1578 -- update_row for:OKC_ASSENTS --
1579 --------------------------------
1580 PROCEDURE update_row(
1581 p_init_msg_list IN VARCHAR2 ,
1582 x_return_status OUT NOCOPY VARCHAR2,
1583 x_msg_count OUT NOCOPY NUMBER,
1584 x_msg_data OUT NOCOPY VARCHAR2,
1585 p_ast_rec IN ast_rec_type,
1586 x_ast_rec OUT NOCOPY ast_rec_type) IS
1587
1588 l_api_version CONSTANT NUMBER := 1;
1589 l_api_name CONSTANT VARCHAR2(30) := 'ASSENTS_update_row';
1590 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1591 l_ast_rec ast_rec_type := p_ast_rec;
1592 l_def_ast_rec ast_rec_type;
1593 l_row_notfound BOOLEAN := TRUE;
1594 ----------------------------------
1595 -- FUNCTION populate_new_record --
1596 ----------------------------------
1597 FUNCTION populate_new_record (
1598 p_ast_rec IN ast_rec_type,
1599 x_ast_rec OUT NOCOPY ast_rec_type
1600 ) RETURN VARCHAR2 IS
1601 l_ast_rec ast_rec_type;
1602 l_row_notfound BOOLEAN := TRUE;
1603 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1604 BEGIN
1605 x_ast_rec := p_ast_rec;
1606 -- Get current database values
1607 l_ast_rec := get_rec(p_ast_rec, l_row_notfound);
1608 IF (l_row_notfound) THEN
1609 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1610 END IF;
1611 IF (x_ast_rec.id = OKC_API.G_MISS_NUM)
1612 THEN
1613 x_ast_rec.id := l_ast_rec.id;
1614 END IF;
1615 IF (x_ast_rec.sts_code = OKC_API.G_MISS_CHAR)
1616 THEN
1617 x_ast_rec.sts_code := l_ast_rec.sts_code;
1618 END IF;
1619 IF (x_ast_rec.opn_code = OKC_API.G_MISS_CHAR)
1620 THEN
1621 x_ast_rec.opn_code := l_ast_rec.opn_code;
1622 END IF;
1623 IF (x_ast_rec.ste_code = OKC_API.G_MISS_CHAR)
1624 THEN
1625 x_ast_rec.ste_code := l_ast_rec.ste_code;
1626 END IF;
1627 IF (x_ast_rec.scs_code = OKC_API.G_MISS_CHAR)
1628 THEN
1629 x_ast_rec.scs_code := l_ast_rec.scs_code;
1630 END IF;
1631 IF (x_ast_rec.allowed_yn = OKC_API.G_MISS_CHAR)
1632 THEN
1633 x_ast_rec.allowed_yn := l_ast_rec.allowed_yn;
1634 END IF;
1635 IF (x_ast_rec.object_version_number = OKC_API.G_MISS_NUM)
1636 THEN
1637 x_ast_rec.object_version_number := l_ast_rec.object_version_number;
1638 END IF;
1639 IF (x_ast_rec.created_by = OKC_API.G_MISS_NUM)
1640 THEN
1641 x_ast_rec.created_by := l_ast_rec.created_by;
1642 END IF;
1643 IF (x_ast_rec.creation_date = OKC_API.G_MISS_DATE)
1644 THEN
1645 x_ast_rec.creation_date := l_ast_rec.creation_date;
1646 END IF;
1647 IF (x_ast_rec.last_updated_by = OKC_API.G_MISS_NUM)
1648 THEN
1649 x_ast_rec.last_updated_by := l_ast_rec.last_updated_by;
1650 END IF;
1651 IF (x_ast_rec.last_update_date = OKC_API.G_MISS_DATE)
1652 THEN
1653 x_ast_rec.last_update_date := l_ast_rec.last_update_date;
1654 END IF;
1655 IF (x_ast_rec.last_update_login = OKC_API.G_MISS_NUM)
1656 THEN
1657 x_ast_rec.last_update_login := l_ast_rec.last_update_login;
1658 END IF;
1659 IF (x_ast_rec.attribute_category = OKC_API.G_MISS_CHAR)
1660 THEN
1661 x_ast_rec.attribute_category := l_ast_rec.attribute_category;
1662 END IF;
1663 IF (x_ast_rec.attribute1 = OKC_API.G_MISS_CHAR)
1664 THEN
1665 x_ast_rec.attribute1 := l_ast_rec.attribute1;
1666 END IF;
1667 IF (x_ast_rec.attribute2 = OKC_API.G_MISS_CHAR)
1671 IF (x_ast_rec.attribute3 = OKC_API.G_MISS_CHAR)
1668 THEN
1669 x_ast_rec.attribute2 := l_ast_rec.attribute2;
1670 END IF;
1672 THEN
1673 x_ast_rec.attribute3 := l_ast_rec.attribute3;
1674 END IF;
1675 IF (x_ast_rec.attribute4 = OKC_API.G_MISS_CHAR)
1676 THEN
1677 x_ast_rec.attribute4 := l_ast_rec.attribute4;
1678 END IF;
1679 IF (x_ast_rec.attribute5 = OKC_API.G_MISS_CHAR)
1680 THEN
1681 x_ast_rec.attribute5 := l_ast_rec.attribute5;
1682 END IF;
1683 IF (x_ast_rec.attribute6 = OKC_API.G_MISS_CHAR)
1684 THEN
1685 x_ast_rec.attribute6 := l_ast_rec.attribute6;
1686 END IF;
1687 IF (x_ast_rec.attribute7 = OKC_API.G_MISS_CHAR)
1688 THEN
1689 x_ast_rec.attribute7 := l_ast_rec.attribute7;
1690 END IF;
1691 IF (x_ast_rec.attribute8 = OKC_API.G_MISS_CHAR)
1692 THEN
1693 x_ast_rec.attribute8 := l_ast_rec.attribute8;
1694 END IF;
1695 IF (x_ast_rec.attribute9 = OKC_API.G_MISS_CHAR)
1696 THEN
1697 x_ast_rec.attribute9 := l_ast_rec.attribute9;
1698 END IF;
1699 IF (x_ast_rec.attribute10 = OKC_API.G_MISS_CHAR)
1700 THEN
1701 x_ast_rec.attribute10 := l_ast_rec.attribute10;
1702 END IF;
1703 IF (x_ast_rec.attribute11 = OKC_API.G_MISS_CHAR)
1704 THEN
1705 x_ast_rec.attribute11 := l_ast_rec.attribute11;
1706 END IF;
1707 IF (x_ast_rec.attribute12 = OKC_API.G_MISS_CHAR)
1708 THEN
1709 x_ast_rec.attribute12 := l_ast_rec.attribute12;
1710 END IF;
1711 IF (x_ast_rec.attribute13 = OKC_API.G_MISS_CHAR)
1712 THEN
1713 x_ast_rec.attribute13 := l_ast_rec.attribute13;
1714 END IF;
1715 IF (x_ast_rec.attribute14 = OKC_API.G_MISS_CHAR)
1716 THEN
1717 x_ast_rec.attribute14 := l_ast_rec.attribute14;
1718 END IF;
1719 IF (x_ast_rec.attribute15 = OKC_API.G_MISS_CHAR)
1720 THEN
1721 x_ast_rec.attribute15 := l_ast_rec.attribute15;
1722 END IF;
1723 RETURN(l_return_status);
1724 END populate_new_record;
1725 ------------------------------------
1726 -- Set_Attributes for:OKC_ASSENTS --
1727 ------------------------------------
1728 FUNCTION Set_Attributes (
1729 p_ast_rec IN ast_rec_type,
1730 x_ast_rec OUT NOCOPY ast_rec_type
1731 ) RETURN VARCHAR2 IS
1732 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1733 BEGIN
1734 x_ast_rec := p_ast_rec;
1735 RETURN(l_return_status);
1736 END Set_Attributes;
1737 BEGIN
1738 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
1739 p_init_msg_list,
1740 '_PVT',
1741 x_return_status);
1742 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1743 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1744 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1745 RAISE OKC_API.G_EXCEPTION_ERROR;
1746 END IF;
1747 --- Setting item attributes
1748 l_return_status := Set_Attributes(
1749 p_ast_rec, -- IN
1750 l_ast_rec); -- OUT
1751 --- If any errors happen abort API
1752 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1753 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1754 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1755 RAISE OKC_API.G_EXCEPTION_ERROR;
1756 END IF;
1757 l_return_status := populate_new_record(l_ast_rec, l_def_ast_rec);
1758 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1759 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1760 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1761 RAISE OKC_API.G_EXCEPTION_ERROR;
1762 END IF;
1763 UPDATE OKC_ASSENTS
1764 SET STS_CODE = l_def_ast_rec.sts_code,
1765 OPN_CODE = l_def_ast_rec.opn_code,
1766 STE_CODE = l_def_ast_rec.ste_code,
1767 SCS_CODE = l_def_ast_rec.scs_code,
1768 ALLOWED_YN = l_def_ast_rec.allowed_yn,
1769 OBJECT_VERSION_NUMBER = l_def_ast_rec.object_version_number,
1770 CREATED_BY = l_def_ast_rec.created_by,
1771 CREATION_DATE = l_def_ast_rec.creation_date,
1772 LAST_UPDATED_BY = l_def_ast_rec.last_updated_by,
1773 LAST_UPDATE_DATE = l_def_ast_rec.last_update_date,
1774 LAST_UPDATE_LOGIN = l_def_ast_rec.last_update_login,
1775 ATTRIBUTE_CATEGORY = l_def_ast_rec.attribute_category,
1776 ATTRIBUTE1 = l_def_ast_rec.attribute1,
1777 ATTRIBUTE2 = l_def_ast_rec.attribute2,
1778 ATTRIBUTE3 = l_def_ast_rec.attribute3,
1779 ATTRIBUTE4 = l_def_ast_rec.attribute4,
1780 ATTRIBUTE5 = l_def_ast_rec.attribute5,
1781 ATTRIBUTE6 = l_def_ast_rec.attribute6,
1782 ATTRIBUTE7 = l_def_ast_rec.attribute7,
1783 ATTRIBUTE8 = l_def_ast_rec.attribute8,
1784 ATTRIBUTE9 = l_def_ast_rec.attribute9,
1785 ATTRIBUTE10 = l_def_ast_rec.attribute10,
1786 ATTRIBUTE11 = l_def_ast_rec.attribute11,
1787 ATTRIBUTE12 = l_def_ast_rec.attribute12,
1788 ATTRIBUTE13 = l_def_ast_rec.attribute13,
1789 ATTRIBUTE14 = l_def_ast_rec.attribute14,
1790 ATTRIBUTE15 = l_def_ast_rec.attribute15
1791 WHERE ID = l_def_ast_rec.id;
1792
1796 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1793 x_ast_rec := l_def_ast_rec;
1794 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
1795 EXCEPTION
1797 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1798 (
1799 l_api_name,
1800 G_PKG_NAME,
1801 'OKC_API.G_RET_STS_ERROR',
1802 x_msg_count,
1803 x_msg_data,
1804 '_PVT'
1805 );
1806 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1807 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1808 (
1809 l_api_name,
1810 G_PKG_NAME,
1811 'OKC_API.G_RET_STS_UNEXP_ERROR',
1812 x_msg_count,
1813 x_msg_data,
1814 '_PVT'
1815 );
1816 WHEN OTHERS THEN
1817 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1818 (
1819 l_api_name,
1820 G_PKG_NAME,
1821 'OTHERS',
1822 x_msg_count,
1823 x_msg_data,
1824 '_PVT'
1825 );
1826 END update_row;
1827 ----------------------------------
1828 -- update_row for:OKC_ASSENTS_V --
1829 ----------------------------------
1830 PROCEDURE update_row(
1831 p_api_version IN NUMBER,
1832 p_init_msg_list IN VARCHAR2 ,
1833 x_return_status OUT NOCOPY VARCHAR2,
1834 x_msg_count OUT NOCOPY NUMBER,
1835 x_msg_data OUT NOCOPY VARCHAR2,
1836 p_astv_rec IN astv_rec_type,
1837 x_astv_rec OUT NOCOPY astv_rec_type) IS
1838
1839 l_api_version CONSTANT NUMBER := 1;
1840 l_api_name CONSTANT VARCHAR2(30) := 'V_update_row';
1841 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1842 l_astv_rec astv_rec_type := p_astv_rec;
1843 l_def_astv_rec astv_rec_type;
1844 l_ast_rec ast_rec_type;
1845 lx_ast_rec ast_rec_type;
1846 -------------------------------
1847 -- FUNCTION fill_who_columns --
1848 -------------------------------
1849 FUNCTION fill_who_columns (
1850 p_astv_rec IN astv_rec_type
1851 ) RETURN astv_rec_type IS
1852 l_astv_rec astv_rec_type := p_astv_rec;
1853 BEGIN
1854 l_astv_rec.LAST_UPDATE_DATE := SYSDATE;
1855 l_astv_rec.LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
1856 l_astv_rec.LAST_UPDATE_LOGIN := FND_GLOBAL.LOGIN_ID;
1857 RETURN(l_astv_rec);
1858 END fill_who_columns;
1859 ----------------------------------
1860 -- FUNCTION populate_new_record --
1861 ----------------------------------
1862 FUNCTION populate_new_record (
1863 p_astv_rec IN astv_rec_type,
1864 x_astv_rec OUT NOCOPY astv_rec_type
1865 ) RETURN VARCHAR2 IS
1866 l_astv_rec astv_rec_type;
1867 l_row_notfound BOOLEAN := TRUE;
1868 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1869 BEGIN
1870 x_astv_rec := p_astv_rec;
1871 -- Get current database values
1872 l_astv_rec := get_rec(p_astv_rec, l_row_notfound);
1873 IF (l_row_notfound) THEN
1874 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
1875 END IF;
1876 IF (x_astv_rec.id = OKC_API.G_MISS_NUM)
1877 THEN
1878 x_astv_rec.id := l_astv_rec.id;
1879 END IF;
1880 IF (x_astv_rec.sts_code = OKC_API.G_MISS_CHAR)
1881 THEN
1882 x_astv_rec.sts_code := l_astv_rec.sts_code;
1883 END IF;
1884 IF (x_astv_rec.opn_code = OKC_API.G_MISS_CHAR)
1885 THEN
1886 x_astv_rec.opn_code := l_astv_rec.opn_code;
1887 END IF;
1888 IF (x_astv_rec.ste_code = OKC_API.G_MISS_CHAR)
1889 THEN
1890 x_astv_rec.ste_code := l_astv_rec.ste_code;
1891 END IF;
1892 IF (x_astv_rec.scs_code = OKC_API.G_MISS_CHAR)
1893 THEN
1894 x_astv_rec.scs_code := l_astv_rec.scs_code;
1895 END IF;
1896 IF (x_astv_rec.object_version_number = OKC_API.G_MISS_NUM)
1897 THEN
1898 x_astv_rec.object_version_number := l_astv_rec.object_version_number;
1899 END IF;
1900 IF (x_astv_rec.allowed_yn = OKC_API.G_MISS_CHAR)
1901 THEN
1902 x_astv_rec.allowed_yn := l_astv_rec.allowed_yn;
1903 END IF;
1904 IF (x_astv_rec.attribute_category = OKC_API.G_MISS_CHAR)
1905 THEN
1906 x_astv_rec.attribute_category := l_astv_rec.attribute_category;
1907 END IF;
1908 IF (x_astv_rec.attribute1 = OKC_API.G_MISS_CHAR)
1909 THEN
1910 x_astv_rec.attribute1 := l_astv_rec.attribute1;
1911 END IF;
1912 IF (x_astv_rec.attribute2 = OKC_API.G_MISS_CHAR)
1913 THEN
1914 x_astv_rec.attribute2 := l_astv_rec.attribute2;
1915 END IF;
1916 IF (x_astv_rec.attribute3 = OKC_API.G_MISS_CHAR)
1917 THEN
1918 x_astv_rec.attribute3 := l_astv_rec.attribute3;
1919 END IF;
1920 IF (x_astv_rec.attribute4 = OKC_API.G_MISS_CHAR)
1921 THEN
1922 x_astv_rec.attribute4 := l_astv_rec.attribute4;
1923 END IF;
1924 IF (x_astv_rec.attribute5 = OKC_API.G_MISS_CHAR)
1925 THEN
1926 x_astv_rec.attribute5 := l_astv_rec.attribute5;
1927 END IF;
1928 IF (x_astv_rec.attribute6 = OKC_API.G_MISS_CHAR)
1929 THEN
1933 THEN
1930 x_astv_rec.attribute6 := l_astv_rec.attribute6;
1931 END IF;
1932 IF (x_astv_rec.attribute7 = OKC_API.G_MISS_CHAR)
1934 x_astv_rec.attribute7 := l_astv_rec.attribute7;
1935 END IF;
1936 IF (x_astv_rec.attribute8 = OKC_API.G_MISS_CHAR)
1937 THEN
1938 x_astv_rec.attribute8 := l_astv_rec.attribute8;
1939 END IF;
1940 IF (x_astv_rec.attribute9 = OKC_API.G_MISS_CHAR)
1941 THEN
1942 x_astv_rec.attribute9 := l_astv_rec.attribute9;
1943 END IF;
1944 IF (x_astv_rec.attribute10 = OKC_API.G_MISS_CHAR)
1945 THEN
1946 x_astv_rec.attribute10 := l_astv_rec.attribute10;
1947 END IF;
1948 IF (x_astv_rec.attribute11 = OKC_API.G_MISS_CHAR)
1949 THEN
1950 x_astv_rec.attribute11 := l_astv_rec.attribute11;
1951 END IF;
1952 IF (x_astv_rec.attribute12 = OKC_API.G_MISS_CHAR)
1953 THEN
1954 x_astv_rec.attribute12 := l_astv_rec.attribute12;
1955 END IF;
1956 IF (x_astv_rec.attribute13 = OKC_API.G_MISS_CHAR)
1957 THEN
1958 x_astv_rec.attribute13 := l_astv_rec.attribute13;
1959 END IF;
1960 IF (x_astv_rec.attribute14 = OKC_API.G_MISS_CHAR)
1961 THEN
1962 x_astv_rec.attribute14 := l_astv_rec.attribute14;
1963 END IF;
1964 IF (x_astv_rec.attribute15 = OKC_API.G_MISS_CHAR)
1965 THEN
1966 x_astv_rec.attribute15 := l_astv_rec.attribute15;
1967 END IF;
1968 IF (x_astv_rec.created_by = OKC_API.G_MISS_NUM)
1969 THEN
1970 x_astv_rec.created_by := l_astv_rec.created_by;
1971 END IF;
1972 IF (x_astv_rec.creation_date = OKC_API.G_MISS_DATE)
1973 THEN
1974 x_astv_rec.creation_date := l_astv_rec.creation_date;
1975 END IF;
1976 IF (x_astv_rec.last_updated_by = OKC_API.G_MISS_NUM)
1977 THEN
1978 x_astv_rec.last_updated_by := l_astv_rec.last_updated_by;
1979 END IF;
1980 IF (x_astv_rec.last_update_date = OKC_API.G_MISS_DATE)
1981 THEN
1982 x_astv_rec.last_update_date := l_astv_rec.last_update_date;
1983 END IF;
1984 IF (x_astv_rec.last_update_login = OKC_API.G_MISS_NUM)
1985 THEN
1986 x_astv_rec.last_update_login := l_astv_rec.last_update_login;
1987 END IF;
1988 RETURN(l_return_status);
1989 END populate_new_record;
1990 --------------------------------------
1991 -- Set_Attributes for:OKC_ASSENTS_V --
1992 --------------------------------------
1993 FUNCTION Set_Attributes (
1994 p_astv_rec IN astv_rec_type,
1995 x_astv_rec OUT NOCOPY astv_rec_type
1996 ) RETURN VARCHAR2 IS
1997 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1998 BEGIN
1999 x_astv_rec := p_astv_rec;
2000 x_astv_rec.OBJECT_VERSION_NUMBER := NVL(x_astv_rec.OBJECT_VERSION_NUMBER, 0) + 1;
2001 RETURN(l_return_status);
2002 END Set_Attributes;
2003 BEGIN
2004 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2005 G_PKG_NAME,
2006 p_init_msg_list,
2007 l_api_version,
2008 p_api_version,
2009 '_PVT',
2010 x_return_status);
2011 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2012 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2013 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2014 RAISE OKC_API.G_EXCEPTION_ERROR;
2015 END IF;
2016 --- Setting item attributes
2017 l_return_status := Set_Attributes(
2018 p_astv_rec, -- IN
2019 l_astv_rec); -- OUT
2020 --- If any errors happen abort API
2021 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2022 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2023 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2024 RAISE OKC_API.G_EXCEPTION_ERROR;
2025 END IF;
2026 l_return_status := populate_new_record(l_astv_rec, l_def_astv_rec);
2027 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2028 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2029 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2030 RAISE OKC_API.G_EXCEPTION_ERROR;
2031 END IF;
2032 l_def_astv_rec := fill_who_columns(l_def_astv_rec);
2033 --- Validate all non-missing attributes (Item Level Validation)
2034 l_return_status := Validate_Attributes(l_def_astv_rec);
2035 --- If any errors happen abort API
2036 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2037 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2038 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2039 RAISE OKC_API.G_EXCEPTION_ERROR;
2040 END IF;
2041 l_return_status := Validate_Record(l_def_astv_rec);
2042 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2043 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2044 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2045 RAISE OKC_API.G_EXCEPTION_ERROR;
2046 END IF;
2047
2048 --------------------------------------
2049 -- Move VIEW record to "Child" records
2050 --------------------------------------
2051 migrate(l_def_astv_rec, l_ast_rec);
2055 update_row(
2052 --------------------------------------------
2053 -- Call the UPDATE_ROW for each child record
2054 --------------------------------------------
2056 p_init_msg_list,
2057 x_return_status,
2058 x_msg_count,
2059 x_msg_data,
2060 l_ast_rec,
2061 lx_ast_rec
2062 );
2063 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2064 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2065 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
2066 RAISE OKC_API.G_EXCEPTION_ERROR;
2067 END IF;
2068 migrate(lx_ast_rec, l_def_astv_rec);
2069 x_astv_rec := l_def_astv_rec;
2070 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2071 EXCEPTION
2072 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2073 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2074 (
2075 l_api_name,
2076 G_PKG_NAME,
2077 'OKC_API.G_RET_STS_ERROR',
2078 x_msg_count,
2079 x_msg_data,
2080 '_PVT'
2081 );
2082 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2083 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2084 (
2085 l_api_name,
2086 G_PKG_NAME,
2087 'OKC_API.G_RET_STS_UNEXP_ERROR',
2088 x_msg_count,
2089 x_msg_data,
2090 '_PVT'
2091 );
2092 WHEN OTHERS THEN
2093 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2094 (
2095 l_api_name,
2096 G_PKG_NAME,
2097 'OTHERS',
2098 x_msg_count,
2099 x_msg_data,
2100 '_PVT'
2101 );
2102 END update_row;
2103 ----------------------------------------
2104 -- PL/SQL TBL update_row for:ASTV_TBL --
2105 ----------------------------------------
2106 PROCEDURE update_row(
2107 p_api_version IN NUMBER,
2108 p_init_msg_list IN VARCHAR2 ,
2109 x_return_status OUT NOCOPY VARCHAR2,
2110 x_msg_count OUT NOCOPY NUMBER,
2111 x_msg_data OUT NOCOPY VARCHAR2,
2112 p_astv_tbl IN astv_tbl_type,
2113 x_astv_tbl OUT NOCOPY astv_tbl_type) IS
2114
2115 l_api_version CONSTANT NUMBER := 1;
2116 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_update_row';
2117 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2118 i NUMBER := 0;
2119 BEGIN
2120 OKC_API.init_msg_list(p_init_msg_list);
2121 -- Make sure PL/SQL table has records in it before passing
2122 IF (p_astv_tbl.COUNT > 0) THEN
2123 i := p_astv_tbl.FIRST;
2124 LOOP
2125 update_row (
2126 p_api_version => p_api_version,
2127 p_init_msg_list => OKC_API.G_FALSE,
2128 x_return_status => x_return_status,
2129 x_msg_count => x_msg_count,
2130 x_msg_data => x_msg_data,
2131 p_astv_rec => p_astv_tbl(i),
2132 x_astv_rec => x_astv_tbl(i));
2133 EXIT WHEN (i = p_astv_tbl.LAST);
2134 i := p_astv_tbl.NEXT(i);
2135 END LOOP;
2136 END IF;
2137 EXCEPTION
2138 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2139 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2140 (
2141 l_api_name,
2142 G_PKG_NAME,
2143 'OKC_API.G_RET_STS_ERROR',
2144 x_msg_count,
2145 x_msg_data,
2146 '_PVT'
2147 );
2148 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2149 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2150 (
2151 l_api_name,
2152 G_PKG_NAME,
2153 'OKC_API.G_RET_STS_UNEXP_ERROR',
2154 x_msg_count,
2155 x_msg_data,
2156 '_PVT'
2157 );
2158 WHEN OTHERS THEN
2159 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2160 (
2161 l_api_name,
2162 G_PKG_NAME,
2163 'OTHERS',
2164 x_msg_count,
2165 x_msg_data,
2166 '_PVT'
2167 );
2168 END update_row;
2169
2170 ---------------------------------------------------------------------------
2171 -- PROCEDURE delete_row
2172 ---------------------------------------------------------------------------
2173 --------------------------------
2174 -- delete_row for:OKC_ASSENTS --
2175 --------------------------------
2176 PROCEDURE delete_row(
2177 p_init_msg_list IN VARCHAR2 ,
2178 x_return_status OUT NOCOPY VARCHAR2,
2179 x_msg_count OUT NOCOPY NUMBER,
2180 x_msg_data OUT NOCOPY VARCHAR2,
2181 p_ast_rec IN ast_rec_type) IS
2182
2183 l_api_version CONSTANT NUMBER := 1;
2184 l_api_name CONSTANT VARCHAR2(30) := 'ASSENTS_delete_row';
2185 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2186 l_ast_rec ast_rec_type:= p_ast_rec;
2187 l_row_notfound BOOLEAN := TRUE;
2188 BEGIN
2189 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2190 p_init_msg_list,
2191 '_PVT',
2195 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2192 x_return_status);
2193 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2194 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2196 RAISE OKC_API.G_EXCEPTION_ERROR;
2197 END IF;
2198 DELETE FROM OKC_ASSENTS
2199 WHERE ID = l_ast_rec.id;
2200
2201 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2202 EXCEPTION
2203 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2204 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2205 (
2206 l_api_name,
2207 G_PKG_NAME,
2208 'OKC_API.G_RET_STS_ERROR',
2209 x_msg_count,
2210 x_msg_data,
2211 '_PVT'
2212 );
2213 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2214 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2215 (
2216 l_api_name,
2217 G_PKG_NAME,
2218 'OKC_API.G_RET_STS_UNEXP_ERROR',
2219 x_msg_count,
2220 x_msg_data,
2221 '_PVT'
2222 );
2223 WHEN OTHERS THEN
2224 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2225 (
2226 l_api_name,
2227 G_PKG_NAME,
2228 'OTHERS',
2229 x_msg_count,
2230 x_msg_data,
2231 '_PVT'
2232 );
2233 END delete_row;
2234 ----------------------------------
2235 -- delete_row for:OKC_ASSENTS_V --
2236 ----------------------------------
2237 PROCEDURE delete_row(
2238 p_api_version IN NUMBER,
2239 p_init_msg_list IN VARCHAR2 ,
2240 x_return_status OUT NOCOPY VARCHAR2,
2241 x_msg_count OUT NOCOPY NUMBER,
2242 x_msg_data OUT NOCOPY VARCHAR2,
2243 p_astv_rec IN astv_rec_type) IS
2244
2245 l_api_version CONSTANT NUMBER := 1;
2246 l_api_name CONSTANT VARCHAR2(30) := 'V_delete_row';
2247 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2248 l_astv_rec astv_rec_type := p_astv_rec;
2249 l_ast_rec ast_rec_type;
2250 BEGIN
2251 l_return_status := OKC_API.START_ACTIVITY(l_api_name,
2252 G_PKG_NAME,
2253 p_init_msg_list,
2254 l_api_version,
2255 p_api_version,
2256 '_PVT',
2257 x_return_status);
2258 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2259 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2260 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
2261 RAISE OKC_API.G_EXCEPTION_ERROR;
2262 END IF;
2263 --------------------------------------
2264 -- Move VIEW record to "Child" records
2265 --------------------------------------
2266 migrate(l_astv_rec, l_ast_rec);
2267 --------------------------------------------
2268 -- Call the DELETE_ROW for each child record
2269 --------------------------------------------
2270 delete_row(
2271 p_init_msg_list,
2272 x_return_status,
2273 x_msg_count,
2274 x_msg_data,
2275 l_ast_rec
2276 );
2277 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
2278 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
2279 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
2280 RAISE OKC_API.G_EXCEPTION_ERROR;
2281 END IF;
2282 OKC_API.END_ACTIVITY(x_msg_count, x_msg_data);
2283 EXCEPTION
2284 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2285 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2286 (
2287 l_api_name,
2288 G_PKG_NAME,
2289 'OKC_API.G_RET_STS_ERROR',
2290 x_msg_count,
2291 x_msg_data,
2292 '_PVT'
2293 );
2294 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2295 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2296 (
2297 l_api_name,
2298 G_PKG_NAME,
2299 'OKC_API.G_RET_STS_UNEXP_ERROR',
2300 x_msg_count,
2301 x_msg_data,
2302 '_PVT'
2303 );
2304 WHEN OTHERS THEN
2305 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2306 (
2307 l_api_name,
2308 G_PKG_NAME,
2309 'OTHERS',
2310 x_msg_count,
2311 x_msg_data,
2312 '_PVT'
2313 );
2314 END delete_row;
2315 ----------------------------------------
2316 -- PL/SQL TBL delete_row for:ASTV_TBL --
2317 ----------------------------------------
2318 PROCEDURE delete_row(
2319 p_api_version IN NUMBER,
2320 p_init_msg_list IN VARCHAR2 ,
2321 x_return_status OUT NOCOPY VARCHAR2,
2322 x_msg_count OUT NOCOPY NUMBER,
2323 x_msg_data OUT NOCOPY VARCHAR2,
2324 p_astv_tbl IN astv_tbl_type) IS
2325
2326 l_api_version CONSTANT NUMBER := 1;
2327 l_api_name CONSTANT VARCHAR2(30) := 'V_tbl_delete_row';
2328 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
2329 i NUMBER := 0;
2333 IF (p_astv_tbl.COUNT > 0) THEN
2330 BEGIN
2331 OKC_API.init_msg_list(p_init_msg_list);
2332 -- Make sure PL/SQL table has records in it before passing
2334 i := p_astv_tbl.FIRST;
2335 LOOP
2336 delete_row (
2337 p_api_version => p_api_version,
2338 p_init_msg_list => OKC_API.G_FALSE,
2339 x_return_status => x_return_status,
2340 x_msg_count => x_msg_count,
2341 x_msg_data => x_msg_data,
2342 p_astv_rec => p_astv_tbl(i));
2343 EXIT WHEN (i = p_astv_tbl.LAST);
2344 i := p_astv_tbl.NEXT(i);
2345 END LOOP;
2346 END IF;
2347 EXCEPTION
2348 WHEN OKC_API.G_EXCEPTION_ERROR THEN
2349 x_return_status := OKC_API.HANDLE_EXCEPTIONS
2350 (
2351 l_api_name,
2352 G_PKG_NAME,
2353 'OKC_API.G_RET_STS_ERROR',
2354 x_msg_count,
2355 x_msg_data,
2356 '_PVT'
2357 );
2358 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2359 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2360 (
2361 l_api_name,
2362 G_PKG_NAME,
2363 'OKC_API.G_RET_STS_UNEXP_ERROR',
2364 x_msg_count,
2365 x_msg_data,
2366 '_PVT'
2367 );
2368 WHEN OTHERS THEN
2369 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
2370 (
2371 l_api_name,
2372 G_PKG_NAME,
2373 'OTHERS',
2374 x_msg_count,
2375 x_msg_data,
2376 '_PVT'
2377 );
2378 END delete_row;
2379
2380 FUNCTION header_operation_allowed(
2381 p_header_id IN NUMBER,
2382 p_opn_code IN VARCHAR2,
2383 p_crt_id IN NUMBER ) return varchar2 IS
2384 l_dummy varchar2(1);
2385 l_row_found BOOLEAN;
2386 l_cr_locked BOOLEAN := FALSE;
2387 l_another_cr_locked BOOLEAN := FALSE;
2388 l_user_in_cr BOOLEAN := FALSE;
2389 l_return_status Varchar2(1);
2390 l_user_id okc_k_processes.user_id%TYPE;
2391 --NPALEPU for bug # 4597099 on 13-AUG-2005
2392 /* l_scs_code okc_k_headers_b.scs_code%TYPE;
2393 l_sts_code okc_k_headers_b.sts_code%TYPE; */
2394 l_scs_code okc_k_headers_all_b.scs_code%TYPE;
2395 l_sts_code okc_k_headers_all_b.sts_code%TYPE;
2396 --END NPALEPU
2397 l_cur_user okc_change_requests_b.user_id%TYPE := FND_GLOBAL.USER_ID;
2398
2399 l_date_approved DATE;
2400 l_date_signed DATE;
2401 --
2402 cursor hdr_csr is
2403 select sts_code, scs_code,date_approved, date_signed
2404 --NPALEPU for bug # 4597099 on 13-AUG-2005
2405 /* from okc_k_headers_b */
2406 from okc_k_headers_all_b
2407 --END NPALEPU
2408 where id = p_header_id;
2409 --
2410 cursor ast_csr (p_allowed_yn okc_assents_v.allowed_yn%TYPE) is
2411 select 'x'
2412 from okc_assents
2413 where scs_code = l_scs_code
2414 and sts_code = l_sts_code
2415 and opn_code = p_opn_code
2416 and allowed_yn = p_allowed_yn;
2417 --
2418 cursor lock_csr (p_in_process_yn okc_k_processes.in_process_yn%TYPE) is
2419 select prc.user_id
2420 from okc_k_processes prc,
2421 okc_change_requests_b crq
2422 where crq.id = p_crt_id
2423 and crq.chr_id = p_header_id
2424 and crq.datetime_applied is null
2425 and crq.id = prc.crt_id
2426 and upper(substr(prc.in_process_yn, 1, 1)) = p_in_process_yn;
2427 --
2428 cursor proc_csr (p_in_process_yn okc_k_processes.in_process_yn%TYPE) is
2429 select prc.user_id
2430 from okc_k_processes prc,
2431 okc_change_requests_b crq
2432 where crq.chr_id = p_header_id
2433 and crq.datetime_applied is null
2434 and crq.id = prc.crt_id
2435 and upper(substr(prc.in_process_yn, 1, 1)) = p_in_process_yn;
2436 --
2437 cursor user_csr is
2438 select 'x'
2439 from okc_change_requests_b crq
2440 where crq.id = p_crt_id
2441 and crq.chr_id = p_header_id
2442 and crq.datetime_applied is null
2443 and crq.user_id = l_cur_user;
2444
2445 BEGIN
2446 open hdr_csr;
2447 fetch hdr_csr into l_sts_code, l_scs_code, l_date_approved, l_date_signed;
2448 close hdr_csr;
2449 l_row_found := true;
2450 if l_sts_code <> 'QA_HOLD' then
2451 open ast_csr('Y');
2452 fetch ast_csr into l_dummy;
2453 l_row_found := ast_csr%FOUND;
2454 close ast_csr;
2455 end if;
2456 if l_row_found then
2457 -- Special treatment for Update Online and Update via CR
2458 if p_opn_code = 'CHG_REQ' then
2459 if p_crt_id is null then
2460 -- p_crt_id null means the check is being done while creating
2461 -- a change request. So if the assent data allows that, simply
2462 -- return with true.
2463 l_return_status := OKC_API.G_TRUE;
2464 else
2465 -- Not null means the check is being done while applying a
2466 -- change request. Check whether the CR has been locked by the
2467 -- supplied p_crt_id.
2468 open lock_csr('Y');
2469 fetch lock_csr into l_user_id;
2473 -- Check whether or not the current user is holding the key
2470 l_cr_locked := lock_csr%FOUND;
2471 close lock_csr;
2472 if l_cr_locked then
2474 if l_user_id = l_cur_user then
2475 l_return_status := OKC_API.G_TRUE;
2476 else
2477 -- Current user does not hold the key, so return False.
2478 l_return_status := OKC_API.G_FALSE;
2479 end if;
2480 else
2481 -- If not locked by the supplied crt_id, check if locked by
2482 -- some other Change Request
2483 open proc_csr('Y');
2484 fetch proc_csr into l_user_id;
2485 l_another_cr_locked := proc_csr%FOUND;
2486 close proc_csr;
2487 -- If locked by some other CR, return false
2488 if l_another_cr_locked Then
2489 l_return_status := OKC_API.G_FALSE;
2490 else
2491 -- If not, check whether the current user is in the CR list
2492 -- for the given contract.
2493 open user_csr;
2494 fetch user_csr into l_dummy;
2495 l_user_in_cr := user_csr%FOUND;
2496 close user_csr;
2497 if l_user_in_cr Then
2498 -- The authoring form needs to issue the key to the user in this
2499 -- case, kind of overhead since it will have to do similar check.
2500 if l_sts_code = 'QA_HOLD' then
2501 l_return_status := OKC_API.G_FALSE;
2502 else
2503 l_return_status := OKC_API.G_TRUE;
2504 end if;
2505 else
2506 l_return_status := OKC_API.G_FALSE;
2507 end if;
2508 end if;
2509 end if;
2510 end if;
2511 elsif p_opn_code = 'UPDATE' Then
2512 -- In case of Update Online, Check whether or not any CR
2513 -- has locked this contract
2514 open proc_csr('Y');
2515 fetch proc_csr into l_user_id;
2516 l_another_cr_locked := proc_csr%FOUND;
2517 close proc_csr;
2518 -- If locked by some CR, return true if locked by the current user
2519 if l_another_cr_locked Then
2520 if l_user_id = l_cur_user then
2521 l_return_status := OKC_API.G_TRUE;
2522 else
2523 l_return_status := OKC_API.G_FALSE;
2524 end if;
2525 else
2526 -- If the Contract is APPROVED, but not SIGNED, no updat allowed
2527 -- This is implemented to fix bug #1800071
2528 if l_date_approved is not null and l_date_signed is null then
2529 l_return_status := OKC_API.G_FALSE;
2530 else
2531 -- otherwise, return true
2532 l_return_status := OKC_API.G_TRUE;
2533 end if;
2534 end if;
2535 else
2536 -- For all other operations, return True.
2537 l_return_status := OKC_API.G_TRUE;
2538 end if;
2539 else
2540 -- Do not allow the operation since no assent data exists.
2541 l_return_status := OKC_API.G_FALSE;
2542 end if;
2543 return(l_return_status);
2544 EXCEPTION
2545 WHEN OTHERS THEN
2546 OKC_API.set_message(G_APP_NAME, G_UNEXPECTED_ERROR, G_SQLCODE_TOKEN,
2547 SQLCODE, G_SQLERRM_TOKEN, SQLERRM);
2548 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2549 Return(l_return_status);
2550 END header_operation_allowed;
2551
2552 FUNCTION line_operation_allowed(
2553 p_line_id IN NUMBER,
2554 p_opn_code IN VARCHAR2) return varchar2 is
2555 l_dummy varchar2(1);
2556 l_row_notfound BOOLEAN;
2557 l_return_status Varchar2(1);
2558 l_lse_id okc_k_lines_v.lse_id%TYPE;
2559 cursor c1(p_allowed_yn okc_assents_v.allowed_yn%TYPE) is
2560 select 'x'
2561 from okc_k_lines_b L,
2562 --NPALEPU for Bug # 4597099 on 13-AUG-2005
2563 /* okc_k_headers_b K, */
2564 OKC_K_HEADERS_ALL_B K,
2565 --END NPALEPU
2566 okc_assents A
2567 where L.ID = p_line_id
2568 and L.DNZ_CHR_ID = K.ID
2569 and A.SCS_CODE = K.SCS_CODE
2570 and A.STS_CODE = L.STS_CODE
2571 and A.OPN_CODE = p_opn_code
2572 and A.ALLOWED_YN = p_allowed_yn;
2573 cursor c2 is
2574 select lse_id
2575 from okc_k_lines_b
2576 where id = p_line_id
2577 and chr_id is not null;
2578 cursor c3 is
2579 select a.lse_id
2580 from okc_k_lines_b a,
2581 okc_ancestrys b
2582 where b.cle_id = p_line_id
2583 and b.level_sequence = 1
2584 and a.id = b.cle_id_ascendant;
2585 cursor c4(p_lse_id okc_val_line_operations_v.lse_id%TYPE) is
2586 select 'x'
2587 from okc_val_line_operations
2588 where lse_id = p_lse_id
2589 and opn_code = p_opn_code;
2590 operation_allowed Exception;
2591 operation_not_allowed Exception;
2592 invalid_data Exception;
2593 BEGIN
2594 --
2595 -- There are 2 steps to check whether or not an operation is allowed for a line.
2596 -- First make sure it is allowed from assent table, taking the subclass from the header.
2597 --
2598 Open c1('Y');
2599 Fetch c1 Into l_dummy;
2600 l_row_notfound := c1%NOTFOUND;
2601 Close c1;
2602 --
2603 -- If it is not allowed, return immediately.
2604 --
2605 If l_row_notfound Then
2606 Raise operation_not_allowed;
2607 End If;
2608 --
2609 -- If allowed, then in the next step, check whether or not that operation is
2610 -- valid for the top line style. To get the top line, if the chr_id is not null,
2611 -- that line itself is top line.
2612 --
2613 Open c2;
2614 Fetch c2 Into l_lse_id;
2615 l_row_notfound := c2%NOTFOUND;
2616 Close c2;
2617 --
2618 -- Otherwise we need to explore the ancestory table to get the top line.
2619 --
2620 If l_row_notfound Then
2621 Open c3;
2622 Fetch c3 Into l_lse_id;
2623 l_row_notfound := c3%NOTFOUND;
2624 Close c3;
2625 --
2626 -- We should be able to get the top line from here. If not, there is some invalid data.
2627 --
2628 If l_row_notfound Then
2629 Raise invalid_data;
2630 End If;
2631 End If;
2632 --
2633 -- Finally check from the valid line operation table,
2634 -- if the operation is valid for the top line style.
2635 --
2636 Open c4(l_lse_id);
2637 Fetch c4 Into l_dummy;
2638 l_row_notfound := c4%NOTFOUND;
2639 Close c4;
2640 If l_row_notfound Then
2641 Raise operation_not_allowed;
2642 Else
2643 Raise operation_allowed;
2644 End If;
2645 EXCEPTION
2646 WHEN operation_allowed THEN
2647 l_return_status := OKC_API.G_TRUE;
2648 Return(l_return_status);
2649 WHEN operation_not_allowed THEN
2650 l_return_status := OKC_API.G_FALSE;
2651 Return(l_return_status);
2652 WHEN invalid_data THEN
2653 OKC_API.set_message(G_APP_NAME, G_INVALID_VALUE, G_COL_NAME_TOKEN, 'line_id');
2654 l_return_status := OKC_API.G_RET_STS_ERROR;
2655 Return(l_return_status);
2656 WHEN OTHERS THEN
2657 OKC_API.set_message(G_APP_NAME, G_UNEXPECTED_ERROR, G_SQLCODE_TOKEN,
2658 SQLCODE, G_SQLERRM_TOKEN, SQLERRM);
2659 l_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
2660 Return(l_return_status);
2661 END line_operation_allowed;
2662
2663 END OKC_AST_PVT;