DBA Data[Home] [Help]

PACKAGE BODY: APPS.OKL_FXL_PVT

Source


1 PACKAGE BODY OKL_FXL_PVT AS
2 /* $Header: OKLSFXLB.pls 120.3 2007/12/21 12:50:54 rajnisku 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_line_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   -- PROCEDURE change_version
85   ---------------------------------------------------------------------------
86   PROCEDURE change_version IS
87   BEGIN
88     null;
89   END change_version;
90 
91   ---------------------------------------------------------------------------
92   -- PROCEDURE api_copy
93   ---------------------------------------------------------------------------
94   PROCEDURE api_copy IS
95   BEGIN
96     null;
97   END api_copy;
98 
99   ---------------------------------------------------------------------------
100   -- PROCEDURE add_language
101   ---------------------------------------------------------------------------
102   PROCEDURE add_language IS
103   BEGIN
104     DELETE FROM OKL_EXT_FA_LINE_SOURCES_TL T
105      WHERE NOT EXISTS (
106         SELECT NULL
107           FROM OKL_EXT_FA_LINE_SOURCES_B B
108          WHERE B.LINE_EXTENSION_ID =T.LINE_EXTENSION_ID
109         );
110 
111     UPDATE OKL_EXT_FA_LINE_SOURCES_TL T SET(
112         INVENTORY_ORG_NAME,
113         TRANS_LINE_DESCRIPTION) = (SELECT
114                                   B.INVENTORY_ORG_NAME,
115                                   B.TRANS_LINE_DESCRIPTION
116                                 FROM OKL_EXT_FA_LINE_SOURCES_TL B
117                                WHERE B.LINE_EXTENSION_ID = T.LINE_EXTENSION_ID
118                                  AND B.LANGUAGE = T.SOURCE_LANG)
119       WHERE ( T.LINE_EXTENSION_ID,
120               T.LANGUAGE)
121           IN (SELECT
122                   SUBT.LINE_EXTENSION_ID,
123                   SUBT.LANGUAGE
124                 FROM OKL_EXT_FA_LINE_SOURCES_TL SUBB, OKL_EXT_FA_LINE_SOURCES_TL SUBT
125                WHERE SUBB.LINE_EXTENSION_ID = SUBT.LINE_EXTENSION_ID
126                  AND SUBB.LANGUAGE = SUBT.SOURCE_LANG
127                  AND (SUBB.INVENTORY_ORG_NAME <> SUBT.INVENTORY_ORG_NAME
128                       OR SUBB.TRANS_LINE_DESCRIPTION <> SUBT.TRANS_LINE_DESCRIPTION
129                       OR (SUBB.INVENTORY_ORG_NAME IS NULL AND SUBT.INVENTORY_ORG_NAME IS NOT NULL)
130                       OR (SUBB.TRANS_LINE_DESCRIPTION IS NULL AND SUBT.TRANS_LINE_DESCRIPTION IS NOT NULL)
131               ));
132 
133     INSERT INTO OKL_EXT_FA_LINE_SOURCES_TL (
134         LINE_EXTENSION_ID,
135         LANGUAGE,
136         SOURCE_LANG,
137         SFWT_FLAG,
138         INVENTORY_ORG_NAME,
139         TRANS_LINE_DESCRIPTION,
140         CREATED_BY,
141         CREATION_DATE,
142         LAST_UPDATED_BY,
143         LAST_UPDATE_DATE,
144         LAST_UPDATE_LOGIN)
145       SELECT
146             B.LINE_EXTENSION_ID,
147             L.LANGUAGE_CODE,
148             B.SOURCE_LANG,
149             B.SFWT_FLAG,
150             B.INVENTORY_ORG_NAME,
151             B.TRANS_LINE_DESCRIPTION,
152             B.CREATED_BY,
153             B.CREATION_DATE,
154             B.LAST_UPDATED_BY,
155             B.LAST_UPDATE_DATE,
156             B.LAST_UPDATE_LOGIN
157         FROM OKL_EXT_FA_LINE_SOURCES_TL B, FND_LANGUAGES L
158        WHERE L.INSTALLED_FLAG IN ('I', 'B')
159          AND B.LANGUAGE = USERENV('LANG')
160          AND NOT EXISTS (
161                     SELECT NULL
162                       FROM OKL_EXT_FA_LINE_SOURCES_TL T
163                      WHERE T.LINE_EXTENSION_ID = B.LINE_EXTENSION_ID
164                        AND T.LANGUAGE = L.LANGUAGE_CODE
165                     );
166   END add_language;
167 
168   ---------------------------------------------------------------------------
169   -- FUNCTION get_rec for: OKL_EXT_FA_LINE_SOURCES_V
170   ---------------------------------------------------------------------------
171   FUNCTION get_rec (
172     p_fxlv_rec                     IN fxlv_rec_type,
173     x_no_data_found                OUT NOCOPY BOOLEAN
174   ) RETURN fxlv_rec_type IS
175     CURSOR okl_ext_fa_line_sou7 (p_line_extension_id IN NUMBER) IS
176     SELECT
177             LINE_EXTENSION_ID,
178             HEADER_EXTENSION_ID,
179             SOURCE_ID,
180             SOURCE_TABLE,
181             OBJECT_VERSION_NUMBER,
182             FA_TRANSACTION_ID,
183             ASSET_ID,
184             KLE_ID,
185             ASSET_NUMBER,
186             CONTRACT_LINE_NUMBER,
187             ASSET_BOOK_TYPE_NAME,
188             ASSET_VENDOR_NAME,
189             INSTALLED_SITE_ID,
190             LINE_ATTRIBUTE_CATEGORY,
191             LINE_ATTRIBUTE1,
192             LINE_ATTRIBUTE2,
193             LINE_ATTRIBUTE3,
194             LINE_ATTRIBUTE4,
195             LINE_ATTRIBUTE5,
196             LINE_ATTRIBUTE6,
197             LINE_ATTRIBUTE7,
198             LINE_ATTRIBUTE8,
199             LINE_ATTRIBUTE9,
200             LINE_ATTRIBUTE10,
201             LINE_ATTRIBUTE11,
202             LINE_ATTRIBUTE12,
203             LINE_ATTRIBUTE13,
204             LINE_ATTRIBUTE14,
205             LINE_ATTRIBUTE15,
206             LANGUAGE,
207             INVENTORY_ORG_NAME,
208             TRANS_LINE_DESCRIPTION,
209             CREATED_BY,
210             CREATION_DATE,
211             LAST_UPDATED_BY,
212             LAST_UPDATE_DATE,
213             LAST_UPDATE_LOGIN,
214             INVENTORY_ORG_CODE
215             ,ASSET_BOOK_TYPE_CODE
216             ,PERIOD_COUNTER
217 	    ,ASSET_VENDOR_ID
218       FROM Okl_Ext_Fa_Line_Sources_V
219      WHERE okl_ext_fa_line_sources_v.line_extension_id = p_line_extension_id;
220     l_okl_ext_fa_line_sources_v_pk okl_ext_fa_line_sou7%ROWTYPE;
221     l_fxlv_rec                     fxlv_rec_type;
222   BEGIN
223     x_no_data_found := TRUE;
224     -- Get current database values
225     OPEN okl_ext_fa_line_sou7 (p_fxlv_rec.line_extension_id);
226     FETCH okl_ext_fa_line_sou7 INTO
227               l_fxlv_rec.line_extension_id,
228               l_fxlv_rec.header_extension_id,
229               l_fxlv_rec.source_id,
230               l_fxlv_rec.source_table,
231               l_fxlv_rec.object_version_number,
232               l_fxlv_rec.fa_transaction_id,
233               l_fxlv_rec.asset_id,
234               l_fxlv_rec.kle_id,
235               l_fxlv_rec.asset_number,
236               l_fxlv_rec.contract_line_number,
237               l_fxlv_rec.asset_book_type_name,
238               l_fxlv_rec.asset_vendor_name,
239               l_fxlv_rec.installed_site_id,
240               l_fxlv_rec.line_attribute_category,
241               l_fxlv_rec.line_attribute1,
242               l_fxlv_rec.line_attribute2,
243               l_fxlv_rec.line_attribute3,
244               l_fxlv_rec.line_attribute4,
245               l_fxlv_rec.line_attribute5,
246               l_fxlv_rec.line_attribute6,
247               l_fxlv_rec.line_attribute7,
248               l_fxlv_rec.line_attribute8,
249               l_fxlv_rec.line_attribute9,
250               l_fxlv_rec.line_attribute10,
251               l_fxlv_rec.line_attribute11,
252               l_fxlv_rec.line_attribute12,
253               l_fxlv_rec.line_attribute13,
254               l_fxlv_rec.line_attribute14,
255               l_fxlv_rec.line_attribute15,
256               l_fxlv_rec.language,
257               l_fxlv_rec.inventory_org_name,
258               l_fxlv_rec.trans_line_description,
259               l_fxlv_rec.created_by,
260               l_fxlv_rec.creation_date,
261               l_fxlv_rec.last_updated_by,
262               l_fxlv_rec.last_update_date,
263               l_fxlv_rec.last_update_login,
264               l_fxlv_rec.inventory_org_code
265               ,l_fxlv_rec.asset_book_type_code
266               ,l_fxlv_rec.period_counter
267 	      ,l_fxlv_rec.asset_vendor_id;
268     x_no_data_found := okl_ext_fa_line_sou7%NOTFOUND;
269     CLOSE okl_ext_fa_line_sou7;
270     RETURN(l_fxlv_rec);
271   END get_rec;
272 
273   ------------------------------------------------------------------
274   -- This version of get_rec sets error messages if no data found --
275   ------------------------------------------------------------------
276   FUNCTION get_rec (
277     p_fxlv_rec                     IN fxlv_rec_type,
278     x_return_status                OUT NOCOPY VARCHAR2
279   ) RETURN fxlv_rec_type IS
280     l_fxlv_rec                     fxlv_rec_type;
281     l_row_notfound                 BOOLEAN := TRUE;
282   BEGIN
283     x_return_status := OKL_API.G_RET_STS_SUCCESS;
284     l_fxlv_rec := get_rec(p_fxlv_rec, l_row_notfound);
285     IF (l_row_notfound) THEN
286       OKL_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'LINE_EXTENSION_ID');
287       x_return_status := OKL_API.G_RET_STS_ERROR;
288     END IF;
289     RETURN(l_fxlv_rec);
290   END get_rec;
291   -----------------------------------------------------------
292   -- So we don't have to pass an "l_row_notfound" variable --
293   -----------------------------------------------------------
294   FUNCTION get_rec (
295     p_fxlv_rec                     IN fxlv_rec_type
296   ) RETURN fxlv_rec_type IS
297     l_row_not_found                BOOLEAN := TRUE;
298   BEGIN
299     RETURN(get_rec(p_fxlv_rec, l_row_not_found));
300   END get_rec;
301   ---------------------------------------------------------------------------
302   -- FUNCTION get_rec for: OKL_EXT_FA_LINE_SOURCES_B
303   ---------------------------------------------------------------------------
304   FUNCTION get_rec (
305     p_fxl_rec                      IN fxl_rec_type,
306     x_no_data_found                OUT NOCOPY BOOLEAN
307   ) RETURN fxl_rec_type IS
308     CURSOR okl_ext_fa_line_sou8 (p_line_extension_id IN NUMBER) IS
309     SELECT
310             LINE_EXTENSION_ID,
311             HEADER_EXTENSION_ID,
312             SOURCE_ID,
313             SOURCE_TABLE,
314             OBJECT_VERSION_NUMBER,
315             FA_TRANSACTION_ID,
316             ASSET_ID,
317             KLE_ID,
318             ASSET_NUMBER,
319             CONTRACT_LINE_NUMBER,
320             ASSET_BOOK_TYPE_NAME,
321             ASSET_VENDOR_NAME,
322             INSTALLED_SITE_ID,
323             LINE_ATTRIBUTE_CATEGORY,
324             LINE_ATTRIBUTE1,
325             LINE_ATTRIBUTE2,
326             LINE_ATTRIBUTE3,
327             LINE_ATTRIBUTE4,
328             LINE_ATTRIBUTE5,
329             LINE_ATTRIBUTE6,
330             LINE_ATTRIBUTE7,
331             LINE_ATTRIBUTE8,
332             LINE_ATTRIBUTE9,
333             LINE_ATTRIBUTE10,
334             LINE_ATTRIBUTE11,
335             LINE_ATTRIBUTE12,
336             LINE_ATTRIBUTE13,
337             LINE_ATTRIBUTE14,
338             LINE_ATTRIBUTE15,
339             CREATED_BY,
340             CREATION_DATE,
341             LAST_UPDATED_BY,
342             LAST_UPDATE_DATE,
343             LAST_UPDATE_LOGIN,
344             INVENTORY_ORG_CODE,
345             ASSET_BOOK_TYPE_CODE,
346             PERIOD_COUNTER,
347 	    ASSET_VENDOR_ID
348       FROM Okl_Ext_Fa_Line_Sources_B
349      WHERE okl_ext_fa_line_sources_b.line_extension_id = p_line_extension_id;
350     l_okl_ext_fa_line_sources_b_pk okl_ext_fa_line_sou8%ROWTYPE;
351     l_fxl_rec                      fxl_rec_type;
352   BEGIN
353     x_no_data_found := TRUE;
354     -- Get current database values
355     OPEN okl_ext_fa_line_sou8 (p_fxl_rec.line_extension_id);
356     FETCH okl_ext_fa_line_sou8 INTO
357               l_fxl_rec.line_extension_id,
358               l_fxl_rec.header_extension_id,
359               l_fxl_rec.source_id,
360               l_fxl_rec.source_table,
361               l_fxl_rec.object_version_number,
362               l_fxl_rec.fa_transaction_id,
363               l_fxl_rec.asset_id,
364               l_fxl_rec.kle_id,
365               l_fxl_rec.asset_number,
366               l_fxl_rec.contract_line_number,
367               l_fxl_rec.asset_book_type_name,
368               l_fxl_rec.asset_vendor_name,
369               l_fxl_rec.installed_site_id,
370               l_fxl_rec.line_attribute_category,
371               l_fxl_rec.line_attribute1,
372               l_fxl_rec.line_attribute2,
373               l_fxl_rec.line_attribute3,
374               l_fxl_rec.line_attribute4,
375               l_fxl_rec.line_attribute5,
376               l_fxl_rec.line_attribute6,
377               l_fxl_rec.line_attribute7,
378               l_fxl_rec.line_attribute8,
379               l_fxl_rec.line_attribute9,
380               l_fxl_rec.line_attribute10,
381               l_fxl_rec.line_attribute11,
382               l_fxl_rec.line_attribute12,
383               l_fxl_rec.line_attribute13,
384               l_fxl_rec.line_attribute14,
385               l_fxl_rec.line_attribute15,
386               l_fxl_rec.created_by,
387               l_fxl_rec.creation_date,
388               l_fxl_rec.last_updated_by,
389               l_fxl_rec.last_update_date,
390               l_fxl_rec.last_update_login,
391               l_fxl_rec.inventory_org_code,
392               l_fxl_rec.asset_book_type_code,
393               l_fxl_rec.period_counter,
394 	      l_fxl_rec.asset_vendor_id;
395     x_no_data_found := okl_ext_fa_line_sou8%NOTFOUND;
396     CLOSE okl_ext_fa_line_sou8;
397     RETURN(l_fxl_rec);
398   END get_rec;
399 
400   ------------------------------------------------------------------
401   -- This version of get_rec sets error messages if no data found --
402   ------------------------------------------------------------------
403   FUNCTION get_rec (
404     p_fxl_rec                      IN fxl_rec_type,
405     x_return_status                OUT NOCOPY VARCHAR2
406   ) RETURN fxl_rec_type IS
407     l_fxl_rec                      fxl_rec_type;
408     l_row_notfound                 BOOLEAN := TRUE;
409   BEGIN
410     x_return_status := OKL_API.G_RET_STS_SUCCESS;
411     l_fxl_rec := get_rec(p_fxl_rec, l_row_notfound);
412     IF (l_row_notfound) THEN
413       OKL_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'LINE_EXTENSION_ID');
414       x_return_status := OKL_API.G_RET_STS_ERROR;
415     END IF;
416     RETURN(l_fxl_rec);
417   END get_rec;
418   -----------------------------------------------------------
419   -- So we don't have to pass an "l_row_notfound" variable --
420   -----------------------------------------------------------
421   FUNCTION get_rec (
422     p_fxl_rec                      IN fxl_rec_type
423   ) RETURN fxl_rec_type IS
424     l_row_not_found                BOOLEAN := TRUE;
425   BEGIN
426     RETURN(get_rec(p_fxl_rec, l_row_not_found));
427   END get_rec;
428   ---------------------------------------------------------------------------
429   -- FUNCTION get_rec for: OKL_EXT_FA_LINE_SOURCES_TL
430   ---------------------------------------------------------------------------
431   FUNCTION get_rec (
432     p_fxll_rec                     IN fxll_rec_type,
433     x_no_data_found                OUT NOCOPY BOOLEAN
434   ) RETURN fxll_rec_type IS
435     CURSOR okl_ext_fa_line_sou9 (p_line_extension_id IN NUMBER,
436                                  p_language          IN VARCHAR2) IS
437     SELECT
438             LINE_EXTENSION_ID,
439             LANGUAGE,
440             SOURCE_LANG,
441             SFWT_FLAG,
442             INVENTORY_ORG_NAME,
443             TRANS_LINE_DESCRIPTION,
444             CREATED_BY,
445             CREATION_DATE,
446             LAST_UPDATED_BY,
447             LAST_UPDATE_DATE,
448             LAST_UPDATE_LOGIN
449       FROM Okl_Ext_Fa_Line_Sources_Tl
450      WHERE okl_ext_fa_line_sources_tl.line_extension_id = p_line_extension_id
451        AND okl_ext_fa_line_sources_tl.language = p_language;
452     l_okl_ext_fa_line_s10          okl_ext_fa_line_sou9%ROWTYPE;
453     l_fxll_rec                     fxll_rec_type;
454   BEGIN
455     x_no_data_found := TRUE;
456     -- Get current database values
457     OPEN okl_ext_fa_line_sou9 (p_fxll_rec.line_extension_id,
458                                p_fxll_rec.language);
459     FETCH okl_ext_fa_line_sou9 INTO
460               l_fxll_rec.line_extension_id,
461               l_fxll_rec.language,
462               l_fxll_rec.source_lang,
463               l_fxll_rec.sfwt_flag,
464               l_fxll_rec.inventory_org_name,
465               l_fxll_rec.trans_line_description,
466               l_fxll_rec.created_by,
467               l_fxll_rec.creation_date,
468               l_fxll_rec.last_updated_by,
469               l_fxll_rec.last_update_date,
470               l_fxll_rec.last_update_login;
471     x_no_data_found := okl_ext_fa_line_sou9%NOTFOUND;
472     CLOSE okl_ext_fa_line_sou9;
473     RETURN(l_fxll_rec);
474   END get_rec;
475 
476   ------------------------------------------------------------------
477   -- This version of get_rec sets error messages if no data found --
478   ------------------------------------------------------------------
479   FUNCTION get_rec (
480     p_fxll_rec                     IN fxll_rec_type,
481     x_return_status                OUT NOCOPY VARCHAR2
482   ) RETURN fxll_rec_type IS
483     l_fxll_rec                     fxll_rec_type;
484     l_row_notfound                 BOOLEAN := TRUE;
485   BEGIN
486     x_return_status := OKL_API.G_RET_STS_SUCCESS;
487     l_fxll_rec := get_rec(p_fxll_rec, l_row_notfound);
488     IF (l_row_notfound) THEN
489       OKL_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'LINE_EXTENSION_ID');
490       OKL_API.set_message(G_APP_NAME,G_INVALID_VALUE,G_COL_NAME_TOKEN,'LANGUAGE');
491       x_return_status := OKL_API.G_RET_STS_ERROR;
492     END IF;
493     RETURN(l_fxll_rec);
494   END get_rec;
495   -----------------------------------------------------------
496   -- So we don't have to pass an "l_row_notfound" variable --
497   -----------------------------------------------------------
498   FUNCTION get_rec (
499     p_fxll_rec                     IN fxll_rec_type
500   ) RETURN fxll_rec_type IS
501     l_row_not_found                BOOLEAN := TRUE;
502   BEGIN
503     RETURN(get_rec(p_fxll_rec, l_row_not_found));
504   END get_rec;
505   ---------------------------------------------------------------------------
506   -- FUNCTION null_out_defaults for: OKL_EXT_FA_LINE_SOURCES_V
507   ---------------------------------------------------------------------------
508   FUNCTION null_out_defaults (
509     p_fxlv_rec   IN fxlv_rec_type
510   ) RETURN fxlv_rec_type IS
511     l_fxlv_rec                     fxlv_rec_type := p_fxlv_rec;
512   BEGIN
513     IF (l_fxlv_rec.line_extension_id = OKL_API.G_MISS_NUM ) THEN
514       l_fxlv_rec.line_extension_id := NULL;
515     END IF;
516     IF (l_fxlv_rec.header_extension_id = OKL_API.G_MISS_NUM ) THEN
517       l_fxlv_rec.header_extension_id := NULL;
518     END IF;
519     IF (l_fxlv_rec.source_id = OKL_API.G_MISS_NUM ) THEN
520       l_fxlv_rec.source_id := NULL;
521     END IF;
522     IF (l_fxlv_rec.source_table = OKL_API.G_MISS_CHAR ) THEN
523       l_fxlv_rec.source_table := NULL;
524     END IF;
525     IF (l_fxlv_rec.object_version_number = OKL_API.G_MISS_NUM ) THEN
526       l_fxlv_rec.object_version_number := NULL;
527     END IF;
528     IF (l_fxlv_rec.fa_transaction_id = OKL_API.G_MISS_NUM ) THEN
529       l_fxlv_rec.fa_transaction_id := NULL;
530     END IF;
531     IF (l_fxlv_rec.asset_id = OKL_API.G_MISS_NUM ) THEN
532       l_fxlv_rec.asset_id := NULL;
533     END IF;
534     IF (l_fxlv_rec.kle_id = OKL_API.G_MISS_NUM ) THEN
535       l_fxlv_rec.kle_id := NULL;
536     END IF;
537     IF (l_fxlv_rec.asset_number = OKL_API.G_MISS_CHAR ) THEN
538       l_fxlv_rec.asset_number := NULL;
539     END IF;
540     IF (l_fxlv_rec.contract_line_number = OKL_API.G_MISS_CHAR ) THEN
541       l_fxlv_rec.contract_line_number := NULL;
542     END IF;
543     IF (l_fxlv_rec.asset_book_type_name = OKL_API.G_MISS_CHAR ) THEN
544       l_fxlv_rec.asset_book_type_name := NULL;
545     END IF;
546     IF (l_fxlv_rec.asset_vendor_name = OKL_API.G_MISS_CHAR ) THEN
547       l_fxlv_rec.asset_vendor_name := NULL;
548     END IF;
549     IF (l_fxlv_rec.installed_site_id = OKL_API.G_MISS_NUM ) THEN
550       l_fxlv_rec.installed_site_id := NULL;
551     END IF;
552     IF (l_fxlv_rec.line_attribute_category = OKL_API.G_MISS_CHAR ) THEN
553       l_fxlv_rec.line_attribute_category := NULL;
554     END IF;
555     IF (l_fxlv_rec.line_attribute1 = OKL_API.G_MISS_CHAR ) THEN
556       l_fxlv_rec.line_attribute1 := NULL;
557     END IF;
558     IF (l_fxlv_rec.line_attribute2 = OKL_API.G_MISS_CHAR ) THEN
559       l_fxlv_rec.line_attribute2 := NULL;
560     END IF;
561     IF (l_fxlv_rec.line_attribute3 = OKL_API.G_MISS_CHAR ) THEN
562       l_fxlv_rec.line_attribute3 := NULL;
563     END IF;
564     IF (l_fxlv_rec.line_attribute4 = OKL_API.G_MISS_CHAR ) THEN
565       l_fxlv_rec.line_attribute4 := NULL;
566     END IF;
567     IF (l_fxlv_rec.line_attribute5 = OKL_API.G_MISS_CHAR ) THEN
568       l_fxlv_rec.line_attribute5 := NULL;
569     END IF;
570     IF (l_fxlv_rec.line_attribute6 = OKL_API.G_MISS_CHAR ) THEN
571       l_fxlv_rec.line_attribute6 := NULL;
572     END IF;
573     IF (l_fxlv_rec.line_attribute7 = OKL_API.G_MISS_CHAR ) THEN
574       l_fxlv_rec.line_attribute7 := NULL;
575     END IF;
576     IF (l_fxlv_rec.line_attribute8 = OKL_API.G_MISS_CHAR ) THEN
577       l_fxlv_rec.line_attribute8 := NULL;
578     END IF;
579     IF (l_fxlv_rec.line_attribute9 = OKL_API.G_MISS_CHAR ) THEN
580       l_fxlv_rec.line_attribute9 := NULL;
581     END IF;
582     IF (l_fxlv_rec.line_attribute10 = OKL_API.G_MISS_CHAR ) THEN
583       l_fxlv_rec.line_attribute10 := NULL;
584     END IF;
585     IF (l_fxlv_rec.line_attribute11 = OKL_API.G_MISS_CHAR ) THEN
586       l_fxlv_rec.line_attribute11 := NULL;
587     END IF;
588     IF (l_fxlv_rec.line_attribute12 = OKL_API.G_MISS_CHAR ) THEN
589       l_fxlv_rec.line_attribute12 := NULL;
590     END IF;
591     IF (l_fxlv_rec.line_attribute13 = OKL_API.G_MISS_CHAR ) THEN
592       l_fxlv_rec.line_attribute13 := NULL;
593     END IF;
594     IF (l_fxlv_rec.line_attribute14 = OKL_API.G_MISS_CHAR ) THEN
595       l_fxlv_rec.line_attribute14 := NULL;
596     END IF;
597     IF (l_fxlv_rec.line_attribute15 = OKL_API.G_MISS_CHAR ) THEN
598       l_fxlv_rec.line_attribute15 := NULL;
599     END IF;
600     IF (l_fxlv_rec.language = OKL_API.G_MISS_CHAR ) THEN
601       l_fxlv_rec.language := NULL;
602     END IF;
603     IF (l_fxlv_rec.inventory_org_name = OKL_API.G_MISS_CHAR ) THEN
604       l_fxlv_rec.inventory_org_name := NULL;
605     END IF;
606     IF (l_fxlv_rec.trans_line_description = OKL_API.G_MISS_CHAR ) THEN
607       l_fxlv_rec.trans_line_description := NULL;
608     END IF;
609     IF (l_fxlv_rec.created_by = OKL_API.G_MISS_NUM ) THEN
610       l_fxlv_rec.created_by := NULL;
611     END IF;
612     IF (l_fxlv_rec.creation_date = OKL_API.G_MISS_DATE ) THEN
613       l_fxlv_rec.creation_date := NULL;
614     END IF;
615     IF (l_fxlv_rec.last_updated_by = OKL_API.G_MISS_NUM ) THEN
616       l_fxlv_rec.last_updated_by := NULL;
617     END IF;
618     IF (l_fxlv_rec.last_update_date = OKL_API.G_MISS_DATE ) THEN
619       l_fxlv_rec.last_update_date := NULL;
620     END IF;
621     IF (l_fxlv_rec.last_update_login = OKL_API.G_MISS_NUM ) THEN
622       l_fxlv_rec.last_update_login := NULL;
623     END IF;
624     IF (l_fxlv_rec.inventory_org_code = OKL_API.G_MISS_CHAR ) THEN
625       l_fxlv_rec.inventory_org_code := NULL;
626     END IF;
627     IF (l_fxlv_rec.asset_book_type_code = OKL_API.G_MISS_CHAR ) THEN
628       l_fxlv_rec.asset_book_type_code := NULL;
629     END IF;
630     IF (l_fxlv_rec.period_counter = OKL_API.G_MISS_NUM ) THEN
631       l_fxlv_rec.period_counter := NULL;
632     END IF;
633       IF (l_fxlv_rec.asset_vendor_id = OKL_API.G_MISS_NUM ) THEN
634       l_fxlv_rec.asset_vendor_id := NULL;
635     END IF;
636 
637     RETURN(l_fxlv_rec);
638   END null_out_defaults;
639   ------------------------------------------------
640   -- Validate_Attributes for: LINE_EXTENSION_ID --
641   ------------------------------------------------
642   PROCEDURE validate_line_extension_id(
643     x_return_status                OUT NOCOPY VARCHAR2,
644     p_line_extension_id            IN NUMBER) IS
645   BEGIN
646     x_return_status := OKL_API.G_RET_STS_SUCCESS;
647     IF (p_line_extension_id IS NULL) THEN
648       OKL_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'line_extension_id');
649       x_return_status := OKL_API.G_RET_STS_ERROR;
650       RAISE G_EXCEPTION_HALT_VALIDATION;
651     END IF;
652   EXCEPTION
653     WHEN G_EXCEPTION_HALT_VALIDATION THEN
654       null;
655     WHEN OTHERS THEN
656       OKL_API.SET_MESSAGE( p_app_name     => G_APP_NAME
657                           ,p_msg_name     => G_UNEXPECTED_ERROR
658                           ,p_token1       => G_SQLCODE_TOKEN
659                           ,p_token1_value => SQLCODE
660                           ,p_token2       => G_SQLERRM_TOKEN
661                           ,p_token2_value => SQLERRM);
662       x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
663   END validate_line_extension_id;
664   --------------------------------------------------
665   -- Validate_Attributes for: HEADER_EXTENSION_ID --
666   --------------------------------------------------
667   PROCEDURE validate_header_extension_id(
668     x_return_status                OUT NOCOPY VARCHAR2,
669     p_header_extension_id          IN NUMBER) IS
670   BEGIN
671     x_return_status := OKL_API.G_RET_STS_SUCCESS;
672     IF (p_header_extension_id IS NULL) THEN
673       OKL_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'header_extension_id');
674       x_return_status := OKL_API.G_RET_STS_ERROR;
675       RAISE G_EXCEPTION_HALT_VALIDATION;
676     END IF;
677   EXCEPTION
678     WHEN G_EXCEPTION_HALT_VALIDATION THEN
679       null;
680     WHEN OTHERS THEN
681       OKL_API.SET_MESSAGE( p_app_name     => G_APP_NAME
682                           ,p_msg_name     => G_UNEXPECTED_ERROR
683                           ,p_token1       => G_SQLCODE_TOKEN
684                           ,p_token1_value => SQLCODE
685                           ,p_token2       => G_SQLERRM_TOKEN
686                           ,p_token2_value => SQLERRM);
687       x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
688   END validate_header_extension_id;
689   ----------------------------------------
690   -- Validate_Attributes for: SOURCE_ID --
691   ----------------------------------------
692   PROCEDURE validate_source_id(
693     x_return_status                OUT NOCOPY VARCHAR2,
694     p_source_id                    IN NUMBER) IS
695   BEGIN
696     x_return_status := OKL_API.G_RET_STS_SUCCESS;
697     IF (p_source_id IS NULL) THEN
698       OKL_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'source_id');
699       x_return_status := OKL_API.G_RET_STS_ERROR;
700       RAISE G_EXCEPTION_HALT_VALIDATION;
701     END IF;
702   EXCEPTION
703     WHEN G_EXCEPTION_HALT_VALIDATION THEN
704       null;
705     WHEN OTHERS THEN
706       OKL_API.SET_MESSAGE( p_app_name     => G_APP_NAME
707                           ,p_msg_name     => G_UNEXPECTED_ERROR
708                           ,p_token1       => G_SQLCODE_TOKEN
709                           ,p_token1_value => SQLCODE
710                           ,p_token2       => G_SQLERRM_TOKEN
711                           ,p_token2_value => SQLERRM);
712       x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
713   END validate_source_id;
714   -------------------------------------------
715   -- Validate_Attributes for: SOURCE_TABLE --
716   -------------------------------------------
717   PROCEDURE validate_source_table(
718     x_return_status                OUT NOCOPY VARCHAR2,
719     p_source_table                 IN VARCHAR2) IS
720   BEGIN
721     x_return_status := OKL_API.G_RET_STS_SUCCESS;
722     IF (p_source_table IS NULL) THEN
723       OKL_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'source_table');
724       x_return_status := OKL_API.G_RET_STS_ERROR;
725       RAISE G_EXCEPTION_HALT_VALIDATION;
726     END IF;
727   EXCEPTION
728     WHEN G_EXCEPTION_HALT_VALIDATION THEN
729       null;
730     WHEN OTHERS THEN
731       OKL_API.SET_MESSAGE( p_app_name     => G_APP_NAME
732                           ,p_msg_name     => G_UNEXPECTED_ERROR
733                           ,p_token1       => G_SQLCODE_TOKEN
734                           ,p_token1_value => SQLCODE
735                           ,p_token2       => G_SQLERRM_TOKEN
736                           ,p_token2_value => SQLERRM);
737       x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
738   END validate_source_table;
739   ----------------------------------------------------
740   -- Validate_Attributes for: OBJECT_VERSION_NUMBER --
741   ----------------------------------------------------
742   PROCEDURE validate_object_version_number(
743     x_return_status                OUT NOCOPY VARCHAR2,
744     p_object_version_number        IN NUMBER) IS
745   BEGIN
746     x_return_status := OKL_API.G_RET_STS_SUCCESS;
747     IF (p_object_version_number IS NULL) THEN
748       OKL_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'object_version_number');
749       x_return_status := OKL_API.G_RET_STS_ERROR;
750       RAISE G_EXCEPTION_HALT_VALIDATION;
751     END IF;
752   EXCEPTION
753     WHEN G_EXCEPTION_HALT_VALIDATION THEN
754       null;
755     WHEN OTHERS THEN
756       OKL_API.SET_MESSAGE( p_app_name     => G_APP_NAME
757                           ,p_msg_name     => G_UNEXPECTED_ERROR
758                           ,p_token1       => G_SQLCODE_TOKEN
759                           ,p_token1_value => SQLCODE
760                           ,p_token2       => G_SQLERRM_TOKEN
761                           ,p_token2_value => SQLERRM);
762       x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
763   END validate_object_version_number;
764   ------------------------------------------------
765   -- Validate_Attributes for: FA_TRANSACTION_ID --
766   ------------------------------------------------
767   PROCEDURE validate_fa_transaction_id(
768     x_return_status                OUT NOCOPY VARCHAR2,
769     p_fa_transaction_id            IN NUMBER) IS
770   BEGIN
771     x_return_status := OKL_API.G_RET_STS_SUCCESS;
772     IF (p_fa_transaction_id IS NULL) THEN
773       OKL_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'fa_transaction_id');
774       x_return_status := OKL_API.G_RET_STS_ERROR;
775       RAISE G_EXCEPTION_HALT_VALIDATION;
776     END IF;
777   EXCEPTION
778     WHEN G_EXCEPTION_HALT_VALIDATION THEN
779       null;
780     WHEN OTHERS THEN
781       OKL_API.SET_MESSAGE( p_app_name     => G_APP_NAME
782                           ,p_msg_name     => G_UNEXPECTED_ERROR
783                           ,p_token1       => G_SQLCODE_TOKEN
784                           ,p_token1_value => SQLCODE
785                           ,p_token2       => G_SQLERRM_TOKEN
786                           ,p_token2_value => SQLERRM);
787       x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
788   END validate_fa_transaction_id;
789   ---------------------------------------
790   -- Validate_Attributes for: ASSET_ID --
791   ---------------------------------------
792   PROCEDURE validate_asset_id(
793     x_return_status                OUT NOCOPY VARCHAR2,
794     p_asset_id                     IN NUMBER) IS
795   BEGIN
796     x_return_status := OKL_API.G_RET_STS_SUCCESS;
797     IF (p_asset_id IS NULL) THEN
798       OKL_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'asset_id');
799       x_return_status := OKL_API.G_RET_STS_ERROR;
800       RAISE G_EXCEPTION_HALT_VALIDATION;
801     END IF;
802   EXCEPTION
803     WHEN G_EXCEPTION_HALT_VALIDATION THEN
804       null;
805     WHEN OTHERS THEN
806       OKL_API.SET_MESSAGE( p_app_name     => G_APP_NAME
807                           ,p_msg_name     => G_UNEXPECTED_ERROR
808                           ,p_token1       => G_SQLCODE_TOKEN
809                           ,p_token1_value => SQLCODE
810                           ,p_token2       => G_SQLERRM_TOKEN
811                           ,p_token2_value => SQLERRM);
812       x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
813   END validate_asset_id;
814   -------------------------------------
815   -- Validate_Attributes for: KLE_ID --
816   -------------------------------------
817   PROCEDURE validate_kle_id(
818     x_return_status                OUT NOCOPY VARCHAR2,
819     p_kle_id                       IN NUMBER) IS
820   BEGIN
821     x_return_status := OKL_API.G_RET_STS_SUCCESS;
822     IF (p_kle_id IS NULL) THEN
823       OKL_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'kle_id');
824       x_return_status := OKL_API.G_RET_STS_ERROR;
825       RAISE G_EXCEPTION_HALT_VALIDATION;
826     END IF;
827   EXCEPTION
828     WHEN G_EXCEPTION_HALT_VALIDATION THEN
829       null;
830     WHEN OTHERS THEN
831       OKL_API.SET_MESSAGE( p_app_name     => G_APP_NAME
832                           ,p_msg_name     => G_UNEXPECTED_ERROR
833                           ,p_token1       => G_SQLCODE_TOKEN
834                           ,p_token1_value => SQLCODE
835                           ,p_token2       => G_SQLERRM_TOKEN
836                           ,p_token2_value => SQLERRM);
837       x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
838   END validate_kle_id;
839   ---------------------------------------
840   -- Validate_Attributes for: LANGUAGE --
841   ---------------------------------------
842   PROCEDURE validate_language(
843     x_return_status                OUT NOCOPY VARCHAR2,
844     p_language                     IN VARCHAR2) IS
845   BEGIN
846     x_return_status := OKL_API.G_RET_STS_SUCCESS;
847     IF (p_language IS NULL) THEN
848       OKL_API.set_message(G_APP_NAME, G_REQUIRED_VALUE, G_COL_NAME_TOKEN, 'language');
849       x_return_status := OKL_API.G_RET_STS_ERROR;
850       RAISE G_EXCEPTION_HALT_VALIDATION;
851     END IF;
852   EXCEPTION
853     WHEN G_EXCEPTION_HALT_VALIDATION THEN
854       null;
855     WHEN OTHERS THEN
856       OKL_API.SET_MESSAGE( p_app_name     => G_APP_NAME
857                           ,p_msg_name     => G_UNEXPECTED_ERROR
858                           ,p_token1       => G_SQLCODE_TOKEN
859                           ,p_token1_value => SQLCODE
860                           ,p_token2       => G_SQLERRM_TOKEN
861                           ,p_token2_value => SQLERRM);
862       x_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
863   END validate_language;
864        ----------------------------------------------------
865   -- Validate_Attributes for: asset_vendor_id  --
866   ----------------------------------------------------
867   PROCEDURE validate_supplier(
868     x_return_status                OUT NOCOPY VARCHAR2,
869     p_asset_vendor_id       IN NUMBER) IS
870    l_return_status         VARCHAR2(1)  := OKC_API.G_RET_STS_SUCCESS;
871   l_asset_vendor_id              VARCHAR2(1);
872   l_row_not_found             BOOLEAN := FALSE;
873   CURSOR c1(p_asset_vendor_id NUMBER) IS
874   SELECT '1'
875   FROM ap_suppliers
876   WHERE  vendor_id =  p_asset_vendor_id   ;
877   BEGIN
878  IF ( p_asset_vendor_id IS NOT NULL) THEN
879     -- initialize return status
880     x_return_status := OKC_API.G_RET_STS_SUCCESS;
881     OPEN c1(p_asset_vendor_id );
882     FETCH c1 INTO l_asset_vendor_id;
883     l_row_not_found := c1%NOTFOUND;
884     CLOSE c1;
885     IF l_row_not_found THEN
886 		OKC_API.set_message('OKL',G_INVALID_VALUE , G_COL_NAME_TOKEN, 'asset_vendor_id');
887 		x_return_status := OKC_API.G_RET_STS_ERROR;
888      END IF;
889      END IF;
890   EXCEPTION
891     WHEN G_EXCEPTION_HALT_VALIDATION THEN
892     -- no processing necessary;  validation can continue
893     -- with the next column
894     NULL;
895 
896     WHEN OTHERS THEN
897       -- store SQL error message on message stack for caller
898       OKC_API.SET_MESSAGE(p_app_name     => g_app_name,
899 
900                           p_msg_name     => g_unexpected_error,
901                           p_token1       => g_sqlcode_token,
902                           p_token1_value => SQLCODE,
903                           p_token2       => g_sqlerrm_token,
904                           p_token2_value => SQLERRM);
905 
906       -- notify caller of an UNEXPECTED error
907       x_return_status := OKC_API.G_RET_STS_UNEXP_ERROR;
908   END validate_supplier;
909   ---------------------------------------------------------------------------
910   -- FUNCTION Validate_Attributes
911   ---------------------------------------------------------------------------
912   -------------------------------------------------------
913   -- Validate_Attributes for:OKL_EXT_FA_LINE_SOURCES_V --
914   -------------------------------------------------------
915   FUNCTION Validate_Attributes (
916     p_fxlv_rec                     IN fxlv_rec_type
917   ) RETURN VARCHAR2 IS
918     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
919     x_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
920   BEGIN
921     -----------------------------
922     -- Column Level Validation --
923     -----------------------------
924     -- ***
925     -- line_extension_id
926     -- ***
927     validate_line_extension_id(x_return_status, p_fxlv_rec.line_extension_id);
928     IF (x_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
929       l_return_status := x_return_status;
930       RAISE G_EXCEPTION_HALT_VALIDATION;
931     END IF;
932 
933     -- ***
934     -- header_extension_id
935     -- ***
936     validate_header_extension_id(x_return_status, p_fxlv_rec.header_extension_id);
937     IF (x_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
938       l_return_status := x_return_status;
939       RAISE G_EXCEPTION_HALT_VALIDATION;
940     END IF;
941 
942     -- ***
943     -- source_id
944     -- ***
945     validate_source_id(x_return_status, p_fxlv_rec.source_id);
946     IF (x_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
947       l_return_status := x_return_status;
948       RAISE G_EXCEPTION_HALT_VALIDATION;
949     END IF;
950 
951     -- ***
952     -- source_table
953     -- ***
954     validate_source_table(x_return_status, p_fxlv_rec.source_table);
955     IF (x_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
956       l_return_status := x_return_status;
957       RAISE G_EXCEPTION_HALT_VALIDATION;
958     END IF;
959 
960     -- ***
961     -- object_version_number
962     -- ***
963     validate_object_version_number(x_return_status, p_fxlv_rec.object_version_number);
964     IF (x_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
965       l_return_status := x_return_status;
966       RAISE G_EXCEPTION_HALT_VALIDATION;
967     END IF;
968 
969     -- ***
970     -- fa_transaction_id
971     -- ***
972     validate_fa_transaction_id(x_return_status, p_fxlv_rec.fa_transaction_id);
973     IF (x_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
974       l_return_status := x_return_status;
975       RAISE G_EXCEPTION_HALT_VALIDATION;
976     END IF;
977 
978     -- ***
979     -- asset_id
980     -- ***
981     validate_asset_id(x_return_status, p_fxlv_rec.asset_id);
982     IF (x_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
983       l_return_status := x_return_status;
984       RAISE G_EXCEPTION_HALT_VALIDATION;
985     END IF;
986 
987     -- ***
988     -- kle_id
989     -- ***
990     validate_kle_id(x_return_status, p_fxlv_rec.kle_id);
991     IF (x_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
992       l_return_status := x_return_status;
993       RAISE G_EXCEPTION_HALT_VALIDATION;
994     END IF;
995 
996     -- ***
997     -- language
998     -- ***
999     validate_language(x_return_status, p_fxlv_rec.language);
1000     IF (x_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
1001       l_return_status := x_return_status;
1002       RAISE G_EXCEPTION_HALT_VALIDATION;
1003     END IF;
1004        -- ***
1005     -- asset_vendor_id
1006     -- ***
1007     validate_supplier(x_return_status, p_fxlv_rec.asset_vendor_id);
1008     IF (x_return_status <> OKL_API.G_RET_STS_SUCCESS) THEN
1009       l_return_status := x_return_status;
1010       RAISE G_EXCEPTION_HALT_VALIDATION;
1011     END IF;
1012 
1013     RETURN(l_return_status);
1014   EXCEPTION
1015     WHEN G_EXCEPTION_HALT_VALIDATION THEN
1016       RETURN(l_return_status);
1017     WHEN OTHERS THEN
1018       OKL_API.SET_MESSAGE( p_app_name     => G_APP_NAME
1019                           ,p_msg_name     => G_UNEXPECTED_ERROR
1020                           ,p_token1       => G_SQLCODE_TOKEN
1021                           ,p_token1_value => SQLCODE
1022                           ,p_token2       => G_SQLERRM_TOKEN
1023                           ,p_token2_value => SQLERRM);
1024       l_return_status := OKL_API.G_RET_STS_UNEXP_ERROR;
1025       RETURN(l_return_status);
1026   END Validate_Attributes;
1027   ---------------------------------------------------------------------------
1028   -- PROCEDURE Validate_Record
1029   ---------------------------------------------------------------------------
1030   ---------------------------------------------------
1031   -- Validate Record for:OKL_EXT_FA_LINE_SOURCES_V --
1032   ---------------------------------------------------
1033   FUNCTION Validate_Record (
1034     p_fxlv_rec IN fxlv_rec_type,
1035     p_db_fxlv_rec IN fxlv_rec_type
1036   ) RETURN VARCHAR2 IS
1037     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1038   BEGIN
1039     RETURN (l_return_status);
1040   END Validate_Record;
1041   FUNCTION Validate_Record (
1042     p_fxlv_rec IN fxlv_rec_type
1043   ) RETURN VARCHAR2 IS
1044     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1045     l_db_fxlv_rec                  fxlv_rec_type := get_rec(p_fxlv_rec);
1046   BEGIN
1047     l_return_status := Validate_Record(p_fxlv_rec => p_fxlv_rec,
1048                                        p_db_fxlv_rec => l_db_fxlv_rec);
1049     RETURN (l_return_status);
1050   END Validate_Record;
1051 
1052   ---------------------------------------------------------------------------
1053   -- PROCEDURE Migrate
1054   ---------------------------------------------------------------------------
1055   PROCEDURE migrate (
1056     p_from IN fxlv_rec_type,
1057     p_to   IN OUT NOCOPY fxl_rec_type
1058   ) IS
1059   BEGIN
1060     p_to.line_extension_id := p_from.line_extension_id;
1061     p_to.header_extension_id := p_from.header_extension_id;
1062     p_to.source_id := p_from.source_id;
1063     p_to.source_table := p_from.source_table;
1064     p_to.object_version_number := p_from.object_version_number;
1065     p_to.fa_transaction_id := p_from.fa_transaction_id;
1066     p_to.asset_id := p_from.asset_id;
1067     p_to.kle_id := p_from.kle_id;
1068     p_to.asset_number := p_from.asset_number;
1069     p_to.contract_line_number := p_from.contract_line_number;
1070     p_to.asset_book_type_name := p_from.asset_book_type_name;
1071     p_to.asset_vendor_name := p_from.asset_vendor_name;
1072     p_to.installed_site_id := p_from.installed_site_id;
1073     p_to.line_attribute_category := p_from.line_attribute_category;
1074     p_to.line_attribute1 := p_from.line_attribute1;
1075     p_to.line_attribute2 := p_from.line_attribute2;
1076     p_to.line_attribute3 := p_from.line_attribute3;
1077     p_to.line_attribute4 := p_from.line_attribute4;
1078     p_to.line_attribute5 := p_from.line_attribute5;
1079     p_to.line_attribute6 := p_from.line_attribute6;
1080     p_to.line_attribute7 := p_from.line_attribute7;
1081     p_to.line_attribute8 := p_from.line_attribute8;
1082     p_to.line_attribute9 := p_from.line_attribute9;
1083     p_to.line_attribute10 := p_from.line_attribute10;
1084     p_to.line_attribute11 := p_from.line_attribute11;
1085     p_to.line_attribute12 := p_from.line_attribute12;
1086     p_to.line_attribute13 := p_from.line_attribute13;
1087     p_to.line_attribute14 := p_from.line_attribute14;
1088     p_to.line_attribute15 := p_from.line_attribute15;
1089     p_to.created_by := p_from.created_by;
1090     p_to.creation_date := p_from.creation_date;
1091     p_to.last_updated_by := p_from.last_updated_by;
1092     p_to.last_update_date := p_from.last_update_date;
1093     p_to.last_update_login := p_from.last_update_login;
1094     p_to.inventory_org_code := p_from.inventory_org_code;
1095     p_to.asset_book_type_code := p_from.asset_book_type_code;
1096     p_to.period_counter := p_from.period_counter;
1097     p_to.asset_vendor_id := p_from.asset_vendor_id;
1098   END migrate;
1099   PROCEDURE migrate (
1100     p_from IN fxl_rec_type,
1101     p_to   IN OUT NOCOPY fxlv_rec_type
1102   ) IS
1103   BEGIN
1104     p_to.line_extension_id := p_from.line_extension_id;
1105     p_to.header_extension_id := p_from.header_extension_id;
1106     p_to.source_id := p_from.source_id;
1107     p_to.source_table := p_from.source_table;
1108     p_to.object_version_number := p_from.object_version_number;
1109     p_to.fa_transaction_id := p_from.fa_transaction_id;
1110     p_to.asset_id := p_from.asset_id;
1111     p_to.kle_id := p_from.kle_id;
1112     p_to.asset_number := p_from.asset_number;
1113     p_to.contract_line_number := p_from.contract_line_number;
1114     p_to.asset_book_type_name := p_from.asset_book_type_name;
1115     p_to.asset_vendor_name := p_from.asset_vendor_name;
1116     p_to.installed_site_id := p_from.installed_site_id;
1117     p_to.line_attribute_category := p_from.line_attribute_category;
1118     p_to.line_attribute1 := p_from.line_attribute1;
1119     p_to.line_attribute2 := p_from.line_attribute2;
1120     p_to.line_attribute3 := p_from.line_attribute3;
1121     p_to.line_attribute4 := p_from.line_attribute4;
1122     p_to.line_attribute5 := p_from.line_attribute5;
1123     p_to.line_attribute6 := p_from.line_attribute6;
1124     p_to.line_attribute7 := p_from.line_attribute7;
1125     p_to.line_attribute8 := p_from.line_attribute8;
1126     p_to.line_attribute9 := p_from.line_attribute9;
1127     p_to.line_attribute10 := p_from.line_attribute10;
1128     p_to.line_attribute11 := p_from.line_attribute11;
1129     p_to.line_attribute12 := p_from.line_attribute12;
1130     p_to.line_attribute13 := p_from.line_attribute13;
1131     p_to.line_attribute14 := p_from.line_attribute14;
1132     p_to.line_attribute15 := p_from.line_attribute15;
1133     p_to.created_by := p_from.created_by;
1134     p_to.creation_date := p_from.creation_date;
1135     p_to.last_updated_by := p_from.last_updated_by;
1136     p_to.last_update_date := p_from.last_update_date;
1137     p_to.last_update_login := p_from.last_update_login;
1138     p_to.inventory_org_code := p_from.inventory_org_code;
1139     p_to.asset_book_type_code := p_from.asset_book_type_code;
1140     p_to.period_counter := p_from.period_counter;
1141     p_to.asset_vendor_id := p_from.asset_vendor_id;
1142   END migrate;
1143   PROCEDURE migrate (
1144     p_from IN fxlv_rec_type,
1145     p_to   IN OUT NOCOPY fxll_rec_type
1146   ) IS
1147   BEGIN
1148     p_to.line_extension_id := p_from.line_extension_id;
1149     p_to.language := p_from.language;
1150     p_to.inventory_org_name := p_from.inventory_org_name;
1151     p_to.trans_line_description := p_from.trans_line_description;
1152     p_to.created_by := p_from.created_by;
1153     p_to.creation_date := p_from.creation_date;
1154     p_to.last_updated_by := p_from.last_updated_by;
1155     p_to.last_update_date := p_from.last_update_date;
1156     p_to.last_update_login := p_from.last_update_login;
1157   END migrate;
1158   PROCEDURE migrate (
1159     p_from IN fxll_rec_type,
1160     p_to   IN OUT NOCOPY fxlv_rec_type
1161   ) IS
1162   BEGIN
1163     p_to.line_extension_id := p_from.line_extension_id;
1164     p_to.language := p_from.language;
1165     p_to.inventory_org_name := p_from.inventory_org_name;
1166     p_to.trans_line_description := p_from.trans_line_description;
1167     p_to.created_by := p_from.created_by;
1168     p_to.creation_date := p_from.creation_date;
1169     p_to.last_updated_by := p_from.last_updated_by;
1170     p_to.last_update_date := p_from.last_update_date;
1171     p_to.last_update_login := p_from.last_update_login;
1172   END migrate;
1173   ---------------------------------------------------------------------------
1174   -- PROCEDURE validate_row
1175   ---------------------------------------------------------------------------
1176   ------------------------------------------------
1177   -- validate_row for:OKL_EXT_FA_LINE_SOURCES_V --
1178   ------------------------------------------------
1179   PROCEDURE validate_row(
1180     p_api_version                  IN NUMBER,
1181     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
1182     x_return_status                OUT NOCOPY VARCHAR2,
1183     x_msg_count                    OUT NOCOPY NUMBER,
1184     x_msg_data                     OUT NOCOPY VARCHAR2,
1185     p_fxlv_rec                     IN fxlv_rec_type) IS
1186 
1187     l_api_version                  CONSTANT NUMBER := 1;
1188     l_api_name                     CONSTANT VARCHAR2(30) := 'V_validate_row';
1189     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1190     l_fxlv_rec                     fxlv_rec_type := p_fxlv_rec;
1191     l_fxl_rec                      fxl_rec_type;
1192     l_fxll_rec                     fxll_rec_type;
1193   BEGIN
1194     l_return_status := OKL_API.START_ACTIVITY(l_api_name,
1195                                               G_PKG_NAME,
1196                                               p_init_msg_list,
1197                                               l_api_version,
1198                                               p_api_version,
1199                                               '_PVT',
1200                                               x_return_status);
1201     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1202       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1203     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
1204       RAISE OKL_API.G_EXCEPTION_ERROR;
1205     END IF;
1206     --- Validate all non-missing attributes (Item Level Validation)
1207     l_return_status := Validate_Attributes(l_fxlv_rec);
1208     --- If any errors happen abort API
1209     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1210       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1211     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
1212       RAISE OKL_API.G_EXCEPTION_ERROR;
1213     END IF;
1214     l_return_status := Validate_Record(l_fxlv_rec);
1215     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1216       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1217     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
1218       RAISE OKL_API.G_EXCEPTION_ERROR;
1219     END IF;
1220     x_return_status := l_return_status;
1221   EXCEPTION
1222     WHEN OKL_API.G_EXCEPTION_ERROR THEN
1223       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1224       (
1225         l_api_name,
1226         G_PKG_NAME,
1227         'OKL_API.G_RET_STS_ERROR',
1228         x_msg_count,
1229         x_msg_data,
1230         '_PVT'
1231       );
1232     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1233       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1234       (
1235         l_api_name,
1236         G_PKG_NAME,
1237         'OKL_API.G_RET_STS_UNEXP_ERROR',
1238         x_msg_count,
1239         x_msg_data,
1240         '_PVT'
1241       );
1242     WHEN OTHERS THEN
1243       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1244       (
1245         l_api_name,
1246         G_PKG_NAME,
1247         'OTHERS',
1248         x_msg_count,
1249         x_msg_data,
1250         '_PVT'
1251       );
1252   END validate_row;
1253   -----------------------------------------------------------
1254   -- PL/SQL TBL validate_row for:OKL_EXT_FA_LINE_SOURCES_V --
1255   -----------------------------------------------------------
1256   PROCEDURE validate_row(
1257     p_api_version                  IN NUMBER,
1258     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
1259     x_return_status                OUT NOCOPY VARCHAR2,
1260     x_msg_count                    OUT NOCOPY NUMBER,
1261     x_msg_data                     OUT NOCOPY VARCHAR2,
1262     p_fxlv_tbl                     IN fxlv_tbl_type,
1263     px_error_tbl                   IN OUT NOCOPY OKL_API.ERROR_TBL_TYPE) IS
1264 
1265     l_api_version                  CONSTANT NUMBER := 1;
1266     l_api_name                     CONSTANT VARCHAR2(30) := 'V_error_tbl_validate_row';
1267     i                              NUMBER := 0;
1268   BEGIN
1269     OKL_API.init_msg_list(p_init_msg_list);
1270     -- Make sure PL/SQL table has records in it before passing
1271     IF (p_fxlv_tbl.COUNT > 0) THEN
1272       i := p_fxlv_tbl.FIRST;
1273       LOOP
1274         DECLARE
1275           l_error_rec         OKL_API.ERROR_REC_TYPE;
1276         BEGIN
1277           l_error_rec.api_name := l_api_name;
1278           l_error_rec.api_package := G_PKG_NAME;
1279           l_error_rec.idx := i;
1280           validate_row (
1281             p_api_version                  => p_api_version,
1282             p_init_msg_list                => OKL_API.G_FALSE,
1283             x_return_status                => l_error_rec.error_type,
1284             x_msg_count                    => l_error_rec.msg_count,
1285             x_msg_data                     => l_error_rec.msg_data,
1286             p_fxlv_rec                     => p_fxlv_tbl(i));
1287           IF (l_error_rec.error_type <> OKL_API.G_RET_STS_SUCCESS) THEN
1288             l_error_rec.sqlcode := SQLCODE;
1289             load_error_tbl(l_error_rec, px_error_tbl);
1290           ELSE
1291             x_msg_count := l_error_rec.msg_count;
1292             x_msg_data := l_error_rec.msg_data;
1293           END IF;
1294         EXCEPTION
1295           WHEN OKL_API.G_EXCEPTION_ERROR THEN
1296             l_error_rec.error_type := OKL_API.G_RET_STS_ERROR;
1297             l_error_rec.sqlcode := SQLCODE;
1298             load_error_tbl(l_error_rec, px_error_tbl);
1299           WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1300             l_error_rec.error_type := OKL_API.G_RET_STS_UNEXP_ERROR;
1301             l_error_rec.sqlcode := SQLCODE;
1302             load_error_tbl(l_error_rec, px_error_tbl);
1303           WHEN OTHERS THEN
1304             l_error_rec.error_type := 'OTHERS';
1305             l_error_rec.sqlcode := SQLCODE;
1306             load_error_tbl(l_error_rec, px_error_tbl);
1307         END;
1308         EXIT WHEN (i = p_fxlv_tbl.LAST);
1309         i := p_fxlv_tbl.NEXT(i);
1310       END LOOP;
1311     END IF;
1312     -- Loop through the error_tbl to find the error with the highest severity
1313     -- and return it.
1314     x_return_status := find_highest_exception(px_error_tbl);
1315     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
1316   EXCEPTION
1317     WHEN OKL_API.G_EXCEPTION_ERROR THEN
1318       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1319       (
1320         l_api_name,
1321         G_PKG_NAME,
1322         'OKL_API.G_RET_STS_ERROR',
1323         x_msg_count,
1324         x_msg_data,
1325         '_PVT'
1326       );
1327     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1328       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1329       (
1330         l_api_name,
1331         G_PKG_NAME,
1332         'OKL_API.G_RET_STS_UNEXP_ERROR',
1333         x_msg_count,
1334         x_msg_data,
1335         '_PVT'
1336       );
1337     WHEN OTHERS THEN
1338       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1339       (
1340         l_api_name,
1341         G_PKG_NAME,
1342         'OTHERS',
1343         x_msg_count,
1344         x_msg_data,
1345         '_PVT'
1346       );
1347   END validate_row;
1348 
1349   -----------------------------------------------------------
1350   -- PL/SQL TBL validate_row for:OKL_EXT_FA_LINE_SOURCES_V --
1351   -----------------------------------------------------------
1352   PROCEDURE validate_row(
1353     p_api_version                  IN NUMBER,
1354     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
1355     x_return_status                OUT NOCOPY VARCHAR2,
1356     x_msg_count                    OUT NOCOPY NUMBER,
1357     x_msg_data                     OUT NOCOPY VARCHAR2,
1358     p_fxlv_tbl                     IN fxlv_tbl_type) IS
1359 
1360     l_api_version                  CONSTANT NUMBER := 1;
1361     l_api_name                     CONSTANT VARCHAR2(30) := 'V_tbl_validate_row';
1362     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1363     l_error_tbl                    OKL_API.ERROR_TBL_TYPE;
1364   BEGIN
1365     OKL_API.init_msg_list(p_init_msg_list);
1366     -- Make sure PL/SQL table has records in it before passing
1367     IF (p_fxlv_tbl.COUNT > 0) THEN
1368       validate_row (
1369         p_api_version                  => p_api_version,
1370         p_init_msg_list                => OKL_API.G_FALSE,
1371         x_return_status                => x_return_status,
1372         x_msg_count                    => x_msg_count,
1373         x_msg_data                     => x_msg_data,
1374         p_fxlv_tbl                     => p_fxlv_tbl,
1375         px_error_tbl                   => l_error_tbl);
1376     END IF;
1377     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
1378   EXCEPTION
1379     WHEN OKL_API.G_EXCEPTION_ERROR THEN
1380       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1381       (
1382         l_api_name,
1383         G_PKG_NAME,
1384         'OKL_API.G_RET_STS_ERROR',
1385         x_msg_count,
1386         x_msg_data,
1387         '_PVT'
1388       );
1389     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1390       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1391       (
1392         l_api_name,
1393         G_PKG_NAME,
1394         'OKL_API.G_RET_STS_UNEXP_ERROR',
1395         x_msg_count,
1396         x_msg_data,
1397         '_PVT'
1398       );
1399     WHEN OTHERS THEN
1400       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1401       (
1402         l_api_name,
1403         G_PKG_NAME,
1404         'OTHERS',
1405         x_msg_count,
1406         x_msg_data,
1407         '_PVT'
1408       );
1409   END validate_row;
1410 
1411   ---------------------------------------------------------------------------
1412   -- PROCEDURE insert_row
1413   ---------------------------------------------------------------------------
1414   ----------------------------------------------
1415   -- insert_row for:OKL_EXT_FA_LINE_SOURCES_B --
1416   ----------------------------------------------
1417   PROCEDURE insert_row(
1418     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
1419     x_return_status                OUT NOCOPY VARCHAR2,
1420     x_msg_count                    OUT NOCOPY NUMBER,
1421     x_msg_data                     OUT NOCOPY VARCHAR2,
1422     p_fxl_rec                      IN fxl_rec_type,
1423     x_fxl_rec                      OUT NOCOPY fxl_rec_type) IS
1424 
1425     l_api_version                  CONSTANT NUMBER := 1;
1426     l_api_name                     CONSTANT VARCHAR2(30) := 'B_insert_row';
1427     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1428     l_fxl_rec                      fxl_rec_type := p_fxl_rec;
1429     l_def_fxl_rec                  fxl_rec_type;
1430     --------------------------------------------------
1431     -- Set_Attributes for:OKL_EXT_FA_LINE_SOURCES_B --
1432     --------------------------------------------------
1433     FUNCTION Set_Attributes (
1434       p_fxl_rec IN fxl_rec_type,
1435       x_fxl_rec OUT NOCOPY fxl_rec_type
1436     ) RETURN VARCHAR2 IS
1437       l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1438     BEGIN
1439       x_fxl_rec := p_fxl_rec;
1440       RETURN(l_return_status);
1441     END Set_Attributes;
1442   BEGIN
1443     l_return_status := OKL_API.START_ACTIVITY(l_api_name,
1444                                               p_init_msg_list,
1445                                               '_PVT',
1446                                               x_return_status);
1447     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1448       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1449     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
1450       RAISE OKL_API.G_EXCEPTION_ERROR;
1451     END IF;
1452     --- Setting item atributes
1453     l_return_status := Set_Attributes(
1454       l_fxl_rec,                         -- IN
1455       l_def_fxl_rec);                    -- OUT
1456     --- If any errors happen abort API
1457     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1458       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1459     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
1460       RAISE OKL_API.G_EXCEPTION_ERROR;
1461     END IF;
1462     INSERT INTO OKL_EXT_FA_LINE_SOURCES_B(
1463       line_extension_id,
1464       header_extension_id,
1465       source_id,
1466       source_table,
1467       object_version_number,
1468       fa_transaction_id,
1469       asset_id,
1470       kle_id,
1471       asset_number,
1472       contract_line_number,
1473       asset_book_type_name,
1474       asset_vendor_name,
1475       installed_site_id,
1476       line_attribute_category,
1477       line_attribute1,
1478       line_attribute2,
1479       line_attribute3,
1480       line_attribute4,
1481       line_attribute5,
1482       line_attribute6,
1483       line_attribute7,
1484       line_attribute8,
1485       line_attribute9,
1486       line_attribute10,
1487       line_attribute11,
1488       line_attribute12,
1489       line_attribute13,
1490       line_attribute14,
1491       line_attribute15,
1492       created_by,
1493       creation_date,
1494       last_updated_by,
1495       last_update_date,
1496       last_update_login,
1497       inventory_org_code
1498       ,asset_book_type_code
1499       ,period_counter
1500       ,asset_vendor_id)
1501     VALUES (
1502       l_def_fxl_rec.line_extension_id,
1503       l_def_fxl_rec.header_extension_id,
1504       l_def_fxl_rec.source_id,
1505       l_def_fxl_rec.source_table,
1506       l_def_fxl_rec.object_version_number,
1507       l_def_fxl_rec.fa_transaction_id,
1508       l_def_fxl_rec.asset_id,
1509       l_def_fxl_rec.kle_id,
1510       l_def_fxl_rec.asset_number,
1511       l_def_fxl_rec.contract_line_number,
1512       l_def_fxl_rec.asset_book_type_name,
1513       l_def_fxl_rec.asset_vendor_name,
1514       l_def_fxl_rec.installed_site_id,
1515       l_def_fxl_rec.line_attribute_category,
1516       l_def_fxl_rec.line_attribute1,
1517       l_def_fxl_rec.line_attribute2,
1518       l_def_fxl_rec.line_attribute3,
1519       l_def_fxl_rec.line_attribute4,
1520       l_def_fxl_rec.line_attribute5,
1521       l_def_fxl_rec.line_attribute6,
1522       l_def_fxl_rec.line_attribute7,
1523       l_def_fxl_rec.line_attribute8,
1524       l_def_fxl_rec.line_attribute9,
1525       l_def_fxl_rec.line_attribute10,
1526       l_def_fxl_rec.line_attribute11,
1527       l_def_fxl_rec.line_attribute12,
1528       l_def_fxl_rec.line_attribute13,
1529       l_def_fxl_rec.line_attribute14,
1530       l_def_fxl_rec.line_attribute15,
1531       l_def_fxl_rec.created_by,
1532       l_def_fxl_rec.creation_date,
1533       l_def_fxl_rec.last_updated_by,
1534       l_def_fxl_rec.last_update_date,
1535       l_def_fxl_rec.last_update_login,
1536       l_def_fxl_rec.inventory_org_code
1537       ,l_def_fxl_rec.asset_book_type_code
1538       ,l_def_fxl_rec.period_counter
1539        ,l_def_fxl_rec.asset_vendor_id);
1540     -- Set OUT values
1541     x_fxl_rec := l_def_fxl_rec;
1542     x_return_status := l_return_status;
1543     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
1544   EXCEPTION
1545     WHEN OKL_API.G_EXCEPTION_ERROR THEN
1546       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1547       (
1548         l_api_name,
1549         G_PKG_NAME,
1550         'OKL_API.G_RET_STS_ERROR',
1551         x_msg_count,
1552         x_msg_data,
1553         '_PVT'
1554       );
1555     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1556       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1557       (
1558         l_api_name,
1559         G_PKG_NAME,
1560         'OKL_API.G_RET_STS_UNEXP_ERROR',
1561         x_msg_count,
1562         x_msg_data,
1563         '_PVT'
1564       );
1565     WHEN OTHERS THEN
1566       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1567       (
1568         l_api_name,
1569         G_PKG_NAME,
1570         'OTHERS',
1571         x_msg_count,
1572         x_msg_data,
1573         '_PVT'
1574       );
1575   END insert_row;
1576   -----------------------------------------------
1577   -- insert_row for:OKL_EXT_FA_LINE_SOURCES_TL --
1578   -----------------------------------------------
1579   PROCEDURE insert_row(
1580     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
1581     x_return_status                OUT NOCOPY VARCHAR2,
1582     x_msg_count                    OUT NOCOPY NUMBER,
1583     x_msg_data                     OUT NOCOPY VARCHAR2,
1584     p_fxll_rec                     IN fxll_rec_type,
1585     x_fxll_rec                     OUT NOCOPY fxll_rec_type) IS
1586 
1587     l_api_version                  CONSTANT NUMBER := 1;
1588     l_api_name                     CONSTANT VARCHAR2(30) := 'TL_insert_row';
1589     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1590     l_fxll_rec                     fxll_rec_type := p_fxll_rec;
1591     l_def_fxll_rec                 fxll_rec_type;
1592     CURSOR get_languages IS
1593       SELECT *
1594         FROM FND_LANGUAGES
1595        WHERE INSTALLED_FLAG IN ('I', 'B');
1596     ---------------------------------------------------
1597     -- Set_Attributes for:OKL_EXT_FA_LINE_SOURCES_TL --
1598     ---------------------------------------------------
1599     FUNCTION Set_Attributes (
1600       p_fxll_rec IN fxll_rec_type,
1601       x_fxll_rec OUT NOCOPY fxll_rec_type
1602     ) RETURN VARCHAR2 IS
1603       l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1604     BEGIN
1605       x_fxll_rec := p_fxll_rec;
1606       x_fxLl_rec.SFWT_FLAG := 'N';
1607       x_fxll_rec.SOURCE_LANG := USERENV('LANG');
1608       RETURN(l_return_status);
1609     END Set_Attributes;
1610   BEGIN
1611     l_return_status := OKL_API.START_ACTIVITY(l_api_name,
1612                                               p_init_msg_list,
1613                                               '_PVT',
1614                                               x_return_status);
1615     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1616       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1617     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
1618       RAISE OKL_API.G_EXCEPTION_ERROR;
1619     END IF;
1620     --- Setting item attributes
1621     l_return_status := Set_Attributes(
1622       p_fxll_rec,                        -- IN
1623       l_fxll_rec);                       -- OUT
1624     --- If any errors happen abort API
1625     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1626       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1627     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
1628       RAISE OKL_API.G_EXCEPTION_ERROR;
1629     END IF;
1630     INSERT INTO OKL_EXT_FA_LINE_SOURCES_TL(
1631       line_extension_id,
1632       language,
1633       source_lang,
1634       sfwt_flag,
1635       inventory_org_name,
1636       trans_line_description,
1637       created_by,
1638       creation_date,
1639       last_updated_by,
1640       last_update_date,
1641       last_update_login)
1642     VALUES (
1643       l_fxll_rec.line_extension_id,
1644       l_fxll_rec.language,
1645       l_fxll_rec.source_lang,
1646       l_fxll_rec.sfwt_flag,
1647       l_fxll_rec.inventory_org_name,
1648       l_fxll_rec.trans_line_description,
1649       l_fxll_rec.created_by,
1650       l_fxll_rec.creation_date,
1651       l_fxll_rec.last_updated_by,
1652       l_fxll_rec.last_update_date,
1653       l_fxll_rec.last_update_login);
1654     -- Set OUT values
1655     x_fxll_rec := l_fxll_rec;
1656     x_return_status := l_return_status;
1657     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
1658   EXCEPTION
1659     WHEN OKL_API.G_EXCEPTION_ERROR THEN
1660       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1661       (
1662         l_api_name,
1663         G_PKG_NAME,
1664         'OKL_API.G_RET_STS_ERROR',
1665         x_msg_count,
1666         x_msg_data,
1667         '_PVT'
1668       );
1669     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1670       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1671       (
1672         l_api_name,
1673         G_PKG_NAME,
1674         'OKL_API.G_RET_STS_UNEXP_ERROR',
1675         x_msg_count,
1676         x_msg_data,
1677         '_PVT'
1678       );
1679     WHEN OTHERS THEN
1680       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1681       (
1682         l_api_name,
1683         G_PKG_NAME,
1684         'OTHERS',
1685         x_msg_count,
1686         x_msg_data,
1687         '_PVT'
1688       );
1689   END insert_row;
1690   -----------------------------------------------
1691   -- insert_row for :OKL_EXT_FA_LINE_SOURCES_B --
1692   -----------------------------------------------
1693   PROCEDURE insert_row(
1694     p_api_version                  IN NUMBER,
1695     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
1696     x_return_status                OUT NOCOPY VARCHAR2,
1697     x_msg_count                    OUT NOCOPY NUMBER,
1698     x_msg_data                     OUT NOCOPY VARCHAR2,
1699     p_fxlv_rec                     IN fxlv_rec_type,
1700     x_fxlv_rec                     OUT NOCOPY fxlv_rec_type) IS
1701 
1702     l_api_version                  CONSTANT NUMBER := 1;
1703     l_api_name                     CONSTANT VARCHAR2(30) := 'V_insert_row';
1704     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1705     l_fxlv_rec                     fxlv_rec_type := p_fxlv_rec;
1706     l_def_fxlv_rec                 fxlv_rec_type;
1707     l_fxl_rec                      fxl_rec_type;
1708     lx_fxl_rec                     fxl_rec_type;
1709     l_fxll_rec                     fxll_rec_type;
1710     lx_fxll_rec                    fxll_rec_type;
1711     -------------------------------
1712     -- FUNCTION fill_who_columns --
1713     -------------------------------
1714     FUNCTION fill_who_columns (
1715       p_fxlv_rec IN fxlv_rec_type
1716     ) RETURN fxlv_rec_type IS
1717       l_fxlv_rec fxlv_rec_type := p_fxlv_rec;
1718     BEGIN
1719       l_fxlv_rec.CREATION_DATE := SYSDATE;
1720       l_fxlv_rec.CREATED_BY := FND_GLOBAL.USER_ID;
1721       l_fxlv_rec.LAST_UPDATE_DATE := l_fxlv_rec.CREATION_DATE;
1722       l_fxlv_rec.LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
1723       l_fxlv_rec.LAST_UPDATE_LOGIN := FND_GLOBAL.LOGIN_ID;
1724       RETURN(l_fxlv_rec);
1725     END fill_who_columns;
1726     --------------------------------------------------
1727     -- Set_Attributes for:OKL_EXT_FA_LINE_SOURCES_B --
1728     --------------------------------------------------
1729     FUNCTION Set_Attributes (
1730       p_fxlv_rec IN fxlv_rec_type,
1731       x_fxlv_rec OUT NOCOPY fxlv_rec_type
1732     ) RETURN VARCHAR2 IS
1733       l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1734     BEGIN
1735       x_fxlv_rec := p_fxlv_rec;
1736       x_fxlv_rec.OBJECT_VERSION_NUMBER := 1;
1737       RETURN(l_return_status);
1738     END Set_Attributes;
1739   BEGIN
1740     l_return_status := OKL_API.START_ACTIVITY(l_api_name,
1741                                               G_PKG_NAME,
1742                                               p_init_msg_list,
1743                                               l_api_version,
1744                                               p_api_version,
1745                                               '_PVT',
1746                                               x_return_status);
1747     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1748       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1749     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
1750       RAISE OKL_API.G_EXCEPTION_ERROR;
1751     END IF;
1752     l_fxlv_rec := null_out_defaults(p_fxlv_rec);
1753     -- Set primary key value
1754     l_fxlv_rec.LINE_EXTENSION_ID := get_seq_id;
1755     -- Setting item attributes
1756     l_return_Status := Set_Attributes(
1757       l_fxlv_rec,                        -- IN
1758       l_def_fxlv_rec);                   -- OUT
1759     --- If any errors happen abort API
1760     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1761       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1762     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
1763       RAISE OKL_API.G_EXCEPTION_ERROR;
1764     END IF;
1765     l_def_fxlv_rec := fill_who_columns(l_def_fxlv_rec);
1766     --- Validate all non-missing attributes (Item Level Validation)
1767     l_return_status := Validate_Attributes(l_def_fxlv_rec);
1768     --- If any errors happen abort API
1769     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1770       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1771     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
1772       RAISE OKL_API.G_EXCEPTION_ERROR;
1773     END IF;
1774     l_return_status := Validate_Record(l_def_fxlv_rec);
1775     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1776       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1777     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
1778       RAISE OKL_API.G_EXCEPTION_ERROR;
1779     END IF;
1780     -----------------------------------------
1781     -- Move VIEW record to "Child" records --
1782     -----------------------------------------
1783     migrate(l_def_fxlv_rec, l_fxl_rec);
1784     migrate(l_def_fxlv_rec, l_fxll_rec);
1785     -----------------------------------------------
1786     -- Call the INSERT_ROW for each child record --
1787     -----------------------------------------------
1788     insert_row(
1789       p_init_msg_list,
1790       l_return_status,
1791       x_msg_count,
1792       x_msg_data,
1793       l_fxl_rec,
1794       lx_fxl_rec
1795     );
1796     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1797       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1798     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
1799       RAISE OKL_API.G_EXCEPTION_ERROR;
1800     END IF;
1801     migrate(lx_fxl_rec, l_def_fxlv_rec);
1802     insert_row(
1803       p_init_msg_list,
1804       l_return_status,
1805       x_msg_count,
1806       x_msg_data,
1807       l_fxll_rec,
1808       lx_fxll_rec
1809     );
1810     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
1811       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
1812     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
1813       RAISE OKL_API.G_EXCEPTION_ERROR;
1814     END IF;
1815     migrate(lx_fxll_rec, l_def_fxlv_rec);
1816     -- Set OUT values
1817     x_fxlv_rec := l_def_fxlv_rec;
1818     x_return_status := l_return_status;
1819     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
1820   EXCEPTION
1821     WHEN OKL_API.G_EXCEPTION_ERROR THEN
1822       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1823       (
1824         l_api_name,
1825         G_PKG_NAME,
1826         'OKL_API.G_RET_STS_ERROR',
1827         x_msg_count,
1828         x_msg_data,
1829         '_PVT'
1830       );
1831     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1832       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1833       (
1834         l_api_name,
1835         G_PKG_NAME,
1836         'OKL_API.G_RET_STS_UNEXP_ERROR',
1837         x_msg_count,
1838         x_msg_data,
1839         '_PVT'
1840       );
1841     WHEN OTHERS THEN
1842       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1843       (
1844         l_api_name,
1845         G_PKG_NAME,
1846         'OTHERS',
1847         x_msg_count,
1848         x_msg_data,
1849         '_PVT'
1850       );
1851   END insert_row;
1852   ----------------------------------------
1853   -- PL/SQL TBL insert_row for:FXLV_TBL --
1854   ----------------------------------------
1855   PROCEDURE insert_row(
1856     p_api_version                  IN NUMBER,
1857     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
1858     x_return_status                OUT NOCOPY VARCHAR2,
1859     x_msg_count                    OUT NOCOPY NUMBER,
1860     x_msg_data                     OUT NOCOPY VARCHAR2,
1861     p_fxlv_tbl                     IN fxlv_tbl_type,
1862     x_fxlv_tbl                     OUT NOCOPY fxlv_tbl_type,
1863     px_error_tbl                   IN OUT NOCOPY OKL_API.ERROR_TBL_TYPE) IS
1864 
1865     l_api_version                  CONSTANT NUMBER := 1;
1866     l_api_name                     CONSTANT VARCHAR2(30) := 'V_error_tbl_insert_row';
1867     i                              NUMBER := 0;
1868   BEGIN
1869     OKL_API.init_msg_list(p_init_msg_list);
1870     -- Make sure PL/SQL table has records in it before passing
1871     IF (p_fxlv_tbl.COUNT > 0) THEN
1872       i := p_fxlv_tbl.FIRST;
1873       LOOP
1874         DECLARE
1875           l_error_rec         OKL_API.ERROR_REC_TYPE;
1876         BEGIN
1877           l_error_rec.api_name := l_api_name;
1878           l_error_rec.api_package := G_PKG_NAME;
1879           l_error_rec.idx := i;
1880           insert_row (
1881             p_api_version                  => p_api_version,
1882             p_init_msg_list                => OKL_API.G_FALSE,
1883             x_return_status                => l_error_rec.error_type,
1884             x_msg_count                    => l_error_rec.msg_count,
1885             x_msg_data                     => l_error_rec.msg_data,
1886             p_fxlv_rec                     => p_fxlv_tbl(i),
1887             x_fxlv_rec                     => x_fxlv_tbl(i));
1888           IF (l_error_rec.error_type <> OKL_API.G_RET_STS_SUCCESS) THEN
1889             l_error_rec.sqlcode := SQLCODE;
1890             load_error_tbl(l_error_rec, px_error_tbl);
1891           ELSE
1892             x_msg_count := l_error_rec.msg_count;
1893             x_msg_data := l_error_rec.msg_data;
1894           END IF;
1895         EXCEPTION
1896           WHEN OKL_API.G_EXCEPTION_ERROR THEN
1897             l_error_rec.error_type := OKL_API.G_RET_STS_ERROR;
1898             l_error_rec.sqlcode := SQLCODE;
1899             load_error_tbl(l_error_rec, px_error_tbl);
1900           WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1901             l_error_rec.error_type := OKL_API.G_RET_STS_UNEXP_ERROR;
1902             l_error_rec.sqlcode := SQLCODE;
1903             load_error_tbl(l_error_rec, px_error_tbl);
1904           WHEN OTHERS THEN
1905             l_error_rec.error_type := 'OTHERS';
1906             l_error_rec.sqlcode := SQLCODE;
1907             load_error_tbl(l_error_rec, px_error_tbl);
1908         END;
1909         EXIT WHEN (i = p_fxlv_tbl.LAST);
1910         i := p_fxlv_tbl.NEXT(i);
1911       END LOOP;
1912     END IF;
1913     -- Loop through the error_tbl to find the error with the highest severity
1914     -- and return it.
1915     x_return_status := find_highest_exception(px_error_tbl);
1916     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
1917   EXCEPTION
1918     WHEN OKL_API.G_EXCEPTION_ERROR THEN
1919       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1920       (
1921         l_api_name,
1922         G_PKG_NAME,
1923         'OKL_API.G_RET_STS_ERROR',
1924         x_msg_count,
1925         x_msg_data,
1926         '_PVT'
1927       );
1928     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1929       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1930       (
1931         l_api_name,
1932         G_PKG_NAME,
1933         'OKL_API.G_RET_STS_UNEXP_ERROR',
1934         x_msg_count,
1935         x_msg_data,
1936         '_PVT'
1937       );
1938     WHEN OTHERS THEN
1939       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1940       (
1941         l_api_name,
1942         G_PKG_NAME,
1943         'OTHERS',
1944         x_msg_count,
1945         x_msg_data,
1946         '_PVT'
1947       );
1948   END insert_row;
1949 
1950   ----------------------------------------
1951   -- PL/SQL TBL insert_row for:FXLV_TBL --
1952   ----------------------------------------
1953   PROCEDURE insert_row(
1954     p_api_version                  IN NUMBER,
1955     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
1956     x_return_status                OUT NOCOPY VARCHAR2,
1957     x_msg_count                    OUT NOCOPY NUMBER,
1958     x_msg_data                     OUT NOCOPY VARCHAR2,
1959     p_fxlv_tbl                     IN fxlv_tbl_type,
1960     x_fxlv_tbl                     OUT NOCOPY fxlv_tbl_type) IS
1961 
1962     l_api_version                  CONSTANT NUMBER := 1;
1963     l_api_name                     CONSTANT VARCHAR2(30) := 'V_tbl_insert_row';
1964     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
1965     l_error_tbl                    OKL_API.ERROR_TBL_TYPE;
1966   BEGIN
1967     OKL_API.init_msg_list(p_init_msg_list);
1968     -- Make sure PL/SQL table has records in it before passing
1969     IF (p_fxlv_tbl.COUNT > 0) THEN
1970       insert_row (
1971         p_api_version                  => p_api_version,
1972         p_init_msg_list                => OKL_API.G_FALSE,
1973         x_return_status                => x_return_status,
1974         x_msg_count                    => x_msg_count,
1975         x_msg_data                     => x_msg_data,
1976         p_fxlv_tbl                     => p_fxlv_tbl,
1977         x_fxlv_tbl                     => x_fxlv_tbl,
1978         px_error_tbl                   => l_error_tbl);
1979     END IF;
1980     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
1981   EXCEPTION
1982     WHEN OKL_API.G_EXCEPTION_ERROR THEN
1983       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1984       (
1985         l_api_name,
1986         G_PKG_NAME,
1987         'OKL_API.G_RET_STS_ERROR',
1988         x_msg_count,
1989         x_msg_data,
1990         '_PVT'
1991       );
1992     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
1993       x_return_status := OKL_API.HANDLE_EXCEPTIONS
1994       (
1995         l_api_name,
1996         G_PKG_NAME,
1997         'OKL_API.G_RET_STS_UNEXP_ERROR',
1998         x_msg_count,
1999         x_msg_data,
2000         '_PVT'
2001       );
2002     WHEN OTHERS THEN
2003       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2004       (
2005         l_api_name,
2006         G_PKG_NAME,
2007         'OTHERS',
2008         x_msg_count,
2009         x_msg_data,
2010         '_PVT'
2011       );
2012   END insert_row;
2013 
2014   ---------------------------------------------------------------------------
2015   -- PROCEDURE lock_row
2016   ---------------------------------------------------------------------------
2017   --------------------------------------------
2018   -- lock_row for:OKL_EXT_FA_LINE_SOURCES_B --
2019   --------------------------------------------
2020   PROCEDURE lock_row(
2021     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
2022     x_return_status                OUT NOCOPY VARCHAR2,
2023     x_msg_count                    OUT NOCOPY NUMBER,
2024     x_msg_data                     OUT NOCOPY VARCHAR2,
2025     p_fxl_rec                      IN fxl_rec_type) IS
2026 
2027     E_Resource_Busy                EXCEPTION;
2028     PRAGMA EXCEPTION_INIT(E_Resource_Busy, -00054);
2029     CURSOR lock_csr (p_fxl_rec IN fxl_rec_type) IS
2030     SELECT OBJECT_VERSION_NUMBER
2031       FROM OKL_EXT_FA_LINE_SOURCES_B
2032      WHERE LINE_EXTENSION_ID = p_fxl_rec.line_extension_id
2033        AND OBJECT_VERSION_NUMBER = p_fxl_rec.object_version_number
2034     FOR UPDATE OF OBJECT_VERSION_NUMBER NOWAIT;
2035 
2036     CURSOR lchk_csr (p_fxl_rec IN fxl_rec_type) IS
2037     SELECT OBJECT_VERSION_NUMBER
2038       FROM OKL_EXT_FA_LINE_SOURCES_B
2039      WHERE LINE_EXTENSION_ID = p_fxl_rec.line_extension_id;
2040     l_api_version                  CONSTANT NUMBER := 1;
2041     l_api_name                     CONSTANT VARCHAR2(30) := 'B_lock_row';
2042     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
2043     l_object_version_number        OKL_EXT_FA_LINE_SOURCES_B.OBJECT_VERSION_NUMBER%TYPE;
2044     lc_object_version_number       OKL_EXT_FA_LINE_SOURCES_B.OBJECT_VERSION_NUMBER%TYPE;
2045     l_row_notfound                 BOOLEAN := FALSE;
2046     lc_row_notfound                BOOLEAN := FALSE;
2047   BEGIN
2048     l_return_status := OKL_API.START_ACTIVITY(l_api_name,
2049                                               p_init_msg_list,
2050                                               '_PVT',
2051                                               x_return_status);
2052     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2053       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2054     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
2055       RAISE OKL_API.G_EXCEPTION_ERROR;
2056     END IF;
2057     BEGIN
2058       OPEN lock_csr(p_fxl_rec);
2059       FETCH lock_csr INTO l_object_version_number;
2060       l_row_notfound := lock_csr%NOTFOUND;
2061       CLOSE lock_csr;
2062     EXCEPTION
2063       WHEN E_Resource_Busy THEN
2064         IF (lock_csr%ISOPEN) THEN
2065           CLOSE lock_csr;
2066         END IF;
2067         OKL_API.set_message(G_FND_APP,G_FORM_UNABLE_TO_RESERVE_REC);
2068         RAISE APP_EXCEPTIONS.RECORD_LOCK_EXCEPTION;
2069     END;
2070 
2071     IF ( l_row_notfound ) THEN
2072       OPEN lchk_csr(p_fxl_rec);
2073       FETCH lchk_csr INTO lc_object_version_number;
2074       lc_row_notfound := lchk_csr%NOTFOUND;
2075       CLOSE lchk_csr;
2076     END IF;
2077     IF (lc_row_notfound) THEN
2078       OKL_API.set_message(G_FND_APP,G_FORM_RECORD_DELETED);
2079       RAISE OKL_API.G_EXCEPTION_ERROR;
2080     ELSIF lc_object_version_number > p_fxl_rec.object_version_number THEN
2081       OKL_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
2082       RAISE OKL_API.G_EXCEPTION_ERROR;
2083     ELSIF lc_object_version_number <> p_fxl_rec.object_version_number THEN
2084       OKL_API.set_message(G_FND_APP,G_FORM_RECORD_CHANGED);
2085       RAISE OKL_API.G_EXCEPTION_ERROR;
2086     ELSIF lc_object_version_number = -1 THEN
2087       OKL_API.set_message(G_APP_NAME,G_RECORD_LOGICALLY_DELETED);
2088       RAISE OKL_API.G_EXCEPTION_ERROR;
2089     END IF;
2090     x_return_status := l_return_status;
2091     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
2092   EXCEPTION
2093     WHEN OKL_API.G_EXCEPTION_ERROR THEN
2094       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2095       (
2096         l_api_name,
2097         G_PKG_NAME,
2098         'OKL_API.G_RET_STS_ERROR',
2099         x_msg_count,
2100         x_msg_data,
2101         '_PVT'
2102       );
2103     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2104       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2105       (
2106         l_api_name,
2107         G_PKG_NAME,
2108         'OKL_API.G_RET_STS_UNEXP_ERROR',
2109         x_msg_count,
2110         x_msg_data,
2111         '_PVT'
2112       );
2113     WHEN OTHERS THEN
2114       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2115       (
2116         l_api_name,
2117         G_PKG_NAME,
2118         'OTHERS',
2119         x_msg_count,
2120         x_msg_data,
2121         '_PVT'
2122       );
2123   END lock_row;
2124   ---------------------------------------------
2125   -- lock_row for:OKL_EXT_FA_LINE_SOURCES_TL --
2126   ---------------------------------------------
2127   PROCEDURE lock_row(
2128     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
2129     x_return_status                OUT NOCOPY VARCHAR2,
2130     x_msg_count                    OUT NOCOPY NUMBER,
2131     x_msg_data                     OUT NOCOPY VARCHAR2,
2132     p_fxll_rec                     IN fxll_rec_type) IS
2133 
2134     E_Resource_Busy                EXCEPTION;
2135     PRAGMA EXCEPTION_INIT(E_Resource_Busy, -00054);
2136     CURSOR lock_csr (p_fxll_rec IN fxll_rec_type) IS
2137     SELECT *
2138       FROM OKL_EXT_FA_LINE_SOURCES_TL
2139      WHERE LINE_EXTENSION_ID = p_fxll_rec.line_extension_id
2140     FOR UPDATE NOWAIT;
2141 
2142     l_api_version                  CONSTANT NUMBER := 1;
2143     l_api_name                     CONSTANT VARCHAR2(30) := 'TL_lock_row';
2144     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
2145     l_lock_var                     lock_csr%ROWTYPE;
2146     l_row_notfound                 BOOLEAN := FALSE;
2147     lc_row_notfound                BOOLEAN := FALSE;
2148   BEGIN
2149     l_return_status := OKL_API.START_ACTIVITY(l_api_name,
2150                                               p_init_msg_list,
2151                                               '_PVT',
2152                                               x_return_status);
2153     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2154       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2155     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
2156       RAISE OKL_API.G_EXCEPTION_ERROR;
2157     END IF;
2158     BEGIN
2159       OPEN lock_csr(p_fxll_rec);
2160       FETCH lock_csr INTO l_lock_var;
2161       l_row_notfound := lock_csr%NOTFOUND;
2162       CLOSE lock_csr;
2163     EXCEPTION
2164       WHEN E_Resource_Busy THEN
2165         IF (lock_csr%ISOPEN) THEN
2166           CLOSE lock_csr;
2167         END IF;
2168         OKL_API.set_message(G_FND_APP,G_FORM_UNABLE_TO_RESERVE_REC);
2169         RAISE APP_EXCEPTIONS.RECORD_LOCK_EXCEPTION;
2170     END;
2171 
2172     IF ( l_row_notfound ) THEN
2173       OKL_API.set_message(G_FND_APP,G_FORM_RECORD_DELETED);
2174       RAISE OKL_API.G_EXCEPTION_ERROR;
2175     END IF;
2176     x_return_status := l_return_status;
2177     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
2178   EXCEPTION
2179     WHEN OKL_API.G_EXCEPTION_ERROR THEN
2180       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2181       (
2182         l_api_name,
2183         G_PKG_NAME,
2184         'OKL_API.G_RET_STS_ERROR',
2185         x_msg_count,
2186         x_msg_data,
2187         '_PVT'
2188       );
2189     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2190       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2191       (
2192         l_api_name,
2193         G_PKG_NAME,
2194         'OKL_API.G_RET_STS_UNEXP_ERROR',
2195         x_msg_count,
2196         x_msg_data,
2197         '_PVT'
2198       );
2199     WHEN OTHERS THEN
2200       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2201       (
2202         l_api_name,
2203         G_PKG_NAME,
2204         'OTHERS',
2205         x_msg_count,
2206         x_msg_data,
2207         '_PVT'
2208       );
2209   END lock_row;
2210   ---------------------------------------------
2211   -- lock_row for: OKL_EXT_FA_LINE_SOURCES_V --
2212   ---------------------------------------------
2213   PROCEDURE lock_row(
2214     p_api_version                  IN NUMBER,
2215     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
2216     x_return_status                OUT NOCOPY VARCHAR2,
2217     x_msg_count                    OUT NOCOPY NUMBER,
2218     x_msg_data                     OUT NOCOPY VARCHAR2,
2219     p_fxlv_rec                     IN fxlv_rec_type) IS
2220 
2221     l_api_version                  CONSTANT NUMBER := 1;
2222     l_api_name                     CONSTANT VARCHAR2(30) := 'V_lock_row';
2223     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
2224     l_fxl_rec                      fxl_rec_type;
2225     l_fxll_rec                     fxll_rec_type;
2226   BEGIN
2227     l_return_status := OKL_API.START_ACTIVITY(l_api_name,
2228                                               G_PKG_NAME,
2229                                               p_init_msg_list,
2230                                               l_api_version,
2231                                               p_api_version,
2232                                               '_PVT',
2233                                               x_return_status);
2234     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2235       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2236     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
2237       RAISE OKL_API.G_EXCEPTION_ERROR;
2238     END IF;
2239     -----------------------------------------
2240     -- Move VIEW record to "Child" records --
2241     -----------------------------------------
2242     migrate(p_fxlv_rec, l_fxl_rec);
2243     migrate(p_fxlv_rec, l_fxll_rec);
2244     ---------------------------------------------
2245     -- Call the LOCK_ROW for each child record --
2246     ---------------------------------------------
2247     lock_row(
2248       p_init_msg_list,
2249       l_return_status,
2250       x_msg_count,
2251       x_msg_data,
2252       l_fxl_rec
2253     );
2254     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2255       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2256     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
2257       RAISE OKL_API.G_EXCEPTION_ERROR;
2258     END IF;
2259     lock_row(
2260       p_init_msg_list,
2261       l_return_status,
2262       x_msg_count,
2263       x_msg_data,
2264       l_fxll_rec
2265     );
2266     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2267       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2268     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
2269       RAISE OKL_API.G_EXCEPTION_ERROR;
2270     END IF;
2271     x_return_status := l_return_status;
2272     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
2273   EXCEPTION
2274     WHEN OKL_API.G_EXCEPTION_ERROR THEN
2275       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2276       (
2277         l_api_name,
2278         G_PKG_NAME,
2279         'OKL_API.G_RET_STS_ERROR',
2280         x_msg_count,
2281         x_msg_data,
2282         '_PVT'
2283       );
2284     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2285       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2286       (
2287         l_api_name,
2288         G_PKG_NAME,
2289         'OKL_API.G_RET_STS_UNEXP_ERROR',
2290         x_msg_count,
2291         x_msg_data,
2292         '_PVT'
2293       );
2294     WHEN OTHERS THEN
2295       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2296       (
2297         l_api_name,
2298         G_PKG_NAME,
2299         'OTHERS',
2300         x_msg_count,
2301         x_msg_data,
2302         '_PVT'
2303       );
2304   END lock_row;
2305   --------------------------------------
2306   -- PL/SQL TBL lock_row for:FXLV_TBL --
2307   --------------------------------------
2308   PROCEDURE lock_row(
2309     p_api_version                  IN NUMBER,
2310     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
2311     x_return_status                OUT NOCOPY VARCHAR2,
2312     x_msg_count                    OUT NOCOPY NUMBER,
2313     x_msg_data                     OUT NOCOPY VARCHAR2,
2314     p_fxlv_tbl                     IN fxlv_tbl_type,
2315     px_error_tbl                   IN OUT NOCOPY OKL_API.ERROR_TBL_TYPE) IS
2316 
2317     l_api_version                  CONSTANT NUMBER := 1;
2318     l_api_name                     CONSTANT VARCHAR2(30) := 'V_error_tbl_lock_row';
2319     i                              NUMBER := 0;
2320   BEGIN
2321     OKL_API.init_msg_list(p_init_msg_list);
2322     -- Make sure PL/SQL table has recrods in it before passing
2323     IF (p_fxlv_tbl.COUNT > 0) THEN
2324       i := p_fxlv_tbl.FIRST;
2325       LOOP
2326         DECLARE
2327           l_error_rec         OKL_API.ERROR_REC_TYPE;
2328         BEGIN
2329           l_error_rec.api_name := l_api_name;
2330           l_error_rec.api_package := G_PKG_NAME;
2331           l_error_rec.idx := i;
2332           lock_row(
2333             p_api_version                  => p_api_version,
2334             p_init_msg_list                => OKL_API.G_FALSE,
2335             x_return_status                => l_error_rec.error_type,
2336             x_msg_count                    => l_error_rec.msg_count,
2337             x_msg_data                     => l_error_rec.msg_data,
2338             p_fxlv_rec                     => p_fxlv_tbl(i));
2339           IF (l_error_rec.error_type <> OKL_API.G_RET_STS_SUCCESS) THEN
2340             l_error_rec.sqlcode := SQLCODE;
2341             load_error_tbl(l_error_rec, px_error_tbl);
2342           ELSE
2343             x_msg_count := l_error_rec.msg_count;
2344             x_msg_data := l_error_rec.msg_data;
2345           END IF;
2346         EXCEPTION
2347           WHEN OKL_API.G_EXCEPTION_ERROR THEN
2348             l_error_rec.error_type := OKL_API.G_RET_STS_ERROR;
2349             l_error_rec.sqlcode := SQLCODE;
2350             load_error_tbl(l_error_rec, px_error_tbl);
2351           WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2352             l_error_rec.error_type := OKL_API.G_RET_STS_UNEXP_ERROR;
2353             l_error_rec.sqlcode := SQLCODE;
2354             load_error_tbl(l_error_rec, px_error_tbl);
2355           WHEN OTHERS THEN
2356             l_error_rec.error_type := 'OTHERS';
2357             l_error_rec.sqlcode := SQLCODE;
2358             load_error_tbl(l_error_rec, px_error_tbl);
2359         END;
2360         EXIT WHEN (i = p_fxlv_tbl.LAST);
2361         i := p_fxlv_tbl.NEXT(i);
2362       END LOOP;
2363     END IF;
2364     -- Loop through the error_tbl to find the error with the highest severity
2365     -- and return it.
2366     x_return_status := find_highest_exception(px_error_tbl);
2367     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
2368   EXCEPTION
2369     WHEN OKL_API.G_EXCEPTION_ERROR THEN
2370       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2371       (
2372         l_api_name,
2373         G_PKG_NAME,
2374         'OKL_API.G_RET_STS_ERROR',
2375         x_msg_count,
2376         x_msg_data,
2377         '_PVT'
2378       );
2379     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_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_UNEXP_ERROR',
2385         x_msg_count,
2386         x_msg_data,
2387         '_PVT'
2388       );
2389     WHEN OTHERS THEN
2390       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2391       (
2392         l_api_name,
2393         G_PKG_NAME,
2394         'OTHERS',
2395         x_msg_count,
2396         x_msg_data,
2397         '_PVT'
2398       );
2399   END lock_row;
2400   --------------------------------------
2401   -- PL/SQL TBL lock_row for:FXLV_TBL --
2402   --------------------------------------
2403   PROCEDURE lock_row(
2404     p_api_version                  IN NUMBER,
2405     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
2406     x_return_status                OUT NOCOPY VARCHAR2,
2407     x_msg_count                    OUT NOCOPY NUMBER,
2408     x_msg_data                     OUT NOCOPY VARCHAR2,
2409     p_fxlv_tbl                     IN fxlv_tbl_type) IS
2410 
2411     l_api_version                  CONSTANT NUMBER := 1;
2412     l_api_name                     CONSTANT VARCHAR2(30) := 'V_tbl_lock_row';
2413     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
2414     l_error_tbl                    OKL_API.ERROR_TBL_TYPE;
2415   BEGIN
2416     OKL_API.init_msg_list(p_init_msg_list);
2417     -- Make sure PL/SQL table has recrods in it before passing
2418     IF (p_fxlv_tbl.COUNT > 0) THEN
2419       lock_row(
2420         p_api_version                  => p_api_version,
2421         p_init_msg_list                => OKL_API.G_FALSE,
2422         x_return_status                => x_return_status,
2423         x_msg_count                    => x_msg_count,
2424         x_msg_data                     => x_msg_data,
2425         p_fxlv_tbl                     => p_fxlv_tbl,
2426         px_error_tbl                   => l_error_tbl);
2427     END IF;
2428     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
2429   EXCEPTION
2430     WHEN OKL_API.G_EXCEPTION_ERROR THEN
2431       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2432       (
2433         l_api_name,
2434         G_PKG_NAME,
2435         'OKL_API.G_RET_STS_ERROR',
2436         x_msg_count,
2437         x_msg_data,
2438         '_PVT'
2439       );
2440     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2441       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2442       (
2443         l_api_name,
2444         G_PKG_NAME,
2445         'OKL_API.G_RET_STS_UNEXP_ERROR',
2446         x_msg_count,
2447         x_msg_data,
2448         '_PVT'
2449       );
2450     WHEN OTHERS THEN
2451       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2452       (
2453         l_api_name,
2454         G_PKG_NAME,
2455         'OTHERS',
2456         x_msg_count,
2457         x_msg_data,
2458         '_PVT'
2459       );
2460   END lock_row;
2461   ---------------------------------------------------------------------------
2462   -- PROCEDURE update_row
2463   ---------------------------------------------------------------------------
2464   ----------------------------------------------
2465   -- update_row for:OKL_EXT_FA_LINE_SOURCES_B --
2466   ----------------------------------------------
2467   PROCEDURE update_row(
2468     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
2469     x_return_status                OUT NOCOPY VARCHAR2,
2470     x_msg_count                    OUT NOCOPY NUMBER,
2471     x_msg_data                     OUT NOCOPY VARCHAR2,
2472     p_fxl_rec                      IN fxl_rec_type,
2473     x_fxl_rec                      OUT NOCOPY fxl_rec_type) IS
2474 
2475     l_api_version                  CONSTANT NUMBER := 1;
2476     l_api_name                     CONSTANT VARCHAR2(30) := 'B_update_row';
2477     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
2478     l_fxl_rec                      fxl_rec_type := p_fxl_rec;
2479     l_def_fxl_rec                  fxl_rec_type;
2480     l_row_notfound                 BOOLEAN := TRUE;
2481     ----------------------------------
2482     -- FUNCTION populate_new_record --
2483     ----------------------------------
2484     FUNCTION populate_new_record (
2485       p_fxl_rec IN fxl_rec_type,
2486       x_fxl_rec OUT NOCOPY fxl_rec_type
2487     ) RETURN VARCHAR2 IS
2488       l_fxl_rec                      fxl_rec_type;
2489       l_row_notfound                 BOOLEAN := TRUE;
2490       l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
2491     BEGIN
2492       x_fxl_rec := p_fxl_rec;
2493       -- Get current database values
2494       l_fxl_rec := get_rec(p_fxl_rec, l_return_status);
2495       IF (l_return_status = OKL_API.G_RET_STS_SUCCESS) THEN
2496         IF x_fxl_rec.line_extension_id IS NULL THEN
2497           x_fxl_rec.line_extension_id := l_fxl_rec.line_extension_id;
2498         END IF;
2499         IF x_fxl_rec.header_extension_id IS NULL THEN
2500           x_fxl_rec.header_extension_id := l_fxl_rec.header_extension_id;
2501         END IF;
2502         IF x_fxl_rec.source_id IS NULL THEN
2503           x_fxl_rec.source_id := l_fxl_rec.source_id;
2504         END IF;
2505         IF x_fxl_rec.source_table IS NULL THEN
2506           x_fxl_rec.source_table := l_fxl_rec.source_table;
2507         END IF;
2508         IF x_fxl_rec.object_version_number IS NULL THEN
2509           x_fxl_rec.object_version_number := l_fxl_rec.object_version_number;
2510         END IF;
2511         IF x_fxl_rec.fa_transaction_id IS NULL THEN
2512           x_fxl_rec.fa_transaction_id := l_fxl_rec.fa_transaction_id;
2513         END IF;
2514         IF x_fxl_rec.asset_id IS NULL THEN
2515           x_fxl_rec.asset_id := l_fxl_rec.asset_id;
2516         END IF;
2517         IF x_fxl_rec.kle_id IS NULL THEN
2518           x_fxl_rec.kle_id := l_fxl_rec.kle_id;
2519         END IF;
2520         IF x_fxl_rec.asset_number IS NULL THEN
2521           x_fxl_rec.asset_number := l_fxl_rec.asset_number;
2522         END IF;
2523         IF x_fxl_rec.contract_line_number IS NULL THEN
2524           x_fxl_rec.contract_line_number := l_fxl_rec.contract_line_number;
2525         END IF;
2526         IF x_fxl_rec.asset_book_type_name IS NULL THEN
2527           x_fxl_rec.asset_book_type_name := l_fxl_rec.asset_book_type_name;
2528         END IF;
2529         IF x_fxl_rec.asset_vendor_name IS NULL THEN
2530           x_fxl_rec.asset_vendor_name := l_fxl_rec.asset_vendor_name;
2531         END IF;
2532         IF x_fxl_rec.installed_site_id IS NULL THEN
2533           x_fxl_rec.installed_site_id := l_fxl_rec.installed_site_id;
2534         END IF;
2535         IF x_fxl_rec.line_attribute_category IS NULL THEN
2536           x_fxl_rec.line_attribute_category := l_fxl_rec.line_attribute_category;
2537         END IF;
2538         IF x_fxl_rec.line_attribute1 IS NULL THEN
2539           x_fxl_rec.line_attribute1 := l_fxl_rec.line_attribute1;
2540         END IF;
2541         IF x_fxl_rec.line_attribute2 IS NULL THEN
2542           x_fxl_rec.line_attribute2 := l_fxl_rec.line_attribute2;
2543         END IF;
2544         IF x_fxl_rec.line_attribute3 IS NULL THEN
2545           x_fxl_rec.line_attribute3 := l_fxl_rec.line_attribute3;
2546         END IF;
2547         IF x_fxl_rec.line_attribute4 IS NULL THEN
2548           x_fxl_rec.line_attribute4 := l_fxl_rec.line_attribute4;
2549         END IF;
2550         IF x_fxl_rec.line_attribute5 IS NULL THEN
2551           x_fxl_rec.line_attribute5 := l_fxl_rec.line_attribute5;
2552         END IF;
2553         IF x_fxl_rec.line_attribute6 IS NULL THEN
2554           x_fxl_rec.line_attribute6 := l_fxl_rec.line_attribute6;
2555         END IF;
2556         IF x_fxl_rec.line_attribute7 IS NULL THEN
2557           x_fxl_rec.line_attribute7 := l_fxl_rec.line_attribute7;
2558         END IF;
2559         IF x_fxl_rec.line_attribute8 IS NULL THEN
2560           x_fxl_rec.line_attribute8 := l_fxl_rec.line_attribute8;
2561         END IF;
2562         IF x_fxl_rec.line_attribute9 IS NULL THEN
2563           x_fxl_rec.line_attribute9 := l_fxl_rec.line_attribute9;
2564         END IF;
2565         IF x_fxl_rec.line_attribute10 IS NULL THEN
2566           x_fxl_rec.line_attribute10 := l_fxl_rec.line_attribute10;
2567         END IF;
2568         IF x_fxl_rec.line_attribute11 IS NULL THEN
2569           x_fxl_rec.line_attribute11 := l_fxl_rec.line_attribute11;
2570         END IF;
2571         IF x_fxl_rec.line_attribute12 IS NULL THEN
2572           x_fxl_rec.line_attribute12 := l_fxl_rec.line_attribute12;
2573         END IF;
2574         IF x_fxl_rec.line_attribute13 IS NULL THEN
2575           x_fxl_rec.line_attribute13 := l_fxl_rec.line_attribute13;
2576         END IF;
2577         IF x_fxl_rec.line_attribute14 IS NULL THEN
2578           x_fxl_rec.line_attribute14 := l_fxl_rec.line_attribute14;
2579         END IF;
2580         IF x_fxl_rec.line_attribute15 IS NULL THEN
2581           x_fxl_rec.line_attribute15 := l_fxl_rec.line_attribute15;
2582         END IF;
2583         IF x_fxl_rec.created_by IS NULL THEN
2584           x_fxl_rec.created_by := l_fxl_rec.created_by;
2585         END IF;
2586         IF x_fxl_rec.creation_date IS NULL THEN
2587           x_fxl_rec.creation_date := l_fxl_rec.creation_date;
2588         END IF;
2589         IF x_fxl_rec.last_updated_by IS NULL THEN
2590           x_fxl_rec.last_updated_by := l_fxl_rec.last_updated_by;
2591         END IF;
2592         IF x_fxl_rec.last_update_date IS NULL THEN
2593           x_fxl_rec.last_update_date := l_fxl_rec.last_update_date;
2594         END IF;
2595         IF x_fxl_rec.last_update_login IS NULL THEN
2596           x_fxl_rec.last_update_login := l_fxl_rec.last_update_login;
2597         END IF;
2598         IF x_fxl_rec.inventory_org_code IS NULL THEN
2599           x_fxl_rec.inventory_org_code := l_fxl_rec.inventory_org_code;
2600         END IF;
2601         IF x_fxl_rec.asset_book_type_code IS NULL THEN
2602           x_fxl_rec.asset_book_type_code := l_fxl_rec.asset_book_type_code;
2603         END IF;
2604         IF x_fxl_rec.period_Counter IS NULL THEN
2605           x_fxl_rec.period_Counter := l_fxl_rec.period_Counter;
2606         END IF;
2607 	 IF x_fxl_rec.asset_vendor_id IS NULL THEN
2608           x_fxl_rec.asset_vendor_id := l_fxl_rec.asset_vendor_id;
2609         END IF;
2610       END IF;
2611       RETURN(l_return_status);
2612     END populate_new_record;
2613     --------------------------------------------------
2614     -- Set_Attributes for:OKL_EXT_FA_LINE_SOURCES_B --
2615     --------------------------------------------------
2616     FUNCTION Set_Attributes (
2617       p_fxl_rec IN fxl_rec_type,
2618       x_fxl_rec OUT NOCOPY fxl_rec_type
2619     ) RETURN VARCHAR2 IS
2620       l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
2621     BEGIN
2622       x_fxl_rec := p_fxl_rec;
2623       x_fxl_rec.OBJECT_VERSION_NUMBER := p_fxl_rec.OBJECT_VERSION_NUMBER + 1;
2624       RETURN(l_return_status);
2625     END Set_Attributes;
2626   BEGIN
2627     l_return_status := OKL_API.START_ACTIVITY(l_api_name,
2628                                               p_init_msg_list,
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     --- Setting item attributes
2637     l_return_status := Set_Attributes(
2638       p_fxl_rec,                         -- IN
2639       l_fxl_rec);                        -- OUT
2640     --- If any errors happen abort API
2641     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2642       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2643     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
2644       RAISE OKL_API.G_EXCEPTION_ERROR;
2645     END IF;
2646     l_return_status := populate_new_record(l_fxl_rec, l_def_fxl_rec);
2647     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2648       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2649     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
2650       RAISE OKL_API.G_EXCEPTION_ERROR;
2651     END IF;
2652     UPDATE OKL_EXT_FA_LINE_SOURCES_B
2653     SET HEADER_EXTENSION_ID = l_def_fxl_rec.header_extension_id,
2654         SOURCE_ID = l_def_fxl_rec.source_id,
2655         SOURCE_TABLE = l_def_fxl_rec.source_table,
2656         OBJECT_VERSION_NUMBER = l_def_fxl_rec.object_version_number,
2657         FA_TRANSACTION_ID = l_def_fxl_rec.fa_transaction_id,
2658         ASSET_ID = l_def_fxl_rec.asset_id,
2659         KLE_ID = l_def_fxl_rec.kle_id,
2660         ASSET_NUMBER = l_def_fxl_rec.asset_number,
2661         CONTRACT_LINE_NUMBER = l_def_fxl_rec.contract_line_number,
2662         ASSET_BOOK_TYPE_NAME = l_def_fxl_rec.asset_book_type_name,
2663         ASSET_VENDOR_NAME = l_def_fxl_rec.asset_vendor_name,
2664         INSTALLED_SITE_ID = l_def_fxl_rec.installed_site_id,
2665         LINE_ATTRIBUTE_CATEGORY = l_def_fxl_rec.line_attribute_category,
2666         LINE_ATTRIBUTE1 = l_def_fxl_rec.line_attribute1,
2667         LINE_ATTRIBUTE2 = l_def_fxl_rec.line_attribute2,
2668         LINE_ATTRIBUTE3 = l_def_fxl_rec.line_attribute3,
2669         LINE_ATTRIBUTE4 = l_def_fxl_rec.line_attribute4,
2670         LINE_ATTRIBUTE5 = l_def_fxl_rec.line_attribute5,
2671         LINE_ATTRIBUTE6 = l_def_fxl_rec.line_attribute6,
2672         LINE_ATTRIBUTE7 = l_def_fxl_rec.line_attribute7,
2673         LINE_ATTRIBUTE8 = l_def_fxl_rec.line_attribute8,
2674         LINE_ATTRIBUTE9 = l_def_fxl_rec.line_attribute9,
2675         LINE_ATTRIBUTE10 = l_def_fxl_rec.line_attribute10,
2676         LINE_ATTRIBUTE11 = l_def_fxl_rec.line_attribute11,
2677         LINE_ATTRIBUTE12 = l_def_fxl_rec.line_attribute12,
2678         LINE_ATTRIBUTE13 = l_def_fxl_rec.line_attribute13,
2679         LINE_ATTRIBUTE14 = l_def_fxl_rec.line_attribute14,
2680         LINE_ATTRIBUTE15 = l_def_fxl_rec.line_attribute15,
2681         CREATED_BY = l_def_fxl_rec.created_by,
2682         CREATION_DATE = l_def_fxl_rec.creation_date,
2683         LAST_UPDATED_BY = l_def_fxl_rec.last_updated_by,
2684         LAST_UPDATE_DATE = l_def_fxl_rec.last_update_date,
2685         LAST_UPDATE_LOGIN = l_def_fxl_rec.last_update_login,
2686         INVENTORY_ORG_CODE = l_def_fxl_rec.inventory_org_code,
2687         ASSET_BOOK_TYPE_CODE = l_def_fxl_rec.asset_book_type_code,
2688         PERIOD_COUNTER = l_def_fxl_rec.period_counter,
2689 	ASSET_VENDOR_ID = l_def_fxl_rec.asset_vendor_id
2690     WHERE LINE_EXTENSION_ID = l_def_fxl_rec.line_extension_id;
2691 
2692     x_fxl_rec := l_fxl_rec;
2693     x_return_status := l_return_status;
2694     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
2695   EXCEPTION
2696     WHEN OKL_API.G_EXCEPTION_ERROR THEN
2697       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2698       (
2699         l_api_name,
2700         G_PKG_NAME,
2701         'OKL_API.G_RET_STS_ERROR',
2702         x_msg_count,
2703         x_msg_data,
2704         '_PVT'
2705       );
2706     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2707       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2708       (
2709         l_api_name,
2710         G_PKG_NAME,
2711         'OKL_API.G_RET_STS_UNEXP_ERROR',
2712         x_msg_count,
2713         x_msg_data,
2714         '_PVT'
2715       );
2716     WHEN OTHERS THEN
2717       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2718       (
2719         l_api_name,
2720         G_PKG_NAME,
2721         'OTHERS',
2722         x_msg_count,
2723         x_msg_data,
2724         '_PVT'
2725       );
2726   END update_row;
2727   -----------------------------------------------
2728   -- update_row for:OKL_EXT_FA_LINE_SOURCES_TL --
2729   -----------------------------------------------
2730   PROCEDURE update_row(
2731     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
2732     x_return_status                OUT NOCOPY VARCHAR2,
2733     x_msg_count                    OUT NOCOPY NUMBER,
2734     x_msg_data                     OUT NOCOPY VARCHAR2,
2735     p_fxll_rec                     IN fxll_rec_type,
2736     x_fxll_rec                     OUT NOCOPY fxll_rec_type) IS
2737 
2738     l_api_version                  CONSTANT NUMBER := 1;
2739     l_api_name                     CONSTANT VARCHAR2(30) := 'TL_update_row';
2740     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
2741     l_fxll_rec                     fxll_rec_type := p_fxll_rec;
2742     l_def_fxll_rec                 fxll_rec_type;
2743     l_row_notfound                 BOOLEAN := TRUE;
2744     ----------------------------------
2745     -- FUNCTION populate_new_record --
2746     ----------------------------------
2747     FUNCTION populate_new_record (
2748       p_fxll_rec IN fxll_rec_type,
2749       x_fxll_rec OUT NOCOPY fxll_rec_type
2750     ) RETURN VARCHAR2 IS
2751       l_fxll_rec                     fxll_rec_type;
2752       l_row_notfound                 BOOLEAN := TRUE;
2753       l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
2754     BEGIN
2755       x_fxll_rec := p_fxll_rec;
2756       -- Get current database values
2757       l_fxll_rec := get_rec(p_fxll_rec, l_return_status);
2758       IF (l_return_status = OKL_API.G_RET_STS_SUCCESS) THEN
2759         IF x_fxll_rec.line_extension_id IS NULL THEN
2760           x_fxll_rec.line_extension_id := l_fxll_rec.line_extension_id;
2761         END IF;
2762         IF x_fxll_rec.language IS NULL THEN
2763           x_fxll_rec.language := l_fxll_rec.language;
2764         END IF;
2765         IF x_fxll_rec.source_lang IS NULL THEN
2766           x_fxll_rec.source_lang := l_fxll_rec.source_lang;
2767         END IF;
2768         IF x_fxll_rec.sfwt_flag IS NULL THEN
2769           x_fxll_rec.sfwt_flag := l_fxll_rec.sfwt_flag;
2770         END IF;
2771         IF x_fxll_rec.inventory_org_name IS NULL THEN
2772           x_fxll_rec.inventory_org_name := l_fxll_rec.inventory_org_name;
2773         END IF;
2774         IF x_fxll_rec.trans_line_description IS NULL THEN
2775           x_fxll_rec.trans_line_description := l_fxll_rec.trans_line_description;
2776         END IF;
2777         IF x_fxll_rec.created_by IS NULL THEN
2778           x_fxll_rec.created_by := l_fxll_rec.created_by;
2779         END IF;
2780         IF x_fxll_rec.creation_date IS NULL THEN
2781           x_fxll_rec.creation_date := l_fxll_rec.creation_date;
2782         END IF;
2783         IF x_fxll_rec.last_updated_by IS NULL THEN
2784           x_fxll_rec.last_updated_by := l_fxll_rec.last_updated_by;
2785         END IF;
2786         IF x_fxll_rec.last_update_date IS NULL THEN
2787           x_fxll_rec.last_update_date := l_fxll_rec.last_update_date;
2788         END IF;
2789         IF x_fxll_rec.last_update_login IS NULL THEN
2790           x_fxll_rec.last_update_login := l_fxll_rec.last_update_login;
2791         END IF;
2792       END IF;
2793       RETURN(l_return_status);
2794     END populate_new_record;
2795     ---------------------------------------------------
2796     -- Set_Attributes for:OKL_EXT_FA_LINE_SOURCES_TL --
2797     ---------------------------------------------------
2798     FUNCTION Set_Attributes (
2799       p_fxll_rec IN fxll_rec_type,
2800       x_fxll_rec OUT NOCOPY fxll_rec_type
2801     ) RETURN VARCHAR2 IS
2802       l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
2803     BEGIN
2804       x_fxll_rec := p_fxll_rec;
2805       x_fxll_rec.LANGUAGE := USERENV('LANG');
2806       x_fxll_rec.LANGUAGE := USERENV('LANG');
2807       RETURN(l_return_status);
2808     END Set_Attributes;
2809   BEGIN
2810     l_return_status := OKL_API.START_ACTIVITY(l_api_name,
2811                                               p_init_msg_list,
2812                                               '_PVT',
2813                                               x_return_status);
2814     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2815       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2816     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
2817       RAISE OKL_API.G_EXCEPTION_ERROR;
2818     END IF;
2819     --- Setting item attributes
2820     l_return_status := Set_Attributes(
2821       p_fxll_rec,                        -- IN
2822       l_fxll_rec);                       -- OUT
2823     --- If any errors happen abort API
2824     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2825       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2826     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
2827       RAISE OKL_API.G_EXCEPTION_ERROR;
2828     END IF;
2829     l_return_status := populate_new_record(l_fxll_rec, l_def_fxll_rec);
2830     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
2831       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
2832     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
2833       RAISE OKL_API.G_EXCEPTION_ERROR;
2834     END IF;
2835     UPDATE OKL_EXT_FA_LINE_SOURCES_TL
2836     SET INVENTORY_ORG_NAME = l_def_fxll_rec.inventory_org_name,
2837         TRANS_LINE_DESCRIPTION = l_def_fxll_rec.trans_line_description,
2838         CREATED_BY = l_def_fxll_rec.created_by,
2839         CREATION_DATE = l_def_fxll_rec.creation_date,
2840         LAST_UPDATED_BY = l_def_fxll_rec.last_updated_by,
2841         LAST_UPDATE_DATE = l_def_fxll_rec.last_update_date,
2842         LAST_UPDATE_LOGIN = l_def_fxll_rec.last_update_login
2843     WHERE LINE_EXTENSION_ID = l_def_fxll_rec.line_extension_id
2844       AND SOURCE_LANG = USERENV('LANG');
2845 
2846     UPDATE OKL_EXT_FA_LINE_SOURCES_TL
2847     SET SFWT_FLAG = 'Y'
2848     WHERE LINE_EXTENSION_ID = l_def_fxll_rec.line_extension_id
2849       AND SOURCE_LANG <> USERENV('LANG');
2850 
2851     x_fxll_rec := l_fxll_rec;
2852     x_return_status := l_return_status;
2853     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
2854   EXCEPTION
2855     WHEN OKL_API.G_EXCEPTION_ERROR THEN
2856       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2857       (
2858         l_api_name,
2859         G_PKG_NAME,
2860         'OKL_API.G_RET_STS_ERROR',
2861         x_msg_count,
2862         x_msg_data,
2863         '_PVT'
2864       );
2865     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
2866       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2867       (
2868         l_api_name,
2869         G_PKG_NAME,
2870         'OKL_API.G_RET_STS_UNEXP_ERROR',
2871         x_msg_count,
2872         x_msg_data,
2873         '_PVT'
2874       );
2875     WHEN OTHERS THEN
2876       x_return_status := OKL_API.HANDLE_EXCEPTIONS
2877       (
2878         l_api_name,
2879         G_PKG_NAME,
2880         'OTHERS',
2881         x_msg_count,
2882         x_msg_data,
2883         '_PVT'
2884       );
2885   END update_row;
2886   ----------------------------------------------
2887   -- update_row for:OKL_EXT_FA_LINE_SOURCES_V --
2888   ----------------------------------------------
2889   PROCEDURE update_row(
2890     p_api_version                  IN NUMBER,
2891     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
2892     x_return_status                OUT NOCOPY VARCHAR2,
2893     x_msg_count                    OUT NOCOPY NUMBER,
2894     x_msg_data                     OUT NOCOPY VARCHAR2,
2895     p_fxlv_rec                     IN fxlv_rec_type,
2896     x_fxlv_rec                     OUT NOCOPY fxlv_rec_type) IS
2897 
2898     l_api_version                  CONSTANT NUMBER := 1;
2899     l_api_name                     CONSTANT VARCHAR2(30) := 'V_update_row';
2900     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
2901     l_fxlv_rec                     fxlv_rec_type := p_fxlv_rec;
2902     l_def_fxlv_rec                 fxlv_rec_type;
2903     l_db_fxlv_rec                  fxlv_rec_type;
2904     l_fxl_rec                      fxl_rec_type;
2905     lx_fxl_rec                     fxl_rec_type;
2906     l_fxll_rec                     fxll_rec_type;
2907     lx_fxll_rec                    fxll_rec_type;
2908     -------------------------------
2909     -- FUNCTION fill_who_columns --
2910     -------------------------------
2911     FUNCTION fill_who_columns (
2912       p_fxlv_rec IN fxlv_rec_type
2913     ) RETURN fxlv_rec_type IS
2914       l_fxlv_rec fxlv_rec_type := p_fxlv_rec;
2915     BEGIN
2916       l_fxlv_rec.LAST_UPDATE_DATE := SYSDATE;
2917       l_fxlv_rec.LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
2918       l_fxlv_rec.LAST_UPDATE_LOGIN := FND_GLOBAL.LOGIN_ID;
2919       RETURN(l_fxlv_rec);
2920     END fill_who_columns;
2921     ----------------------------------
2922     -- FUNCTION populate_new_record --
2923     ----------------------------------
2924     FUNCTION populate_new_record (
2925       p_fxlv_rec IN fxlv_rec_type,
2926       x_fxlv_rec OUT NOCOPY fxlv_rec_type
2927     ) RETURN VARCHAR2 IS
2928       l_row_notfound                 BOOLEAN := TRUE;
2929       l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
2930     BEGIN
2931       x_fxlv_rec := p_fxlv_rec;
2932       -- Get current database values
2933       -- NOTE: Never assign the OBJECT_VERSION_NUMBER.  Force the user to pass it
2934       --       so it may be verified through LOCK_ROW.
2935       l_db_fxlv_rec := get_rec(p_fxlv_rec, l_return_status);
2936       IF (l_return_status = OKL_API.G_RET_STS_SUCCESS) THEN
2937         IF x_fxlv_rec.line_extension_id IS NULL THEN
2938           x_fxlv_rec.line_extension_id := l_db_fxlv_rec.line_extension_id;
2939         END IF;
2940         IF x_fxlv_rec.header_extension_id IS NULL THEN
2941           x_fxlv_rec.header_extension_id := l_db_fxlv_rec.header_extension_id;
2942         END IF;
2943         IF x_fxlv_rec.source_id IS NULL THEN
2944           x_fxlv_rec.source_id := l_db_fxlv_rec.source_id;
2945         END IF;
2946         IF x_fxlv_rec.source_table IS NULL THEN
2947           x_fxlv_rec.source_table := l_db_fxlv_rec.source_table;
2948         END IF;
2949         IF x_fxlv_rec.fa_transaction_id IS NULL THEN
2950           x_fxlv_rec.fa_transaction_id := l_db_fxlv_rec.fa_transaction_id;
2951         END IF;
2952         IF x_fxlv_rec.asset_id IS NULL THEN
2953           x_fxlv_rec.asset_id := l_db_fxlv_rec.asset_id;
2954         END IF;
2955         IF x_fxlv_rec.kle_id IS NULL THEN
2956           x_fxlv_rec.kle_id := l_db_fxlv_rec.kle_id;
2957         END IF;
2958         IF x_fxlv_rec.asset_number IS NULL THEN
2959           x_fxlv_rec.asset_number := l_db_fxlv_rec.asset_number;
2960         END IF;
2961         IF x_fxlv_rec.contract_line_number IS NULL THEN
2962           x_fxlv_rec.contract_line_number := l_db_fxlv_rec.contract_line_number;
2963         END IF;
2964         IF x_fxlv_rec.asset_book_type_name IS NULL THEN
2965           x_fxlv_rec.asset_book_type_name := l_db_fxlv_rec.asset_book_type_name;
2966         END IF;
2967         IF x_fxlv_rec.asset_vendor_name IS NULL THEN
2968           x_fxlv_rec.asset_vendor_name := l_db_fxlv_rec.asset_vendor_name;
2969         END IF;
2970         IF x_fxlv_rec.installed_site_id IS NULL THEN
2971           x_fxlv_rec.installed_site_id := l_db_fxlv_rec.installed_site_id;
2972         END IF;
2973         IF x_fxlv_rec.line_attribute_category IS NULL THEN
2974           x_fxlv_rec.line_attribute_category := l_db_fxlv_rec.line_attribute_category;
2975         END IF;
2976         IF x_fxlv_rec.line_attribute1 IS NULL THEN
2977           x_fxlv_rec.line_attribute1 := l_db_fxlv_rec.line_attribute1;
2978         END IF;
2979         IF x_fxlv_rec.line_attribute2 IS NULL THEN
2980           x_fxlv_rec.line_attribute2 := l_db_fxlv_rec.line_attribute2;
2981         END IF;
2982         IF x_fxlv_rec.line_attribute3 IS NULL THEN
2983           x_fxlv_rec.line_attribute3 := l_db_fxlv_rec.line_attribute3;
2984         END IF;
2985         IF x_fxlv_rec.line_attribute4 IS NULL THEN
2986           x_fxlv_rec.line_attribute4 := l_db_fxlv_rec.line_attribute4;
2987         END IF;
2988         IF x_fxlv_rec.line_attribute5 IS NULL THEN
2989           x_fxlv_rec.line_attribute5 := l_db_fxlv_rec.line_attribute5;
2990         END IF;
2991         IF x_fxlv_rec.line_attribute6 IS NULL THEN
2992           x_fxlv_rec.line_attribute6 := l_db_fxlv_rec.line_attribute6;
2993         END IF;
2994         IF x_fxlv_rec.line_attribute7 IS NULL THEN
2995           x_fxlv_rec.line_attribute7 := l_db_fxlv_rec.line_attribute7;
2996         END IF;
2997         IF x_fxlv_rec.line_attribute8 IS NULL THEN
2998           x_fxlv_rec.line_attribute8 := l_db_fxlv_rec.line_attribute8;
2999         END IF;
3000         IF x_fxlv_rec.line_attribute9 IS NULL THEN
3001           x_fxlv_rec.line_attribute9 := l_db_fxlv_rec.line_attribute9;
3002         END IF;
3003         IF x_fxlv_rec.line_attribute10 IS NULL THEN
3004           x_fxlv_rec.line_attribute10 := l_db_fxlv_rec.line_attribute10;
3005         END IF;
3006         IF x_fxlv_rec.line_attribute11 IS NULL THEN
3007           x_fxlv_rec.line_attribute11 := l_db_fxlv_rec.line_attribute11;
3008         END IF;
3009         IF x_fxlv_rec.line_attribute12 IS NULL THEN
3010           x_fxlv_rec.line_attribute12 := l_db_fxlv_rec.line_attribute12;
3011         END IF;
3012         IF x_fxlv_rec.line_attribute13 IS NULL THEN
3013           x_fxlv_rec.line_attribute13 := l_db_fxlv_rec.line_attribute13;
3014         END IF;
3015         IF x_fxlv_rec.line_attribute14 IS NULL THEN
3016           x_fxlv_rec.line_attribute14 := l_db_fxlv_rec.line_attribute14;
3017         END IF;
3018         IF x_fxlv_rec.line_attribute15 IS NULL THEN
3019           x_fxlv_rec.line_attribute15 := l_db_fxlv_rec.line_attribute15;
3020         END IF;
3021         IF x_fxlv_rec.language IS NULL THEN
3022           x_fxlv_rec.language := l_db_fxlv_rec.language;
3023         END IF;
3024         IF x_fxlv_rec.inventory_org_name IS NULL THEN
3025           x_fxlv_rec.inventory_org_name := l_db_fxlv_rec.inventory_org_name;
3026         END IF;
3027         IF x_fxlv_rec.trans_line_description IS NULL THEN
3028           x_fxlv_rec.trans_line_description := l_db_fxlv_rec.trans_line_description;
3029         END IF;
3030         IF x_fxlv_rec.created_by IS NULL THEN
3031           x_fxlv_rec.created_by := l_db_fxlv_rec.created_by;
3032         END IF;
3033         IF x_fxlv_rec.creation_date IS NULL THEN
3034           x_fxlv_rec.creation_date := l_db_fxlv_rec.creation_date;
3035         END IF;
3036         IF x_fxlv_rec.last_updated_by IS NULL THEN
3037           x_fxlv_rec.last_updated_by := l_db_fxlv_rec.last_updated_by;
3038         END IF;
3039         IF x_fxlv_rec.last_update_date IS NULL THEN
3040           x_fxlv_rec.last_update_date := l_db_fxlv_rec.last_update_date;
3041         END IF;
3042         IF x_fxlv_rec.last_update_login IS NULL THEN
3043           x_fxlv_rec.last_update_login := l_db_fxlv_rec.last_update_login;
3044         END IF;
3045         IF x_fxlv_rec.inventory_org_code IS NULL THEN
3046           x_fxlv_rec.inventory_org_code := l_db_fxlv_rec.inventory_org_code;
3047         END IF;
3048         IF x_fxlv_rec.asset_book_type_code IS NULL THEN
3049           x_fxlv_rec.asset_book_type_code := l_db_fxlv_rec.asset_book_type_code;
3050         END IF;
3051         IF x_fxlv_rec.period_counter IS NULL THEN
3052           x_fxlv_rec.period_counter := l_db_fxlv_rec.period_counter;
3053         END IF;
3054 	 IF x_fxlv_rec.asset_vendor_id IS NULL THEN
3055           x_fxlv_rec.asset_vendor_id := l_db_fxlv_rec.asset_vendor_id;
3056         END IF;
3057       END IF;
3058       RETURN(l_return_status);
3059     END populate_new_record;
3060     --------------------------------------------------
3061     -- Set_Attributes for:OKL_EXT_FA_LINE_SOURCES_V --
3062     --------------------------------------------------
3063     FUNCTION Set_Attributes (
3064       p_fxlv_rec IN fxlv_rec_type,
3065       x_fxlv_rec OUT NOCOPY fxlv_rec_type
3066     ) RETURN VARCHAR2 IS
3067       l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
3068     BEGIN
3069       x_fxlv_rec := p_fxlv_rec;
3070       RETURN(l_return_status);
3071     END Set_Attributes;
3072   BEGIN
3073     l_return_status := OKL_API.START_ACTIVITY(l_api_name,
3074                                               G_PKG_NAME,
3075                                               p_init_msg_list,
3076                                               l_api_version,
3077                                               p_api_version,
3078                                               '_PVT',
3079                                               x_return_status);
3080     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
3081       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
3082     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
3083       RAISE OKL_API.G_EXCEPTION_ERROR;
3084     END IF;
3085     --- Setting item attributes
3086     l_return_status := Set_Attributes(
3087       p_fxlv_rec,                        -- IN
3088       x_fxlv_rec);                       -- OUT
3089     --- If any errors happen abort API
3090     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
3091       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
3092     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
3093       RAISE OKL_API.G_EXCEPTION_ERROR;
3094     END IF;
3095     l_return_status := populate_new_record(l_fxlv_rec, l_def_fxlv_rec);
3096     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
3097       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
3098     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
3099       RAISE OKL_API.G_EXCEPTION_ERROR;
3100     END IF;
3101     l_def_fxlv_rec := null_out_defaults(l_def_fxlv_rec);
3102     l_def_fxlv_rec := fill_who_columns(l_def_fxlv_rec);
3103     --- Validate all non-missing attributes (Item Level Validation)
3104     l_return_status := Validate_Attributes(l_def_fxlv_rec);
3105     --- If any errors happen abort API
3106     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
3107       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
3108     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
3109       RAISE OKL_API.G_EXCEPTION_ERROR;
3110     END IF;
3111     l_return_status := Validate_Record(l_def_fxlv_rec, l_db_fxlv_rec);
3112     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
3113       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
3114     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
3115       RAISE OKL_API.G_EXCEPTION_ERROR;
3116     END IF;
3117 
3118     -- Lock the Record
3119     lock_row(
3120       p_api_version                  => p_api_version,
3121       p_init_msg_list                => p_init_msg_list,
3122       x_return_status                => l_return_status,
3123       x_msg_count                    => x_msg_count,
3124       x_msg_data                     => x_msg_data,
3125       p_fxlv_rec                     => p_fxlv_rec);
3126     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
3127       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
3128     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
3129       RAISE OKL_API.G_EXCEPTION_ERROR;
3130     END IF;
3131 
3132     -----------------------------------------
3133     -- Move VIEW record to "Child" records --
3134     -----------------------------------------
3135     migrate(l_def_fxlv_rec, l_fxl_rec);
3136     migrate(l_def_fxlv_rec, l_fxll_rec);
3137     -----------------------------------------------
3138     -- Call the UPDATE_ROW for each child record --
3139     -----------------------------------------------
3140     update_row(
3141       p_init_msg_list,
3142       l_return_status,
3143       x_msg_count,
3144       x_msg_data,
3145       l_fxl_rec,
3146       lx_fxl_rec
3147     );
3148     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
3149       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
3150     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
3151       RAISE OKL_API.G_EXCEPTION_ERROR;
3152     END IF;
3153     migrate(lx_fxl_rec, l_def_fxlv_rec);
3154     update_row(
3155       p_init_msg_list,
3156       l_return_status,
3157       x_msg_count,
3158       x_msg_data,
3159       l_fxll_rec,
3160       lx_fxll_rec
3161     );
3162     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
3163       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
3164     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
3165       RAISE OKL_API.G_EXCEPTION_ERROR;
3166     END IF;
3167     migrate(lx_fxll_rec, l_def_fxlv_rec);
3168     x_fxlv_rec := l_def_fxlv_rec;
3169     x_return_status := l_return_status;
3170     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
3171   EXCEPTION
3172     WHEN OKL_API.G_EXCEPTION_ERROR THEN
3173       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3174       (
3175         l_api_name,
3176         G_PKG_NAME,
3177         'OKL_API.G_RET_STS_ERROR',
3178         x_msg_count,
3179         x_msg_data,
3180         '_PVT'
3181       );
3182     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3183       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3184       (
3185         l_api_name,
3186         G_PKG_NAME,
3187         'OKL_API.G_RET_STS_UNEXP_ERROR',
3188         x_msg_count,
3189         x_msg_data,
3190         '_PVT'
3191       );
3192     WHEN OTHERS THEN
3193       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3194       (
3195         l_api_name,
3196         G_PKG_NAME,
3197         'OTHERS',
3198         x_msg_count,
3199         x_msg_data,
3200         '_PVT'
3201       );
3202   END update_row;
3203   ----------------------------------------
3204   -- PL/SQL TBL update_row for:fxlv_tbl --
3205   ----------------------------------------
3206   PROCEDURE update_row(
3207     p_api_version                  IN NUMBER,
3208     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
3209     x_return_status                OUT NOCOPY VARCHAR2,
3210     x_msg_count                    OUT NOCOPY NUMBER,
3211     x_msg_data                     OUT NOCOPY VARCHAR2,
3212     p_fxlv_tbl                     IN fxlv_tbl_type,
3213     x_fxlv_tbl                     OUT NOCOPY fxlv_tbl_type,
3214     px_error_tbl                   IN OUT NOCOPY OKL_API.ERROR_TBL_TYPE) IS
3215 
3216     l_api_version                  CONSTANT NUMBER := 1;
3217     l_api_name                     CONSTANT VARCHAR2(30) := 'V_error_tbl_update_row';
3218     i                              NUMBER := 0;
3219   BEGIN
3220     OKL_API.init_msg_list(p_init_msg_list);
3221     -- Make sure PL/SQL table has records in it before passing
3222     IF (p_fxlv_tbl.COUNT > 0) THEN
3223       i := p_fxlv_tbl.FIRST;
3224       LOOP
3225         DECLARE
3226           l_error_rec         OKL_API.ERROR_REC_TYPE;
3227         BEGIN
3228           l_error_rec.api_name := l_api_name;
3229           l_error_rec.api_package := G_PKG_NAME;
3230           l_error_rec.idx := i;
3231           update_row (
3232             p_api_version                  => p_api_version,
3233             p_init_msg_list                => OKL_API.G_FALSE,
3234             x_return_status                => l_error_rec.error_type,
3235             x_msg_count                    => l_error_rec.msg_count,
3236             x_msg_data                     => l_error_rec.msg_data,
3237             p_fxlv_rec                     => p_fxlv_tbl(i),
3238             x_fxlv_rec                     => x_fxlv_tbl(i));
3239           IF (l_error_rec.error_type <> OKL_API.G_RET_STS_SUCCESS) THEN
3240             l_error_rec.sqlcode := SQLCODE;
3241             load_error_tbl(l_error_rec, px_error_tbl);
3242           ELSE
3243             x_msg_count := l_error_rec.msg_count;
3244             x_msg_data := l_error_rec.msg_data;
3245           END IF;
3246         EXCEPTION
3247           WHEN OKL_API.G_EXCEPTION_ERROR THEN
3248             l_error_rec.error_type := OKL_API.G_RET_STS_ERROR;
3249             l_error_rec.sqlcode := SQLCODE;
3250             load_error_tbl(l_error_rec, px_error_tbl);
3251           WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3252             l_error_rec.error_type := OKL_API.G_RET_STS_UNEXP_ERROR;
3253             l_error_rec.sqlcode := SQLCODE;
3254             load_error_tbl(l_error_rec, px_error_tbl);
3255           WHEN OTHERS THEN
3256             l_error_rec.error_type := 'OTHERS';
3257             l_error_rec.sqlcode := SQLCODE;
3258             load_error_tbl(l_error_rec, px_error_tbl);
3259         END;
3260         EXIT WHEN (i = p_fxlv_tbl.LAST);
3261         i := p_fxlv_tbl.NEXT(i);
3262       END LOOP;
3263     END IF;
3264     -- Loop through the error_tbl to find the error with the highest severity
3265     -- and return it.
3266     x_return_status := find_highest_exception(px_error_tbl);
3267     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
3268   EXCEPTION
3269     WHEN OKL_API.G_EXCEPTION_ERROR THEN
3270       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3271       (
3272         l_api_name,
3273         G_PKG_NAME,
3274         'OKL_API.G_RET_STS_ERROR',
3275         x_msg_count,
3276         x_msg_data,
3277         '_PVT'
3278       );
3279     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3280       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3281       (
3282         l_api_name,
3283         G_PKG_NAME,
3284         'OKL_API.G_RET_STS_UNEXP_ERROR',
3285         x_msg_count,
3286         x_msg_data,
3287         '_PVT'
3288       );
3289     WHEN OTHERS THEN
3290       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3291       (
3292         l_api_name,
3293         G_PKG_NAME,
3294         'OTHERS',
3295         x_msg_count,
3296         x_msg_data,
3297         '_PVT'
3298       );
3299   END update_row;
3300 
3301   ----------------------------------------
3302   -- PL/SQL TBL update_row for:FXLV_TBL --
3303   ----------------------------------------
3304   PROCEDURE update_row(
3305     p_api_version                  IN NUMBER,
3306     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
3307     x_return_status                OUT NOCOPY VARCHAR2,
3308     x_msg_count                    OUT NOCOPY NUMBER,
3309     x_msg_data                     OUT NOCOPY VARCHAR2,
3310     p_fxlv_tbl                     IN fxlv_tbl_type,
3311     x_fxlv_tbl                     OUT NOCOPY fxlv_tbl_type) IS
3312 
3313     l_api_version                  CONSTANT NUMBER := 1;
3314     l_api_name                     CONSTANT VARCHAR2(30) := 'V_tbl_update_row';
3315     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
3316     l_error_tbl                    OKL_API.ERROR_TBL_TYPE;
3317   BEGIN
3318     OKL_API.init_msg_list(p_init_msg_list);
3319     -- Make sure PL/SQL table has records in it before passing
3320     IF (p_fxlv_tbl.COUNT > 0) THEN
3321       update_row (
3322         p_api_version                  => p_api_version,
3323         p_init_msg_list                => OKL_API.G_FALSE,
3324         x_return_status                => x_return_status,
3325         x_msg_count                    => x_msg_count,
3326         x_msg_data                     => x_msg_data,
3327         p_fxlv_tbl                     => p_fxlv_tbl,
3328         x_fxlv_tbl                     => x_fxlv_tbl,
3329         px_error_tbl                   => l_error_tbl);
3330     END IF;
3331     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
3332   EXCEPTION
3333     WHEN OKL_API.G_EXCEPTION_ERROR THEN
3334       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3335       (
3336         l_api_name,
3337         G_PKG_NAME,
3338         'OKL_API.G_RET_STS_ERROR',
3339         x_msg_count,
3340         x_msg_data,
3341         '_PVT'
3342       );
3343     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3344       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3345       (
3346         l_api_name,
3347         G_PKG_NAME,
3348         'OKL_API.G_RET_STS_UNEXP_ERROR',
3349         x_msg_count,
3350         x_msg_data,
3351         '_PVT'
3352       );
3353     WHEN OTHERS THEN
3354       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3355       (
3356         l_api_name,
3357         G_PKG_NAME,
3358         'OTHERS',
3359         x_msg_count,
3360         x_msg_data,
3361         '_PVT'
3362       );
3363   END update_row;
3364 
3365   ---------------------------------------------------------------------------
3366   -- PROCEDURE delete_row
3367   ---------------------------------------------------------------------------
3368   ----------------------------------------------
3369   -- delete_row for:OKL_EXT_FA_LINE_SOURCES_B --
3370   ----------------------------------------------
3371   PROCEDURE delete_row(
3372     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
3373     x_return_status                OUT NOCOPY VARCHAR2,
3374     x_msg_count                    OUT NOCOPY NUMBER,
3375     x_msg_data                     OUT NOCOPY VARCHAR2,
3376     p_fxl_rec                      IN fxl_rec_type) IS
3377 
3378     l_api_version                  CONSTANT NUMBER := 1;
3379     l_api_name                     CONSTANT VARCHAR2(30) := 'B_delete_row';
3380     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
3381     l_fxl_rec                      fxl_rec_type := p_fxl_rec;
3382     l_row_notfound                 BOOLEAN := TRUE;
3383   BEGIN
3384     l_return_status := OKL_API.START_ACTIVITY(l_api_name,
3385                                               p_init_msg_list,
3386                                               '_PVT',
3387                                               x_return_status);
3388     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
3389       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
3390     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
3391       RAISE OKL_API.G_EXCEPTION_ERROR;
3392     END IF;
3393 
3394     DELETE FROM OKL_EXT_FA_LINE_SOURCES_B
3395      WHERE LINE_EXTENSION_ID = p_fxl_rec.line_extension_id;
3396 
3397     x_return_status := l_return_status;
3398     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
3399   EXCEPTION
3400     WHEN OKL_API.G_EXCEPTION_ERROR THEN
3401       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3402       (
3403         l_api_name,
3404         G_PKG_NAME,
3405         'OKL_API.G_RET_STS_ERROR',
3406         x_msg_count,
3407         x_msg_data,
3408         '_PVT'
3409       );
3410     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_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_UNEXP_ERROR',
3416         x_msg_count,
3417         x_msg_data,
3418         '_PVT'
3419       );
3420     WHEN OTHERS THEN
3421       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3422       (
3423         l_api_name,
3424         G_PKG_NAME,
3425         'OTHERS',
3426         x_msg_count,
3427         x_msg_data,
3428         '_PVT'
3429       );
3430   END delete_row;
3431   -----------------------------------------------
3432   -- delete_row for:OKL_EXT_FA_LINE_SOURCES_TL --
3433   -----------------------------------------------
3434   PROCEDURE delete_row(
3435     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
3436     x_return_status                OUT NOCOPY VARCHAR2,
3437     x_msg_count                    OUT NOCOPY NUMBER,
3438     x_msg_data                     OUT NOCOPY VARCHAR2,
3439     p_fxll_rec                     IN fxll_rec_type) IS
3440 
3441     l_api_version                  CONSTANT NUMBER := 1;
3442     l_api_name                     CONSTANT VARCHAR2(30) := 'TL_delete_row';
3443     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
3444     l_fxll_rec                     fxll_rec_type := p_fxll_rec;
3445     l_row_notfound                 BOOLEAN := TRUE;
3446   BEGIN
3447     l_return_status := OKL_API.START_ACTIVITY(l_api_name,
3448                                               p_init_msg_list,
3449                                               '_PVT',
3450                                               x_return_status);
3451     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
3452       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
3453     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
3454       RAISE OKL_API.G_EXCEPTION_ERROR;
3455     END IF;
3456 
3457     DELETE FROM OKL_EXT_FA_LINE_SOURCES_TL
3458      WHERE LINE_EXTENSION_ID = p_fxll_rec.line_extension_id;
3459 
3460     x_return_status := l_return_status;
3461     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
3462   EXCEPTION
3463     WHEN OKL_API.G_EXCEPTION_ERROR THEN
3464       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3465       (
3466         l_api_name,
3467         G_PKG_NAME,
3468         'OKL_API.G_RET_STS_ERROR',
3469         x_msg_count,
3470         x_msg_data,
3471         '_PVT'
3472       );
3473     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3474       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3475       (
3476         l_api_name,
3477         G_PKG_NAME,
3478         'OKL_API.G_RET_STS_UNEXP_ERROR',
3479         x_msg_count,
3480         x_msg_data,
3481         '_PVT'
3482       );
3483     WHEN OTHERS THEN
3484       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3485       (
3486         l_api_name,
3487         G_PKG_NAME,
3488         'OTHERS',
3489         x_msg_count,
3490         x_msg_data,
3491         '_PVT'
3492       );
3493   END delete_row;
3494   ----------------------------------------------
3495   -- delete_row for:OKL_EXT_FA_LINE_SOURCES_V --
3496   ----------------------------------------------
3497   PROCEDURE delete_row(
3498     p_api_version                  IN NUMBER,
3499     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
3500     x_return_status                OUT NOCOPY VARCHAR2,
3501     x_msg_count                    OUT NOCOPY NUMBER,
3502     x_msg_data                     OUT NOCOPY VARCHAR2,
3503     p_fxlv_rec                     IN fxlv_rec_type) IS
3504 
3505     l_api_version                  CONSTANT NUMBER := 1;
3506     l_api_name                     CONSTANT VARCHAR2(30) := 'V_delete_row';
3507     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
3508     l_fxlv_rec                     fxlv_rec_type := p_fxlv_rec;
3509     l_fxll_rec                     fxll_rec_type;
3510     l_fxl_rec                      fxl_rec_type;
3511   BEGIN
3512     l_return_status := OKL_API.START_ACTIVITY(l_api_name,
3513                                               G_PKG_NAME,
3514                                               p_init_msg_list,
3515                                               l_api_version,
3516                                               p_api_version,
3517                                               '_PVT',
3518                                               x_return_status);
3519     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
3520       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
3521     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
3522       RAISE OKL_API.G_EXCEPTION_ERROR;
3523     END IF;
3524     -----------------------------------------
3525     -- Move VIEW record to "Child" records --
3526     -----------------------------------------
3527     migrate(l_fxlv_rec, l_fxll_rec);
3528     migrate(l_fxlv_rec, l_fxl_rec);
3529     -----------------------------------------------
3530     -- Call the DELETE_ROW for each child record --
3531     -----------------------------------------------
3532     delete_row(
3533       p_init_msg_list,
3534       l_return_status,
3535       x_msg_count,
3536       x_msg_data,
3537       l_fxll_rec
3538     );
3539     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
3540       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
3541     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
3542       RAISE OKL_API.G_EXCEPTION_ERROR;
3543     END IF;
3544     delete_row(
3545       p_init_msg_list,
3546       l_return_status,
3547       x_msg_count,
3548       x_msg_data,
3549       l_fxl_rec
3550     );
3551     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
3552       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
3553     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
3554       RAISE OKL_API.G_EXCEPTION_ERROR;
3555     END IF;
3556     x_return_status := l_return_status;
3557     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
3558   EXCEPTION
3559     WHEN OKL_API.G_EXCEPTION_ERROR THEN
3560       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3561       (
3562         l_api_name,
3563         G_PKG_NAME,
3564         'OKL_API.G_RET_STS_ERROR',
3565         x_msg_count,
3566         x_msg_data,
3567         '_PVT'
3568       );
3569     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3570       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3571       (
3572         l_api_name,
3573         G_PKG_NAME,
3574         'OKL_API.G_RET_STS_UNEXP_ERROR',
3575         x_msg_count,
3576         x_msg_data,
3577         '_PVT'
3578       );
3579     WHEN OTHERS THEN
3580       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3581       (
3582         l_api_name,
3583         G_PKG_NAME,
3584         'OTHERS',
3585         x_msg_count,
3586         x_msg_data,
3587         '_PVT'
3588       );
3589   END delete_row;
3590   ---------------------------------------------------------
3591   -- PL/SQL TBL delete_row for:OKL_EXT_FA_LINE_SOURCES_V --
3592   ---------------------------------------------------------
3593   PROCEDURE delete_row(
3594     p_api_version                  IN NUMBER,
3595     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
3596     x_return_status                OUT NOCOPY VARCHAR2,
3597     x_msg_count                    OUT NOCOPY NUMBER,
3598     x_msg_data                     OUT NOCOPY VARCHAR2,
3599     p_fxlv_tbl                     IN fxlv_tbl_type,
3600     px_error_tbl                   IN OUT NOCOPY OKL_API.ERROR_TBL_TYPE) IS
3601 
3602     l_api_version                  CONSTANT NUMBER := 1;
3603     l_api_name                     CONSTANT VARCHAR2(30) := 'V_error_tbl_delete_row';
3604     i                              NUMBER := 0;
3605   BEGIN
3606     OKL_API.init_msg_list(p_init_msg_list);
3607     -- Make sure PL/SQL table has records in it before passing
3608     IF (p_fxlv_tbl.COUNT > 0) THEN
3609       i := p_fxlv_tbl.FIRST;
3610       LOOP
3611         DECLARE
3612           l_error_rec         OKL_API.ERROR_REC_TYPE;
3613         BEGIN
3614           l_error_rec.api_name := l_api_name;
3615           l_error_rec.api_package := G_PKG_NAME;
3616           l_error_rec.idx := i;
3617           delete_row (
3618             p_api_version                  => p_api_version,
3619             p_init_msg_list                => OKL_API.G_FALSE,
3620             x_return_status                => l_error_rec.error_type,
3621             x_msg_count                    => l_error_rec.msg_count,
3622             x_msg_data                     => l_error_rec.msg_data,
3623             p_fxlv_rec                     => p_fxlv_tbl(i));
3624           IF (l_error_rec.error_type <> OKL_API.G_RET_STS_SUCCESS) THEN
3625             l_error_rec.sqlcode := SQLCODE;
3626             load_error_tbl(l_error_rec, px_error_tbl);
3627           ELSE
3628             x_msg_count := l_error_rec.msg_count;
3629             x_msg_data := l_error_rec.msg_data;
3630           END IF;
3631         EXCEPTION
3632           WHEN OKL_API.G_EXCEPTION_ERROR THEN
3633             l_error_rec.error_type := OKL_API.G_RET_STS_ERROR;
3634             l_error_rec.sqlcode := SQLCODE;
3635             load_error_tbl(l_error_rec, px_error_tbl);
3636           WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3637             l_error_rec.error_type := OKL_API.G_RET_STS_UNEXP_ERROR;
3638             l_error_rec.sqlcode := SQLCODE;
3639             load_error_tbl(l_error_rec, px_error_tbl);
3640           WHEN OTHERS THEN
3641             l_error_rec.error_type := 'OTHERS';
3642             l_error_rec.sqlcode := SQLCODE;
3643             load_error_tbl(l_error_rec, px_error_tbl);
3644         END;
3645         EXIT WHEN (i = p_fxlv_tbl.LAST);
3646         i := p_fxlv_tbl.NEXT(i);
3647       END LOOP;
3648     END IF;
3649     -- Loop through the error_tbl to find the error with the highest severity
3650     -- and return it.
3651     x_return_status := find_highest_exception(px_error_tbl);
3652     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
3653   EXCEPTION
3654     WHEN OKL_API.G_EXCEPTION_ERROR THEN
3655       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3656       (
3657         l_api_name,
3658         G_PKG_NAME,
3659         'OKL_API.G_RET_STS_ERROR',
3660         x_msg_count,
3661         x_msg_data,
3662         '_PVT'
3663       );
3664     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3665       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3666       (
3667         l_api_name,
3668         G_PKG_NAME,
3669         'OKL_API.G_RET_STS_UNEXP_ERROR',
3670         x_msg_count,
3671         x_msg_data,
3672         '_PVT'
3673       );
3674     WHEN OTHERS THEN
3675       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3676       (
3677         l_api_name,
3678         G_PKG_NAME,
3679         'OTHERS',
3680         x_msg_count,
3681         x_msg_data,
3682         '_PVT'
3683       );
3684   END delete_row;
3685 
3686   ---------------------------------------------------------
3687   -- PL/SQL TBL delete_row for:OKL_EXT_FA_LINE_SOURCES_V --
3688   ---------------------------------------------------------
3689   PROCEDURE delete_row(
3690     p_api_version                  IN NUMBER,
3691     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
3692     x_return_status                OUT NOCOPY VARCHAR2,
3693     x_msg_count                    OUT NOCOPY NUMBER,
3694     x_msg_data                     OUT NOCOPY VARCHAR2,
3695     p_fxlv_tbl                     IN fxlv_tbl_type) IS
3696 
3697     l_api_version                  CONSTANT NUMBER := 1;
3698     l_api_name                     CONSTANT VARCHAR2(30) := 'V_tbl_delete_row';
3699     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
3700     l_error_tbl                    OKL_API.ERROR_TBL_TYPE;
3701   BEGIN
3702     OKL_API.init_msg_list(p_init_msg_list);
3703     -- Make sure PL/SQL table has records in it before passing
3704     IF (p_fxlv_tbl.COUNT > 0) THEN
3705       delete_row (
3706         p_api_version                  => p_api_version,
3707         p_init_msg_list                => OKL_API.G_FALSE,
3708         x_return_status                => x_return_status,
3709         x_msg_count                    => x_msg_count,
3710         x_msg_data                     => x_msg_data,
3711         p_fxlv_tbl                     => p_fxlv_tbl,
3712         px_error_tbl                   => l_error_tbl);
3713     END IF;
3714     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
3715   EXCEPTION
3716     WHEN OKL_API.G_EXCEPTION_ERROR THEN
3717       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3718       (
3719         l_api_name,
3720         G_PKG_NAME,
3721         'OKL_API.G_RET_STS_ERROR',
3722         x_msg_count,
3723         x_msg_data,
3724         '_PVT'
3725       );
3726     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3727       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3728       (
3729         l_api_name,
3730         G_PKG_NAME,
3731         'OKL_API.G_RET_STS_UNEXP_ERROR',
3732         x_msg_count,
3733         x_msg_data,
3734         '_PVT'
3735       );
3736     WHEN OTHERS THEN
3737       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3738       (
3739         l_api_name,
3740         G_PKG_NAME,
3741         'OTHERS',
3742         x_msg_count,
3743         x_msg_data,
3744         '_PVT'
3745       );
3746   END delete_row;
3747 
3748   -- Added : Bug# 6268782 : PRASJAIN
3749   PROCEDURE insert_row(
3750     p_api_version                  IN NUMBER,
3751     p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE,
3752     x_return_status                OUT NOCOPY VARCHAR2,
3753     x_msg_count                    OUT NOCOPY NUMBER,
3754     x_msg_data                     OUT NOCOPY VARCHAR2,
3755     p_fxl_rec                      IN fxl_rec_type,
3756     p_fxll_tbl                     IN fxll_tbl_type,
3757     x_fxl_rec                      OUT NOCOPY fxl_rec_type,
3758     x_fxll_tbl                     OUT NOCOPY fxll_tbl_type) IS
3759 
3760     l_api_version                  CONSTANT NUMBER := 1;
3761     l_api_name                     CONSTANT VARCHAR2(30) := 'insert_row';
3762     l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
3763 
3764     l_fxl_rec                      fxl_rec_type := p_fxl_rec;
3765     l_def_fxl_rec                  fxl_rec_type;
3766     lx_fxl_rec                     fxl_rec_type;
3767 
3768     l_fxll_tbl                     okl_fxl_pvt.fxll_tbl_type := p_fxll_tbl;
3769     lx_fxll_tbl                    okl_fxl_pvt.fxll_tbl_type;
3770 
3771     -------------------------------
3772     -- FUNCTION fill_who_columns --
3773     -------------------------------
3774     FUNCTION fill_who_columns (
3775       p_fxl_rec IN fxl_rec_type
3776     ) RETURN fxl_rec_type IS
3777       l_fxl_rec fxl_rec_type := p_fxl_rec;
3778     BEGIN
3779       l_fxl_rec.CREATION_DATE := SYSDATE;
3780       l_fxl_rec.CREATED_BY := FND_GLOBAL.USER_ID;
3781       l_fxl_rec.LAST_UPDATE_DATE := l_fxl_rec.CREATION_DATE;
3782       l_fxl_rec.LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
3783       l_fxl_rec.LAST_UPDATE_LOGIN := FND_GLOBAL.LOGIN_ID;
3784       RETURN(l_fxl_rec);
3785     END fill_who_columns;
3786     --------------------------------------------
3787     -- Set_Attributes for:OKL_TXL_EXTENSION_B --
3788     --------------------------------------------
3789     FUNCTION Set_Attributes (
3790       p_fxl_rec IN fxl_rec_type,
3791       x_fxl_rec OUT NOCOPY fxl_rec_type
3792     ) RETURN VARCHAR2 IS
3793       l_return_status                VARCHAR2(1) := OKL_API.G_RET_STS_SUCCESS;
3794     BEGIN
3795       x_fxl_rec := p_fxl_rec;
3796       x_fxl_rec.OBJECT_VERSION_NUMBER := 1;
3797       RETURN(l_return_status);
3798     END Set_Attributes;
3799   BEGIN
3800     l_return_status := OKL_API.START_ACTIVITY(l_api_name,
3801                                               G_PKG_NAME,
3802                                               p_init_msg_list,
3803                                               l_api_version,
3804                                               p_api_version,
3805                                               '_PVT',
3806                                               x_return_status);
3807     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
3808       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
3809     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
3810       RAISE OKL_API.G_EXCEPTION_ERROR;
3811     END IF;
3812     -- Set primary key value
3813     l_fxl_rec.LINE_EXTENSION_ID := get_seq_id;
3814     -- Setting item attributes
3815     l_return_Status := Set_Attributes(
3816       l_fxl_rec,                        -- IN
3817       l_def_fxl_rec);                   -- OUT
3818     --- If any errors happen abort API
3819     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
3820       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
3821     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
3822       RAISE OKL_API.G_EXCEPTION_ERROR;
3823     END IF;
3824     l_def_fxl_rec  := fill_who_columns(l_def_fxl_rec);
3825     l_fxl_rec  := l_def_fxl_rec;
3826     -----------------------------------------------
3827     -- Call the INSERT_ROW for each child record --
3828     -----------------------------------------------
3829     insert_row(
3830       p_init_msg_list,
3831       l_return_status,
3832       x_msg_count,
3833       x_msg_data,
3834       l_fxl_rec,
3835       lx_fxl_rec
3836     );
3837     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
3838       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
3839     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
3840       RAISE OKL_API.G_EXCEPTION_ERROR;
3841     END IF;
3842     FOR idx IN p_fxll_tbl.FIRST .. p_fxll_tbl.LAST
3843     LOOP
3844       l_fxll_tbl(idx).line_extension_id := lx_fxl_rec.line_extension_id;
3845       l_fxll_tbl(idx).CREATION_DATE := SYSDATE;
3846       l_fxll_tbl(idx).CREATED_BY := FND_GLOBAL.USER_ID;
3847       l_fxll_tbl(idx).LAST_UPDATE_DATE := l_fxll_tbl(idx).CREATION_DATE;
3848       l_fxll_tbl(idx).LAST_UPDATED_BY := FND_GLOBAL.USER_ID;
3849       l_fxll_tbl(idx).LAST_UPDATE_LOGIN := FND_GLOBAL.LOGIN_ID;
3850      insert_row(
3851        p_init_msg_list,
3852        l_return_status,
3853        x_msg_count,
3854        x_msg_data,
3855        l_fxll_tbl(idx),
3856        lx_fxll_tbl(idx)
3857      );
3858     END LOOP;
3859     IF (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
3860       RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
3861     ELSIF (l_return_status = OKL_API.G_RET_STS_ERROR) THEN
3862       RAISE OKL_API.G_EXCEPTION_ERROR;
3863     END IF;
3864     -- Set OUT values
3865     x_fxl_rec       := lx_fxl_rec;
3866     x_fxll_tbl      := lx_fxll_tbl;
3867     x_return_status := l_return_status;
3868     OKL_API.END_ACTIVITY(x_msg_count, x_msg_data);
3869   EXCEPTION
3870     WHEN OKL_API.G_EXCEPTION_ERROR THEN
3871       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3872       (
3873         l_api_name,
3874         G_PKG_NAME,
3875         'OKL_API.G_RET_STS_ERROR',
3876         x_msg_count,
3877         x_msg_data,
3878         '_PVT'
3879       );
3880     WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
3881       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3882       (
3883         l_api_name,
3884         G_PKG_NAME,
3885         'OKL_API.G_RET_STS_UNEXP_ERROR',
3886         x_msg_count,
3887         x_msg_data,
3888         '_PVT'
3889       );
3890     WHEN OTHERS THEN
3891       x_return_status := OKL_API.HANDLE_EXCEPTIONS
3892       (
3893         l_api_name,
3894         G_PKG_NAME,
3895         'OTHERS',
3896         x_msg_count,
3897         x_msg_data,
3898         '_PVT'
3899       );
3900   END insert_row;
3901 END OKL_FXL_PVT;