DBA Data[Home] [Help]

PACKAGE BODY: APPS.OKL_DFLEX_UTIL_PVT

Source


1 PACKAGE BODY OKL_DFLEX_UTIL_PVT  AS
2 /* $Header: OKLRDFUB.pls 120.3 2006/02/23 18:19:20 rpillay noship $ */
3 
4   TYPE seg_info_rec_type IS RECORD
5    (col1  varchar2(30)
6    ,col2  varchar2(255)
7     );
8   --
9   TYPE seg_info_tbl_type IS TABLE OF seg_info_rec_type INDEX BY BINARY_INTEGER;
10 
11   G_API_TYPE		CONSTANT VARCHAR2(4) := '_PVT';
12 
13 procedure print(s in varchar2) is
14 begin
15   fnd_file.put_line(fnd_file.log, s);
16 end;
17 
18 -- ----------------------------------------------------------------------------
19 -- |------------------------<     find_error_segment      >-------------------|
20 -- ----------------------------------------------------------------------------
21 --
22 procedure find_error_segment(p_appl_short_name      IN  varchar2,
23                              p_flexfield_name       IN  varchar2,
24                              p_context_code         IN  varchar2,
25                              p_error_seg_num        IN  number,
26                              p_application_col_name OUT NOCOPY varchar2,
27                              p_form_left_prompt     OUT NOCOPY varchar2,
28                              p_table_name           OUT NOCOPY varchar2
29                             )is
30 --
31 -- Cursors
32 --
33 CURSOR c_context_valid(p_appl_short_name in VARCHAR2,
34                        p_flexfield_name in VARCHAR2,
35                        p_context in VARCHAR2) is
36 SELECT 'Y'
37 FROM fnd_application a,
38      fnd_descr_flex_contexts dfc
39 WHERE a.application_short_name = p_appl_short_name
40 AND a.application_id = dfc.application_id
41 AND dfc.descriptive_flexfield_name = p_flexfield_name
42 AND dfc.descriptive_flex_context_code = p_context;
43 --
44 -- Local Variables
45 --
46 l_api_name		  CONSTANT VARCHAR2(30) := 'FIND_ERROR_SEGMENT';
47 l_api_version	  CONSTANT NUMBER	      := 1.0;
48 l_return_status	  VARCHAR2(1)           := OKL_API.G_RET_STS_SUCCESS;
49 
50 l_flexfield         fnd_dflex.dflex_r;
51 l_flexinfo          fnd_dflex.dflex_dr;
52 l_global_context    fnd_dflex.context_r;
53 l_context           fnd_dflex.context_r;
54 l_global_segments   fnd_dflex.segments_dr;
55 l_global_count      number :=0;
56 l_segments          fnd_dflex.segments_dr;
57 l_segment_info      seg_info_tbl_type;
58 l_counter	        number :=0;
59 l_check_segments    BOOLEAN := TRUE;
60 l_exists            varchar2(2);
61 l_error_seg_num     number;
62 
63 begin
64 
65 --
66 -- First get the flexfield information
67 --
68   fnd_dflex.get_flexfield(appl_short_name => p_appl_short_name,
69                         flexfield_name  => p_flexfield_name,
70                         flexfield       => l_flexfield,
71                         flexinfo        => l_flexinfo);
72 --
73 -- Use l_flexfield in calls that follow to identify the flexfield.
74 -- Next check that the context is valid, otherwise return the context
75 -- column name and prompt
76 --
77 --
78   if (p_error_seg_num is null) then
79 --
80 --   The context is in error, and the context is not one of the global
81 --   data elements.  In this case, we should simply set the application
82 --   column name and the context prompt to those associated with the
83 --   context information defined for this flexfield.
84 
85      p_application_col_name := l_flexinfo.context_column_name;
86      p_form_left_prompt := l_flexinfo.form_context_prompt;
87      p_table_name := l_flexinfo.table_name;
88 --
89 --   Since we know that the context was invalid, we don't have to check
90 --   the segments.
91 --
92        l_check_segments := FALSE;
93 --
94   else
95 
96      if p_context_code is not null then
97        open c_context_valid(p_appl_short_name, p_flexfield_name, p_context_code);
98        fetch c_context_valid into l_exists;
99 --
100 -- If this cursor did not return a record, we have an invalid context.
101 --
102        if c_context_valid%NOTFOUND then
103          p_application_col_name := l_flexinfo.context_column_name;
104          p_form_left_prompt := l_flexinfo.form_context_prompt;
105          p_table_name := l_flexinfo.table_name;
106 --
107 -- Since we know we have an invalid context, we need not check the segments.
108 --
109          l_check_segments := FALSE;
110       end if;
111       close c_context_valid;
112      end if; -- Not null context code
113   end if;
114 
115   if l_check_segments then
116 --
117 -- First set up the Global Data Elements flexfield context, which is
118 -- always called 'Global Data Elements', as is not translated.
119 --
120      l_global_context := fnd_dflex.make_context(flexfield => l_flexfield,
121                                    context_code => 'Global Data Elements');
122 
123      fnd_dflex.get_segments(context => l_global_context,
124                             segments => l_global_segments,
125                             enabled_only => true);
126 
127      if (l_global_segments.application_column_name.count > 0) then
128 
129        for l_counter in l_global_segments.application_column_name.first..
130                          l_global_segments.application_column_name.last loop
131 
132          l_segment_info(l_counter).col1 :=
133                         l_global_segments.application_column_name(l_counter);
134          l_segment_info(l_counter).col2 := l_global_segments.row_prompt(l_counter);
135          l_global_count := l_global_count+1;
136        end loop;
137      else
138        l_global_count := 0;
139      end if;
140 --
141 -- Add information about the context column
142 --
143      l_global_count := l_global_count +1;
144 
145      l_segment_info(l_global_count).col1 := l_flexinfo.context_column_name;
146      l_segment_info(l_global_count).col2 := l_flexinfo.form_context_prompt;
147 --
148 -- Next get the specific information if the context is not global data elements
149 --
150      if (p_context_code is not null) then
151 
152        l_context := fnd_dflex.make_context(flexfield => l_flexfield,
153                                            context_code => p_context_code);
154 --
155 -- Retrieve the segment information for this context
156 --
157        fnd_dflex.get_segments(context => l_context,
158                               segments => l_segments,
159                               enabled_only => true);
160 --
161 -- Append the specific context segment information to the Global Segment Information
162 -- again, checking that there is information to obtain
163 --
164        if (l_segments.application_column_name.count > 0) then
165            for l_counter in l_segments.application_column_name.first..
166                             l_segments.application_column_name.last loop
167                l_segment_info(l_counter+l_global_count).col1 :=
168                          l_segments.application_column_name(l_counter);
169                l_segment_info(l_counter+l_global_count).col2 :=
170                          l_segments.row_prompt(l_counter);
171            end loop;
172        end if;
173      end if;
174 
175 --
176 -- Next retrieve the application column name corresponding to the segment
177 -- in error.
178     p_application_col_name := l_segment_info(p_error_seg_num).col1;
179     p_form_left_prompt := l_segment_info(p_error_seg_num).col2;
180     p_table_name := l_flexinfo.table_name;
181 --
182   end if;
183 --
184 end find_error_segment;
185 --
186 --
187 -- ----------------------------------------------------------------------------
188 -- |------------------------< validate_desc_flex >-----------------------------|
189 -- ----------------------------------------------------------------------------
190 --
191 PROCEDURE validate_desc_flex
192   (p_api_version                  IN NUMBER
193   ,p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE
194   ,x_return_status                OUT NOCOPY VARCHAR2
195   ,x_msg_count                    OUT NOCOPY NUMBER
196   ,x_msg_data                     OUT NOCOPY VARCHAR2
197   ,p_appl_short_name              IN  VARCHAR2
198   ,p_descflex_name                IN  VARCHAR2
199   ,p_segment_partial_name         IN  VARCHAR2
200   ,p_segment_values_rec           IN  DFF_Rec_type
201   )
202 IS
203   --
204   l_api_name      CONSTANT VARCHAR2(30) := 'VALIDATE_DESC_FLEX';
205   l_api_version	CONSTANT NUMBER	    := 1.0;
206   l_return_status	VARCHAR2(1)           := OKL_API.G_RET_STS_SUCCESS;
207   --
208   l_attr_set          seg_info_tbl_type;
209   l_attr_set_cnt      binary_integer;
210   l_segment_set       seg_info_tbl_type;
211   l_segment_cnt       binary_integer;
212   l_seg_tbl_cnt       binary_integer;
213   l_ne_attr_set       seg_info_tbl_type;
214   --
215   l_seg_column_name   varchar2(30);
216   l_ne_column_name    varchar2(30);
217   l_ne_column_value   varchar2(255);
218   l_attr_name         varchar2(30);
219   l_attr_value        varchar2(255);
220   l_enab_seg_count    number;
221   l_first_enab_segnum number;
222   l_error_seg         number;
223   i		          number;
224   l_app_col_name      FND_DESCR_FLEX_COLUMN_USAGES.APPLICATION_COLUMN_NAME%TYPE;
225   l_table_name        varchar2(60);
226   l_flex_seg_error_prompt FND_DESCR_FLEX_COL_USAGE_TL.FORM_LEFT_PROMPT%TYPE;
227 
228   l_desc_col_name1  VARCHAR2(30) := p_segment_partial_name||'1';
229   l_desc_col_name2  VARCHAR2(30) := p_segment_partial_name||'2';
230   l_desc_col_name3  VARCHAR2(30) := p_segment_partial_name||'3';
231   l_desc_col_name4  VARCHAR2(30) := p_segment_partial_name||'4';
232   l_desc_col_name5  VARCHAR2(30) := p_segment_partial_name||'5';
233   l_desc_col_name6  VARCHAR2(30) := p_segment_partial_name||'6';
234   l_desc_col_name7  VARCHAR2(30) := p_segment_partial_name||'7';
235   l_desc_col_name8  VARCHAR2(30) := p_segment_partial_name||'8';
236   l_desc_col_name9  VARCHAR2(30) := p_segment_partial_name||'9';
237   l_desc_col_name10 VARCHAR2(30) := p_segment_partial_name||'10';
238   l_desc_col_name11 VARCHAR2(30) := p_segment_partial_name||'11';
239   l_desc_col_name12 VARCHAR2(30) := p_segment_partial_name||'12';
240   l_desc_col_name13 VARCHAR2(30) := p_segment_partial_name||'13';
241   l_desc_col_name14 VARCHAR2(30) := p_segment_partial_name||'14';
242   l_desc_col_name15 VARCHAR2(30) := p_segment_partial_name||'15';
243 
244   l_flexfield         fnd_dflex.dflex_r;
245   l_flexinfo          fnd_dflex.dflex_dr;
246 
247   --  --------------------------------------------------------------------------
248   --  |-----------------------< attribute_set_add_dtls >-----------------------|
249   --  --------------------------------------------------------------------------
250   --
251   --  Add attribute details to a attribute set
252   --
253   PROCEDURE attribute_set_add_dtls
254     (p_attr_set         IN OUT NOCOPY seg_info_tbl_type
255     ,p_attr_set_row_num IN OUT NOCOPY NUMBER
256     ,p_attr_name        IN VARCHAR2
257     ,p_attr_value       IN VARCHAR2
258     )
259   IS
260   BEGIN
261       p_attr_set(p_attr_set_row_num).col1 := p_attr_name;
262       p_attr_set(p_attr_set_row_num).col2 := p_attr_value;
263       p_attr_set_row_num := p_attr_set_row_num + 1;
264   END attribute_set_add_dtls;
265 
266   --  --------------------------------------------------------------------------
267   --  |-----------------------------< get_non_exist_rows >----------------------|
268   --  --------------------------------------------------------------------------
269   --
270   --  Get PLSQL Table rows which exist in p_seg_info_tbl1 but not p_seg_info_tbl2
271   --
272   PROCEDURE get_non_exist_rows
273     (p_seg_info_tbl1  IN         seg_info_tbl_type
274     ,p_seg_info_tbl2  IN         seg_info_tbl_type
275     ,p_ne_tbl_rows    OUT NOCOPY seg_info_tbl_type
276     )
277   IS
278     --
279     l_api_name       CONSTANT VARCHAR2(30) := 'GET_NON_EXIST_ROWS';
280     l_api_version	   CONSTANT NUMBER       := 1.0;
281     l_return_status  VARCHAR2(1)           := OKL_API.G_RET_STS_SUCCESS;
282     --
283     l_tbl1_row       seg_info_rec_type;
284     --
285     l_tbl1_count     binary_integer;
286     l_tbl2_count     binary_integer;
287     l_ne_row_count   binary_integer;
288     l_tbl1_ele_value varchar2(255);
289     l_tbl2_ele_value varchar2(255);
290     l_match_count    number;
291     --
292   BEGIN
293     --
294     -- Check if Table 1 contains rows
295     --
296     if p_seg_info_tbl1.count > 0 then
297       --
298       -- Loop through rows
299       --
300       l_ne_row_count := 0;
301       --
302       for l_tbl1_count in p_seg_info_tbl1.first .. p_seg_info_tbl1.last loop
303         --
304         l_tbl1_ele_value := p_seg_info_tbl1(l_tbl1_count).col1;
305         --
306         -- Check if Table 2 contains rows
307         --
308         if p_seg_info_tbl2.count > 0 then
309           --
310           -- Loop through rows
311           --
312           l_match_count := 0;
313           --
314           for l_tbl2_count in p_seg_info_tbl2.first .. p_seg_info_tbl2.last loop
315             --
316             l_tbl2_ele_value := p_seg_info_tbl2(l_tbl2_count).col1;
317             --
318             -- Check for a value match
319             --
320             if l_tbl1_ele_value = l_tbl2_ele_value then
321               --
322               l_match_count := l_match_count + 1;
323               exit;
324               --
325             end if;
326             --
327           end loop;
328           --
329           -- Check for a non existant value
330           --
331           if l_match_count = 0 then
332             --
333             -- Set the NE row to a local row
334             --
335             l_tbl1_row := p_seg_info_tbl1(l_tbl1_count);
336             --
337             -- Add the NE row to the NE Table
338             --
339             p_ne_tbl_rows(l_ne_row_count) := l_tbl1_row;
340             l_ne_row_count := l_ne_row_count + 1;
341             --
342           end if;
343           --
344         end if;
345         --
346       end loop;
347       --
348     end if;
349     --
350   END get_non_exist_rows;
351   --
352 
353 BEGIN
354 
355    -- call START_ACTIVITY to create savepoint, check compatibility
356    -- and initialize message list
357 
358    l_return_status := OKL_API.START_ACTIVITY(
359 			p_api_name      => l_api_name,
360 			p_pkg_name      => g_pkg_name,
361 			p_init_msg_list => p_init_msg_list,
362 			l_api_version   => l_api_version,
363 			p_api_version   => p_api_version,
364 			p_api_type      => g_api_type,
365 			x_return_status => x_return_status);
366 
367    -- check if activity started successfully
368    If (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) then
369      raise OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
370    Elsif (l_return_status = OKL_API.G_RET_STS_ERROR) then
371      raise OKL_API.G_EXCEPTION_ERROR;
372    End If;
373 
374    l_attr_set_cnt := 0;
375 
376    attribute_set_add_dtls
377     (p_attr_set         => l_attr_set
378     ,p_attr_set_row_num => l_attr_set_cnt
379     ,p_attr_name        => l_desc_col_name1
380     ,p_attr_value       => p_segment_values_rec.attribute1
381     );
382 
383    attribute_set_add_dtls
384     (p_attr_set         => l_attr_set
385     ,p_attr_set_row_num => l_attr_set_cnt
386     ,p_attr_name        => l_desc_col_name2
387     ,p_attr_value       => p_segment_values_rec.attribute2
388     );
389 
390    attribute_set_add_dtls
391     (p_attr_set         => l_attr_set
392     ,p_attr_set_row_num => l_attr_set_cnt
393     ,p_attr_name        => l_desc_col_name3
394     ,p_attr_value       => p_segment_values_rec.attribute3
395     );
396 
397    attribute_set_add_dtls
398     (p_attr_set         => l_attr_set
399     ,p_attr_set_row_num => l_attr_set_cnt
400     ,p_attr_name        => l_desc_col_name4
401     ,p_attr_value       => p_segment_values_rec.attribute4
402     );
403 
404     attribute_set_add_dtls
405     (p_attr_set         => l_attr_set
406     ,p_attr_set_row_num => l_attr_set_cnt
407     ,p_attr_name        => l_desc_col_name5
408     ,p_attr_value       => p_segment_values_rec.attribute5
409     );
410 
411     attribute_set_add_dtls
412     (p_attr_set         => l_attr_set
413     ,p_attr_set_row_num => l_attr_set_cnt
414     ,p_attr_name        => l_desc_col_name6
415     ,p_attr_value       => p_segment_values_rec.attribute6
416     );
417 
418     attribute_set_add_dtls
419     (p_attr_set         => l_attr_set
420     ,p_attr_set_row_num => l_attr_set_cnt
421     ,p_attr_name        => l_desc_col_name7
422     ,p_attr_value       => p_segment_values_rec.attribute7
423     );
424 
425     attribute_set_add_dtls
426     (p_attr_set         => l_attr_set
427     ,p_attr_set_row_num => l_attr_set_cnt
428     ,p_attr_name        => l_desc_col_name8
429     ,p_attr_value       => p_segment_values_rec.attribute8
430     );
431 
432     attribute_set_add_dtls
433     (p_attr_set         => l_attr_set
434     ,p_attr_set_row_num => l_attr_set_cnt
435     ,p_attr_name        => l_desc_col_name9
436     ,p_attr_value       => p_segment_values_rec.attribute9
437     );
438 
439     attribute_set_add_dtls
440     (p_attr_set         => l_attr_set
441     ,p_attr_set_row_num => l_attr_set_cnt
442     ,p_attr_name        => l_desc_col_name10
443     ,p_attr_value       => p_segment_values_rec.attribute10
444     );
445 
446     attribute_set_add_dtls
447     (p_attr_set         => l_attr_set
448     ,p_attr_set_row_num => l_attr_set_cnt
449     ,p_attr_name        => l_desc_col_name11
450     ,p_attr_value       => p_segment_values_rec.attribute11
451     );
452 
453     attribute_set_add_dtls
454     (p_attr_set         => l_attr_set
455     ,p_attr_set_row_num => l_attr_set_cnt
456     ,p_attr_name        => l_desc_col_name12
457     ,p_attr_value       => p_segment_values_rec.attribute12
458     );
459 
460     attribute_set_add_dtls
461     (p_attr_set         => l_attr_set
462     ,p_attr_set_row_num => l_attr_set_cnt
463     ,p_attr_name        => l_desc_col_name13
464     ,p_attr_value       => p_segment_values_rec.attribute13
465     );
466 
467     attribute_set_add_dtls
468     (p_attr_set         => l_attr_set
469     ,p_attr_set_row_num => l_attr_set_cnt
470     ,p_attr_name        => l_desc_col_name14
471     ,p_attr_value       => p_segment_values_rec.attribute14
472     );
473 
474     attribute_set_add_dtls
475     (p_attr_set         => l_attr_set
476     ,p_attr_set_row_num => l_attr_set_cnt
477     ,p_attr_name        => l_desc_col_name15
478     ,p_attr_value       => p_segment_values_rec.attribute15
479     );
480 
481    fnd_flex_descval.set_context_value
482      (p_segment_values_rec.attribute_category);
483 
484    if l_attr_set.count > 0 then
485      --
486      -- Loop through the attribute set
487      --
488      for l_attr_set_cnt in l_attr_set.first .. l_attr_set.last loop
489        --
490        l_attr_name  := l_attr_set(l_attr_set_cnt).col1;
491        l_attr_value := l_attr_set(l_attr_set_cnt).col2;
492        --
493        -- Add attribute details to AOL DF column details
494        --
495        fnd_flex_descval.set_column_value
496          (column_name  => l_attr_name
497          ,column_value => l_attr_value
498          );
499        --
500      end loop;
501    end if;
502 
503    --
504    -- Validate DF column details passed to AOL
505    --
506    if NOT FND_FLEX_DESCVAL.validate_desccols
507       (appl_short_name  => p_appl_short_name
508       ,desc_flex_name   => p_descflex_name
509       ,values_or_ids    => 'I'
510    )
511    then
512 
513       l_error_seg := FND_FLEX_DESCVAL.error_segment;
514       find_error_segment(p_appl_short_name      => p_appl_short_name,
515                          p_flexfield_name       => p_descflex_name,
516                          p_context_code         => p_segment_values_rec.attribute_category,
517                          p_error_seg_num        => l_error_seg,
518                          p_application_col_name => l_app_col_name,
519                          p_form_left_prompt     => l_flex_seg_error_prompt,
520                          p_table_name           => l_table_name
521                          );
522 
523       OKL_API.SET_MESSAGE
524         (p_app_name     => G_APP_NAME
525         ,p_msg_name     => 'OKL_DESC_FLEX_ERROR'
526         ,p_token1       => 'DESC_FLEX_MSG'
527         ,p_token1_value =>  FND_FLEX_DESCVAL.error_message
528         ,p_token2       => 'ERROR_SEGMENT'
529         ,p_token2_value => l_flex_seg_error_prompt
530         ,p_token3       => 'TABLE_NAME'
531         ,p_token3_value => l_table_name
532         ,p_token4       => 'DFF_NAME'
533         ,p_token4_value => p_descflex_name
534         ,p_token5       => 'CONTEXT_VALUE'
535         ,p_token5_value => p_segment_values_rec.attribute_category);
536 
537       RAISE OKL_API.G_EXCEPTION_ERROR;
538       --
539    end if;  --  FND_FLEX_DESCVAL.validate_desccols
540    --
541    -- Build the segment set
542    l_seg_tbl_cnt := 0;
543    --
544    l_first_enab_segnum := 1;
545    --
546    --   Get the enabled segment count
547    --
548    l_enab_seg_count := fnd_flex_descval.segment_count;
549    --
550    for l_segment_cnt in l_first_enab_segnum..l_enab_seg_count loop
551      --
552      -- Get the segment column name
553      --
554      l_seg_column_name := fnd_flex_descval.segment_column_name(l_segment_cnt);
555      --
556      -- Check if the column name is set
557      --
558      if l_seg_column_name is not null then
559        --
560        -- Populate the segment Table
561        l_segment_set(l_seg_tbl_cnt).col1 := l_seg_column_name;
562        l_seg_tbl_cnt := l_seg_tbl_cnt + 1;
563      end if;
564    --
565    end loop;
566    --
567    -- Get Non Enabled attribute names
568    --
569    get_non_exist_rows
570      (p_seg_info_tbl1  => l_attr_set
571      ,p_seg_info_tbl2  => l_segment_set
572      ,p_ne_tbl_rows    => l_ne_attr_set
573      );
574    --
575    -- Check if non enabled attributes have been provided
576    --
577    if l_ne_attr_set.count > 0 then
578      for x in l_ne_attr_set.first..l_ne_attr_set.last loop
579        --
580        -- Set the non enabled column name
581        --
582          l_ne_column_name  := l_ne_attr_set(x).col1;
583          l_ne_column_value := l_ne_attr_set(x).col2;
584        --
585        -- Check if the value is set for the non enabled column
586        --
587        if l_ne_column_value is not null then
588        --
589 
590          fnd_dflex.get_flexfield
591            (appl_short_name => p_appl_short_name,
592             flexfield_name  => p_descflex_name,
593             flexfield       => l_flexfield,
594             flexinfo        => l_flexinfo);
595 
596          OKL_API.SET_MESSAGE
597            (p_app_name     => G_APP_NAME
598            ,p_msg_name     => 'OKL_NON_EXIST_SEG_NAME'
599            ,p_token1       => 'SEGMENT'
600            ,p_token1_value => l_ne_column_name
601            ,p_token2       => 'VALUE'
602            ,p_token2_value => l_ne_column_value
603            ,p_token3       => 'TABLE_NAME'
604            ,p_token3_value => l_flexinfo.table_name
605            ,p_token4       => 'DFF_NAME'
606            ,p_token4_value => p_descflex_name
607            ,p_token5       => 'CONTEXT_VALUE'
608            ,p_token5_value => p_segment_values_rec.attribute_category);
609 
610          RAISE OKL_API.G_EXCEPTION_ERROR;
611        --
612        end if;
613        --
614      end loop;
615    end if;
616 
617    OKL_API.END_ACTIVITY(x_msg_count => x_msg_count,
618                          x_msg_data	 => x_msg_data);
619 
620 EXCEPTION
621  WHEN OKL_API.G_EXCEPTION_ERROR THEN
622      x_return_status := OKL_API.HANDLE_EXCEPTIONS
623               (l_api_name,
624               G_PKG_NAME,
625               'OKL_API.G_RET_STS_ERROR',
626               x_msg_count,
627               x_msg_data,
628               '_PVT');
629      WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
630      x_return_status :=OKL_API.HANDLE_EXCEPTIONS
631              (l_api_name,
632              G_PKG_NAME,
633              'OKL_API.G_RET_STS_UNEXP_ERROR',
634              x_msg_count,
635              x_msg_data,
636              '_PVT');
637      WHEN OTHERS THEN
638      x_return_status :=OKL_API.HANDLE_EXCEPTIONS
639              (l_api_name,
640              G_PKG_NAME,
641              'OTHERS',
642              x_msg_count,
643              x_msg_data,
644              '_PVT');
645 END validate_desc_flex;
646 --
647 --
648 -- ----------------------------------------------------------------------------
649 -- |------------------------< update_contract_add_info >-----------------------|
650 -- ----------------------------------------------------------------------------
651 --
652 PROCEDURE update_contract_add_info
653   (p_api_version                  IN NUMBER
654   ,p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE
655   ,x_return_status                OUT NOCOPY VARCHAR2
656   ,x_msg_count                    OUT NOCOPY NUMBER
657   ,x_msg_data                     OUT NOCOPY VARCHAR2
658   ,p_chr_id                       IN  NUMBER
659   ,p_add_info_rec                 IN  DFF_Rec_type
660   )
661 IS
662   --
663   l_api_name      CONSTANT VARCHAR2(30) := 'UPDATE_CONTRACT_ADD_INFO';
664   l_api_version	CONSTANT NUMBER	    := 1.0;
665   l_return_status	VARCHAR2(1)           := OKL_API.G_RET_STS_SUCCESS;
666   --
667 
668   lp_chrv_rec OKL_OKC_MIGRATION_PVT.chrv_rec_type;
669   lx_chrv_rec OKL_OKC_MIGRATION_PVT.chrv_rec_type;
670 
671   lp_khrv_rec OKL_CONTRACT_PUB.khrv_rec_type;
672   lx_khrv_rec OKL_CONTRACT_PUB.khrv_rec_type;
673 BEGIN
674 
675    -- call START_ACTIVITY to create savepoint, check compatibility
676    -- and initialize message list
677 
678    l_return_status := OKL_API.START_ACTIVITY(
679 			p_api_name      => l_api_name,
680 			p_pkg_name      => g_pkg_name,
681 			p_init_msg_list => p_init_msg_list,
682 			l_api_version   => l_api_version,
683 			p_api_version   => p_api_version,
684 			p_api_type      => g_api_type,
685 			x_return_status => x_return_status);
686 
687    -- check if activity started successfully
688    If (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) then
689      raise OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
690    Elsif (l_return_status = OKL_API.G_RET_STS_ERROR) then
691      raise OKL_API.G_EXCEPTION_ERROR;
692    End If;
693 
694    lp_chrv_rec.id := p_chr_id;
695    lp_khrv_rec.id := p_chr_id;
696 
697    lp_khrv_rec.attribute_category := p_add_info_rec.attribute_category;
698    lp_khrv_rec.attribute1         := p_add_info_rec.attribute1;
699    lp_khrv_rec.attribute2         := p_add_info_rec.attribute2;
700    lp_khrv_rec.attribute3         := p_add_info_rec.attribute3;
701    lp_khrv_rec.attribute4         := p_add_info_rec.attribute4;
702    lp_khrv_rec.attribute5         := p_add_info_rec.attribute5;
703    lp_khrv_rec.attribute6         := p_add_info_rec.attribute6;
704    lp_khrv_rec.attribute7         := p_add_info_rec.attribute7;
705    lp_khrv_rec.attribute8         := p_add_info_rec.attribute8;
706    lp_khrv_rec.attribute9         := p_add_info_rec.attribute9;
707    lp_khrv_rec.attribute10        := p_add_info_rec.attribute10;
708    lp_khrv_rec.attribute11        := p_add_info_rec.attribute11;
709    lp_khrv_rec.attribute12        := p_add_info_rec.attribute12;
710    lp_khrv_rec.attribute13        := p_add_info_rec.attribute13;
711    lp_khrv_rec.attribute14        := p_add_info_rec.attribute14;
712    lp_khrv_rec.attribute15        := p_add_info_rec.attribute15;
713 
714    lp_khrv_rec.validate_dff_yn    := 'Y';
715 
716    OKL_CONTRACT_PUB.update_contract_header(
717      p_api_version       => p_api_version,
718      p_init_msg_list  	 => p_init_msg_list,
719      x_return_status  	 => x_return_status,
720      x_msg_count         => x_msg_count,
721      x_msg_data          => x_msg_data,
722      p_restricted_update => 'F',
723      p_chrv_rec          => lp_chrv_rec,
724      p_khrv_rec       	 => lp_khrv_rec,
725      x_chrv_rec       	 => lx_chrv_rec,
726      x_khrv_rec       	 => lx_khrv_rec);
727 
728    IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
729      RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
730    ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
731      RAISE OKL_API.G_EXCEPTION_ERROR;
732    END IF;
733 
734    OKL_API.END_ACTIVITY(x_msg_count => x_msg_count,
735                          x_msg_data	 => x_msg_data);
736 
737 EXCEPTION
738  WHEN OKL_API.G_EXCEPTION_ERROR THEN
739      x_return_status := OKL_API.HANDLE_EXCEPTIONS
740               (l_api_name,
741               G_PKG_NAME,
742               'OKL_API.G_RET_STS_ERROR',
743               x_msg_count,
744               x_msg_data,
745               '_PVT');
746      WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
747      x_return_status :=OKL_API.HANDLE_EXCEPTIONS
748              (l_api_name,
749              G_PKG_NAME,
750              'OKL_API.G_RET_STS_UNEXP_ERROR',
751              x_msg_count,
752              x_msg_data,
753              '_PVT');
754      WHEN OTHERS THEN
755      x_return_status :=OKL_API.HANDLE_EXCEPTIONS
756              (l_api_name,
757              G_PKG_NAME,
758              'OTHERS',
759              x_msg_count,
760              x_msg_data,
761              '_PVT');
762 END update_contract_add_info;
763 --
764 --
765 -- ----------------------------------------------------------------------------
766 -- |------------------------< update_line_add_info >-----------------------|
767 -- ----------------------------------------------------------------------------
768 --
769 PROCEDURE update_line_add_info
770   (p_api_version                  IN NUMBER
771   ,p_init_msg_list                IN VARCHAR2 DEFAULT OKL_API.G_FALSE
772   ,x_return_status                OUT NOCOPY VARCHAR2
773   ,x_msg_count                    OUT NOCOPY NUMBER
774   ,x_msg_data                     OUT NOCOPY VARCHAR2
775   ,p_cle_id                       IN  NUMBER
776   ,p_add_info_rec                 IN  DFF_Rec_type
777   )
778 IS
779   --
780   l_api_name      CONSTANT VARCHAR2(30) := 'UPDATE_LINE_ADD_INFO';
781   l_api_version	CONSTANT NUMBER	    := 1.0;
782   l_return_status	VARCHAR2(1)           := OKL_API.G_RET_STS_SUCCESS;
783   --
784 
785   lp_clev_rec OKL_OKC_MIGRATION_PVT.clev_rec_type;
786   lx_clev_rec OKL_OKC_MIGRATION_PVT.clev_rec_type;
787 
788   lp_klev_rec OKL_CONTRACT_PUB.klev_rec_type;
789   lx_klev_rec OKL_CONTRACT_PUB.klev_rec_type;
790 BEGIN
791 
792    -- call START_ACTIVITY to create savepoint, check compatibility
793    -- and initialize message list
794 
795    l_return_status := OKL_API.START_ACTIVITY(
796 			p_api_name      => l_api_name,
797 			p_pkg_name      => g_pkg_name,
798 			p_init_msg_list => p_init_msg_list,
799 			l_api_version   => l_api_version,
800 			p_api_version   => p_api_version,
801 			p_api_type      => g_api_type,
802 			x_return_status => x_return_status);
803 
804    -- check if activity started successfully
805    If (l_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) then
806      raise OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
807    Elsif (l_return_status = OKL_API.G_RET_STS_ERROR) then
808      raise OKL_API.G_EXCEPTION_ERROR;
809    End If;
810 
811    --Bug# 4959361
812     OKL_LLA_UTIL_PVT.check_line_update_allowed
813       (p_api_version     => p_api_version,
814        p_init_msg_list   => p_init_msg_list,
815        x_return_status   => x_return_status,
816        x_msg_count       => x_msg_count,
817        x_msg_data        => x_msg_data,
818        p_cle_id          => p_cle_id);
819 
820     IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
821        RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
822     ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
823        RAISE OKL_API.G_EXCEPTION_ERROR;
824     END IF;
825     --Bug# 4959361
826 
827    lp_clev_rec.id := p_cle_id;
828    lp_klev_rec.id := p_cle_id;
829 
830    lp_klev_rec.attribute_category := p_add_info_rec.attribute_category;
831    lp_klev_rec.attribute1         := p_add_info_rec.attribute1;
832    lp_klev_rec.attribute2         := p_add_info_rec.attribute2;
833    lp_klev_rec.attribute3         := p_add_info_rec.attribute3;
834    lp_klev_rec.attribute4         := p_add_info_rec.attribute4;
835    lp_klev_rec.attribute5         := p_add_info_rec.attribute5;
836    lp_klev_rec.attribute6         := p_add_info_rec.attribute6;
837    lp_klev_rec.attribute7         := p_add_info_rec.attribute7;
838    lp_klev_rec.attribute8         := p_add_info_rec.attribute8;
839    lp_klev_rec.attribute9         := p_add_info_rec.attribute9;
840    lp_klev_rec.attribute10        := p_add_info_rec.attribute10;
841    lp_klev_rec.attribute11        := p_add_info_rec.attribute11;
842    lp_klev_rec.attribute12        := p_add_info_rec.attribute12;
843    lp_klev_rec.attribute13        := p_add_info_rec.attribute13;
844    lp_klev_rec.attribute14        := p_add_info_rec.attribute14;
845    lp_klev_rec.attribute15        := p_add_info_rec.attribute15;
846 
847    lp_klev_rec.validate_dff_yn    := 'Y';
848 
849    OKL_CONTRACT_PUB.update_contract_line(
850      p_api_version       => p_api_version,
851      p_init_msg_list  	 => p_init_msg_list,
852      x_return_status  	 => x_return_status,
853      x_msg_count         => x_msg_count,
854      x_msg_data          => x_msg_data,
855      p_clev_rec          => lp_clev_rec,
856      p_klev_rec       	 => lp_klev_rec,
857      x_clev_rec       	 => lx_clev_rec,
858      x_klev_rec       	 => lx_klev_rec);
859 
860    IF (x_return_status = OKL_API.G_RET_STS_UNEXP_ERROR) THEN
861      RAISE OKL_API.G_EXCEPTION_UNEXPECTED_ERROR;
862    ELSIF (x_return_status = OKL_API.G_RET_STS_ERROR) THEN
863      RAISE OKL_API.G_EXCEPTION_ERROR;
864    END IF;
865 
866    OKL_API.END_ACTIVITY(x_msg_count => x_msg_count,
867                          x_msg_data	 => x_msg_data);
868 
869 EXCEPTION
870  WHEN OKL_API.G_EXCEPTION_ERROR THEN
871      x_return_status := OKL_API.HANDLE_EXCEPTIONS
872               (l_api_name,
873               G_PKG_NAME,
874               'OKL_API.G_RET_STS_ERROR',
875               x_msg_count,
876               x_msg_data,
877               '_PVT');
878      WHEN OKL_API.G_EXCEPTION_UNEXPECTED_ERROR THEN
879      x_return_status :=OKL_API.HANDLE_EXCEPTIONS
880              (l_api_name,
881              G_PKG_NAME,
882              'OKL_API.G_RET_STS_UNEXP_ERROR',
883              x_msg_count,
884              x_msg_data,
885              '_PVT');
886      WHEN OTHERS THEN
887      x_return_status :=OKL_API.HANDLE_EXCEPTIONS
888              (l_api_name,
889              G_PKG_NAME,
890              'OTHERS',
891              x_msg_count,
892              x_msg_data,
893              '_PVT');
894 END update_line_add_info;
895 --
896 
897 END OKL_DFLEX_UTIL_PVT;