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