[Home] [Help]
PACKAGE BODY: APPS.OKL_TXD_ASSETS_PVT
Source
1 package body OKL_TXD_ASSETS_PVT as
2 /* $Header: OKLCASDB.pls 120.6 2006/02/22 17:17:56 rpillay noship $ */
3
4 ------------------------------------------------------------------------------------
5 -- GLOBAL OKL MESSAGES
6 ------------------------------------------------------------------------------------
7 G_LINE_RECORD CONSTANT VARCHAR2(200) := 'OKL_LLA_LINE_RECORD';
8 G_AMOUNT_ROUNDING CONSTANT VARCHAR2(200) := 'OKL_LA_ROUNDING_ERROR';
9
10 /*
11 * sjalasut: aug 18, 04 added constants used in raising business event. BEGIN
12 */
13 G_WF_EVT_ASSETTAX_DPRN_CRTD CONSTANT VARCHAR2(65) := 'oracle.apps.okl.la.lease_contract.asset_tax_depreciation_created';
14 G_WF_EVT_ASSETTAX_DPRN_RMVD CONSTANT VARCHAR2(65) := 'oracle.apps.okl.la.lease_contract.remove_asset_tax_depreciation';
15 G_WF_ITM_CONTRACT_ID CONSTANT VARCHAR2(30) := 'CONTRACT_ID';
16 G_WF_ITM_ASSET_ID CONSTANT VARCHAR2(30) := 'ASSET_ID';
17 G_WF_ITM_CONTRACT_PROCESS CONSTANT VARCHAR2(30) := 'CONTRACT_PROCESS';
18 /*
19 * sjalasut: aug 18, 04 added constants used in raising business event. END
20 */
21
22 /*
23 * sjalasut: aug 18, 04 added procedure to call private wrapper that raises the business event. BEGIN
24 * the procedure is located at the global level and not at the insert row level as the same procedure
25 * can later be used for capturing other DML logic.
26 */
27 -------------------------------------------------------------------------------
28 -- PROCEDURE raise_business_event
29 -------------------------------------------------------------------------------
30 -- Start of comments
31 --
32 -- Procedure Name : raise_business_event
33 -- Description : This procedure is a wrapper that raises a business event
34 -- : when ever asset tax depreciation is created or updated.
35 -- Business Rules :
36 -- Parameters : p_chr_id,p_asset_id, p_event_name along with other api params
37 -- Version : 1.0
38 -- History : 30-AUG-2004 SJALASUT created
39 -- End of comments
40
41 PROCEDURE raise_business_event(p_api_version IN NUMBER,
42 p_init_msg_list IN VARCHAR2,
43 p_chr_id IN okc_k_headers_b.id%TYPE,
44 p_asset_id IN okc_k_lines_b.id%TYPE,
45 p_event_name IN VARCHAR2,
46 x_return_status OUT NOCOPY VARCHAR2,
47 x_msg_count OUT NOCOPY NUMBER,
48 x_msg_data OUT NOCOPY VARCHAR2
49 ) IS
50 l_parameter_list wf_parameter_list_t;
51 l_contract_process VARCHAR2(20);
52 BEGIN
53 x_return_status := OKL_API.G_RET_STS_SUCCESS;
54
55 -- wrapper API to get contract process. this API determines in which status the
56 -- contract in question is.
57 l_contract_process := okl_lla_util_pvt.get_contract_process(p_chr_id => p_chr_id);
58 wf_event.AddParameterToList(G_WF_ITM_CONTRACT_ID, p_chr_id, l_parameter_list);
59 wf_event.AddParameterToList(G_WF_ITM_ASSET_ID, p_asset_id, l_parameter_list);
60 wf_event.AddParameterToList(G_WF_ITM_CONTRACT_PROCESS, l_contract_process, l_parameter_list);
61
62 OKL_WF_PVT.raise_event(p_api_version => p_api_version,
63 p_init_msg_list => p_init_msg_list,
64 x_return_status => x_return_status,
65 x_msg_count => x_msg_count,
66 x_msg_data => x_msg_data,
67 p_event_name => p_event_name,
68 p_parameters => l_parameter_list);
69 EXCEPTION
70 WHEN OTHERS THEN
71 x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
72 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
73 END raise_business_event;
74
75 /*
76 * sjalasut: aug 18, 04 added procedure to call private wrapper that raises the business event. END
77 */
78
79
80 PROCEDURE Create_txd_asset_def(
81 p_api_version IN NUMBER,
82 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
83 x_return_status OUT NOCOPY VARCHAR2,
84 x_msg_count OUT NOCOPY NUMBER,
85 x_msg_data OUT NOCOPY VARCHAR2,
86 p_asdv_rec IN advv_rec_type,
87 x_asdv_rec OUT NOCOPY advv_rec_type)
88 IS
89 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_TRX_ASSETS_LINE_DTL';
90 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
91
92 -- Temp parameters to store cost and currency code
93 l_cost OKL_TXD_ASSETS_B.COST%TYPE;
94 l_currency_code OKL_TXD_ASSETS_B.CURRENCY_CODE%TYPE;
95 l_asdv_rec advv_rec_type := p_asdv_rec;
96
97 -- Bug# 3477560
98 ln_chr_id OKC_K_LINES_B.DNZ_CHR_ID%TYPE;
99 CURSOR get_chr_id(p_tal_id OKL_TXD_ASSETS_B.TAL_ID%TYPE)
100 IS
101 SELECT to_char(cle.dnz_chr_id)
102 FROM okc_k_lines_b cle,
103 okl_txl_assets_b tal,
104 okl_txd_assets_b txd
105 WHERE tal.kle_id = cle.id
106 AND tal.id = txd.tal_id
107 AND tal.tal_type in ('CFA','CIB','CRB','CRL','CRV','CSP','ALI')
108 AND txd.tal_id = p_tal_id;
109
110 /*
111 CURSOR c_get_currency_code(p_tal_id OKL_TXL_ASSETS_B.ID%TYPE) IS
112 SELECT tal.currency_code
113 FROM OKL_TXL_ASSETS_B tal
114 WHERE tal.id = p_tal_id;
115 */
116 CURSOR header_curr_csr(p_tal_id OKL_TXD_ASSETS_V.TAL_ID%TYPE) IS
117 SELECT h.currency_code,
118 h.currency_conversion_type,
119 h.currency_conversion_date
120 FROM okl_k_headers_full_v h,
121 okl_txl_assets_v txl
122 WHERE h.id = txl.dnz_khr_id
123 AND txl.id = p_tal_id;
124
125 /*
126 * sjalasut added cursor to derive the contract header id and contract line id. BEGIN
127 *
128 */
129 CURSOR get_chr_and_cle_id(p_tal_id OKL_TXD_ASSETS_B.TAL_ID%TYPE)
130 IS
131 SELECT to_char(cle.dnz_chr_id) chr_id, cle.cle_id cle_id
132 FROM okc_k_lines_b cle,
133 okl_txl_assets_b tal,
134 okl_txd_assets_b txd
135 WHERE tal.kle_id = cle.id
136 AND tal.id = txd.tal_id
137 AND tal.tal_type in ('CFA','CIB','CRB','CRL','CRV','CSP','ALI')
138 AND txd.tal_id = p_tal_id;
139
140 l_chr_id okc_k_headers_b.id%TYPE;
141 l_cle_id okc_k_lines_b.id%TYPE;
142
143 /*
144 * sjalasut added cursor to derive the contract header id and contract line id. END
145 *
146 */
147
148 l_header_curr_code OKL_K_HEADERS_FULL_V.CURRENCY_CODE%TYPE;
149 l_header_curr_conv_type OKL_K_HEADERS_FULL_V.CURRENCY_CONVERSION_TYPE%TYPE;
150 l_header_curr_conv_date OKL_K_HEADERS_FULL_V.CURRENCY_CONVERSION_DATE%TYPE;
151
152 --Bug# 4959361
153 CURSOR l_tal_csr(p_tal_id IN NUMBER) IS
154 SELECT kle_id
155 FROM okl_txl_assets_b tal
156 WHERE tal.id = p_tal_id;
157
158 l_tal_rec l_tal_csr%ROWTYPE;
159 --Bug# 4959361
160
161 BEGIN
162 -- Call start_activity to create savepoint, check compatibility
163 -- and initialize message list
164 l_return_status := OKC_API.START_ACTIVITY (l_api_name
165 ,p_init_msg_list
166 ,'_PVT'
167 ,x_return_status);
168 -- Check if activity started successfully
169 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
170 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
171 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
172 RAISE OKC_API.G_EXCEPTION_ERROR;
173 END IF;
174
175 /* rounding is doen at corresponding TAPI
176 -- Modified by rravikir
177 -- Call to Accounting Util package to address Multi Currency requirement
178 -- Start
179 OPEN c_get_currency_code(p_tal_id => l_asdv_rec.tal_id);
180 IF c_get_currency_code%NOTFOUND THEN
181 OKL_API.set_message(p_app_name => G_APP_NAME,
182 p_msg_name => G_LINE_RECORD);
183 RAISE OKL_API.G_EXCEPTION_ERROR;
184 END IF;
185 FETCH c_get_currency_code INTO l_currency_code;
186 CLOSE c_get_currency_code;
187
188 l_cost := l_asdv_rec.cost;
189 l_asdv_rec.cost :=
190 OKL_ACCOUNTING_UTIL.CROSS_CURRENCY_ROUND_AMOUNT(l_asdv_rec.cost,
191 l_currency_code);
192 IF (l_cost <> 0 AND l_asdv_rec.cost = 0) THEN
193 OKL_API.set_message(p_app_name => G_APP_NAME,
194 p_msg_name => G_AMOUNT_ROUNDING,
195 p_token1 => 'AMT',
196 p_token1_value => to_char(l_cost));
197 RAISE G_EXCEPTION_HALT_VALIDATION;
198 END IF;
199
200 -- End Modification for Multi Currency
201 */
202
203 --Bug# 4959361
204 OPEN l_tal_csr(p_tal_id => p_asdv_rec.tal_id);
205 FETCH l_tal_csr INTO l_tal_rec;
206 CLOSE l_tal_csr;
207
208 IF l_tal_rec.kle_id IS NOT NULL THEN
209 OKL_LLA_UTIL_PVT.check_line_update_allowed
210 (p_api_version => p_api_version,
211 p_init_msg_list => p_init_msg_list,
212 x_return_status => x_return_status,
213 x_msg_count => x_msg_count,
214 x_msg_data => x_msg_data,
215 p_cle_id => l_tal_rec.kle_id);
216
217 IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
218 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
219 ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
220 RAISE OKL_API.G_EXCEPTION_ERROR;
221 END IF;
222 END IF;
223 --Bug# 4959361
224
225 l_asdv_rec := p_asdv_rec;
226 --
227 -- Get Currency from contract header if not provided
228 -- at p_talv_rec record
229 -- Fix Bug# 2737014
230 --
231 IF (p_asdv_rec.currency_code IS NULL) THEN
232
233 l_header_curr_code := NULL;
234 l_header_curr_conv_type := NULL;
235 l_header_curr_conv_date := NULL;
236
237 OPEN header_curr_csr (p_asdv_rec.tal_id);
238 FETCH header_curr_csr INTO l_header_curr_code,
239 l_header_curr_conv_type,
240 l_header_curr_conv_date;
241 CLOSE header_curr_csr;
242
243 IF (l_header_curr_code IS NOT NULL) THEN
244 l_asdv_rec.currency_code := l_header_curr_code;
245 l_asdv_rec.currency_conversion_type := l_header_curr_conv_type;
246 l_asdv_rec.currency_conversion_date := l_header_curr_conv_date;
247 END IF;
248 END IF;
249
250 --Bug# 3657624 : Depreciation Rate should not be divided by 100
251 /*
252 --Bug# 3573504 : Flat rate method support
253 If nvl(l_asdv_rec.DEPRN_RATE_TAX,OKL_API.G_MISS_NUM) <> OKL_API.G_MISS_NUM then
254 l_asdv_rec.DEPRN_RATE_TAX := l_asdv_rec.DEPRN_RATE_TAX/100;
255 End If;
256 --Bug# 3573504
257 */
258 --Bug# 3657624
259
260 -- evaluate conditions, build outcomes for true conditions and
261 -- put them on outcome queue
262 OKL_ASD_PVT.insert_row(p_api_version,
263 p_init_msg_list,
264 x_return_status,
265 x_msg_count,
266 x_msg_data,
267 l_asdv_rec,
268 x_asdv_rec);
269
270 /*
271 * sjalasut: aug 18, 04 added code to enable business event. BEGIN
272 * raise event only if the context contract is a LEASE contract
273 */
274 -- get the contract header id
275 OPEN get_chr_and_cle_id(x_asdv_rec.tal_id);
276 FETCH get_chr_and_cle_id INTO l_chr_id, l_cle_id;
277 CLOSE get_chr_and_cle_id;
278 IF(OKL_LLA_UTIL_PVT.is_lease_contract(l_chr_id)= OKL_API.G_TRUE)THEN
279 raise_business_event(p_api_version => p_api_version,
280 p_init_msg_list => p_init_msg_list,
281 p_chr_id => l_chr_id,
282 p_asset_id => l_cle_id,
283 p_event_name => G_WF_EVT_ASSETTAX_DPRN_CRTD,
284 x_return_status => x_return_status,
285 x_msg_count => x_msg_count,
286 x_msg_data => x_msg_data
287 );
288 IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
289 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
290 ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
291 RAISE OKL_API.G_EXCEPTION_ERROR;
292 END IF;
293 END IF;
294 /*
295 * sjalasut: aug 18, 04 added code to enable business event. END
296 */
297
298 -- Bug# 3477560
299 OPEN get_chr_id(x_asdv_rec.tal_Id);
300 FETCH get_chr_id INTO ln_chr_id;
301 CLOSE get_chr_id;
302
303 -- We need to change the status of the header whenever there is updating happening
304 -- after the contract status is approved
305 IF (ln_chr_id is NOT NULL) AND
306 (ln_chr_id <> OKL_API.G_MISS_NUM) THEN
307 --cascade edit status on to lines
308 okl_contract_status_pub.cascade_lease_status_edit
309 (p_api_version => p_api_version,
310 p_init_msg_list => p_init_msg_list,
311 x_return_status => x_return_status,
312 x_msg_count => x_msg_count,
313 x_msg_data => x_msg_data,
314 p_chr_id => ln_chr_id);
315 IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
316 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
317 ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
318 RAISE OKC_API.G_EXCEPTION_ERROR;
319 END IF;
320 END IF;
321
322 OKC_API.END_ACTIVITY (x_msg_count
323 ,x_msg_data );
324 EXCEPTION
325 WHEN OKC_API.G_EXCEPTION_ERROR THEN
326 x_return_status := OKC_API.HANDLE_EXCEPTIONS
327 (l_api_name,
328 G_PKG_NAME,
329 'OKC_API.G_RET_STS_ERROR',
330 x_msg_count,
331 x_msg_data,
332 '_PVT');
333 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
334 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
335 (l_api_name,
336 G_PKG_NAME,
337 'OKC_API.G_RET_STS_UNEXP_ERROR',
338 x_msg_count,
339 x_msg_data,
340 '_PVT');
341 WHEN OTHERS THEN x_return_status :=OKC_API.HANDLE_EXCEPTIONS
342 (l_api_name,
343 G_PKG_NAME,
344 'OTHERS',
345 x_msg_count,
346 x_msg_data,
347 '_PVT');
348 END Create_txd_asset_def;
349
350 PROCEDURE Create_txd_asset_def(
351 p_api_version IN NUMBER,
352 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
353 x_return_status OUT NOCOPY VARCHAR2,
354 x_msg_count OUT NOCOPY NUMBER,
355 x_msg_data OUT NOCOPY VARCHAR2,
356 p_asdv_tbl IN advv_tbl_type,
357 x_asdv_tbl OUT NOCOPY advv_tbl_type)
358 IS
359 l_api_name CONSTANT VARCHAR2(30) := 'CREATE_TRX_ASSETS_LINE_DTL';
360 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
361
362 p NUMBER := 0;
363 BEGIN
364 -- Call start_activity to create savepoint, check compatibility
365 -- and initialize message list
366 l_return_status := OKC_API.START_ACTIVITY (l_api_name
367 ,p_init_msg_list
368 ,'_PVT'
369 , x_return_status);
370 -- Check if activity started successfully
371 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
372 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
373 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
374 RAISE OKC_API.G_EXCEPTION_ERROR;
375 END IF;
376
377 -- Modified by rravikir
378 -- calling create_txd_asset_def record version to create records
379
380 IF p_asdv_tbl.COUNT > 0 THEN
381 p := p_asdv_tbl.FIRST;
382 LOOP
383 create_txd_asset_def(p_api_version => p_api_version,
384 p_init_msg_list => p_init_msg_list,
385 x_return_status => x_return_status,
386 x_msg_count => x_msg_count,
387 x_msg_data => x_msg_data,
388 p_asdv_rec => p_asdv_tbl(p),
389 x_asdv_rec => x_asdv_tbl(p));
390
391 IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
392 EXIT WHEN (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR);
393 ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
394 EXIT WHEN (x_return_status = OKL_API.G_RET_STS_ERROR);
395 END IF;
396 EXIT WHEN (p = p_asdv_tbl.LAST);
397 p := p_asdv_tbl.NEXT(p);
398 END LOOP;
399 IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
400 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
401 ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
402 RAISE OKL_API.G_EXCEPTION_ERROR;
403 END IF;
404 END IF;
405
406 -- End Modification
407
408 -- evaluate conditions, build outcomes for true conditions and
409 -- put them on outcome queue
410 /* OKL_ASD_PVT.insert_row(p_api_version,
411 p_init_msg_list,
412 x_return_status,
413 x_msg_count,
414 x_msg_data,
415 p_asdv_tbl,
416 x_asdv_tbl);*/
417
418 OKC_API.END_ACTIVITY (x_msg_count
419 ,x_msg_data );
420
421 EXCEPTION
422 WHEN OKC_API.G_EXCEPTION_ERROR THEN
423 x_return_status := OKC_API.HANDLE_EXCEPTIONS
424 (l_api_name,
425 G_PKG_NAME,
426 'OKC_API.G_RET_STS_ERROR',
427 x_msg_count,
428 x_msg_data,
429 '_PVT');
430 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
431 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
432 (l_api_name,
433 G_PKG_NAME,
434 'OKC_API.G_RET_STS_UNEXP_ERROR',
435 x_msg_count,
436 x_msg_data,
437 '_PVT');
438 WHEN OTHERS THEN x_return_status :=OKC_API.HANDLE_EXCEPTIONS
439 ( l_api_name,
440 G_PKG_NAME,
441 'OTHERS',
442 x_msg_count,
443 x_msg_data,
444 '_PVT');
445 END Create_txd_asset_def;
446
447 PROCEDURE lock_txd_asset_def(
448 p_api_version IN NUMBER,
449 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
450 x_return_status OUT NOCOPY VARCHAR2,
451 x_msg_count OUT NOCOPY NUMBER,
452 x_msg_data OUT NOCOPY VARCHAR2,
453 p_asdv_rec IN advv_rec_type)
454 IS
455 l_api_name CONSTANT VARCHAR2(30) := 'LOCK_TRX_ASSETS_LINE_DTL';
456 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
457 BEGIN
458 -- Call start_activity to create savepoint, check compatibility
459 -- and initialize message list
460 l_return_status := OKC_API.START_ACTIVITY (l_api_name
461 ,p_init_msg_list
462 ,'_PVT'
463 ,x_return_status);
464 -- Check if activity started successfully
465 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
466 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
467 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
468 RAISE OKC_API.G_EXCEPTION_ERROR;
469 END IF;
470 -- evaluate conditions, build outcomes for true conditions and
471 -- put them on outcome queue
472 OKL_ASD_PVT.lock_row(p_api_version,
473 p_init_msg_list,
474 x_return_status,
475 x_msg_count,
476 x_msg_data,
477 p_asdv_rec);
478 OKC_API.END_ACTIVITY (x_msg_count
479 ,x_msg_data );
480 EXCEPTION
481 WHEN OKC_API.G_EXCEPTION_ERROR THEN
482 x_return_status := OKC_API.HANDLE_EXCEPTIONS
483 (l_api_name,
484 G_PKG_NAME,
485 'OKC_API.G_RET_STS_ERROR',
486 x_msg_count,
487 x_msg_data,
488 '_PVT');
489 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
490 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
491 (l_api_name,
492 G_PKG_NAME,
493 'OKC_API.G_RET_STS_UNEXP_ERROR',
494 x_msg_count,
495 x_msg_data,
496 '_PVT');
497 WHEN OTHERS THEN x_return_status :=OKC_API.HANDLE_EXCEPTIONS
498 (l_api_name,
499 G_PKG_NAME,
500 'OTHERS',
501 x_msg_count,
502 x_msg_data,
503 '_PVT');
504 END lock_txd_asset_def;
505
506 PROCEDURE lock_txd_asset_def(
507 p_api_version IN NUMBER,
508 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
509 x_return_status OUT NOCOPY VARCHAR2,
510 x_msg_count OUT NOCOPY NUMBER,
511 x_msg_data OUT NOCOPY VARCHAR2,
512 p_asdv_tbl IN advv_tbl_type)
513 IS
514 l_api_name CONSTANT VARCHAR2(30) := 'LOCK_TRX_ASSETS_LINE_DTL';
515 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
516 BEGIN
517 -- Call start_activity to create savepoint, check compatibility
518 -- and initialize message list
519 l_return_status := OKC_API.START_ACTIVITY (l_api_name
520 ,p_init_msg_list
521 ,'_PVT'
522 ,x_return_status);
523 -- Check if activity started successfully
524 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
525 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
526 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
527 RAISE OKC_API.G_EXCEPTION_ERROR;
528 END IF;
529 -- evaluate conditions, build outcomes for true conditions and
530 -- put them on outcome queue
531 OKL_ASD_PVT.lock_row(p_api_version,
532 p_init_msg_list,
533 x_return_status,
534 x_msg_count,
535 x_msg_data,
536 p_asdv_tbl);
537 OKC_API.END_ACTIVITY (x_msg_count
538 ,x_msg_data );
539 EXCEPTION
540 WHEN OKC_API.G_EXCEPTION_ERROR THEN
541 x_return_status := OKC_API.HANDLE_EXCEPTIONS
542 (l_api_name,
543 G_PKG_NAME,
544 'OKC_API.G_RET_STS_ERROR',
545 x_msg_count,
546 x_msg_data,
547 '_PVT');
548 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
549 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
550 (l_api_name,
551 G_PKG_NAME,
552 'OKC_API.G_RET_STS_UNEXP_ERROR',
553 x_msg_count,
554 x_msg_data,
555 '_PVT');
556 WHEN OTHERS THEN x_return_status :=OKC_API.HANDLE_EXCEPTIONS
557 (l_api_name,
558 G_PKG_NAME,
559 'OTHERS',
560 x_msg_count,
561 x_msg_data,
562 '_PVT');
563 END lock_txd_asset_def;
564
565 PROCEDURE update_txd_asset_def(
566 p_api_version IN NUMBER,
567 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
568 x_return_status OUT NOCOPY VARCHAR2,
569 x_msg_count OUT NOCOPY NUMBER,
570 x_msg_data OUT NOCOPY VARCHAR2,
571 p_asdv_rec IN advv_rec_type,
572 x_asdv_rec OUT NOCOPY advv_rec_type)
573 IS
574 l_api_name CONSTANT VARCHAR2(30) := 'UPDATE_TRX_ASSETS_LINE_DTL';
575 ln_chr_id OKC_K_LINES_B.DNZ_CHR_ID%TYPE;
576
577 -- Temp parameters to store cost and currency code
578 l_cost OKL_TXD_ASSETS_B.COST%TYPE;
579 l_currency_code OKL_TXD_ASSETS_B.CURRENCY_CODE%TYPE;
580
581 l_asdv_rec advv_rec_type := p_asdv_rec;
582
583 CURSOR get_chr_id(p_tal_id OKL_TXD_ASSETS_B.TAL_ID%TYPE)
584 IS
585 SELECT to_char(cle.dnz_chr_id)
586 FROM okc_k_lines_b cle,
587 okl_txl_assets_b tal,
588 okl_txd_assets_b txd
589 WHERE tal.kle_id = cle.id
590 AND tal.id = txd.tal_id
591 AND tal.tal_type in ('CFA','CIB','CRB','CRL','CRV','CSP','ALI')
592 AND txd.tal_id = p_tal_id;
593 /*
594 CURSOR c_get_currency_code(p_id OKL_TXD_ASSETS_B.ID%TYPE) IS
595 SELECT tas.currency_code
596 FROM OKL_TXD_ASSETS_B tas
597 WHERE tas.id = p_id;
598 */
599 CURSOR header_curr_csr(p_txd_id OKL_TXD_ASSETS_V.ID%TYPE) IS
600 SELECT h.currency_code,
601 h.currency_conversion_type,
602 h.currency_conversion_date
603 FROM okl_k_headers_full_v h,
604 okl_txl_assets_v txl,
605 okl_txd_assets_v txd
606 WHERE h.id = txl.dnz_khr_id
607 AND txl.id = txd.tal_id
608 AND txd.id = p_txd_id;
609
610 l_header_curr_code OKL_K_HEADERS_FULL_V.CURRENCY_CODE%TYPE;
611 l_header_curr_conv_type OKL_K_HEADERS_FULL_V.CURRENCY_CONVERSION_TYPE%TYPE;
612 l_header_curr_conv_date OKL_K_HEADERS_FULL_V.CURRENCY_CONVERSION_DATE%TYPE;
613
614 --Bug# 4959361
615 CURSOR l_tal_csr(p_tal_id IN NUMBER) IS
616 SELECT kle_id
617 FROM okl_txl_assets_b tal
618 WHERE tal.id = p_tal_id;
619
620 l_tal_rec l_tal_csr%ROWTYPE;
621 --Bug# 4959361
622
623 BEGIN
624 x_return_status := OKC_API.G_RET_STS_SUCCESS;
625 -- Call start_activity to create savepoint, check compatibility
626 -- and initialize message list
627 x_return_status := OKC_API.START_ACTIVITY (l_api_name
628 ,p_init_msg_list
629 ,'_PVT'
630 ,x_return_status);
631 -- Check if activity started successfully
632 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
633 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
634 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
635 RAISE OKC_API.G_EXCEPTION_ERROR;
636 END IF;
637
638 /* Rounding logic is at TAPI
639 -- Modified by rravikir
640 -- Call to Accounting Util package to address Multi Currency requirement
641 -- Start
642 OPEN c_get_currency_code(p_id => l_asdv_rec.id);
643
644 IF c_get_currency_code%NOTFOUND THEN
645 OKL_API.set_message(p_app_name => G_APP_NAME,
646 p_msg_name => G_LINE_RECORD);
647 RAISE OKL_API.G_EXCEPTION_ERROR;
648 END IF;
649 FETCH c_get_currency_code INTO l_currency_code;
650 CLOSE c_get_currency_code;
651
652 l_cost := l_asdv_rec.cost;
653
654 l_asdv_rec.cost :=
655 OKL_ACCOUNTING_UTIL.CROSS_CURRENCY_ROUND_AMOUNT(l_asdv_rec.cost,
656 l_currency_code);
657
658 IF (l_cost <> 0 AND l_asdv_rec.cost = 0) THEN
659 OKL_API.set_message(p_app_name => G_APP_NAME,
660 p_msg_name => G_AMOUNT_ROUNDING,
661 p_token1 => 'AMT',
662 p_token1_value => to_char(l_cost));
663 RAISE G_EXCEPTION_HALT_VALIDATION;
664 END IF;
665
666 -- End Modification for Multi Currency
667 */
668
669 --Bug# 4959361
670 OPEN l_tal_csr(p_tal_id => p_asdv_rec.tal_id);
671 FETCH l_tal_csr INTO l_tal_rec;
672 CLOSE l_tal_csr;
673
674 IF l_tal_rec.kle_id IS NOT NULL THEN
675 OKL_LLA_UTIL_PVT.check_line_update_allowed
676 (p_api_version => p_api_version,
677 p_init_msg_list => p_init_msg_list,
678 x_return_status => x_return_status,
679 x_msg_count => x_msg_count,
680 x_msg_data => x_msg_data,
681 p_cle_id => l_tal_rec.kle_id);
682
683 IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
684 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
685 ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
686 RAISE OKL_API.G_EXCEPTION_ERROR;
687 END IF;
688 END IF;
689 --Bug# 4959361
690
691 l_asdv_rec := p_asdv_rec;
692 --
693 -- Get Currency from contract header if not provided
694 -- at p_asdv_rec record
695 -- Fix Bug# 2737014
696 --
697 IF (p_asdv_rec.currency_code IS NULL) THEN
698
699 l_header_curr_code := NULL;
700 l_header_curr_conv_type := NULL;
701 l_header_curr_conv_date := NULL;
702
703 OPEN header_curr_csr (p_asdv_rec.id);
704 FETCH header_curr_csr INTO l_header_curr_code,
705 l_header_curr_conv_type,
706 l_header_curr_conv_date;
707 CLOSE header_curr_csr;
708
709 IF (l_header_curr_code IS NOT NULL) THEN
710 l_asdv_rec.currency_code := l_header_curr_code;
711 l_asdv_rec.currency_conversion_type := l_header_curr_conv_type;
712 l_asdv_rec.currency_conversion_date := l_header_curr_conv_date;
713 END IF;
714 END IF;
715
716 --Bug# 3657624 : Depreciation Rate should not be divided by 100
717 /*
718 --Bug# 3573504 : Flat rate method support
719 If nvl(l_asdv_rec.DEPRN_RATE_TAX,OKL_API.G_MISS_NUM) <> OKL_API.G_MISS_NUM then
720 l_asdv_rec.DEPRN_RATE_TAX := l_asdv_rec.DEPRN_RATE_TAX/100;
721 End If;
722 --Bug# 3573504
723 */
724 --Bug# 3657624
725
726 -- evaluate conditions, build outcomes for true conditions and
727 -- put them on outcome queue
728 OKL_ASD_PVT.update_row(p_api_version,
729 p_init_msg_list,
730 x_return_status,
731 x_msg_count,
732 x_msg_data,
733 l_asdv_rec,
734 x_asdv_rec);
735 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
736 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
737 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
738 RAISE OKC_API.G_EXCEPTION_ERROR;
739 END IF;
740 OPEN get_chr_id(x_asdv_rec.tal_Id);
741 FETCH get_chr_id INTO ln_chr_id;
742 CLOSE get_chr_id;
743 -- We need to change the status of the header whenever there is updating happening
744 -- after the contract status is approved
745 IF (ln_chr_id is NOT NULL) AND
746 (ln_chr_id <> OKL_API.G_MISS_NUM) THEN
747 --cascade edit status on to lines
748 okl_contract_status_pub.cascade_lease_status_edit
749 (p_api_version => p_api_version,
750 p_init_msg_list => p_init_msg_list,
751 x_return_status => x_return_status,
752 x_msg_count => x_msg_count,
753 x_msg_data => x_msg_data,
754 p_chr_id => ln_chr_id);
755 IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
756 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
757 ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
758 RAISE OKC_API.G_EXCEPTION_ERROR;
759 END IF;
760 END IF;
761 OKC_API.END_ACTIVITY (x_msg_count
762 ,x_msg_data );
763 EXCEPTION
764 WHEN OKC_API.G_EXCEPTION_ERROR THEN
765 x_return_status := OKC_API.HANDLE_EXCEPTIONS
766 (l_api_name,
767 G_PKG_NAME,
768 'OKC_API.G_RET_STS_ERROR',
769 x_msg_count,
770 x_msg_data,
771 '_PVT');
772 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
773 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
774 (l_api_name,
775 G_PKG_NAME,
776 'OKC_API.G_RET_STS_UNEXP_ERROR',
777 x_msg_count,
778 x_msg_data,
779 '_PVT');
780 WHEN OTHERS THEN x_return_status :=OKC_API.HANDLE_EXCEPTIONS
781 (l_api_name,
782 G_PKG_NAME,
783 'OTHERS',
784 x_msg_count,
785 x_msg_data,
786 '_PVT');
787 END update_txd_asset_def;
788
789 PROCEDURE update_txd_asset_def(
790 p_api_version IN NUMBER,
791 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
792 x_return_status OUT NOCOPY VARCHAR2,
793 x_msg_count OUT NOCOPY NUMBER,
794 x_msg_data OUT NOCOPY VARCHAR2,
795 p_asdv_tbl IN advv_tbl_type,
796 x_asdv_tbl OUT NOCOPY advv_tbl_type)
797 IS
798 l_api_name CONSTANT VARCHAR2(30) := 'UPDATE_TRX_ASSETS_LINE_DTL';
799 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
800
801 p NUMBER := 0;
802 BEGIN
803 -- Call start_activity to create savepoint, check compatibility
804 -- and initialize message list
805 l_return_status := OKC_API.START_ACTIVITY (l_api_name
806 ,p_init_msg_list
807 ,'_PVT'
808 ,x_return_status);
809 -- Check if activity started successfully
810 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
811 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
812 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
813 RAISE OKC_API.G_EXCEPTION_ERROR;
814 END IF;
815
816 -- Modified by rravikir
817 -- calling update_txd_asset_def record version to create records
818
819 IF p_asdv_tbl.COUNT > 0 THEN
820 p := p_asdv_tbl.FIRST;
821 LOOP
822 update_txd_asset_def(p_api_version => p_api_version,
823 p_init_msg_list => p_init_msg_list,
824 x_return_status => x_return_status,
825 x_msg_count => x_msg_count,
826 x_msg_data => x_msg_data,
827 p_asdv_rec => p_asdv_tbl(p),
828 x_asdv_rec => x_asdv_tbl(p));
829
830 IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
831 EXIT WHEN (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR);
832 ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
833 EXIT WHEN (x_return_status = OKL_API.G_RET_STS_ERROR);
834 END IF;
835 EXIT WHEN (p = p_asdv_tbl.LAST);
836 p := p_asdv_tbl.NEXT(p);
837 END LOOP;
838 IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
839 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
840 ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
841 RAISE OKL_API.G_EXCEPTION_ERROR;
842 END IF;
843 END IF;
844
845 -- End Modification
846
847 -- evaluate conditions, build outcomes for true conditions and
848 -- put them on outcome queue
849 OKL_ASD_PVT.update_row(p_api_version,
850 p_init_msg_list,
851 x_return_status,
852 x_msg_count,
853 x_msg_data,
854 p_asdv_tbl,
855 x_asdv_tbl);
856 OKC_API.END_ACTIVITY (x_msg_count
857 ,x_msg_data );
858 EXCEPTION
859 WHEN OKC_API.G_EXCEPTION_ERROR THEN
860 x_return_status := OKC_API.HANDLE_EXCEPTIONS
861 (l_api_name,
862 G_PKG_NAME,
863 'OKC_API.G_RET_STS_ERROR',
864 x_msg_count,
865 x_msg_data,
866 '_PVT');
867 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
868 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
869 (l_api_name,
870 G_PKG_NAME,
871 'OKC_API.G_RET_STS_UNEXP_ERROR',
872 x_msg_count,
873 x_msg_data,
874 '_PVT');
875 WHEN OTHERS THEN x_return_status :=OKC_API.HANDLE_EXCEPTIONS
876 (l_api_name,
877 G_PKG_NAME,
878 'OTHERS',
879 x_msg_count,
880 x_msg_data,
881 '_PVT');
882 END update_txd_asset_def;
883
884 PROCEDURE delete_txd_asset_def(
885 p_api_version IN NUMBER,
886 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
887 x_return_status OUT NOCOPY VARCHAR2,
888 x_msg_count OUT NOCOPY NUMBER,
889 x_msg_data OUT NOCOPY VARCHAR2,
890 p_asdv_rec IN advv_rec_type)
891 IS
892 l_api_name CONSTANT VARCHAR2(30) := 'DELETE_TRX_ASSETS_LINE_DTL';
893 ln_chr_id OKC_K_LINES_B.DNZ_CHR_ID%TYPE;
894
895 -- Bug# 3477560
896 CURSOR get_chr_id(p_txd_id OKL_TXD_ASSETS_B.ID%TYPE)
897 IS
898 SELECT to_char(cle.dnz_chr_id)
899 FROM okc_k_lines_b cle,
900 okl_txl_assets_b tal,
901 okl_txd_assets_b txd
902 WHERE tal.kle_id = cle.id
903 AND tal.id = txd.tal_id
904 AND tal.tal_type in ('CFA','CIB','CRB','CRL','CRV','CSP','ALI')
905 AND txd.id = p_txd_id;
906
907 /*
908 * sjalasut added cursor to derive the contract header id and contract line id. BEGIN
909 *
910 */
911 CURSOR get_chr_and_cle_id(p_id OKL_TXD_ASSETS_B.ID%TYPE)
912 IS
913 SELECT to_char(cle.dnz_chr_id) chr_id, cle.cle_id cle_id
914 FROM okc_k_lines_b cle,
915 okl_txl_assets_b tal,
916 okl_txd_assets_b txd
917 WHERE tal.kle_id = cle.id
918 AND tal.id = txd.tal_id
919 AND tal.tal_type in ('CFA','CIB','CRB','CRL','CRV','CSP','ALI')
920 AND txd.id = p_id;
921
922 l_chr_id okc_k_headers_b.id%TYPE;
923 l_cle_id okc_k_lines_b.id%TYPE;
924
925 /*
926 * sjalasut added cursor to derive the contract header id and contract line id. END
927 *
928 */
929
930 --Bug# 4959361
931 CURSOR l_tal_csr(p_txd_id IN NUMBER) IS
932 SELECT tal.kle_id
933 FROM okl_txl_assets_b tal,
934 okl_txd_assets_b txd
935 WHERE tal.id = txd.tal_id
936 AND txd.id = p_txd_id;
937
938 l_tal_rec l_tal_csr%ROWTYPE;
939 --Bug# 4959361
940
941 BEGIN
942 x_return_status := OKC_API.G_RET_STS_SUCCESS;
943 -- Call start_activity to create savepoint, check compatibility
944 -- and initialize message list
945 x_return_status := OKC_API.START_ACTIVITY (l_api_name
946 ,p_init_msg_list
947 ,'_PVT'
948 ,x_return_status);
949 -- Check if activity started successfully
950 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
951 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
952 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
953 RAISE OKC_API.G_EXCEPTION_ERROR;
954 END IF;
955
956 --Bug# 4959361
957 OPEN l_tal_csr(p_txd_id => p_asdv_rec.id);
958 FETCH l_tal_csr INTO l_tal_rec;
959 CLOSE l_tal_csr;
960
961 IF l_tal_rec.kle_id IS NOT NULL THEN
962 OKL_LLA_UTIL_PVT.check_line_update_allowed
963 (p_api_version => p_api_version,
964 p_init_msg_list => p_init_msg_list,
965 x_return_status => x_return_status,
966 x_msg_count => x_msg_count,
967 x_msg_data => x_msg_data,
968 p_cle_id => l_tal_rec.kle_id);
969
970 IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
971 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
972 ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
973 RAISE OKL_API.G_EXCEPTION_ERROR;
974 END IF;
975 END IF;
976 --Bug# 4959361
977
978 -- Bug# 3477560
979 OPEN get_chr_id(p_asdv_rec.Id);
980 FETCH get_chr_id INTO ln_chr_id;
981 CLOSE get_chr_id;
982
983 /*
984 * sjalasut: aug 18, 04 added code to enable business event. BEGIN
985 */
986 -- get the contract header id
987 OPEN get_chr_and_cle_id(p_asdv_rec.id);
988 FETCH get_chr_and_cle_id INTO l_chr_id, l_cle_id;
989 CLOSE get_chr_and_cle_id;
990 /*
991 * sjalasut: aug 18, 04 added code to enable business event. END
992 */
993 -- evaluate conditions, build outcomes for true conditions and
994 -- put them on outcome queue
995 OKL_ASD_PVT.delete_row(p_api_version,
996 p_init_msg_list,
997 x_return_status,
998 x_msg_count,
999 x_msg_data,
1000 p_asdv_rec);
1001 IF (x_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1002 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1003 ELSIF (x_return_status = OKC_API.G_RET_STS_ERROR) THEN
1004 RAISE OKC_API.G_EXCEPTION_ERROR;
1005 END IF;
1006
1007 /*
1008 * sjalasut: aug 18, 04 added code to enable business event. BEGIN
1009 */
1010 IF(OKL_LLA_UTIL_PVT.is_lease_contract(l_chr_id)= OKL_API.G_TRUE)THEN
1011 raise_business_event(p_api_version => p_api_version,
1012 p_init_msg_list => p_init_msg_list,
1013 p_chr_id => l_chr_id,
1014 p_asset_id => l_cle_id,
1015 p_event_name => G_WF_EVT_ASSETTAX_DPRN_RMVD,
1016 x_return_status => x_return_status,
1017 x_msg_count => x_msg_count,
1018 x_msg_data => x_msg_data
1019 );
1020 IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1021 RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1022 ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
1023 RAISE OKL_API.G_EXCEPTION_ERROR;
1024 END IF;
1025 END IF;
1026 /*
1027 * sjalasut: aug 18, 04 added code to enable business event. END
1028 */
1029
1030 -- We need to change the status of the header whenever there is updating happening
1031 -- after the contract status is approved
1032 IF (ln_chr_id is NOT NULL) AND
1033 (ln_chr_id <> OKL_API.G_MISS_NUM) THEN
1034 --cascade edit status on to lines
1035 okl_contract_status_pub.cascade_lease_status_edit
1036 (p_api_version => p_api_version,
1037 p_init_msg_list => p_init_msg_list,
1038 x_return_status => x_return_status,
1039 x_msg_count => x_msg_count,
1040 x_msg_data => x_msg_data,
1041 p_chr_id => ln_chr_id);
1042 IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1043 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1044 ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
1045 RAISE OKC_API.G_EXCEPTION_ERROR;
1046 END IF;
1047 END IF;
1048 OKC_API.END_ACTIVITY (x_msg_count
1049 ,x_msg_data );
1050 EXCEPTION
1051 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1052 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1053 (l_api_name,
1054 G_PKG_NAME,
1055 'OKC_API.G_RET_STS_ERROR',
1056 x_msg_count,
1057 x_msg_data,
1058 '_PVT');
1059 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1060 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1061 (l_api_name,
1062 G_PKG_NAME,
1063 'OKC_API.G_RET_STS_UNEXP_ERROR',
1064 x_msg_count,
1065 x_msg_data,
1066 '_PVT');
1067 WHEN OTHERS THEN x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1068 (l_api_name,
1069 G_PKG_NAME,
1070 'OTHERS',
1071 x_msg_count,
1072 x_msg_data,
1073 '_PVT');
1074 END delete_txd_asset_def;
1075
1076 PROCEDURE delete_txd_asset_def(
1077 p_api_version IN NUMBER,
1078 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
1079 x_return_status OUT NOCOPY VARCHAR2,
1080 x_msg_count OUT NOCOPY NUMBER,
1081 x_msg_data OUT NOCOPY VARCHAR2,
1082 p_asdv_tbl IN advv_tbl_type)
1083 IS
1084 l_api_name CONSTANT VARCHAR2(30) := 'DELETE_TRX_ASSETS_LINE_DTL';
1085 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1086 BEGIN
1087 -- Call start_activity to create savepoint, check compatibility
1088 -- and initialize message list
1089 l_return_status := OKC_API.START_ACTIVITY (l_api_name
1090 ,p_init_msg_list
1091 ,'_PVT'
1092 ,x_return_status);
1093 -- Check if activity started successfully
1094 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1095 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1096 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1097 RAISE OKC_API.G_EXCEPTION_ERROR;
1098 END IF;
1099 -- evaluate conditions, build outcomes for true conditions and
1100 -- put them on outcome queue
1101 OKL_ASD_PVT.delete_row(p_api_version,
1102 p_init_msg_list,
1103 x_return_status,
1104 x_msg_count,
1105 x_msg_data,
1106 p_asdv_tbl);
1107 OKC_API.END_ACTIVITY (x_msg_count
1108 ,x_msg_data );
1109 EXCEPTION
1110 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1111 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1112 (l_api_name,
1113 G_PKG_NAME,
1114 'OKC_API.G_RET_STS_ERROR',
1115 x_msg_count,
1116 x_msg_data,
1117 '_PVT');
1118 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1119 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1120 (l_api_name,
1121 G_PKG_NAME,
1122 'OKC_API.G_RET_STS_UNEXP_ERROR',
1123 x_msg_count,
1124 x_msg_data,
1125 '_PVT');
1126 WHEN OTHERS THEN x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1127 (l_api_name,
1128 G_PKG_NAME,
1129 'OTHERS',
1130 x_msg_count,
1131 x_msg_data,
1132 '_PVT');
1133 END delete_txd_asset_def;
1134
1135 PROCEDURE validate_txd_asset_def(
1136 p_api_version IN NUMBER,
1137 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
1138 x_return_status OUT NOCOPY VARCHAR2,
1139 x_msg_count OUT NOCOPY NUMBER,
1140 x_msg_data OUT NOCOPY VARCHAR2,
1141 p_asdv_rec IN advv_rec_type)
1142 IS
1143 l_api_name CONSTANT VARCHAR2(30) := 'VALIDATE_TRX_ASSETS_LINE_DTL';
1144 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1145 BEGIN
1146 -- Call start_activity to create savepoint, check compatibility
1147 -- and initialize message list
1148 l_return_status := OKC_API.START_ACTIVITY (l_api_name
1149 ,p_init_msg_list
1150 ,'_PVT'
1151 ,x_return_status);
1152 -- Check if activity started successfully
1153 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1154 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1155 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1156 RAISE OKC_API.G_EXCEPTION_ERROR;
1157 END IF;
1158 -- evaluate conditions, build outcomes for true conditions and
1159 -- put them on outcome queue
1160 OKL_ASD_PVT.validate_row(p_api_version,
1161 p_init_msg_list,
1162 x_return_status,
1163 x_msg_count,
1164 x_msg_data,
1165 p_asdv_rec);
1166 OKC_API.END_ACTIVITY (x_msg_count
1167 ,x_msg_data );
1168 EXCEPTION
1169 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1170 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1171 (l_api_name,
1172 G_PKG_NAME,
1173 'OKC_API.G_RET_STS_ERROR',
1174 x_msg_count,
1175 x_msg_data,
1176 '_PVT');
1177 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1178 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1179 (l_api_name,
1180 G_PKG_NAME,
1181 'OKC_API.G_RET_STS_UNEXP_ERROR',
1182 x_msg_count,
1183 x_msg_data,
1184 '_PVT');
1185 WHEN OTHERS THEN x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1186 (l_api_name,
1187 G_PKG_NAME,
1188 'OTHERS',
1189 x_msg_count,
1190 x_msg_data,
1191 '_PVT');
1192 END validate_txd_asset_def;
1193
1194 PROCEDURE validate_txd_asset_def(
1195 p_api_version IN NUMBER,
1196 p_init_msg_list IN VARCHAR2 DEFAULT OKC_API.G_FALSE,
1197 x_return_status OUT NOCOPY VARCHAR2,
1198 x_msg_count OUT NOCOPY NUMBER,
1199 x_msg_data OUT NOCOPY VARCHAR2,
1200 p_asdv_tbl IN advv_tbl_type)
1201 IS
1202 l_api_name CONSTANT VARCHAR2(30) := 'VALIDATE_TRX_ASSETS_LINE_DTL';
1203 l_return_status VARCHAR2(1) := OKC_API.G_RET_STS_SUCCESS;
1204 BEGIN
1205 -- Call start_activity to create savepoint, check compatibility
1206 -- and initialize message list
1207 l_return_status := OKC_API.START_ACTIVITY (l_api_name
1208 ,p_init_msg_list
1209 ,'_PVT'
1210 ,x_return_status);
1211 -- Check if activity started successfully
1212 IF (l_return_status = OKC_API.G_RET_STS_UNEXP_ERROR) THEN
1213 RAISE OKC_API.G_EXCEPTION_UNEXPECTED_ERROR;
1214 ELSIF (l_return_status = OKC_API.G_RET_STS_ERROR) THEN
1215 RAISE OKC_API.G_EXCEPTION_ERROR;
1216 END IF;
1217 -- evaluate conditions, build outcomes for true conditions and
1218 -- put them on outcome queue
1219 OKL_ASD_PVT.validate_row(p_api_version,
1220 p_init_msg_list,
1221 x_return_status,
1222 x_msg_count,
1223 x_msg_data,
1224 p_asdv_tbl);
1225 OKC_API.END_ACTIVITY (x_msg_count
1226 ,x_msg_data );
1227 EXCEPTION
1228 WHEN OKC_API.G_EXCEPTION_ERROR THEN
1229 x_return_status := OKC_API.HANDLE_EXCEPTIONS
1230 (l_api_name,
1231 G_PKG_NAME,
1232 'OKC_API.G_RET_STS_ERROR',
1233 x_msg_count,
1234 x_msg_data,
1235 '_PVT');
1236 WHEN OKC_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1237 x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1238 (l_api_name,
1239 G_PKG_NAME,
1240 'OKC_API.G_RET_STS_UNEXP_ERROR',
1241 x_msg_count,
1242 x_msg_data,
1243 '_PVT');
1244 WHEN OTHERS THEN x_return_status :=OKC_API.HANDLE_EXCEPTIONS
1245 (l_api_name,
1246 G_PKG_NAME,
1247 'OTHERS',
1248 x_msg_count,
1249 x_msg_data,
1250 '_PVT');
1251 END validate_txd_asset_def;
1252
1253 END OKL_TXD_ASSETS_PVT;