DBA Data[Home] [Help]

PACKAGE BODY: APPS.OKL_TRY_PVT

Source


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