DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_BATCH_ELEMENT_ENTRY_API

Source


1 Package Body PAY_BATCH_ELEMENT_ENTRY_API as
2 /* $Header: pybthapi.pkb 120.14.12020000.2 2012/07/04 21:23:44 amnaraya ship $ */
3 --
4 -- Package Variables
5 --
6 g_package  varchar2(33) := 'pay_batch_element_entry_api.';
7 --
8 --
9 function get_upgrade_status
10    (p_batch_id          number
11    ,p_batch_line_id     number
12    ,p_short_name        varchar2
13    )return varchar2 is
14    --
15    l_status pay_upgrade_status.status%type;
16    l_business_group_id pay_batch_headers.business_group_id%TYPE;
17    --
18    cursor csr_bg_id is
19       select bth.business_group_id
20         from pay_batch_headers bth
21        where bth.batch_id = p_batch_id
22        union all
23       select bth.business_group_id
24         from pay_batch_headers bth,
25              pay_batch_lines btl
26        where bth.batch_id = btl.batch_id
27          and btl.batch_line_id = p_batch_line_id;
28    --
29 begin
30    --
31    open csr_bg_id;
32    fetch csr_bg_id into l_business_group_id;
33    close csr_bg_id;
34    --
35    pay_core_utils.get_upgrade_status(l_business_group_id,p_short_name,l_status);
36    --
37    return l_status;
38    --
39 exception
40    when others then
41    --
42    return 'E';
43    --
44 end;
45 --
46 -- -------------------------------------------------------------------------
47 -- Procedure to convert input values from display format to internal format.
48 -- -------------------------------------------------------------------------
49 function convert_display_to_internal
50   (p_input_value     varchar2,
51    p_uom_value       varchar2,
52    p_lookup_type     varchar2,
53    p_value_set_id    number,
54    p_currency_code   varchar2)
55    return varchar2 is
56 --
57    l_display_value   varchar2(80) := p_input_value;
58    l_formatted_value varchar2(80) := p_input_value;
59    l_dummy           varchar2(100);
60    l_date_prof_value      varchar2(80);
61    --
62    cursor csr_valid_lookup
63           (p_lookup_type varchar2,
64            p_meaning     varchar2) is
65        select HL.lookup_code
66          from hr_lookups HL
67         where HL.lookup_type = p_lookup_type
68           and HL.meaning     = p_meaning;
69 --
70 begin
71 --
72    if (p_lookup_type is not null and
73        l_display_value is not null) then
74       --
75       open csr_valid_lookup(p_lookup_type, l_display_value);
76       fetch csr_valid_lookup into l_formatted_value ;
77       --
78       if csr_valid_lookup%NOTFOUND then
79          close csr_valid_lookup;
80          raise no_data_found;
81       end if;
82       --
83       close csr_valid_lookup;
84       --
85    elsif (p_value_set_id is not null and
86           l_display_value is not null) then
87       --
88       l_formatted_value := pay_input_values_pkg.decode_vset_meaning(
89                            p_value_set_id, l_display_value);
90       --
91       if l_formatted_value is null then
92          raise no_data_found;
93       end if;
94       --
95    else
96       --
97 	  /* Bug 13697030 , Since we are converting the date format to DD-MON-RRRR in the procedure convert_date_to_canonical
98 	  we have to initialize the fnd_date to the same DD-MON-RRRR */
99 
100 	   fnd_profile.get('ICX_DATE_FORMAT_MASK', l_date_prof_value);
101 	   l_date_prof_value := nvl(l_date_prof_value,'DD-MON-RRRR');
102        fnd_date.initialize('DD-MON-RRRR',null);
103 
104 	    hr_chkfmt.checkformat (
105          l_display_value, 		/* the value to be formatted (out - display) */
106          p_uom_value,			/* the format to check */
107          l_formatted_value, 	/* the formatted value on output (out - canonical) */
108          null, 				/* minimum value (can be null) */
109          null,		 		    /* maximum value (can be null) */
110          'Y', 				    /* is ok to be null ? */
111          l_dummy,              /* used for range checking */
112          p_currency_code );
113 
114 		 /* Setting back the fnd_date to profile value */
115 		 fnd_date.initialize(l_date_prof_value,null);
116       --
117    end if;
118    --
119    return l_formatted_value;
120 --
121 exception
122    when others then
123 
124 		 /* Setting back the fnd_date to profile value */
125 		 fnd_date.initialize(l_date_prof_value,null);
126 
127       fnd_message.set_name ('PAY','PAY_6306_INPUT_VALUE_FORMAT');
128       fnd_message.set_token ('UNIT_OF_MEASURE', hr_general.decode_lookup ('UNITS', p_uom_value ));
129       fnd_message.raise_error;
130 --
131 end convert_display_to_internal;
132 --
133 -- -------------------------------------------------------------------------------
134 -- Procedure to convert date input values from display format to canonical format.
135 -- -------------------------------------------------------------------------------
136 procedure convert_date_to_canonical
137   (p_iv1               in out nocopy varchar2
138   ,p_iv2               in out nocopy varchar2
139   ,p_iv3               in out nocopy varchar2
140   ,p_iv4               in out nocopy varchar2
141   ,p_iv5               in out nocopy varchar2
142   ,p_iv6               in out nocopy varchar2
143   ,p_iv7               in out nocopy varchar2
144   ,p_iv8               in out nocopy varchar2
145   ,p_iv9               in out nocopy varchar2
146   ,p_iv10              in out nocopy varchar2
147   ,p_iv11              in out nocopy varchar2
148   ,p_iv12              in out nocopy varchar2
149   ,p_iv13              in out nocopy varchar2
150   ,p_iv14              in out nocopy varchar2
151   ,p_iv15              in out nocopy varchar2
152   ,p_element_type_id   in number
153   ,p_element_name      in varchar2
154   ,p_batch_id          in number        default null
155   ,p_effective_date    in date
156   ,p_batch_line_id     in number        default null
157   ,p_date_cfmt         in varchar2
158   ,p_int_fmt           in varchar2
159   ) is
160   --
161   cursor csr_table_inp_ids(p_ele_type_id number
162                           ,p_eff_date    date) is
163        select inv.uom,inv.lookup_type,inv.value_set_id
164        from   pay_input_values_f  inv
165        where  inv.element_type_id   = p_ele_type_id
166        and    p_eff_date between inv.effective_start_date
167                          and     inv.effective_end_date
168        order by inv.display_sequence
169        ,        inv.name;
170   --
171   l_uom               pay_input_values_f.uom%TYPE;
172   --
173   l_lookup_type       pay_input_values_f.lookup_type%TYPE;
174   l_value_set_id      pay_input_values_f.value_set_id%TYPE;
175   l_input_curr_code   pay_element_types_f.input_currency_code%TYPE;
176   --
177   l_element_type_id   pay_element_types_f.element_type_id%TYPE := null;
178   l_element_name      pay_element_types_f.element_name%TYPE := null;
179   l_count             number := 0;
180   l_legislation_code  per_business_groups.legislation_code%TYPE := null;
181   l_business_group_id per_business_groups.business_group_id%TYPE;
182   l_batch_id          pay_batch_lines.batch_id%TYPE;
183   l_effective_date    pay_batch_lines.effective_date%TYPE;
184   l_date_prof_value   varchar2(80);
185   --
186   /*Temporary variables for doing only validation when BEE_IV_UPG is  'N'*/
187   --
188   temp_iv1  pay_batch_lines.value_1%TYPE := null;
189   --
190 
191   lv_dummy           varchar2(100);
192   cursor csr_element_type (p_ele_name     varchar2
193                           ,p_bus_group_id number
194                           ,p_leg_code     varchar2
195                           ,p_eff_date     date
196                           ,p_ele_id       number) is
197        select pet.element_type_id,pet.input_currency_code
198          from pay_element_types_f pet
199         where p_ele_id is null
200           and upper(pet.element_name) = upper(p_ele_name)
201           and p_eff_date between pet.effective_start_date
202                          and     pet.effective_end_date
203           and (pet.business_group_id = p_bus_group_id
204                  or (pet.business_group_id is null
205                      and pet.legislation_code = p_leg_code)
206                  or (pet.business_group_id is null
207                      and pet.legislation_code is null))
208        union all
209        select pet.element_type_id,pet.input_currency_code
210          from pay_element_types_f pet
211         where p_ele_id is not null
212           and pet.element_type_id = p_ele_id
213           and p_eff_date between pet.effective_start_date
214                          and     pet.effective_end_date;
215   --
216   l_proc        varchar2(72) := g_package||'convert_date_to_canonical';
217   --
218 begin
219   --
220   hr_utility.set_location('Entering:'|| l_proc, 10);
221 
222    fnd_profile.get('ICX_DATE_FORMAT_MASK', l_date_prof_value);
223    l_date_prof_value := nvl(l_date_prof_value,'DD-MON-RRRR');
224   --
225   if p_effective_date = hr_api.g_date then
226      select effective_date
227        into l_effective_date
228        from pay_batch_lines pbl
229       where pbl.batch_line_id = p_batch_line_id;
230   else
231      l_effective_date := p_effective_date;
232   end if;
233   --
234   if (p_element_type_id = hr_api.g_number) then
235      select pbl.element_type_id
236        into l_element_type_id
237        from pay_batch_lines pbl
238       where pbl.batch_line_id = p_batch_line_id;
239   else
240      l_element_type_id := p_element_type_id;
241   end if;
242   --
243   if (l_element_type_id is null) then
244      --
245      if (p_batch_id is null and p_batch_line_id is not null) then
246         select pbl.batch_id
247           into l_batch_id
248           from pay_batch_lines pbl
249          where pbl.batch_line_id = p_batch_line_id;
250      else
251         l_batch_id := p_batch_id;
252      end if;
253      --
254      if p_element_name = hr_api.g_varchar2 then
255         select pbl.element_name
256           into l_element_name
257           from pay_batch_lines pbl
258          where pbl.batch_line_id = p_batch_line_id;
259      else
260          l_element_name := p_element_name;
261      end if;
262      --
263      select pbg.business_group_id,pbg.legislation_code
264        into l_business_group_id,l_legislation_code
265        from per_business_groups pbg,
266             pay_batch_headers pbh
267       where pbh.batch_id = l_batch_id
268         and pbg.business_group_id = pbh.business_group_id;
269      --
270      open csr_element_type(l_element_name
271                           ,l_business_group_id
272                           ,l_legislation_code
273                           ,l_effective_date
274                           ,l_element_type_id);
275      fetch csr_element_type into l_element_type_id,l_input_curr_code;
276      close csr_element_type;
277      --
278   else
279      --
280      open csr_element_type(l_element_name
281                           ,l_business_group_id
282                           ,l_legislation_code
283                           ,l_effective_date
284                           ,l_element_type_id);
285      fetch csr_element_type into l_element_type_id,l_input_curr_code;
286      close csr_element_type;
287      --
288   end if;
289   --
290   open csr_table_inp_ids(l_element_type_id,l_effective_date);
291   --
292   loop
293     fetch csr_table_inp_ids into l_uom,l_lookup_type,l_value_set_id;
294     exit when csr_table_inp_ids%NOTFOUND;
295     --
296     l_count := l_count +1;
297     --
298     if l_count > 15 then
299        exit;
300     end if;
301     --
302     -- Only convert the date if the input value is of date format, as well as the
303     -- input value is not defaulted or the intented format is canonical but the passed
304     -- value might be DD-MON-YYYY or DD-MON-YY format or they are specifically stated as
305     -- non-canonical format.
306     if (l_count = 1
307         and p_iv1 <> hr_api.g_varchar2
308         and ((l_uom = 'D' and p_date_cfmt = 'Y' and instr(p_iv1,'-',1,2) <> 0)
309              or (l_uom = 'D' and p_date_cfmt = 'N')
310              or (l_uom <> 'D'))) then
311        /*Bug 8873865 */
312         /*Bug 9459769*/
313         temp_iv1 := p_iv1;
314 
315       /*Bug 11813275 handling both cases DD/MM/YYYY and YYYY/MM/DD
316         Same is changed for all the input values*/
317 
318 	/* Bug 13697030 Handling each and every date format in the below way is tidious and error prone .
319 	   For eg if the customer has set the date format MM/DD/YYYY and gave input date as 11/12/2011
320 	   then the actual date should be 12-NOV-2011 but as per the below code the date ll be decoded to 11-DEC-2011.
321 	   Hence commenting the below code and handling the date formatting in a generlized way using the profile
322 	   ICX_DATE_FORMAT_MASK */
323 
324       /* If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv1,'/',1,1)= 3 and instr(p_iv1,'/',1,2)= 6 then
325           p_iv1:=to_char(to_date(p_iv1,'DD/MM/YYYY HH24:MI:SS'),'DD-MON-YYYY');
326        end if;
327 
328        If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv1,'/',1,1)= 5 and instr(p_iv1,'/',1,2)= 8 then
329           p_iv1:=to_char(to_date(p_iv1,'YYYY/MM/DD HH24:MI:SS'),'DD-MON-YYYY');
330        end if; */
331 
332 	   	If l_uom = 'D' and p_date_cfmt = 'N' then
333 				 p_iv1 :=to_char(to_date(p_iv1,l_date_prof_value),'DD-MON-RRRR');
334          end if;
335 
336        If (l_uom <> 'D' and p_int_fmt = 'N' ) then
337           hr_chkfmt.checkformat (p_iv1,l_uom,temp_iv1,null,null,'Y',lv_dummy,l_input_curr_code );
338        else
339        --
340           p_iv1 := convert_display_to_internal(p_iv1,l_uom,l_lookup_type,l_value_set_id,l_input_curr_code);
341        --
342        end if;
343     elsif (l_count = 2
344            and p_iv2 <> hr_api.g_varchar2
345            and ((l_uom = 'D' and p_date_cfmt = 'Y' and instr(p_iv2,'-',1,2) <> 0)
346                 or (l_uom = 'D' and p_date_cfmt = 'N')
347                 or (l_uom <> 'D'))) THEN
348         /*Bug 9459769*/
349         temp_iv1 := p_iv2;
350        /*Bug 8873865 */
351       /* If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv2,'/',1,1)= 3 and instr(p_iv2,'/',1,2)= 6 then
352           p_iv2 :=to_char(to_date(p_iv2,'DD/MM/YYYY HH24:MI:SS'),'DD-MON-YYYY');
353        end if;
354 
355        If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv2,'/',1,1)= 5 and instr(p_iv2,'/',1,2)= 8 then
356           p_iv2 :=to_char(to_date(p_iv2,'YYYY/MM/DD HH24:MI:SS'),'DD-MON-YYYY');
357        end if; */
358 
359 	   	If l_uom = 'D' and p_date_cfmt = 'N' then
360 				 p_iv2 :=to_char(to_date(p_iv2,l_date_prof_value),'DD-MON-RRRR');
361         end if;
362 
363        If (l_uom <> 'D' and p_int_fmt = 'N' ) then
364           hr_chkfmt.checkformat (p_iv2,l_uom,temp_iv1,null,null,'Y',lv_dummy,l_input_curr_code );
365        else
366            --
367           p_iv2 := convert_display_to_internal(p_iv2,l_uom,l_lookup_type,l_value_set_id,l_input_curr_code);
368           --
369        end if;
370     elsif (l_count = 3
371            and p_iv3 <> hr_api.g_varchar2
372            and ((l_uom = 'D' and p_date_cfmt = 'Y' and instr(p_iv3,'-',1,2) <> 0)
373                 or (l_uom = 'D' and p_date_cfmt = 'N')
374                 or (l_uom <> 'D'))) THEN
375         /*Bug 9459769*/
376         temp_iv1 := p_iv3;
377        /*Bug 8873865 */
378        /*If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv3,'/',1,1)= 3 and instr(p_iv3,'/',1,2)= 6 then
379           p_iv3 :=to_char(to_date(p_iv3,'DD/MM/YYYY HH24:MI:SS'),'DD-MON-YYYY');
380        end if;
381 
382        If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv3,'/',1,1)= 5 and instr(p_iv3,'/',1,2)= 8 then
383           p_iv3 :=to_char(to_date(p_iv3,'YYYY/MM/DD HH24:MI:SS'),'DD-MON-YYYY');
384        end if; */
385 
386 	   	If l_uom = 'D' and p_date_cfmt = 'N' then
387 				 p_iv3 :=to_char(to_date(p_iv3,l_date_prof_value),'DD-MON-RRRR');
388         end if;
389 
390        If (l_uom <> 'D' and p_int_fmt = 'N' ) then
391           hr_chkfmt.checkformat (p_iv3,l_uom,temp_iv1,null,null,'Y',lv_dummy,l_input_curr_code );
392        else
393           --
394           p_iv3 := convert_display_to_internal(p_iv3,l_uom,l_lookup_type,l_value_set_id,l_input_curr_code);
395           --
396        end if;
397     elsif (l_count = 4
398            and p_iv4 <> hr_api.g_varchar2
399            and ((l_uom = 'D' and p_date_cfmt = 'Y' and instr(p_iv4,'-',1,2) <> 0)
400                 or (l_uom = 'D' and p_date_cfmt = 'N')
401                 or (l_uom <> 'D'))) THEN
402        /*Bug 9459769*/
403         temp_iv1 := p_iv4;
404        /*Bug 8873865 */
405       /* If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv4,'/',1,1)= 3 and instr(p_iv4,'/',1,2)= 6 then
406           p_iv4 :=to_char(to_date(p_iv4,'DD/MM/YYYY HH24:MI:SS'),'DD-MON-YYYY');
407        end if;
408 
409        If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv4,'/',1,1)= 5 and instr(p_iv4,'/',1,2)= 8 then
410           p_iv4 :=to_char(to_date(p_iv4,'YYYY/MM/DD HH24:MI:SS'),'DD-MON-YYYY');
411        end if; */
412 
413 	   	If l_uom = 'D' and p_date_cfmt = 'N' then
414 				 p_iv4 :=to_char(to_date(p_iv4,l_date_prof_value),'DD-MON-RRRR');
415         end if;
416 
417        If (l_uom <> 'D' and p_int_fmt = 'N' ) then
418           hr_chkfmt.checkformat (p_iv4,l_uom,temp_iv1,null,null,'Y',lv_dummy,l_input_curr_code );
419        else
420           --
421           p_iv4 := convert_display_to_internal(p_iv4,l_uom,l_lookup_type,l_value_set_id,l_input_curr_code);
422           --
423        end if;
424     elsif (l_count = 5
425            and p_iv5 <> hr_api.g_varchar2
426            and ((l_uom = 'D' and p_date_cfmt = 'Y' and instr(p_iv5,'-',1,2) <> 0)
427                 or (l_uom = 'D' and p_date_cfmt = 'N')
428                 or (l_uom <> 'D'))) THEN
429          /*Bug 9459769*/
430          temp_iv1 := p_iv5;
431        /*Bug 8873865 */
432       /* If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv5,'/',1,1)= 3 and instr(p_iv5,'/',1,2)= 6 then
433           p_iv5 :=to_char(to_date(p_iv5,'DD/MM/YYYY HH24:MI:SS'),'DD-MON-YYYY');
434        end if;
435 
436        If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv5,'/',1,1)= 5 and instr(p_iv5,'/',1,2)= 8 then
437           p_iv5 :=to_char(to_date(p_iv5,'YYYY/MM/DD HH24:MI:SS'),'DD-MON-YYYY');
438        end if; */
439 
440 	   	If l_uom = 'D' and p_date_cfmt = 'N' then
441 				 p_iv5 :=to_char(to_date(p_iv5,l_date_prof_value),'DD-MON-RRRR');
442         end if;
443 
444        If (l_uom <> 'D' and p_int_fmt = 'N' ) then
445           hr_chkfmt.checkformat (p_iv5,l_uom,temp_iv1,null,null,'Y',lv_dummy,l_input_curr_code );
446        else
447           --
448           p_iv5 := convert_display_to_internal(p_iv5,l_uom,l_lookup_type,l_value_set_id,l_input_curr_code);
449           --
450        end if;
451     elsif (l_count = 6
452            and p_iv6 <> hr_api.g_varchar2
453            and ((l_uom = 'D' and p_date_cfmt = 'Y' and instr(p_iv6,'-',1,2) <> 0)
454                 or (l_uom = 'D' and p_date_cfmt = 'N')
455                 or (l_uom <> 'D'))) THEN
456         /*Bug 9459769*/
457         temp_iv1 := p_iv6;
458        /*Bug 8873865 */
459        /* If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv6,'/',1,1)= 3 and instr(p_iv6,'/',1,2)= 6 then
460           p_iv6 :=to_char(to_date(p_iv6,'DD/MM/YYYY HH24:MI:SS'),'DD-MON-YYYY');
461        end if;
462 
463        If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv6,'/',1,1)= 5 and instr(p_iv6,'/',1,2)= 8 then
464           p_iv6 :=to_char(to_date(p_iv6,'YYYY/MM/DD HH24:MI:SS'),'DD-MON-YYYY');
465        end if; */
466 
467 	   	If l_uom = 'D' and p_date_cfmt = 'N' then
468 				 p_iv6 :=to_char(to_date(p_iv6,l_date_prof_value),'DD-MON-RRRR');
469         end if;
470 
471        If (l_uom <> 'D' and p_int_fmt = 'N' ) then
472           hr_chkfmt.checkformat (p_iv6,l_uom,temp_iv1,null,null,'Y',lv_dummy,l_input_curr_code );
473        else
474           --
475           p_iv6 := convert_display_to_internal(p_iv6,l_uom,l_lookup_type,l_value_set_id,l_input_curr_code);
476           --
477        end if;
478     elsif (l_count = 7
479            and p_iv7 <> hr_api.g_varchar2
480            and ((l_uom = 'D' and p_date_cfmt = 'Y' and instr(p_iv7,'-',1,2) <> 0)
481                 or (l_uom = 'D' and p_date_cfmt = 'N')
482                 or (l_uom <> 'D'))) THEN
483         /*Bug 9459769*/
484         temp_iv1 := p_iv7;
485        /*Bug 8873865 */
486       /* If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv7,'/',1,1)= 3 and instr(p_iv7,'/',1,2)= 6 then
487           p_iv7 :=to_char(to_date(p_iv7,'DD/MM/YYYY HH24:MI:SS'),'DD-MON-YYYY');
488        end if;
489 
490        If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv7,'/',1,1)= 5 and instr(p_iv7,'/',1,2)= 8 then
491           p_iv7 :=to_char(to_date(p_iv7,'YYYY/MM/DD HH24:MI:SS'),'DD-MON-YYYY');
492        end if; */
493 
494 	   	If l_uom = 'D' and p_date_cfmt = 'N' then
495 				 p_iv7 :=to_char(to_date(p_iv7,l_date_prof_value),'DD-MON-RRRR');
496         end if;
497 
498        If (l_uom <> 'D' and p_int_fmt = 'N' ) then
499           hr_chkfmt.checkformat (p_iv7,l_uom,temp_iv1,null,null,'Y',lv_dummy,l_input_curr_code );
500        else
501           --
502           p_iv7 := convert_display_to_internal(p_iv7,l_uom,l_lookup_type,l_value_set_id,l_input_curr_code);
503           --
504        end if;
505     elsif (l_count = 8
506            and p_iv8 <> hr_api.g_varchar2
507            and ((l_uom = 'D' and p_date_cfmt = 'Y' and instr(p_iv8,'-',1,2) <> 0)
508                 or (l_uom = 'D' and p_date_cfmt = 'N')
509                 or (l_uom <> 'D'))) THEN
510          /*Bug 9459769*/
511         temp_iv1 := p_iv8;
512        /*Bug 8873865 */
513        /* If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv8,'/',1,1)= 3 and instr(p_iv8,'/',1,2)= 6 then
514           p_iv8 :=to_char(to_date(p_iv8,'DD/MM/YYYY HH24:MI:SS'),'DD-MON-YYYY');
515        end if;
516 
517        If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv8,'/',1,1)= 5 and instr(p_iv8,'/',1,2)= 8 then
518           p_iv8 :=to_char(to_date(p_iv8,'YYYY/MM/DD HH24:MI:SS'),'DD-MON-YYYY');
519        end if; */
520 
521 	   	If l_uom = 'D' and p_date_cfmt = 'N' then
522 				 p_iv8 :=to_char(to_date(p_iv8,l_date_prof_value),'DD-MON-RRRR');
523         end if;
524 
525        If (l_uom <> 'D' and p_int_fmt = 'N' ) then
526           hr_chkfmt.checkformat (p_iv8,l_uom,temp_iv1,null,null,'Y',lv_dummy,l_input_curr_code );
527        else
528           --
529           p_iv8 := convert_display_to_internal(p_iv8,l_uom,l_lookup_type,l_value_set_id,l_input_curr_code);
530           --
531        end if;
532     elsif (l_count = 9
533            and p_iv9 <> hr_api.g_varchar2
534            and ((l_uom = 'D' and p_date_cfmt = 'Y' and instr(p_iv9,'-',1,2) <> 0)
535                 or (l_uom = 'D' and p_date_cfmt = 'N')
536                 or (l_uom <> 'D'))) THEN
537        /*Bug 9459769*/
538        temp_iv1 := p_iv9;
539        /*Bug 8873865 */
540       /* If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv9,'/',1,1)= 3 and instr(p_iv9,'/',1,2)= 6 then
541           p_iv9 :=to_char(to_date(p_iv9,'DD/MM/YYYY HH24:MI:SS'),'DD-MON-YYYY');
542        end if;
543 
544        If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv9,'/',1,1)= 5 and instr(p_iv9,'/',1,2)= 8 then
545           p_iv9 :=to_char(to_date(p_iv9,'YYYY/MM/DD HH24:MI:SS'),'DD-MON-YYYY');
546        end if; */
547 
548 	   	If l_uom = 'D' and p_date_cfmt = 'N' then
549 				 p_iv9 :=to_char(to_date(p_iv9,l_date_prof_value),'DD-MON-RRRR');
550         end if;
551 
552        If (l_uom <> 'D' and p_int_fmt = 'N' ) then
553           hr_chkfmt.checkformat (p_iv9,l_uom,temp_iv1,null,null,'Y',lv_dummy,l_input_curr_code );
554        else
555           --
556           p_iv9 := convert_display_to_internal(p_iv9,l_uom,l_lookup_type,l_value_set_id,l_input_curr_code);
557           --
558        end if;
559     elsif (l_count = 10
560            and p_iv10 <> hr_api.g_varchar2
561            and ((l_uom = 'D' and p_date_cfmt = 'Y' and instr(p_iv10,'-',1,2) <> 0)
562                 or (l_uom = 'D' and p_date_cfmt = 'N')
563                 or (l_uom <> 'D'))) THEN
564        /*Bug 9459769*/
565        temp_iv1 := p_iv10;
566        /*Bug 8873865 */
567        /* If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv10,'/',1,1)= 3 and instr(p_iv10,'/',1,2)= 6 then
568           p_iv10 :=to_char(to_date(p_iv10,'DD/MM/YYYY HH24:MI:SS'),'DD-MON-YYYY');
569        end if;
570 
571        If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv10,'/',1,1)= 5 and instr(p_iv10,'/',1,2)= 8 then
572           p_iv10 :=to_char(to_date(p_iv10,'YYYY/MM/DD HH24:MI:SS'),'DD-MON-YYYY');
573        end if; */
574 
575 	   	If l_uom = 'D' and p_date_cfmt = 'N' then
576 				 p_iv10 :=to_char(to_date(p_iv10,l_date_prof_value),'DD-MON-RRRR');
577         end if;
578 
579        If (l_uom <> 'D' and p_int_fmt = 'N' ) then
580           hr_chkfmt.checkformat (p_iv10,l_uom,temp_iv1,null,null,'Y',lv_dummy,l_input_curr_code );
581        else
582           --
583           p_iv10 := convert_display_to_internal(p_iv10,l_uom,l_lookup_type,l_value_set_id,l_input_curr_code);
584           --
585        end if;
586     elsif (l_count = 11
587            and p_iv11 <> hr_api.g_varchar2
588            and ((l_uom = 'D' and p_date_cfmt = 'Y' and instr(p_iv11,'-',1,2) <> 0)
589                 or (l_uom = 'D' and p_date_cfmt = 'N')
590                 or (l_uom <> 'D'))) THEN
591        /*Bug 9459769*/
592        temp_iv1 := p_iv11;
593        /*Bug 8873865 */
594        /* If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv11,'/',1,1)= 3 and instr(p_iv11,'/',1,2)= 6 then
595           p_iv11 :=to_char(to_date(p_iv11,'DD/MM/YYYY HH24:MI:SS'),'DD-MON-YYYY');
596        end if;
597 
598        If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv11,'/',1,1)= 5 and instr(p_iv11,'/',1,2)= 8 then
599           p_iv11 :=to_char(to_date(p_iv11,'YYYY/MM/DD HH24:MI:SS'),'DD-MON-YYYY');
600        end if; */
601 
602 	   	If l_uom = 'D' and p_date_cfmt = 'N' then
603 				 p_iv11 :=to_char(to_date(p_iv11,l_date_prof_value),'DD-MON-RRRR');
604         end if;
605 
606        If (l_uom <> 'D' and p_int_fmt = 'N' ) then
607           hr_chkfmt.checkformat (p_iv11,l_uom,temp_iv1,null,null,'Y',lv_dummy,l_input_curr_code );
608        else
609           --
610           p_iv11 := convert_display_to_internal(p_iv11,l_uom,l_lookup_type,l_value_set_id,l_input_curr_code);
611           --
612        end if;
613     elsif (l_count = 12
614            and p_iv12 <> hr_api.g_varchar2
615            and ((l_uom = 'D' and p_date_cfmt = 'Y' and instr(p_iv12,'-',1,2) <> 0)
616                 or (l_uom = 'D' and p_date_cfmt = 'N')
617                 or (l_uom <> 'D'))) then
618        /*Bug 9459769*/
619        temp_iv1 := p_iv12;
620        /*Bug 8873865 */
621        /* If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv12,'/',1,1)= 3 and instr(p_iv12,'/',1,2)= 6 then
622           p_iv12 :=to_char(to_date(p_iv12,'DD/MM/YYYY HH24:MI:SS'),'DD-MON-YYYY');
623        end if;
624 
625        If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv12,'/',1,1)= 5 and instr(p_iv12,'/',1,2)= 8 then
626           p_iv12 :=to_char(to_date(p_iv12,'YYYY/MM/DD HH24:MI:SS'),'DD-MON-YYYY');
627        end if; */
628 
629 	   	If l_uom = 'D' and p_date_cfmt = 'N' then
630 				 p_iv12 :=to_char(to_date(p_iv12,l_date_prof_value),'DD-MON-RRRR');
631         end if;
632 
633        If (l_uom <> 'D' and p_int_fmt = 'N' ) then
634           hr_chkfmt.checkformat (p_iv12,l_uom,temp_iv1,null,null,'Y',lv_dummy,l_input_curr_code );
635        else
636            --
637           p_iv12 := convert_display_to_internal(p_iv12,l_uom,l_lookup_type,l_value_set_id,l_input_curr_code);
638           --
639        end if;
640     elsif (l_count = 13
641            and p_iv13 <> hr_api.g_varchar2
642            and ((l_uom = 'D' and p_date_cfmt = 'Y' and instr(p_iv13,'-',1,2) <> 0)
643                 or (l_uom = 'D' and p_date_cfmt = 'N')
644                 or (l_uom <> 'D'))) then
645        /*Bug 9459769*/
646        temp_iv1 := p_iv13;
647        /*Bug 8873865 */
648        /* If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv13,'/',1,1)= 3 and instr(p_iv13,'/',1,2)= 6 then
649           p_iv13 :=to_char(to_date(p_iv13,'DD/MM/YYYY HH24:MI:SS'),'DD-MON-YYYY');
650        end if;
651        If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv13,'/',1,1)= 5 and instr(p_iv13,'/',1,2)= 8 then
652           p_iv13 :=to_char(to_date(p_iv13,'YYYY/MM/DD HH24:MI:SS'),'DD-MON-YYYY');
653        end if; */
654 
655 	   	If l_uom = 'D' and p_date_cfmt = 'N' then
656 				 p_iv13 :=to_char(to_date(p_iv13,l_date_prof_value),'DD-MON-RRRR');
657         end if;
658 
659        If (l_uom <> 'D' and p_int_fmt = 'N' ) then
660           hr_chkfmt.checkformat (p_iv13,l_uom,temp_iv1,null,null,'Y',lv_dummy,l_input_curr_code );
661        else
662           --
663           p_iv13 := convert_display_to_internal(p_iv13,l_uom,l_lookup_type,l_value_set_id,l_input_curr_code);
664           --
665        end if;
666     elsif (l_count = 14
667            and p_iv14 <> hr_api.g_varchar2
668            and ((l_uom = 'D' and p_date_cfmt = 'Y' and instr(p_iv14,'-',1,2) <> 0)
669                 or (l_uom = 'D' and p_date_cfmt = 'N')
670                 or (l_uom <> 'D'))) then
671        /*Bug 9459769*/
672        temp_iv1 := p_iv14;
673        /*Bug 8873865 */
674        /* If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv14,'/',1,1)= 3 and instr(p_iv14,'/',1,2)= 6 then
675           p_iv14 :=to_char(to_date(p_iv14,'DD/MM/YYYY HH24:MI:SS'),'DD-MON-YYYY');
676        end if;
677 
678        If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv14,'/',1,1)= 5 and instr(p_iv14,'/',1,2)= 8 then
679           p_iv14 :=to_char(to_date(p_iv14,'YYYY/MM/DD HH24:MI:SS'),'DD-MON-YYYY');
680        end if; */
681 
682 	   	If l_uom = 'D' and p_date_cfmt = 'N' then
683 				 p_iv14 :=to_char(to_date(p_iv14,l_date_prof_value),'DD-MON-RRRR');
684         end if;
685 
686        If (l_uom <> 'D' and p_int_fmt = 'N' ) then
687           hr_chkfmt.checkformat (p_iv14,l_uom,temp_iv1,null,null,'Y',lv_dummy,l_input_curr_code );
688        else
689           --
690           p_iv14 := convert_display_to_internal(p_iv14,l_uom,l_lookup_type,l_value_set_id,l_input_curr_code);
691           --
692        end if;
693     elsif (l_count = 15
694            and p_iv15 <> hr_api.g_varchar2
695            and ((l_uom = 'D' and p_date_cfmt = 'Y' and instr(p_iv15,'-',1,2) <> 0)
696                 or (l_uom = 'D' and p_date_cfmt = 'N')
697                 or (l_uom <> 'D'))) then
698         /*Bug 9459769*/
699        temp_iv1 := p_iv15;
700        /*Bug 8873865 */
701        /* If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv15,'/',1,1)= 3 and instr(p_iv15,'/',1,2)= 6 then
702           p_iv15 :=to_char(to_date(p_iv15,'DD/MM/YYYY HH24:MI:SS'),'DD-MON-YYYY');
703        end if;
704 
705        If l_uom = 'D' and p_date_cfmt = 'N' and instr(p_iv15,'/',1,1)= 5 and instr(p_iv15,'/',1,2)= 8 then
706           p_iv15 :=to_char(to_date(p_iv15,'YYYY/MM/DD HH24:MI:SS'),'DD-MON-YYYY');
707        end if; */
708 
709 	   	If l_uom = 'D' and p_date_cfmt = 'N' then
710 				 p_iv15 :=to_char(to_date(p_iv15,l_date_prof_value),'DD-MON-RRRR');
711         end if;
712 
713        If (l_uom <> 'D' and p_int_fmt = 'N' ) then
714           hr_chkfmt.checkformat (p_iv15,l_uom,temp_iv1,null,null,'Y',lv_dummy,l_input_curr_code );
715        else
716           --
717           p_iv15 := convert_display_to_internal(p_iv15,l_uom,l_lookup_type,l_value_set_id,l_input_curr_code);
718           --
719        end if;
720     end if;
721     --
722    /*Bug 9459769*/
723    temp_iv1 := null;
724   end loop;
725   --
726   close csr_table_inp_ids;
727   --
728   hr_utility.set_location('Leaving:'|| l_proc, 20);
729   --
730 exception
731   when others then
732     --fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
733     --fnd_message.set_token('PROCEDURE', l_proc);
734     --fnd_message.set_token('STEP','10');
735     --fnd_message.raise_error;
736     fnd_message.set_name ('PAY','PAY_6306_INPUT_VALUE_FORMAT');
737     fnd_message.set_token ('UNIT_OF_MEASURE', hr_general.decode_lookup ('UNITS', l_uom ));
738     fnd_message.raise_error;
739 end convert_date_to_canonical;
740 --
741 -- ----------------------------------------------------------------------------
742 -- |------------------------< create_batch_header >-------------------------|
743 -- ----------------------------------------------------------------------------
744 --
745 procedure create_batch_header
746   (p_validate                      in     boolean  default false
747   ,p_session_date                  in     date
748   ,p_batch_name                    in     varchar2
749   ,p_batch_status                  in     varchar2 default 'U'
750   ,p_business_group_id             in     number
751   ,p_action_if_exists              in     varchar2 default 'R'
752   ,p_batch_reference               in     varchar2 default null
753   ,p_batch_source                  in     varchar2 default null
754   ,p_comments                      in     varchar2 default null
755   ,p_date_effective_changes        in     varchar2 default null
756   ,p_purge_after_transfer          in     varchar2 default 'N'
757   ,p_reject_if_future_changes      in     varchar2 default 'Y'
758   ,p_batch_id                         out nocopy number
759   ,p_object_version_number            out nocopy number
760   ,p_reject_if_results_exists      in     varchar2 default 'Y'
761   ,p_purge_after_rollback          in     varchar2 default 'N'
762   ,p_batch_type                    in     varchar2 default null
763   ,p_REJECT_ENTRY_NOT_REMOVED      in     varchar2 default 'N'
764   ,p_ROLLBACK_ENTRY_UPDATES        in     varchar2 default 'N'
765   ) is
766   --
767   -- Declare cursors and local variables
768   --
769   l_proc                   varchar2(72) := g_package||'create_batch_header';
770   l_batch_id               pay_batch_headers.batch_id%TYPE;
771   l_object_version_number  pay_batch_headers.object_version_number%TYPE;
772   l_session_date           date;
773   --
774 begin
775   hr_utility.set_location('Entering:'|| l_proc, 10);
776   --
777   -- Issue a savepoint
778   --
779   savepoint create_batch_header;
780   --
781   -- Truncate the time portion from all IN date parameters
782   --
783   l_session_date := trunc(p_session_date);
784   --
785   -- Call Before Process User Hook
786   --
787   begin
788     pay_batch_element_entry_bk1.create_batch_header_b
789       (p_session_date                   => l_session_date
790       ,p_batch_name                     => p_batch_name
791       ,p_batch_status                   => p_batch_status
792       ,p_business_group_id              => p_business_group_id
793       ,p_action_if_exists               => p_action_if_exists
794       ,p_batch_reference                => p_batch_reference
795       ,p_batch_source                   => p_batch_source
796       ,p_comments                       => p_comments
797       ,p_date_effective_changes         => p_date_effective_changes
798       ,p_purge_after_transfer           => p_purge_after_transfer
799       ,p_reject_if_future_changes       => p_reject_if_future_changes
800       ,p_reject_if_results_exists       => p_reject_if_results_exists
801       ,p_purge_after_rollback           => p_purge_after_rollback
802       ,p_batch_type                     => p_batch_type
803       ,p_REJECT_ENTRY_NOT_REMOVED       => p_REJECT_ENTRY_NOT_REMOVED
804       ,p_ROLLBACK_ENTRY_UPDATES         => p_ROLLBACK_ENTRY_UPDATES
805       );
806   exception
807     when hr_api.cannot_find_prog_unit then
808       hr_api.cannot_find_prog_unit_error
809         (p_module_name => 'create_batch_header_b'
810         ,p_hook_type   => 'BP'
811         );
812   end;
813   --
814   -- Validation in addition to Row Handlers
815   --
816 
817   /* Bug 12687744 : BEE Header name should not be duplicated */
818   declare
819     l_temp_var varchar(2);
820   begin
821     select 'Y'
822     into   l_temp_var
823     from   dual
824     where  EXISTS (
825            select 1
826            from   pay_batch_headers
827            where  upper(batch_name) = upper(p_batch_name)
828            and    business_group_id = p_business_group_id);
829 
830     hr_utility.set_message(801, 'PAY_500013_BEE_DUPL_HEADER');
831     hr_utility.raise_error;
832 
833   exception
834     when no_data_found then
835       null;
836 
837   end;
838   /* Bug 12687744 - Ends */
839 
840   --
841   -- Process Logic
842   --
843   pay_bth_ins.ins
844       (p_session_date             => l_session_date
845       ,p_business_group_id        => p_business_group_id
846       ,p_batch_name               => p_batch_name
847       ,p_batch_status             => p_batch_status
848       ,p_action_if_exists         => p_action_if_exists
849       ,p_batch_reference          => p_batch_reference
850       ,p_batch_source             => p_batch_source
851       ,p_batch_type               => p_batch_type
852       ,p_comments                 => p_comments
853       ,p_date_effective_changes   => p_date_effective_changes
854       ,p_purge_after_transfer     => p_purge_after_transfer
855       ,p_reject_if_future_changes => p_reject_if_future_changes
856       ,p_reject_if_results_exists => p_reject_if_results_exists
857       ,p_purge_after_rollback     => p_purge_after_rollback
858       ,p_REJECT_ENTRY_NOT_REMOVED => p_REJECT_ENTRY_NOT_REMOVED
859       ,p_ROLLBACK_ENTRY_UPDATES   => p_ROLLBACK_ENTRY_UPDATES
860       ,p_batch_id                 => l_batch_id
861       ,p_object_version_number    => l_object_version_number);
862   --
863   -- Call After Process User Hook
864   --
865   begin
866     pay_batch_element_entry_bk1.create_batch_header_a
867       (p_session_date                   => l_session_date
868       ,p_batch_name                     => p_batch_name
869       ,p_batch_status                   => p_batch_status
870       ,p_business_group_id              => p_business_group_id
871       ,p_action_if_exists               => p_action_if_exists
872       ,p_batch_reference                => p_batch_reference
873       ,p_batch_source                   => p_batch_source
874       ,p_comments                       => p_comments
875       ,p_date_effective_changes         => p_date_effective_changes
876       ,p_purge_after_transfer           => p_purge_after_transfer
877       ,p_reject_if_future_changes       => p_reject_if_future_changes
878       ,p_batch_id                       => l_batch_id
879       ,p_object_version_number          => l_object_version_number
880       ,p_reject_if_results_exists       => p_reject_if_results_exists
881       ,p_purge_after_rollback           => p_purge_after_rollback
882       ,p_batch_type                     => p_batch_type
883       ,p_REJECT_ENTRY_NOT_REMOVED       => p_REJECT_ENTRY_NOT_REMOVED
884       ,p_ROLLBACK_ENTRY_UPDATES         => p_ROLLBACK_ENTRY_UPDATES
885       );
886   exception
887     when hr_api.cannot_find_prog_unit then
888       hr_api.cannot_find_prog_unit_error
889         (p_module_name => 'create_batch_header_a'
890         ,p_hook_type   => 'AP'
891         );
892   end;
893   --
894   -- When in validation only mode raise the Validate_Enabled exception
895   --
896   if p_validate then
897     raise hr_api.validate_enabled;
898   end if;
899   --
900   -- Set all output arguments
901   --
902   p_batch_id               := l_batch_id;
903   p_object_version_number  := l_object_version_number;
904   --
905   hr_utility.set_location(' Leaving:'||l_proc, 70);
906 exception
907   when hr_api.validate_enabled then
908     --
909     -- As the Validate_Enabled exception has been raised
910     -- we must rollback to the savepoint
911     --
912     rollback to create_batch_header;
913     --
914     -- Only set output warning arguments
915     -- (Any key or derived arguments must be set to null
916     -- when validation only mode is being used.)
917     --
918     p_batch_id               := null;
919     p_object_version_number  := null;
920     hr_utility.set_location(' Leaving:'||l_proc, 80);
921   when others then
922     --
923     -- A validation or unexpected error has occured
924     --
925     rollback to create_batch_header;
926     p_batch_id               := null;
927     p_object_version_number  := null;
928     hr_utility.set_location(' Leaving:'||l_proc, 90);
929     raise;
930 end create_batch_header;
931 --
932 --
933 -- ----------------------------------------------------------------------------
934 -- |-------------------------< create_batch_line >--------------------------|
935 -- ----------------------------------------------------------------------------
936 --
937 procedure create_batch_line
938   (p_validate                      in     boolean  default false
939   ,p_session_date                  in     date
940   ,p_batch_id                      in     number
941   ,p_batch_line_status             in     varchar2 default 'U'
942   ,p_assignment_id                 in     number   default null
943   ,p_assignment_number             in     varchar2 default null
944   ,p_attribute_category            in     varchar2 default null
945   ,p_attribute1                    in     varchar2 default null
946   ,p_attribute2                    in     varchar2 default null
947   ,p_attribute3                    in     varchar2 default null
948   ,p_attribute4                    in     varchar2 default null
949   ,p_attribute5                    in     varchar2 default null
950   ,p_attribute6                    in     varchar2 default null
951   ,p_attribute7                    in     varchar2 default null
952   ,p_attribute8                    in     varchar2 default null
953   ,p_attribute9                    in     varchar2 default null
954   ,p_attribute10                   in     varchar2 default null
955   ,p_attribute11                   in     varchar2 default null
956   ,p_attribute12                   in     varchar2 default null
957   ,p_attribute13                   in     varchar2 default null
958   ,p_attribute14                   in     varchar2 default null
959   ,p_attribute15                   in     varchar2 default null
960   ,p_attribute16                   in     varchar2 default null
961   ,p_attribute17                   in     varchar2 default null
962   ,p_attribute18                   in     varchar2 default null
963   ,p_attribute19                   in     varchar2 default null
964   ,p_attribute20                   in     varchar2 default null
965   ,p_entry_information_category    in     varchar2 default null
966   ,p_entry_information1            in     varchar2 default null
967   ,p_entry_information2            in     varchar2 default null
968   ,p_entry_information3            in     varchar2 default null
969   ,p_entry_information4            in     varchar2 default null
970   ,p_entry_information5            in     varchar2 default null
971   ,p_entry_information6            in     varchar2 default null
972   ,p_entry_information7            in     varchar2 default null
973   ,p_entry_information8            in     varchar2 default null
974   ,p_entry_information9            in     varchar2 default null
975   ,p_entry_information10           in     varchar2 default null
976   ,p_entry_information11           in     varchar2 default null
977   ,p_entry_information12           in     varchar2 default null
978   ,p_entry_information13           in     varchar2 default null
979   ,p_entry_information14           in     varchar2 default null
980   ,p_entry_information15           in     varchar2 default null
981   ,p_entry_information16           in     varchar2 default null
982   ,p_entry_information17           in     varchar2 default null
983   ,p_entry_information18           in     varchar2 default null
984   ,p_entry_information19           in     varchar2 default null
985   ,p_entry_information20           in     varchar2 default null
986   ,p_entry_information21           in     varchar2 default null
987   ,p_entry_information22           in     varchar2 default null
988   ,p_entry_information23           in     varchar2 default null
989   ,p_entry_information24           in     varchar2 default null
990   ,p_entry_information25           in     varchar2 default null
991   ,p_entry_information26           in     varchar2 default null
992   ,p_entry_information27           in     varchar2 default null
993   ,p_entry_information28           in     varchar2 default null
994   ,p_entry_information29           in     varchar2 default null
995   ,p_entry_information30           in     varchar2 default null
996   ,p_date_earned                   in     date     default null
997   ,p_personal_payment_method_id    in     number   default null
998   ,p_subpriority                   in     number   default null
999   ,p_batch_sequence                in     number   default null
1000   ,p_concatenated_segments         in     varchar2 default null
1001   ,p_cost_allocation_keyflex_id    in     number   default null
1002   ,p_effective_date                in     date     default null
1003   ,p_effective_start_date          in     date     default null
1004   ,p_effective_end_date            in     date     default null
1005   ,p_element_name                  in     varchar2 default null
1006   ,p_element_type_id               in     number   default null
1007   ,p_entry_type                    in     varchar2 default null
1008   ,p_reason                        in     varchar2 default null
1009   ,p_segment1                      in     varchar2 default null
1010   ,p_segment2                      in     varchar2 default null
1011   ,p_segment3                      in     varchar2 default null
1012   ,p_segment4                      in     varchar2 default null
1013   ,p_segment5                      in     varchar2 default null
1014   ,p_segment6                      in     varchar2 default null
1015   ,p_segment7                      in     varchar2 default null
1016   ,p_segment8                      in     varchar2 default null
1017   ,p_segment9                      in     varchar2 default null
1018   ,p_segment10                     in     varchar2 default null
1019   ,p_segment11                     in     varchar2 default null
1020   ,p_segment12                     in     varchar2 default null
1021   ,p_segment13                     in     varchar2 default null
1022   ,p_segment14                     in     varchar2 default null
1023   ,p_segment15                     in     varchar2 default null
1024   ,p_segment16                     in     varchar2 default null
1025   ,p_segment17                     in     varchar2 default null
1026   ,p_segment18                     in     varchar2 default null
1027   ,p_segment19                     in     varchar2 default null
1028   ,p_segment20                     in     varchar2 default null
1029   ,p_segment21                     in     varchar2 default null
1030   ,p_segment22                     in     varchar2 default null
1031   ,p_segment23                     in     varchar2 default null
1032   ,p_segment24                     in     varchar2 default null
1033   ,p_segment25                     in     varchar2 default null
1034   ,p_segment26                     in     varchar2 default null
1035   ,p_segment27                     in     varchar2 default null
1036   ,p_segment28                     in     varchar2 default null
1037   ,p_segment29                     in     varchar2 default null
1038   ,p_segment30                     in     varchar2 default null
1039   ,p_value_1                       in     varchar2 default null
1040   ,p_value_2                       in     varchar2 default null
1041   ,p_value_3                       in     varchar2 default null
1042   ,p_value_4                       in     varchar2 default null
1043   ,p_value_5                       in     varchar2 default null
1044   ,p_value_6                       in     varchar2 default null
1045   ,p_value_7                       in     varchar2 default null
1046   ,p_value_8                       in     varchar2 default null
1047   ,p_value_9                       in     varchar2 default null
1048   ,p_value_10                      in     varchar2 default null
1049   ,p_value_11                      in     varchar2 default null
1050   ,p_value_12                      in     varchar2 default null
1051   ,p_value_13                      in     varchar2 default null
1052   ,p_value_14                      in     varchar2 default null
1053   ,p_value_15                      in     varchar2 default null
1054   ,p_canonical_date_format         in     varchar2 default 'Y'
1055   ,p_iv_all_internal_format        in     varchar2 default 'N'
1056   ,p_batch_line_id                    out nocopy number
1057   ,p_object_version_number            out nocopy number
1058   ) is
1059   --
1060   -- Declare cursors and local variables
1061   --
1062   l_proc                   varchar2(72) := g_package||'create_batch_line';
1063   l_batch_line_id          pay_batch_lines.batch_line_id%TYPE;
1064   l_object_version_number  pay_batch_lines.object_version_number%TYPE;
1065   l_session_date           date;
1066   l_effective_date         date;
1067   l_effective_start_date   date;
1068   l_effective_end_date     date;
1069   l_date_earned            date;
1070   --
1071   l_value_1                pay_batch_lines.value_1%TYPE := p_value_1;
1072   l_value_2                pay_batch_lines.value_2%TYPE := p_value_2;
1073   l_value_3                pay_batch_lines.value_3%TYPE := p_value_3;
1074   l_value_4                pay_batch_lines.value_4%TYPE := p_value_4;
1075   l_value_5                pay_batch_lines.value_5%TYPE := p_value_5;
1076   l_value_6                pay_batch_lines.value_6%TYPE := p_value_6;
1077   l_value_7                pay_batch_lines.value_7%TYPE := p_value_7;
1078   l_value_8                pay_batch_lines.value_8%TYPE := p_value_8;
1079   l_value_9                pay_batch_lines.value_9%TYPE := p_value_9;
1080   l_value_10               pay_batch_lines.value_10%TYPE := p_value_10;
1081   l_value_11               pay_batch_lines.value_11%TYPE := p_value_11;
1082   l_value_12               pay_batch_lines.value_12%TYPE := p_value_12;
1083   l_value_13               pay_batch_lines.value_13%TYPE := p_value_13;
1084   l_value_14               pay_batch_lines.value_14%TYPE := p_value_14;
1085   l_value_15               pay_batch_lines.value_15%TYPE := p_value_15;
1086   --
1087   l_bee_iv_upgrade  varchar2(1);
1088   --
1089   CURSOR CSR_CHECK_FND_SESSION (p_eff_date date)
1090   is
1091   select session_id
1092   from fnd_sessions
1093   where session_id = userenv('sessionid')
1094   and effective_date = p_eff_date;
1095   --
1096   LR_CHECK_FND_SESSION CSR_CHECK_FND_SESSION%ROWTYPE;
1097   --
1098 begin
1099   hr_utility.set_location('Entering:'|| l_proc, 10);
1100   --
1101   -- Issue a savepoint
1102   --
1103   savepoint create_batch_line;
1104   --
1105   -- Truncate the time portion from all IN date parameters
1106   --
1107   l_session_date         := trunc(p_session_date);
1108   --l_effective_date       := trunc(p_effective_date);
1109 /*If effective date is not passed, then we are setting the session date
1110     passed as effective date.*/
1111   if (p_effective_date is null) then
1112       l_effective_date := trunc(p_session_date);
1113   else
1114       l_effective_date := trunc(p_effective_date);
1115   end if;
1116   l_effective_start_date := trunc(p_effective_start_date);
1117   l_effective_end_date   := trunc(p_effective_end_date);
1118   l_date_earned          := trunc(p_date_earned);
1119 
1120     --Insert row into fnd_Sessions table.
1121   OPEN  CSR_CHECK_FND_SESSION (l_effective_date);
1122 	  FETCH CSR_CHECK_FND_SESSION INTO LR_CHECK_FND_SESSION;
1123   IF CSR_CHECK_FND_SESSION%notfound
1124   THEN
1125 	  INSERT INTO fnd_sessions(session_id, effective_date) VALUES(userenv('sessionid'), l_effective_date);
1126   END IF;
1127 
1128   CLOSE CSR_CHECK_FND_SESSION;
1129   --
1130   --
1131   l_bee_iv_upgrade := get_upgrade_status(p_batch_id,null,'BEE_IV_UPG');
1132   --
1133   -- Check whether the upgrade process is in progress.
1134   --
1135   if l_bee_iv_upgrade = 'E' then
1136      hr_utility.set_message(800, 'HR_449106_BEE_UPGRADING');
1137      hr_utility.raise_error;
1138   end if;
1139   --
1140   if p_iv_all_internal_format = 'Y' and l_bee_iv_upgrade = 'N' then
1141     fnd_message.set_name('PAY', 'HR_7462_PLK_INVLD_VALUE');
1142     fnd_message.set_token('COLUMN_NAME','P_IV_ALL_INTERNAL_FORMAT');
1143     fnd_message.raise_error;
1144   end if;
1145   --
1146   if p_iv_all_internal_format = 'Y' and p_canonical_date_format = 'N' then
1147     fnd_message.set_name('PAY', 'HR_7462_PLK_INVLD_VALUE');
1148     fnd_message.set_token('COLUMN_NAME','P_CANONICAL_DATE_FORMAT');
1149     fnd_message.raise_error;
1150   end if;
1151   --
1152   --
1153   if p_iv_all_internal_format <> 'Y' then
1154      convert_date_to_canonical
1155      (p_iv1               => l_value_1
1156      ,p_iv2               => l_value_2
1157      ,p_iv3               => l_value_3
1158      ,p_iv4               => l_value_4
1159      ,p_iv5               => l_value_5
1160      ,p_iv6               => l_value_6
1161      ,p_iv7               => l_value_7
1162      ,p_iv8               => l_value_8
1163      ,p_iv9               => l_value_9
1164      ,p_iv10              => l_value_10
1165      ,p_iv11              => l_value_11
1166      ,p_iv12              => l_value_12
1167      ,p_iv13              => l_value_13
1168      ,p_iv14              => l_value_14
1169      ,p_iv15              => l_value_15
1170      ,p_element_type_id   => p_element_type_id
1171      ,p_element_name      => p_element_name
1172      ,p_batch_id          => p_batch_id
1173      ,p_effective_date    => l_effective_date
1174      ,p_date_cfmt         => p_canonical_date_format
1175      ,p_int_fmt           => l_bee_iv_upgrade
1176      );
1177   end if;
1178   --
1179   -- Call Before Process User Hook
1180   --
1181   begin
1182     pay_batch_element_entry_bk2.create_batch_line_b
1183       (p_session_date                   => l_session_date
1184       ,p_batch_id                       => p_batch_id
1185       ,p_batch_line_status              => p_batch_line_status
1186       ,p_assignment_id                  => p_assignment_id
1187       ,p_assignment_number              => p_assignment_number
1188       ,p_attribute_category             => p_attribute_category
1189       ,p_attribute1                     => p_attribute1
1190       ,p_attribute2                     => p_attribute2
1191       ,p_attribute3                     => p_attribute3
1192       ,p_attribute4                     => p_attribute4
1193       ,p_attribute5                     => p_attribute5
1194       ,p_attribute6                     => p_attribute6
1195       ,p_attribute7                     => p_attribute7
1196       ,p_attribute8                     => p_attribute8
1197       ,p_attribute9                     => p_attribute9
1198       ,p_attribute10                    => p_attribute10
1199       ,p_attribute11                    => p_attribute11
1200       ,p_attribute12                    => p_attribute12
1201       ,p_attribute13                    => p_attribute13
1202       ,p_attribute14                    => p_attribute14
1203       ,p_attribute15                    => p_attribute15
1204       ,p_attribute16                    => p_attribute16
1205       ,p_attribute17                    => p_attribute17
1206       ,p_attribute18                    => p_attribute18
1207       ,p_attribute19                    => p_attribute19
1208       ,p_attribute20                    => p_attribute20
1209       ,p_entry_information_category     => p_entry_information_category
1210       ,p_entry_information1             => p_entry_information1
1211       ,p_entry_information2             => p_entry_information2
1212       ,p_entry_information3             => p_entry_information3
1213       ,p_entry_information4             => p_entry_information4
1214       ,p_entry_information5             => p_entry_information5
1215       ,p_entry_information6             => p_entry_information6
1216       ,p_entry_information7             => p_entry_information7
1217       ,p_entry_information8             => p_entry_information8
1218       ,p_entry_information9             => p_entry_information9
1219       ,p_entry_information10            => p_entry_information10
1220       ,p_entry_information11            => p_entry_information11
1221       ,p_entry_information12            => p_entry_information12
1222       ,p_entry_information13            => p_entry_information13
1223       ,p_entry_information14            => p_entry_information14
1224       ,p_entry_information15            => p_entry_information15
1225       ,p_entry_information16            => p_entry_information16
1226       ,p_entry_information17            => p_entry_information17
1227       ,p_entry_information18            => p_entry_information18
1228       ,p_entry_information19            => p_entry_information19
1229       ,p_entry_information20            => p_entry_information20
1230       ,p_entry_information21            => p_entry_information21
1231       ,p_entry_information22            => p_entry_information22
1232       ,p_entry_information23            => p_entry_information23
1233       ,p_entry_information24            => p_entry_information24
1234       ,p_entry_information25            => p_entry_information25
1235       ,p_entry_information26            => p_entry_information26
1236       ,p_entry_information27            => p_entry_information27
1237       ,p_entry_information28            => p_entry_information28
1238       ,p_entry_information29            => p_entry_information29
1239       ,p_entry_information30            => p_entry_information30
1240       ,p_date_earned                    => l_date_earned
1241       ,p_personal_payment_method_id     => p_personal_payment_method_id
1242       ,p_subpriority                    => p_subpriority
1243       ,p_batch_sequence                 => p_batch_sequence
1244       ,p_concatenated_segments          => p_concatenated_segments
1245       ,p_cost_allocation_keyflex_id     => p_cost_allocation_keyflex_id
1246       ,p_effective_date                 => l_effective_date
1247       ,p_effective_start_date           => l_effective_start_date
1248       ,p_effective_end_date             => l_effective_end_date
1249       ,p_element_name                   => p_element_name
1250       ,p_element_type_id                => p_element_type_id
1251       ,p_entry_type                     => p_entry_type
1252       ,p_reason                         => p_reason
1253       ,p_segment1                       => p_segment1
1254       ,p_segment2                       => p_segment2
1255       ,p_segment3                       => p_segment3
1256       ,p_segment4                       => p_segment4
1257       ,p_segment5                       => p_segment5
1258       ,p_segment6                       => p_segment6
1259       ,p_segment7                       => p_segment7
1260       ,p_segment8                       => p_segment8
1261       ,p_segment9                       => p_segment9
1262       ,p_segment10                      => p_segment10
1263       ,p_segment11                      => p_segment11
1264       ,p_segment12                      => p_segment12
1265       ,p_segment13                      => p_segment13
1266       ,p_segment14                      => p_segment14
1267       ,p_segment15                      => p_segment15
1268       ,p_segment16                      => p_segment16
1269       ,p_segment17                      => p_segment17
1270       ,p_segment18                      => p_segment18
1271       ,p_segment19                      => p_segment19
1272       ,p_segment20                      => p_segment20
1273       ,p_segment21                      => p_segment21
1274       ,p_segment22                      => p_segment22
1275       ,p_segment23                      => p_segment23
1276       ,p_segment24                      => p_segment24
1277       ,p_segment25                      => p_segment25
1278       ,p_segment26                      => p_segment26
1279       ,p_segment27                      => p_segment27
1280       ,p_segment28                      => p_segment28
1281       ,p_segment29                      => p_segment29
1282       ,p_segment30                      => p_segment30
1283       ,p_value_1                        => l_value_1
1284       ,p_value_2                        => l_value_2
1285       ,p_value_3                        => l_value_3
1286       ,p_value_4                        => l_value_4
1287       ,p_value_5                        => l_value_5
1288       ,p_value_6                        => l_value_6
1289       ,p_value_7                        => l_value_7
1290       ,p_value_8                        => l_value_8
1291       ,p_value_9                        => l_value_9
1292       ,p_value_10                       => l_value_10
1293       ,p_value_11                       => l_value_11
1294       ,p_value_12                       => l_value_12
1295       ,p_value_13                       => l_value_13
1296       ,p_value_14                       => l_value_14
1297       ,p_value_15                       => l_value_15
1298       );
1299   exception
1300     when hr_api.cannot_find_prog_unit then
1301       hr_api.cannot_find_prog_unit_error
1302         (p_module_name => 'create_batch_line_b'
1303         ,p_hook_type   => 'BP'
1304         );
1305   end;
1306   --
1307   -- Validation in addition to Row Handlers
1308   --
1309   --
1310   -- Process Logic
1311   --
1312   pay_btl_ins.ins
1313       (p_session_date                => l_session_date
1314       ,p_batch_id                    => p_batch_id
1315       ,p_batch_line_status           => p_batch_line_status
1316       ,p_cost_allocation_keyflex_id  => p_cost_allocation_keyflex_id
1317       ,p_element_type_id             => p_element_type_id
1318       ,p_assignment_id               => p_assignment_id
1319       ,p_assignment_number           => p_assignment_number
1320       ,p_batch_sequence              => p_batch_sequence
1321       ,p_concatenated_segments       => p_concatenated_segments
1322       ,p_effective_date              => l_effective_date
1323       ,p_element_name                => p_element_name
1324       ,p_entry_type                  => p_entry_type
1325       ,p_reason                      => p_reason
1326       ,p_segment1                    => p_segment1
1327       ,p_segment2                    => p_segment2
1328       ,p_segment3                    => p_segment3
1329       ,p_segment4                    => p_segment4
1330       ,p_segment5                    => p_segment5
1331       ,p_segment6                    => p_segment6
1332       ,p_segment7                    => p_segment7
1333       ,p_segment8                    => p_segment8
1334       ,p_segment9                    => p_segment9
1335       ,p_segment10                   => p_segment10
1336       ,p_segment11                   => p_segment11
1337       ,p_segment12                   => p_segment12
1338       ,p_segment13                   => p_segment13
1339       ,p_segment14                   => p_segment14
1340       ,p_segment15                   => p_segment15
1341       ,p_segment16                   => p_segment16
1342       ,p_segment17                   => p_segment17
1343       ,p_segment18                   => p_segment18
1344       ,p_segment19                   => p_segment19
1345       ,p_segment20                   => p_segment20
1346       ,p_segment21                   => p_segment21
1347       ,p_segment22                   => p_segment22
1348       ,p_segment23                   => p_segment23
1349       ,p_segment24                   => p_segment24
1350       ,p_segment25                   => p_segment25
1351       ,p_segment26                   => p_segment26
1352       ,p_segment27                   => p_segment27
1353       ,p_segment28                   => p_segment28
1354       ,p_segment29                   => p_segment29
1355       ,p_segment30                   => p_segment30
1356       ,p_value_1                     => l_value_1
1357       ,p_value_2                     => l_value_2
1358       ,p_value_3                     => l_value_3
1359       ,p_value_4                     => l_value_4
1360       ,p_value_5                     => l_value_5
1361       ,p_value_6                     => l_value_6
1362       ,p_value_7                     => l_value_7
1363       ,p_value_8                     => l_value_8
1364       ,p_value_9                     => l_value_9
1365       ,p_value_10                    => l_value_10
1366       ,p_value_11                    => l_value_11
1367       ,p_value_12                    => l_value_12
1368       ,p_value_13                    => l_value_13
1369       ,p_value_14                    => l_value_14
1370       ,p_value_15                    => l_value_15
1371       ,p_attribute_category          => p_attribute_category
1372       ,p_attribute1                  => p_attribute1
1373       ,p_attribute2                  => p_attribute2
1374       ,p_attribute3                  => p_attribute3
1375       ,p_attribute4                  => p_attribute4
1376       ,p_attribute5                  => p_attribute5
1377       ,p_attribute6                  => p_attribute6
1378       ,p_attribute7                  => p_attribute7
1379       ,p_attribute8                  => p_attribute8
1380       ,p_attribute9                  => p_attribute9
1381       ,p_attribute10                 => p_attribute10
1382       ,p_attribute11                 => p_attribute11
1383       ,p_attribute12                 => p_attribute12
1384       ,p_attribute13                 => p_attribute13
1385       ,p_attribute14                 => p_attribute14
1386       ,p_attribute15                 => p_attribute15
1387       ,p_attribute16                 => p_attribute16
1388       ,p_attribute17                 => p_attribute17
1389       ,p_attribute18                 => p_attribute18
1390       ,p_attribute19                 => p_attribute19
1391       ,p_attribute20                 => p_attribute20
1392       ,p_entry_information_category  => p_entry_information_category
1393       ,p_entry_information1          => p_entry_information1
1394       ,p_entry_information2          => p_entry_information2
1395       ,p_entry_information3          => p_entry_information3
1396       ,p_entry_information4          => p_entry_information4
1397       ,p_entry_information5          => p_entry_information5
1398       ,p_entry_information6          => p_entry_information6
1399       ,p_entry_information7          => p_entry_information7
1400       ,p_entry_information8          => p_entry_information8
1401       ,p_entry_information9          => p_entry_information9
1402       ,p_entry_information10         => p_entry_information10
1403       ,p_entry_information11         => p_entry_information11
1404       ,p_entry_information12         => p_entry_information12
1405       ,p_entry_information13         => p_entry_information13
1406       ,p_entry_information14         => p_entry_information14
1407       ,p_entry_information15         => p_entry_information15
1408       ,p_entry_information16         => p_entry_information16
1409       ,p_entry_information17         => p_entry_information17
1410       ,p_entry_information18         => p_entry_information18
1411       ,p_entry_information19         => p_entry_information19
1412       ,p_entry_information20         => p_entry_information20
1413       ,p_entry_information21         => p_entry_information21
1414       ,p_entry_information22         => p_entry_information22
1415       ,p_entry_information23         => p_entry_information23
1416       ,p_entry_information24         => p_entry_information24
1417       ,p_entry_information25         => p_entry_information25
1418       ,p_entry_information26         => p_entry_information26
1419       ,p_entry_information27         => p_entry_information27
1420       ,p_entry_information28         => p_entry_information28
1421       ,p_entry_information29         => p_entry_information29
1422       ,p_entry_information30         => p_entry_information30
1423       ,p_date_earned                 => l_date_earned
1424       ,p_personal_payment_method_id  => p_personal_payment_method_id
1425       ,p_subpriority                 => p_subpriority
1426       ,p_effective_start_date        => l_effective_start_date
1427       ,p_effective_end_date          => l_effective_end_date
1428       ,p_batch_line_id               => l_batch_line_id
1429       ,p_object_version_number       => l_object_version_number);
1430   --
1431   -- Call After Process User Hook
1432   --
1433   begin
1434     pay_batch_element_entry_bk2.create_batch_line_a
1435       (p_session_date                   => l_session_date
1436       ,p_batch_id                       => p_batch_id
1437       ,p_batch_line_status              => p_batch_line_status
1438       ,p_assignment_id                  => p_assignment_id
1439       ,p_assignment_number              => p_assignment_number
1440       ,p_attribute_category             => p_attribute_category
1441       ,p_attribute1                     => p_attribute1
1442       ,p_attribute2                     => p_attribute2
1443       ,p_attribute3                     => p_attribute3
1444       ,p_attribute4                     => p_attribute4
1445       ,p_attribute5                     => p_attribute5
1446       ,p_attribute6                     => p_attribute6
1447       ,p_attribute7                     => p_attribute7
1448       ,p_attribute8                     => p_attribute8
1449       ,p_attribute9                     => p_attribute9
1450       ,p_attribute10                    => p_attribute10
1451       ,p_attribute11                    => p_attribute11
1452       ,p_attribute12                    => p_attribute12
1453       ,p_attribute13                    => p_attribute13
1454       ,p_attribute14                    => p_attribute14
1455       ,p_attribute15                    => p_attribute15
1456       ,p_attribute16                    => p_attribute16
1457       ,p_attribute17                    => p_attribute17
1458       ,p_attribute18                    => p_attribute18
1459       ,p_attribute19                    => p_attribute19
1460       ,p_attribute20                    => p_attribute20
1461       ,p_entry_information_category     => p_entry_information_category
1462       ,p_entry_information1             => p_entry_information1
1463       ,p_entry_information2             => p_entry_information2
1464       ,p_entry_information3             => p_entry_information3
1465       ,p_entry_information4             => p_entry_information4
1466       ,p_entry_information5             => p_entry_information5
1467       ,p_entry_information6             => p_entry_information6
1468       ,p_entry_information7             => p_entry_information7
1469       ,p_entry_information8             => p_entry_information8
1470       ,p_entry_information9             => p_entry_information9
1471       ,p_entry_information10            => p_entry_information10
1472       ,p_entry_information11            => p_entry_information11
1473       ,p_entry_information12            => p_entry_information12
1474       ,p_entry_information13            => p_entry_information13
1475       ,p_entry_information14            => p_entry_information14
1476       ,p_entry_information15            => p_entry_information15
1477       ,p_entry_information16            => p_entry_information16
1478       ,p_entry_information17            => p_entry_information17
1479       ,p_entry_information18            => p_entry_information18
1480       ,p_entry_information19            => p_entry_information19
1481       ,p_entry_information20            => p_entry_information20
1482       ,p_entry_information21            => p_entry_information21
1483       ,p_entry_information22            => p_entry_information22
1484       ,p_entry_information23            => p_entry_information23
1485       ,p_entry_information24            => p_entry_information24
1486       ,p_entry_information25            => p_entry_information25
1487       ,p_entry_information26            => p_entry_information26
1488       ,p_entry_information27            => p_entry_information27
1489       ,p_entry_information28            => p_entry_information28
1490       ,p_entry_information29            => p_entry_information29
1491       ,p_entry_information30            => p_entry_information30
1492       ,p_date_earned                    => l_date_earned
1493       ,p_personal_payment_method_id     => p_personal_payment_method_id
1494       ,p_subpriority                    => p_subpriority
1495       ,p_batch_sequence                 => p_batch_sequence
1496       ,p_concatenated_segments          => p_concatenated_segments
1497       ,p_cost_allocation_keyflex_id     => p_cost_allocation_keyflex_id
1498       ,p_effective_date                 => l_effective_date
1499       ,p_effective_start_date           => l_effective_start_date
1500       ,p_effective_end_date             => l_effective_end_date
1501       ,p_element_name                   => p_element_name
1502       ,p_element_type_id                => p_element_type_id
1503       ,p_entry_type                     => p_entry_type
1504       ,p_reason                         => p_reason
1505       ,p_segment1                       => p_segment1
1506       ,p_segment2                       => p_segment2
1507       ,p_segment3                       => p_segment3
1508       ,p_segment4                       => p_segment4
1509       ,p_segment5                       => p_segment5
1510       ,p_segment6                       => p_segment6
1511       ,p_segment7                       => p_segment7
1512       ,p_segment8                       => p_segment8
1513       ,p_segment9                       => p_segment9
1514       ,p_segment10                      => p_segment10
1515       ,p_segment11                      => p_segment11
1516       ,p_segment12                      => p_segment12
1517       ,p_segment13                      => p_segment13
1518       ,p_segment14                      => p_segment14
1519       ,p_segment15                      => p_segment15
1520       ,p_segment16                      => p_segment16
1521       ,p_segment17                      => p_segment17
1522       ,p_segment18                      => p_segment18
1523       ,p_segment19                      => p_segment19
1524       ,p_segment20                      => p_segment20
1525       ,p_segment21                      => p_segment21
1526       ,p_segment22                      => p_segment22
1527       ,p_segment23                      => p_segment23
1528       ,p_segment24                      => p_segment24
1529       ,p_segment25                      => p_segment25
1530       ,p_segment26                      => p_segment26
1531       ,p_segment27                      => p_segment27
1532       ,p_segment28                      => p_segment28
1533       ,p_segment29                      => p_segment29
1534       ,p_segment30                      => p_segment30
1535       ,p_value_1                        => l_value_1
1536       ,p_value_2                        => l_value_2
1537       ,p_value_3                        => l_value_3
1538       ,p_value_4                        => l_value_4
1539       ,p_value_5                        => l_value_5
1540       ,p_value_6                        => l_value_6
1541       ,p_value_7                        => l_value_7
1542       ,p_value_8                        => l_value_8
1543       ,p_value_9                        => l_value_9
1544       ,p_value_10                       => l_value_10
1545       ,p_value_11                       => l_value_11
1546       ,p_value_12                       => l_value_12
1547       ,p_value_13                       => l_value_13
1548       ,p_value_14                       => l_value_14
1549       ,p_value_15                       => l_value_15
1550       ,p_batch_line_id                  => l_batch_line_id
1551       ,p_object_version_number          => l_object_version_number
1552       );
1553   exception
1554     when hr_api.cannot_find_prog_unit then
1555       hr_api.cannot_find_prog_unit_error
1556         (p_module_name => 'create_batch_line_a'
1557         ,p_hook_type   => 'AP'
1558         );
1559   end;
1560   --
1561   -- When in validation only mode raise the Validate_Enabled exception
1562   --
1563   if p_validate then
1564     raise hr_api.validate_enabled;
1565   end if;
1566   --
1567   -- Set all output arguments
1568   --
1569   p_batch_line_id          := l_batch_line_id;
1570   p_object_version_number  := l_object_version_number;
1571   --
1572   hr_utility.set_location(' Leaving:'||l_proc, 70);
1573 exception
1574   when hr_api.validate_enabled then
1575     --
1576     -- As the Validate_Enabled exception has been raised
1577     -- we must rollback to the savepoint
1578     --
1579     rollback to create_batch_line;
1580     --
1581     -- Only set output warning arguments
1582     -- (Any key or derived arguments must be set to null
1583     -- when validation only mode is being used.)
1584     --
1585     p_batch_line_id          := null;
1586     p_object_version_number  := null;
1587     hr_utility.set_location(' Leaving:'||l_proc, 80);
1588   when others then
1589     --
1590     -- A validation or unexpected error has occured
1591     --
1592     rollback to create_batch_line;
1593     p_batch_line_id          := null;
1594     p_object_version_number  := null;
1595     hr_utility.set_location(' Leaving:'||l_proc, 90);
1596     raise;
1597 end create_batch_line;
1598 --
1599 --
1600 -- ----------------------------------------------------------------------------
1601 -- |------------------------< create_batch_total >--------------------------|
1602 -- ----------------------------------------------------------------------------
1603 --
1604 /* Bug 10373368, new parameters p_iv_all_internal_format, p_control_column_name
1605 p_iv_all_internal_format - New flag to enable truncation, default is 'N'
1606 p_control_column_name    - Name of the Input Value name for
1607                            which the control total is entered
1608 */
1609 procedure create_batch_total
1610   (p_validate                      in     boolean  default false
1611   ,p_session_date                  in     date
1612   ,p_batch_id                      in     number
1613   ,p_control_status                in     varchar2 default 'U'
1614   ,p_control_total                 in     varchar2 default null
1615   ,p_control_type                  in     varchar2 default null
1616   ,p_batch_control_id                 out nocopy number
1617   ,p_object_version_number            out nocopy number
1618   ,p_iv_all_internal_format        in     varchar2 default 'N'
1619   ,p_control_column_name           in     varchar2 default null
1620   ) is
1621   --
1622   -- Declare cursors and local variables
1623   --
1624   l_proc                   varchar2(72) := g_package||'create_batch_total';
1625   l_batch_control_id       pay_batch_control_totals.batch_control_id%TYPE;
1626   l_object_version_number  pay_batch_control_totals.object_version_number%TYPE;
1627   l_session_date           date;
1628   /* Changes for Bug 10373368 starts here */
1629   l_uom                    pay_input_values_f.uom%TYPE;
1630   l_input_curr_code   pay_element_types_f.input_currency_code%TYPE;
1631   lv_rgrflg           varchar2(1);
1632   v_control_total    pay_batch_control_totals.control_total%TYPE;
1633   --
1634   cursor batch_total_validate
1635                             ( p_batch_id number,
1636                               p_control_type varchar2,
1637 							  p_control_column_name varchar2
1638 							 )  is
1639   select distinct petf.input_currency_code, pivf.uom
1640   from pay_input_values_f pivf, pay_element_types_f petf, pay_batch_lines pbl
1641   where pbl.batch_id = p_batch_id
1642   and pbl.element_type_id = petf.element_type_id
1643   and petf.element_type_id = pivf.element_type_id
1644   and pivf.uom <> 'D'
1645   and pivf.name = p_control_column_name;
1646  --
1647  --
1648  /* Changes for Bug 10373368 ends here */
1649   --
1650 begin
1651   hr_utility.set_location('Entering:'|| l_proc, 10);
1652   --
1653   -- Issue a savepoint
1654   --
1655   savepoint create_batch_total;
1656   --
1657   -- Truncate the time portion from all IN date parameters
1658   --
1659   l_session_date := trunc(p_session_date);
1660   --
1661   -- Call Before Process User Hook
1662   --
1663   begin
1664     pay_batch_element_entry_bk3.create_batch_total_b
1665       (p_session_date                   => l_session_date
1666       ,p_batch_id                       => p_batch_id
1667       ,p_control_status                 => p_control_status
1668       ,p_control_total                  => p_control_total
1669       ,p_control_type                   => p_control_type
1670       );
1671   exception
1672     when hr_api.cannot_find_prog_unit then
1673       hr_api.cannot_find_prog_unit_error
1674         (p_module_name => 'create_batch_total_b'
1675         ,p_hook_type   => 'BP'
1676         );
1677   end;
1678 --
1679   /* Changes for Bug 10373368 starts here.
1680   These changes are done to make sure control total is rounded depending
1681   on unit of measure of the element for which control total is created */
1682   	v_control_total := p_control_total;
1683     hr_utility.set_location(l_proc, 20);
1684 	begin
1685 		open batch_total_validate(p_batch_id, p_control_type,p_control_column_name);
1686 		fetch batch_total_validate into l_input_curr_code, l_uom;
1687 	    close batch_total_validate;
1688    	  if p_iv_all_internal_format = 'Y' then
1689 			hr_chkfmt.checkformat (
1690                		         v_control_total,
1691 				             l_uom,
1692              		         v_control_total,
1693 		                     null,
1694              				 null,
1695 		                    'Y',
1696                	            lv_rgrflg,
1697              	            l_input_curr_code
1698 						);
1699             hr_utility.set_location(l_proc||', status: '||lv_rgrflg, 30);
1700        end if;
1701 	exception
1702 		when others then
1703   	        v_control_total := p_control_total;
1704             hr_utility.set_location(l_proc, 40);
1705 	end;
1706     hr_utility.set_location(l_proc, 50);
1707   /*Changes for Bug 10373368 ends here */
1708   --
1709   -- Validation in addition to Row Handlers
1710   --
1711   --
1712   -- Process Logic
1713   --
1714   pay_bct_ins.ins
1715       (p_session_date             => l_session_date
1716       ,p_batch_id                 => p_batch_id
1717       ,p_control_status           => p_control_status
1718       ,p_control_total            => v_control_total  -- Change for the bug  10373368
1719       ,p_control_type             => p_control_type
1720       ,p_batch_control_id         => l_batch_control_id
1721       ,p_object_version_number    => l_object_version_number);
1722   --
1723   -- Call After Process User Hook
1724   --
1725   begin
1726     pay_batch_element_entry_bk3.create_batch_total_a
1727       (p_session_date                   => l_session_date
1728       ,p_batch_id                       => p_batch_id
1729       ,p_control_status                 => p_control_status
1730       ,p_control_total                  => p_control_total
1731       ,p_control_type                   => p_control_type
1732       ,p_batch_control_id               => l_batch_control_id
1733       ,p_object_version_number          => l_object_version_number
1734       );
1735   exception
1736     when hr_api.cannot_find_prog_unit then
1737       hr_api.cannot_find_prog_unit_error
1738         (p_module_name => 'create_batch_total_a'
1739         ,p_hook_type   => 'AP'
1740         );
1741   end;
1742   --
1743   -- When in validation only mode raise the Validate_Enabled exception
1744   --
1745   if p_validate then
1746     raise hr_api.validate_enabled;
1747   end if;
1748   --
1749   -- Set all output arguments
1750   --
1751   p_batch_control_id       := l_batch_control_id;
1752   p_object_version_number  := l_object_version_number;
1753   --
1754   hr_utility.set_location(' Leaving:'||l_proc, 70);
1755 exception
1756   when hr_api.validate_enabled then
1757     --
1758     -- As the Validate_Enabled exception has been raised
1759     -- we must rollback to the savepoint
1760     --
1761     rollback to create_batch_total;
1762     --
1763     -- Only set output warning arguments
1764     -- (Any key or derived arguments must be set to null
1765     -- when validation only mode is being used.)
1766     --
1767     p_batch_control_id       := null;
1768     p_object_version_number  := null;
1769     hr_utility.set_location(' Leaving:'||l_proc, 80);
1770   when others then
1771     --
1772     -- A validation or unexpected error has occured
1773     --
1774     rollback to create_batch_total;
1775     p_batch_control_id       := null;
1776     p_object_version_number  := null;
1777     hr_utility.set_location(' Leaving:'||l_proc, 90);
1778     raise;
1779 end create_batch_total;
1780 --
1781 --
1782 -- ----------------------------------------------------------------------------
1783 -- |------------------------< update_batch_header >-------------------------|
1784 -- ----------------------------------------------------------------------------
1785 --
1786 procedure update_batch_header
1787   (p_validate                      in     boolean  default false
1788   ,p_session_date                  in     date
1789   ,p_batch_id                      in     number
1790   ,p_object_version_number         in out nocopy number
1791   ,p_action_if_exists              in     varchar2 default hr_api.g_varchar2
1792   ,p_batch_name                    in     varchar2 default hr_api.g_varchar2
1793   ,p_batch_reference               in     varchar2 default hr_api.g_varchar2
1794   ,p_batch_source                  in     varchar2 default hr_api.g_varchar2
1795   ,p_batch_status                  in     varchar2 default hr_api.g_varchar2
1796   ,p_comments                      in     varchar2 default hr_api.g_varchar2
1797   ,p_date_effective_changes        in     varchar2 default hr_api.g_varchar2
1798   ,p_purge_after_transfer          in     varchar2 default hr_api.g_varchar2
1799   ,p_reject_if_future_changes      in     varchar2 default hr_api.g_varchar2
1800   ,p_reject_if_results_exists      in     varchar2 default hr_api.g_varchar2
1801   ,p_purge_after_rollback          in     varchar2 default hr_api.g_varchar2
1802   ,p_batch_type                    in     varchar2 default hr_api.g_varchar2
1803   ,p_REJECT_ENTRY_NOT_REMOVED      in     varchar2 default hr_api.g_varchar2
1804   ,p_ROLLBACK_ENTRY_UPDATES        in     varchar2 default hr_api.g_varchar2
1805   ) is
1806   --
1807   -- Declare cursors and local variables
1808   --
1809   l_proc                   varchar2(72) := g_package||'update_batch_header';
1810   l_object_version_number  pay_batch_headers.object_version_number%TYPE;
1811   l_session_date           date;
1812   --
1813 begin
1814   hr_utility.set_location('Entering:'|| l_proc, 10);
1815   --
1816   -- Issue a savepoint
1817   --
1818   savepoint update_batch_header;
1819   --
1820   -- Store initial values for IN OUT parameters
1821   --
1822   l_object_version_number := p_object_version_number;
1823   --
1824   -- Truncate the time portion from all IN date parameters
1825   --
1826   l_session_date := trunc(p_session_date);
1827   --
1828   -- Call Before Process User Hook
1829   --
1830   begin
1831     pay_batch_element_entry_bk4.update_batch_header_b
1832       (p_session_date                   => l_session_date
1833       ,p_batch_id                       => p_batch_id
1834       ,p_object_version_number          => l_object_version_number
1835       ,p_action_if_exists               => p_action_if_exists
1836       ,p_batch_name                     => p_batch_name
1837       ,p_batch_reference                => p_batch_reference
1838       ,p_batch_source                   => p_batch_source
1839       ,p_batch_status                   => p_batch_status
1840       ,p_comments                       => p_comments
1841       ,p_date_effective_changes         => p_date_effective_changes
1842       ,p_purge_after_transfer           => p_purge_after_transfer
1843       ,p_reject_if_future_changes       => p_reject_if_future_changes
1844       ,p_reject_if_results_exists       => p_reject_if_results_exists
1845       ,p_purge_after_rollback           => p_purge_after_rollback
1846       ,p_batch_type                     => p_batch_type
1847       ,p_REJECT_ENTRY_NOT_REMOVED       => p_REJECT_ENTRY_NOT_REMOVED
1848       ,p_ROLLBACK_ENTRY_UPDATES         => p_ROLLBACK_ENTRY_UPDATES
1849       );
1850   exception
1851     when hr_api.cannot_find_prog_unit then
1852       hr_api.cannot_find_prog_unit_error
1853         (p_module_name => 'update_batch_header_b'
1854         ,p_hook_type   => 'BP'
1855         );
1856   end;
1857   --
1858   -- Validation in addition to Row Handlers
1859   --
1860   --
1861   -- Process Logic
1862   --
1863   pay_bth_upd.upd
1864       (p_session_date             => l_session_date
1865       ,p_batch_id                 => p_batch_id
1866       ,p_object_version_number    => l_object_version_number
1867       ,p_batch_name               => p_batch_name
1868       ,p_batch_status             => p_batch_status
1869       ,p_action_if_exists         => p_action_if_exists
1870       ,p_batch_reference          => p_batch_reference
1871       ,p_batch_source             => p_batch_source
1872       ,p_batch_type               => p_batch_type
1873       ,p_comments                 => p_comments
1874       ,p_date_effective_changes   => p_date_effective_changes
1875       ,p_purge_after_transfer     => p_purge_after_transfer
1876       ,p_reject_if_future_changes => p_reject_if_future_changes
1877       ,p_reject_if_results_exists => p_reject_if_results_exists
1878       ,p_purge_after_rollback     => p_purge_after_rollback
1879       ,p_REJECT_ENTRY_NOT_REMOVED => p_REJECT_ENTRY_NOT_REMOVED
1880       ,p_ROLLBACK_ENTRY_UPDATES   => p_ROLLBACK_ENTRY_UPDATES);
1881   --
1882   -- Call After Process User Hook
1883   --
1884   begin
1885     pay_batch_element_entry_bk4.update_batch_header_a
1886       (p_session_date                   => l_session_date
1887       ,p_batch_id                       => p_batch_id
1888       ,p_object_version_number          => l_object_version_number
1889       ,p_action_if_exists               => p_action_if_exists
1890       ,p_batch_name                     => p_batch_name
1891       ,p_batch_reference                => p_batch_reference
1892       ,p_batch_source                   => p_batch_source
1893       ,p_batch_status                   => p_batch_status
1894       ,p_comments                       => p_comments
1895       ,p_date_effective_changes         => p_date_effective_changes
1896       ,p_purge_after_transfer           => p_purge_after_transfer
1897       ,p_reject_if_future_changes       => p_reject_if_future_changes
1898       ,p_reject_if_results_exists       => p_reject_if_results_exists
1899       ,p_purge_after_rollback           => p_purge_after_rollback
1900       ,p_batch_type                     => p_batch_type
1901       ,p_REJECT_ENTRY_NOT_REMOVED       => p_REJECT_ENTRY_NOT_REMOVED
1902       ,p_ROLLBACK_ENTRY_UPDATES         => p_ROLLBACK_ENTRY_UPDATES
1903       );
1904   exception
1905     when hr_api.cannot_find_prog_unit then
1906       hr_api.cannot_find_prog_unit_error
1907         (p_module_name => 'update_batch_header_a'
1908         ,p_hook_type   => 'AP'
1909         );
1910   end;
1911   --
1912   -- When in validation only mode raise the Validate_Enabled exception
1913   --
1914   if p_validate then
1915     raise hr_api.validate_enabled;
1916   end if;
1917   --
1918   -- Set all output arguments
1919   --
1920   p_object_version_number  := l_object_version_number;
1921   --
1922   hr_utility.set_location(' Leaving:'||l_proc, 70);
1923 exception
1924   when hr_api.validate_enabled then
1925     --
1926     -- As the Validate_Enabled exception has been raised
1927     -- we must rollback to the savepoint
1928     --
1929     rollback to update_batch_header;
1930     --
1931     -- Only set output warning arguments
1932     -- (Any key or derived arguments must be set to null
1933     -- when validation only mode is being used.)
1934     --
1935     hr_utility.set_location(' Leaving:'||l_proc, 80);
1936   when others then
1937     --
1938     -- A validation or unexpected error has occured
1939     --
1940     rollback to update_batch_header;
1941     p_object_version_number := l_object_version_number;
1942     hr_utility.set_location(' Leaving:'||l_proc, 90);
1943     raise;
1944 end update_batch_header;
1945 --
1946 --
1947 -- ----------------------------------------------------------------------------
1948 -- |-------------------------< update_batch_line >--------------------------|
1949 -- ----------------------------------------------------------------------------
1950 --
1951 procedure update_batch_line
1952   (p_validate                      in     boolean  default false
1953   ,p_session_date                  in     date
1954   ,p_batch_line_id                 in     number
1955   ,p_batch_line_status             in     varchar2 default hr_api.g_varchar2
1956   ,p_object_version_number         in out nocopy number
1957   ,p_assignment_id                 in     number   default hr_api.g_number
1958   ,p_assignment_number             in     varchar2 default hr_api.g_varchar2
1959   ,p_attribute_category            in     varchar2 default hr_api.g_varchar2
1960   ,p_attribute1                    in     varchar2 default hr_api.g_varchar2
1961   ,p_attribute2                    in     varchar2 default hr_api.g_varchar2
1962   ,p_attribute3                    in     varchar2 default hr_api.g_varchar2
1963   ,p_attribute4                    in     varchar2 default hr_api.g_varchar2
1964   ,p_attribute5                    in     varchar2 default hr_api.g_varchar2
1965   ,p_attribute6                    in     varchar2 default hr_api.g_varchar2
1966   ,p_attribute7                    in     varchar2 default hr_api.g_varchar2
1967   ,p_attribute8                    in     varchar2 default hr_api.g_varchar2
1968   ,p_attribute9                    in     varchar2 default hr_api.g_varchar2
1969   ,p_attribute10                   in     varchar2 default hr_api.g_varchar2
1970   ,p_attribute11                   in     varchar2 default hr_api.g_varchar2
1971   ,p_attribute12                   in     varchar2 default hr_api.g_varchar2
1972   ,p_attribute13                   in     varchar2 default hr_api.g_varchar2
1973   ,p_attribute14                   in     varchar2 default hr_api.g_varchar2
1974   ,p_attribute15                   in     varchar2 default hr_api.g_varchar2
1975   ,p_attribute16                   in     varchar2 default hr_api.g_varchar2
1976   ,p_attribute17                   in     varchar2 default hr_api.g_varchar2
1977   ,p_attribute18                   in     varchar2 default hr_api.g_varchar2
1978   ,p_attribute19                   in     varchar2 default hr_api.g_varchar2
1979   ,p_attribute20                   in     varchar2 default hr_api.g_varchar2
1980   ,p_entry_information_category    in     varchar2  default hr_api.g_varchar2
1981   ,p_entry_information1            in     varchar2  default hr_api.g_varchar2
1982   ,p_entry_information2            in     varchar2  default hr_api.g_varchar2
1983   ,p_entry_information3            in     varchar2  default hr_api.g_varchar2
1984   ,p_entry_information4            in     varchar2  default hr_api.g_varchar2
1985   ,p_entry_information5            in     varchar2  default hr_api.g_varchar2
1986   ,p_entry_information6            in     varchar2  default hr_api.g_varchar2
1987   ,p_entry_information7            in     varchar2  default hr_api.g_varchar2
1988   ,p_entry_information8            in     varchar2  default hr_api.g_varchar2
1989   ,p_entry_information9            in     varchar2  default hr_api.g_varchar2
1990   ,p_entry_information10           in     varchar2  default hr_api.g_varchar2
1991   ,p_entry_information11           in     varchar2  default hr_api.g_varchar2
1992   ,p_entry_information12           in     varchar2  default hr_api.g_varchar2
1993   ,p_entry_information13           in     varchar2  default hr_api.g_varchar2
1994   ,p_entry_information14           in     varchar2  default hr_api.g_varchar2
1995   ,p_entry_information15           in     varchar2  default hr_api.g_varchar2
1996   ,p_entry_information16           in     varchar2  default hr_api.g_varchar2
1997   ,p_entry_information17           in     varchar2  default hr_api.g_varchar2
1998   ,p_entry_information18           in     varchar2  default hr_api.g_varchar2
1999   ,p_entry_information19           in     varchar2  default hr_api.g_varchar2
2000   ,p_entry_information20           in     varchar2  default hr_api.g_varchar2
2001   ,p_entry_information21           in     varchar2  default hr_api.g_varchar2
2002   ,p_entry_information22           in     varchar2  default hr_api.g_varchar2
2003   ,p_entry_information23           in     varchar2  default hr_api.g_varchar2
2004   ,p_entry_information24           in     varchar2  default hr_api.g_varchar2
2005   ,p_entry_information25           in     varchar2  default hr_api.g_varchar2
2006   ,p_entry_information26           in     varchar2  default hr_api.g_varchar2
2007   ,p_entry_information27           in     varchar2  default hr_api.g_varchar2
2008   ,p_entry_information28           in     varchar2  default hr_api.g_varchar2
2009   ,p_entry_information29           in     varchar2  default hr_api.g_varchar2
2010   ,p_entry_information30           in     varchar2  default hr_api.g_varchar2
2011   ,p_date_earned                   in     date      default hr_api.g_date
2012   ,p_personal_payment_method_id    in     number    default hr_api.g_number
2013   ,p_subpriority                   in     number    default hr_api.g_number
2014   ,p_batch_sequence                in     number   default hr_api.g_number
2015   ,p_concatenated_segments         in     varchar2 default hr_api.g_varchar2
2016   ,p_cost_allocation_keyflex_id    in     number   default hr_api.g_number
2017   ,p_effective_date                in     date     default hr_api.g_date
2018   ,p_effective_start_date          in     date     default hr_api.g_date
2019   ,p_effective_end_date            in     date     default hr_api.g_date
2020   ,p_element_name                  in     varchar2 default hr_api.g_varchar2
2021   ,p_element_type_id               in     number   default hr_api.g_number
2022   ,p_entry_type                    in     varchar2 default hr_api.g_varchar2
2023   ,p_reason                        in     varchar2 default hr_api.g_varchar2
2024   ,p_segment1                      in     varchar2 default hr_api.g_varchar2
2025   ,p_segment2                      in     varchar2 default hr_api.g_varchar2
2026   ,p_segment3                      in     varchar2 default hr_api.g_varchar2
2027   ,p_segment4                      in     varchar2 default hr_api.g_varchar2
2028   ,p_segment5                      in     varchar2 default hr_api.g_varchar2
2029   ,p_segment6                      in     varchar2 default hr_api.g_varchar2
2030   ,p_segment7                      in     varchar2 default hr_api.g_varchar2
2031   ,p_segment8                      in     varchar2 default hr_api.g_varchar2
2032   ,p_segment9                      in     varchar2 default hr_api.g_varchar2
2033   ,p_segment10                     in     varchar2 default hr_api.g_varchar2
2034   ,p_segment11                     in     varchar2 default hr_api.g_varchar2
2035   ,p_segment12                     in     varchar2 default hr_api.g_varchar2
2036   ,p_segment13                     in     varchar2 default hr_api.g_varchar2
2037   ,p_segment14                     in     varchar2 default hr_api.g_varchar2
2038   ,p_segment15                     in     varchar2 default hr_api.g_varchar2
2039   ,p_segment16                     in     varchar2 default hr_api.g_varchar2
2040   ,p_segment17                     in     varchar2 default hr_api.g_varchar2
2041   ,p_segment18                     in     varchar2 default hr_api.g_varchar2
2042   ,p_segment19                     in     varchar2 default hr_api.g_varchar2
2043   ,p_segment20                     in     varchar2 default hr_api.g_varchar2
2044   ,p_segment21                     in     varchar2 default hr_api.g_varchar2
2045   ,p_segment22                     in     varchar2 default hr_api.g_varchar2
2046   ,p_segment23                     in     varchar2 default hr_api.g_varchar2
2047   ,p_segment24                     in     varchar2 default hr_api.g_varchar2
2048   ,p_segment25                     in     varchar2 default hr_api.g_varchar2
2049   ,p_segment26                     in     varchar2 default hr_api.g_varchar2
2050   ,p_segment27                     in     varchar2 default hr_api.g_varchar2
2051   ,p_segment28                     in     varchar2 default hr_api.g_varchar2
2052   ,p_segment29                     in     varchar2 default hr_api.g_varchar2
2053   ,p_segment30                     in     varchar2 default hr_api.g_varchar2
2054   ,p_value_1                       in     varchar2 default hr_api.g_varchar2
2055   ,p_value_2                       in     varchar2 default hr_api.g_varchar2
2056   ,p_value_3                       in     varchar2 default hr_api.g_varchar2
2057   ,p_value_4                       in     varchar2 default hr_api.g_varchar2
2058   ,p_value_5                       in     varchar2 default hr_api.g_varchar2
2059   ,p_value_6                       in     varchar2 default hr_api.g_varchar2
2060   ,p_value_7                       in     varchar2 default hr_api.g_varchar2
2061   ,p_value_8                       in     varchar2 default hr_api.g_varchar2
2062   ,p_value_9                       in     varchar2 default hr_api.g_varchar2
2063   ,p_value_10                      in     varchar2 default hr_api.g_varchar2
2064   ,p_value_11                      in     varchar2 default hr_api.g_varchar2
2065   ,p_value_12                      in     varchar2 default hr_api.g_varchar2
2066   ,p_value_13                      in     varchar2 default hr_api.g_varchar2
2067   ,p_value_14                      in     varchar2 default hr_api.g_varchar2
2068   ,p_value_15                      in     varchar2 default hr_api.g_varchar2
2069   ,p_canonical_date_format         in     varchar2 default 'Y'
2070   ,p_iv_all_internal_format        in     varchar2 default 'N'
2071   ) is
2072   --
2073   -- Declare cursors and local variables
2074   --
2075   l_proc                   varchar2(72) := g_package||'update_batch_line';
2076   l_object_version_number  pay_batch_lines.object_version_number%TYPE;
2077   l_session_date           date;
2078   l_effective_date         date;
2079   l_effective_start_date   date;
2080   l_effective_end_date     date;
2081   l_date_earned            date;
2082   --
2083   l_value_1                pay_batch_lines.value_1%TYPE := p_value_1;
2084   l_value_2                pay_batch_lines.value_2%TYPE := p_value_2;
2085   l_value_3                pay_batch_lines.value_3%TYPE := p_value_3;
2086   l_value_4                pay_batch_lines.value_4%TYPE := p_value_4;
2087   l_value_5                pay_batch_lines.value_5%TYPE := p_value_5;
2088   l_value_6                pay_batch_lines.value_6%TYPE := p_value_6;
2089   l_value_7                pay_batch_lines.value_7%TYPE := p_value_7;
2090   l_value_8                pay_batch_lines.value_8%TYPE := p_value_8;
2091   l_value_9                pay_batch_lines.value_9%TYPE := p_value_9;
2092   l_value_10               pay_batch_lines.value_10%TYPE := p_value_10;
2093   l_value_11               pay_batch_lines.value_11%TYPE := p_value_11;
2094   l_value_12               pay_batch_lines.value_12%TYPE := p_value_12;
2095   l_value_13               pay_batch_lines.value_13%TYPE := p_value_13;
2096   l_value_14               pay_batch_lines.value_14%TYPE := p_value_14;
2097   l_value_15               pay_batch_lines.value_15%TYPE := p_value_15;
2098   --
2099   l_bee_iv_upgrade  varchar2(1);
2100   --
2101 begin
2102   hr_utility.set_location('Entering:'|| l_proc, 10);
2103   --
2104   -- Issue a savepoint
2105   --
2106   savepoint update_batch_line;
2107   --
2108   -- Store initial values for IN OUT parameters
2109   --
2110   l_object_version_number := p_object_version_number;
2111   --
2112   -- Truncate the time portion from all IN date parameters
2113   --
2114   l_session_date         := trunc(p_session_date);
2115   l_effective_date       := trunc(p_effective_date);
2116   l_effective_start_date := trunc(p_effective_start_date);
2117   l_effective_end_date   := trunc(p_effective_end_date);
2118   l_date_earned          := trunc(p_date_earned);
2119   --
2120   l_bee_iv_upgrade := get_upgrade_status(null,p_batch_line_id,'BEE_IV_UPG');
2121   --
2122   -- Check whether the upgrade process is in progress.
2123   --
2124   if l_bee_iv_upgrade = 'E' then
2125      hr_utility.set_message(800, 'HR_449106_BEE_UPGRADING');
2126      hr_utility.raise_error;
2127   end if;
2128   --
2129   if p_iv_all_internal_format = 'Y' and l_bee_iv_upgrade = 'N' then
2130     fnd_message.set_name('PAY', 'HR_7462_PLK_INVLD_VALUE');
2131     fnd_message.set_token('COLUMN_NAME','P_IV_ALL_INTERNAL_FORMAT');
2132     fnd_message.raise_error;
2133   end if;
2134   --
2135   if p_iv_all_internal_format = 'Y' and p_canonical_date_format = 'N' then
2136     fnd_message.set_name('PAY', 'HR_7462_PLK_INVLD_VALUE');
2137     fnd_message.set_token('COLUMN_NAME','P_CANONICAL_DATE_FORMAT');
2138     fnd_message.raise_error;
2139   end if;
2140   --
2141   --
2142   if p_iv_all_internal_format <> 'Y' then
2143      convert_date_to_canonical
2144      (p_iv1               => l_value_1
2145      ,p_iv2               => l_value_2
2146      ,p_iv3               => l_value_3
2147      ,p_iv4               => l_value_4
2148      ,p_iv5               => l_value_5
2149      ,p_iv6               => l_value_6
2150      ,p_iv7               => l_value_7
2151      ,p_iv8               => l_value_8
2152      ,p_iv9               => l_value_9
2153      ,p_iv10              => l_value_10
2154      ,p_iv11              => l_value_11
2155      ,p_iv12              => l_value_12
2156      ,p_iv13              => l_value_13
2157      ,p_iv14              => l_value_14
2158      ,p_iv15              => l_value_15
2159      ,p_element_type_id   => p_element_type_id
2160      ,p_element_name      => p_element_name
2161      ,p_effective_date    => p_effective_date
2162      ,p_batch_line_id     => p_batch_line_id
2163      ,p_date_cfmt         => p_canonical_date_format
2164      ,p_int_fmt           => l_bee_iv_upgrade
2165      );
2166   end if;
2167   --
2168   -- Call Before Process User Hook
2169   --
2170   begin
2171     pay_batch_element_entry_bk5.update_batch_line_b
2172       (p_session_date                   => l_session_date
2173       ,p_batch_line_id                  => p_batch_line_id
2174       ,p_batch_line_status              => p_batch_line_status
2175       ,p_object_version_number          => l_object_version_number
2176       ,p_assignment_id                  => p_assignment_id
2177       ,p_assignment_number              => p_assignment_number
2178       ,p_attribute_category             => p_attribute_category
2179       ,p_attribute1                     => p_attribute1
2180       ,p_attribute2                     => p_attribute2
2181       ,p_attribute3                     => p_attribute3
2182       ,p_attribute4                     => p_attribute4
2183       ,p_attribute5                     => p_attribute5
2184       ,p_attribute6                     => p_attribute6
2185       ,p_attribute7                     => p_attribute7
2186       ,p_attribute8                     => p_attribute8
2187       ,p_attribute9                     => p_attribute9
2188       ,p_attribute10                    => p_attribute10
2189       ,p_attribute11                    => p_attribute11
2190       ,p_attribute12                    => p_attribute12
2191       ,p_attribute13                    => p_attribute13
2192       ,p_attribute14                    => p_attribute14
2193       ,p_attribute15                    => p_attribute15
2194       ,p_attribute16                    => p_attribute16
2195       ,p_attribute17                    => p_attribute17
2196       ,p_attribute18                    => p_attribute18
2197       ,p_attribute19                    => p_attribute19
2198       ,p_attribute20                    => p_attribute20
2199       ,p_entry_information_category     => p_entry_information_category
2200       ,p_entry_information1             => p_entry_information1
2201       ,p_entry_information2             => p_entry_information2
2202       ,p_entry_information3             => p_entry_information3
2203       ,p_entry_information4             => p_entry_information4
2204       ,p_entry_information5             => p_entry_information5
2205       ,p_entry_information6             => p_entry_information6
2206       ,p_entry_information7             => p_entry_information7
2207       ,p_entry_information8             => p_entry_information8
2208       ,p_entry_information9             => p_entry_information9
2209       ,p_entry_information10            => p_entry_information10
2210       ,p_entry_information11            => p_entry_information11
2211       ,p_entry_information12            => p_entry_information12
2212       ,p_entry_information13            => p_entry_information13
2213       ,p_entry_information14            => p_entry_information14
2214       ,p_entry_information15            => p_entry_information15
2215       ,p_entry_information16            => p_entry_information16
2216       ,p_entry_information17            => p_entry_information17
2217       ,p_entry_information18            => p_entry_information18
2218       ,p_entry_information19            => p_entry_information19
2219       ,p_entry_information20            => p_entry_information20
2220       ,p_entry_information21            => p_entry_information21
2221       ,p_entry_information22            => p_entry_information22
2222       ,p_entry_information23            => p_entry_information23
2223       ,p_entry_information24            => p_entry_information24
2224       ,p_entry_information25            => p_entry_information25
2225       ,p_entry_information26            => p_entry_information26
2226       ,p_entry_information27            => p_entry_information27
2227       ,p_entry_information28            => p_entry_information28
2228       ,p_entry_information29            => p_entry_information29
2229       ,p_entry_information30            => p_entry_information30
2230       ,p_date_earned                    => l_date_earned
2231       ,p_personal_payment_method_id     => p_personal_payment_method_id
2232       ,p_subpriority                    => p_subpriority
2233       ,p_batch_sequence                 => p_batch_sequence
2234       ,p_concatenated_segments          => p_concatenated_segments
2235       ,p_cost_allocation_keyflex_id     => p_cost_allocation_keyflex_id
2236       ,p_effective_date                 => l_effective_date
2237       ,p_effective_start_date           => l_effective_start_date
2238       ,p_effective_end_date             => l_effective_end_date
2239       ,p_element_name                   => p_element_name
2240       ,p_element_type_id                => p_element_type_id
2241       ,p_entry_type                     => p_entry_type
2242       ,p_reason                         => p_reason
2243       ,p_segment1                       => p_segment1
2244       ,p_segment2                       => p_segment2
2245       ,p_segment3                       => p_segment3
2246       ,p_segment4                       => p_segment4
2247       ,p_segment5                       => p_segment5
2248       ,p_segment6                       => p_segment6
2249       ,p_segment7                       => p_segment7
2250       ,p_segment8                       => p_segment8
2251       ,p_segment9                       => p_segment9
2252       ,p_segment10                      => p_segment10
2253       ,p_segment11                      => p_segment11
2254       ,p_segment12                      => p_segment12
2255       ,p_segment13                      => p_segment13
2256       ,p_segment14                      => p_segment14
2257       ,p_segment15                      => p_segment15
2258       ,p_segment16                      => p_segment16
2259       ,p_segment17                      => p_segment17
2260       ,p_segment18                      => p_segment18
2261       ,p_segment19                      => p_segment19
2262       ,p_segment20                      => p_segment20
2263       ,p_segment21                      => p_segment21
2264       ,p_segment22                      => p_segment22
2265       ,p_segment23                      => p_segment23
2266       ,p_segment24                      => p_segment24
2267       ,p_segment25                      => p_segment25
2268       ,p_segment26                      => p_segment26
2269       ,p_segment27                      => p_segment27
2270       ,p_segment28                      => p_segment28
2271       ,p_segment29                      => p_segment29
2272       ,p_segment30                      => p_segment30
2273       ,p_value_1                        => l_value_1
2274       ,p_value_2                        => l_value_2
2275       ,p_value_3                        => l_value_3
2276       ,p_value_4                        => l_value_4
2277       ,p_value_5                        => l_value_5
2278       ,p_value_6                        => l_value_6
2279       ,p_value_7                        => l_value_7
2280       ,p_value_8                        => l_value_8
2281       ,p_value_9                        => l_value_9
2282       ,p_value_10                       => l_value_10
2283       ,p_value_11                       => l_value_11
2284       ,p_value_12                       => l_value_12
2285       ,p_value_13                       => l_value_13
2286       ,p_value_14                       => l_value_14
2287       ,p_value_15                       => l_value_15
2288       );
2289   exception
2290     when hr_api.cannot_find_prog_unit then
2291       hr_api.cannot_find_prog_unit_error
2292         (p_module_name => 'update_batch_line_b'
2293         ,p_hook_type   => 'BP'
2294         );
2295   end;
2296   --
2297   hr_utility.set_location(l_proc, 11);
2298   --
2299   -- Validation in addition to Row Handlers
2300   --
2301   --
2302   -- Process Logic
2303   --
2304   pay_btl_upd.upd
2305       (p_session_date                => l_session_date
2306       ,p_batch_line_id               => p_batch_line_id
2307       ,p_object_version_number       => l_object_version_number
2308       ,p_batch_line_status           => p_batch_line_status
2309       ,p_cost_allocation_keyflex_id  => p_cost_allocation_keyflex_id
2310       ,p_element_type_id             => p_element_type_id
2311       ,p_assignment_id               => p_assignment_id
2312       ,p_assignment_number           => p_assignment_number
2313       ,p_batch_sequence              => p_batch_sequence
2314       ,p_concatenated_segments       => p_concatenated_segments
2315       ,p_effective_date              => l_effective_date
2316       ,p_element_name                => p_element_name
2317       ,p_entry_type                  => p_entry_type
2318       ,p_reason                      => p_reason
2319       ,p_segment1                    => p_segment1
2320       ,p_segment2                    => p_segment2
2321       ,p_segment3                    => p_segment3
2322       ,p_segment4                    => p_segment4
2323       ,p_segment5                    => p_segment5
2324       ,p_segment6                    => p_segment6
2325       ,p_segment7                    => p_segment7
2326       ,p_segment8                    => p_segment8
2327       ,p_segment9                    => p_segment9
2328       ,p_segment10                   => p_segment10
2329       ,p_segment11                   => p_segment11
2330       ,p_segment12                   => p_segment12
2331       ,p_segment13                   => p_segment13
2332       ,p_segment14                   => p_segment14
2333       ,p_segment15                   => p_segment15
2334       ,p_segment16                   => p_segment16
2335       ,p_segment17                   => p_segment17
2336       ,p_segment18                   => p_segment18
2337       ,p_segment19                   => p_segment19
2338       ,p_segment20                   => p_segment20
2339       ,p_segment21                   => p_segment21
2340       ,p_segment22                   => p_segment22
2341       ,p_segment23                   => p_segment23
2342       ,p_segment24                   => p_segment24
2343       ,p_segment25                   => p_segment25
2344       ,p_segment26                   => p_segment26
2345       ,p_segment27                   => p_segment27
2346       ,p_segment28                   => p_segment28
2347       ,p_segment29                   => p_segment29
2348       ,p_segment30                   => p_segment30
2349       ,p_value_1                     => l_value_1
2350       ,p_value_2                     => l_value_2
2351       ,p_value_3                     => l_value_3
2352       ,p_value_4                     => l_value_4
2353       ,p_value_5                     => l_value_5
2354       ,p_value_6                     => l_value_6
2355       ,p_value_7                     => l_value_7
2356       ,p_value_8                     => l_value_8
2357       ,p_value_9                     => l_value_9
2358       ,p_value_10                    => l_value_10
2359       ,p_value_11                    => l_value_11
2360       ,p_value_12                    => l_value_12
2361       ,p_value_13                    => l_value_13
2362       ,p_value_14                    => l_value_14
2363       ,p_value_15                    => l_value_15
2364       ,p_attribute_category          => p_attribute_category
2365       ,p_attribute1                  => p_attribute1
2366       ,p_attribute2                  => p_attribute2
2367       ,p_attribute3                  => p_attribute3
2368       ,p_attribute4                  => p_attribute4
2369       ,p_attribute5                  => p_attribute5
2370       ,p_attribute6                  => p_attribute6
2371       ,p_attribute7                  => p_attribute7
2372       ,p_attribute8                  => p_attribute8
2373       ,p_attribute9                  => p_attribute9
2374       ,p_attribute10                 => p_attribute10
2375       ,p_attribute11                 => p_attribute11
2376       ,p_attribute12                 => p_attribute12
2377       ,p_attribute13                 => p_attribute13
2378       ,p_attribute14                 => p_attribute14
2379       ,p_attribute15                 => p_attribute15
2380       ,p_attribute16                 => p_attribute16
2381       ,p_attribute17                 => p_attribute17
2382       ,p_attribute18                 => p_attribute18
2383       ,p_attribute19                 => p_attribute19
2384       ,p_attribute20                 => p_attribute20
2385       ,p_entry_information_category  => p_entry_information_category
2386       ,p_entry_information1          => p_entry_information1
2387       ,p_entry_information2          => p_entry_information2
2388       ,p_entry_information3          => p_entry_information3
2389       ,p_entry_information4          => p_entry_information4
2390       ,p_entry_information5          => p_entry_information5
2391       ,p_entry_information6          => p_entry_information6
2392       ,p_entry_information7          => p_entry_information7
2393       ,p_entry_information8          => p_entry_information8
2394       ,p_entry_information9          => p_entry_information9
2395       ,p_entry_information10         => p_entry_information10
2396       ,p_entry_information11         => p_entry_information11
2397       ,p_entry_information12         => p_entry_information12
2398       ,p_entry_information13         => p_entry_information13
2399       ,p_entry_information14         => p_entry_information14
2400       ,p_entry_information15         => p_entry_information15
2401       ,p_entry_information16         => p_entry_information16
2402       ,p_entry_information17         => p_entry_information17
2403       ,p_entry_information18         => p_entry_information18
2404       ,p_entry_information19         => p_entry_information19
2405       ,p_entry_information20         => p_entry_information20
2406       ,p_entry_information21         => p_entry_information21
2407       ,p_entry_information22         => p_entry_information22
2408       ,p_entry_information23         => p_entry_information23
2409       ,p_entry_information24         => p_entry_information24
2410       ,p_entry_information25         => p_entry_information25
2411       ,p_entry_information26         => p_entry_information26
2412       ,p_entry_information27         => p_entry_information27
2413       ,p_entry_information28         => p_entry_information28
2414       ,p_entry_information29         => p_entry_information29
2415       ,p_entry_information30         => p_entry_information30
2416       ,p_date_earned                 => l_date_earned
2417       ,p_personal_payment_method_id  => p_personal_payment_method_id
2418       ,p_subpriority                 => p_subpriority
2419       ,p_effective_start_date        => l_effective_start_date
2420       ,p_effective_end_date          => l_effective_end_date);
2421   --
2422   hr_utility.set_location(l_proc, 12);
2423   --
2424   --
2425   -- Call After Process User Hook
2426   --
2427   begin
2428     pay_batch_element_entry_bk5.update_batch_line_a
2429       (p_session_date                   => l_session_date
2430       ,p_batch_line_id                  => p_batch_line_id
2431       ,p_batch_line_status              => p_batch_line_status
2432       ,p_object_version_number          => l_object_version_number
2433       ,p_assignment_id                  => p_assignment_id
2434       ,p_assignment_number              => p_assignment_number
2435       ,p_attribute_category             => p_attribute_category
2436       ,p_attribute1                     => p_attribute1
2437       ,p_attribute2                     => p_attribute2
2438       ,p_attribute3                     => p_attribute3
2439       ,p_attribute4                     => p_attribute4
2440       ,p_attribute5                     => p_attribute5
2441       ,p_attribute6                     => p_attribute6
2442       ,p_attribute7                     => p_attribute7
2443       ,p_attribute8                     => p_attribute8
2444       ,p_attribute9                     => p_attribute9
2445       ,p_attribute10                    => p_attribute10
2446       ,p_attribute11                    => p_attribute11
2447       ,p_attribute12                    => p_attribute12
2448       ,p_attribute13                    => p_attribute13
2449       ,p_attribute14                    => p_attribute14
2450       ,p_attribute15                    => p_attribute15
2451       ,p_attribute16                    => p_attribute16
2452       ,p_attribute17                    => p_attribute17
2453       ,p_attribute18                    => p_attribute18
2454       ,p_attribute19                    => p_attribute19
2455       ,p_attribute20                    => p_attribute20
2456       ,p_entry_information_category     => p_entry_information_category
2457       ,p_entry_information1             => p_entry_information1
2458       ,p_entry_information2             => p_entry_information2
2459       ,p_entry_information3             => p_entry_information3
2460       ,p_entry_information4             => p_entry_information4
2461       ,p_entry_information5             => p_entry_information5
2462       ,p_entry_information6             => p_entry_information6
2463       ,p_entry_information7             => p_entry_information7
2464       ,p_entry_information8             => p_entry_information8
2465       ,p_entry_information9             => p_entry_information9
2466       ,p_entry_information10            => p_entry_information10
2467       ,p_entry_information11            => p_entry_information11
2468       ,p_entry_information12            => p_entry_information12
2469       ,p_entry_information13            => p_entry_information13
2470       ,p_entry_information14            => p_entry_information14
2471       ,p_entry_information15            => p_entry_information15
2472       ,p_entry_information16            => p_entry_information16
2473       ,p_entry_information17            => p_entry_information17
2474       ,p_entry_information18            => p_entry_information18
2475       ,p_entry_information19            => p_entry_information19
2476       ,p_entry_information20            => p_entry_information20
2477       ,p_entry_information21            => p_entry_information21
2478       ,p_entry_information22            => p_entry_information22
2479       ,p_entry_information23            => p_entry_information23
2480       ,p_entry_information24            => p_entry_information24
2481       ,p_entry_information25            => p_entry_information25
2482       ,p_entry_information26            => p_entry_information26
2483       ,p_entry_information27            => p_entry_information27
2484       ,p_entry_information28            => p_entry_information28
2485       ,p_entry_information29            => p_entry_information29
2486       ,p_entry_information30            => p_entry_information30
2487       ,p_date_earned                    => l_date_earned
2488       ,p_personal_payment_method_id     => p_personal_payment_method_id
2489       ,p_subpriority                    => p_subpriority
2490       ,p_batch_sequence                 => p_batch_sequence
2491       ,p_concatenated_segments          => p_concatenated_segments
2492       ,p_cost_allocation_keyflex_id     => p_cost_allocation_keyflex_id
2493       ,p_effective_date                 => l_effective_date
2494       ,p_effective_start_date           => l_effective_start_date
2495       ,p_effective_end_date             => l_effective_end_date
2496       ,p_element_name                   => p_element_name
2497       ,p_element_type_id                => p_element_type_id
2498       ,p_entry_type                     => p_entry_type
2499       ,p_reason                         => p_reason
2500       ,p_segment1                       => p_segment1
2501       ,p_segment2                       => p_segment2
2502       ,p_segment3                       => p_segment3
2503       ,p_segment4                       => p_segment4
2504       ,p_segment5                       => p_segment5
2505       ,p_segment6                       => p_segment6
2506       ,p_segment7                       => p_segment7
2507       ,p_segment8                       => p_segment8
2508       ,p_segment9                       => p_segment9
2509       ,p_segment10                      => p_segment10
2510       ,p_segment11                      => p_segment11
2511       ,p_segment12                      => p_segment12
2512       ,p_segment13                      => p_segment13
2513       ,p_segment14                      => p_segment14
2514       ,p_segment15                      => p_segment15
2515       ,p_segment16                      => p_segment16
2516       ,p_segment17                      => p_segment17
2517       ,p_segment18                      => p_segment18
2518       ,p_segment19                      => p_segment19
2519       ,p_segment20                      => p_segment20
2520       ,p_segment21                      => p_segment21
2521       ,p_segment22                      => p_segment22
2522       ,p_segment23                      => p_segment23
2523       ,p_segment24                      => p_segment24
2524       ,p_segment25                      => p_segment25
2525       ,p_segment26                      => p_segment26
2526       ,p_segment27                      => p_segment27
2527       ,p_segment28                      => p_segment28
2528       ,p_segment29                      => p_segment29
2529       ,p_segment30                      => p_segment30
2530       ,p_value_1                        => l_value_1
2531       ,p_value_2                        => l_value_2
2532       ,p_value_3                        => l_value_3
2533       ,p_value_4                        => l_value_4
2534       ,p_value_5                        => l_value_5
2535       ,p_value_6                        => l_value_6
2536       ,p_value_7                        => l_value_7
2537       ,p_value_8                        => l_value_8
2538       ,p_value_9                        => l_value_9
2539       ,p_value_10                       => l_value_10
2540       ,p_value_11                       => l_value_11
2541       ,p_value_12                       => l_value_12
2542       ,p_value_13                       => l_value_13
2543       ,p_value_14                       => l_value_14
2544       ,p_value_15                       => l_value_15
2545       );
2546   exception
2547     when hr_api.cannot_find_prog_unit then
2548       hr_api.cannot_find_prog_unit_error
2549         (p_module_name => 'update_batch_line_a'
2550         ,p_hook_type   => 'AP'
2551         );
2552   end;
2553   --
2554   -- When in validation only mode raise the Validate_Enabled exception
2555   --
2556   if p_validate then
2557     raise hr_api.validate_enabled;
2558   end if;
2559   --
2560   -- Set all output arguments
2561   --
2562   p_object_version_number  := l_object_version_number;
2563   --
2564   hr_utility.set_location(' Leaving:'||l_proc, 70);
2565 exception
2566   when hr_api.validate_enabled then
2567     --
2568     -- As the Validate_Enabled exception has been raised
2569     -- we must rollback to the savepoint
2570     --
2571     rollback to update_batch_line;
2572     --
2573     -- Only set output warning arguments
2574     -- (Any key or derived arguments must be set to null
2575     -- when validation only mode is being used.)
2576     --
2577     hr_utility.set_location(' Leaving:'||l_proc, 80);
2578   when others then
2579     --
2580     -- A validation or unexpected error has occured
2581     --
2582     rollback to update_batch_line;
2583     p_object_version_number  := l_object_version_number;
2584     hr_utility.set_location(' Leaving:'||l_proc, 90);
2585     raise;
2586 end update_batch_line;
2587 --
2588 --
2589 -- ----------------------------------------------------------------------------
2590 -- |------------------------< update_batch_total >--------------------------|
2591 -- ----------------------------------------------------------------------------
2592 --
2593 procedure update_batch_total
2594   (p_validate                      in     boolean  default false
2595   ,p_session_date                  in     date
2596   ,p_batch_control_id              in     number
2597   ,p_object_version_number         in out nocopy number
2598   ,p_control_status                in     varchar2 default hr_api.g_varchar2
2599   ,p_control_total                 in     varchar2 default hr_api.g_varchar2
2600   ,p_control_type                  in     varchar2 default hr_api.g_varchar2
2601   ) is
2602   --
2603   -- Declare cursors and local variables
2604   --
2605   l_proc                   varchar2(72) := g_package||'update_batch_total';
2606   l_object_version_number  pay_batch_control_totals.object_version_number%TYPE;
2607   l_session_date           date;
2608   --
2609 begin
2610   hr_utility.set_location('Entering:'|| l_proc, 10);
2611   --
2612   -- Issue a savepoint
2613   --
2614   savepoint update_batch_total;
2615   --
2616   -- Store initial values for IN OUT parameters
2617   --
2618   l_object_version_number := p_object_version_number;
2619   --
2620   -- Truncate the time portion from all IN date parameters
2621   --
2622   l_session_date := trunc(p_session_date);
2623   --
2624   -- Call Before Process User Hook
2625   --
2626   begin
2627     pay_batch_element_entry_bk6.update_batch_total_b
2628       (p_session_date                   => l_session_date
2629       ,p_batch_control_id               => p_batch_control_id
2630       ,p_object_version_number          => l_object_version_number
2631       ,p_control_status                 => p_control_status
2632       ,p_control_total                  => p_control_total
2633       ,p_control_type                   => p_control_type
2634       );
2635   exception
2636     when hr_api.cannot_find_prog_unit then
2637       hr_api.cannot_find_prog_unit_error
2638         (p_module_name => 'update_batch_total_b'
2639         ,p_hook_type   => 'BP'
2640         );
2641   end;
2642   --
2643   -- Validation in addition to Row Handlers
2644   --
2645   --
2646   -- Process Logic
2647   --
2648   pay_bct_upd.upd
2649       (p_session_date             => l_session_date
2650       ,p_batch_control_id         => p_batch_control_id
2651       ,p_object_version_number    => l_object_version_number
2652       ,p_control_status           => p_control_status
2653       ,p_control_total            => p_control_total
2654       ,p_control_type             => p_control_type);
2655   --
2656   -- Call After Process User Hook
2657   --
2658   begin
2659     pay_batch_element_entry_bk6.update_batch_total_a
2660       (p_session_date                   => l_session_date
2661       ,p_batch_control_id               => p_batch_control_id
2662       ,p_object_version_number          => l_object_version_number
2663       ,p_control_status                 => p_control_status
2664       ,p_control_total                  => p_control_total
2665       ,p_control_type                   => p_control_type
2666       );
2667   exception
2668     when hr_api.cannot_find_prog_unit then
2669       hr_api.cannot_find_prog_unit_error
2670         (p_module_name => 'update_batch_total_a'
2671         ,p_hook_type   => 'AP'
2672         );
2673   end;
2674   --
2675   -- When in validation only mode raise the Validate_Enabled exception
2676   --
2677   if p_validate then
2678     raise hr_api.validate_enabled;
2679   end if;
2680   --
2681   -- Set all output arguments
2682   --
2683   p_object_version_number  := l_object_version_number;
2684   --
2685   hr_utility.set_location(' Leaving:'||l_proc, 70);
2686 exception
2687   when hr_api.validate_enabled then
2688     --
2689     -- As the Validate_Enabled exception has been raised
2690     -- we must rollback to the savepoint
2691     --
2692     rollback to update_batch_total;
2693     --
2694     -- Only set output warning arguments
2695     -- (Any key or derived arguments must be set to null
2696     -- when validation only mode is being used.)
2697     --
2698     hr_utility.set_location(' Leaving:'||l_proc, 80);
2699   when others then
2700     --
2701     -- A validation or unexpected error has occured
2702     --
2703     rollback to update_batch_total;
2704     p_object_version_number  := l_object_version_number;
2705     hr_utility.set_location(' Leaving:'||l_proc, 90);
2706     raise;
2707 end update_batch_total;
2708 --
2709 --
2710 -- ----------------------------------------------------------------------------
2711 -- |------------------------< delete_batch_header >-------------------------|
2712 -- ----------------------------------------------------------------------------
2713 --
2714 procedure delete_batch_header
2715   (p_validate                      in     boolean  default false
2716   ,p_batch_id                      in     number
2717   ,p_object_version_number         in     number
2718   ) is
2719   --
2720   -- Declare cursors and local variables
2721   --
2722   l_proc                  varchar2(72) := g_package||'delete_batch_header';
2723   --
2724   cursor csr_batch_lines is
2725      select btl.batch_line_id,btl.object_version_number
2726        from pay_batch_lines btl
2727       where btl.batch_id = p_batch_id;
2728   --
2729   cursor csr_batch_ctl_totals is
2730      select bct.batch_control_id,bct.object_version_number
2731        from pay_batch_control_totals bct
2732       where bct.batch_id = p_batch_id;
2733   --
2734 begin
2735   hr_utility.set_location('Entering:'|| l_proc, 5);
2736   --
2737   -- Issue a savepoint if operating in validation only mode.
2738   --
2739   savepoint delete_batch_header;
2740   --
2741   -- Call Before Process User Hook
2742   --
2743   begin
2744     pay_batch_element_entry_bk7.delete_batch_header_b
2745       (p_batch_id                       => p_batch_id
2746       ,p_object_version_number          => p_object_version_number
2747       );
2748   exception
2749     when hr_api.cannot_find_prog_unit then
2750       hr_api.cannot_find_prog_unit_error
2751         (p_module_name => 'delete_batch_header_b'
2752         ,p_hook_type   => 'BP'
2753         );
2754   end;
2755   --
2756   --
2757   hr_utility.set_location(l_proc, 7);
2758   --
2759   -- Process Logic
2760   --
2761   --
2762   -- Deletes all batch lines.
2763   --
2764   for cssr in csr_batch_lines loop
2765       --
2766       -- Deletes all messages
2767       --
2768       delete from pay_message_lines
2769        where SOURCE_TYPE = 'L'
2770          and SOURCE_ID = cssr.batch_line_id;
2771       --
2772       pay_btl_del.del
2773       (p_batch_line_id                 => cssr.batch_line_id
2774       ,p_object_version_number         => cssr.object_version_number
2775       );
2776   end loop;
2777   --
2778   hr_utility.set_location(l_proc, 10);
2779   --
2780   -- Deletes all batch control totals
2781   --
2782   for cssr in csr_batch_ctl_totals loop
2783       --
2784       -- Deletes all messages
2785       --
2786       delete from pay_message_lines
2787        where SOURCE_TYPE = 'C'
2788          and SOURCE_ID = cssr.batch_control_id;
2789       --
2790       pay_bct_del.del
2791       (p_batch_control_id              => cssr.batch_control_id
2792       ,p_object_version_number         => cssr.object_version_number
2793       );
2794   end loop;
2795   --
2796   hr_utility.set_location(l_proc, 15);
2797   --
2798   -- Deletes all messages
2799   --
2800   delete from pay_message_lines
2801    where SOURCE_TYPE = 'H'
2802      and SOURCE_ID = p_batch_id;
2803   --
2804   -- Deletes the batch header
2805   --
2806   pay_bth_del.del
2807   (p_batch_id                      => p_batch_id
2808   ,p_object_version_number         => p_object_version_number
2809   );
2810   --
2811   hr_utility.set_location(l_proc, 20);
2812   --
2813   --
2814   -- Call After Process User Hook
2815   --
2816   begin
2817     pay_batch_element_entry_bk7.delete_batch_header_a
2818       (p_batch_id                       => p_batch_id
2819       ,p_object_version_number          => p_object_version_number
2820       );
2821   exception
2822     when hr_api.cannot_find_prog_unit then
2823       hr_api.cannot_find_prog_unit_error
2824         (p_module_name => 'delete_batch_header_a'
2825         ,p_hook_type   => 'AP'
2826         );
2827   end;
2828   --
2829   -- When in validation only mode raise the Validate_Enabled exception
2830   --
2831   if p_validate then
2832     raise hr_api.validate_enabled;
2833   end if;
2834   --
2835   hr_utility.set_location(' Leaving:'||l_proc, 21);
2836 exception
2837   when hr_api.validate_enabled then
2838     --
2839     -- As the Validate_Enabled exception has been raised
2840     -- we must rollback to the savepoint
2841     --
2842     ROLLBACK TO delete_batch_header;
2843     --
2844     hr_utility.set_location(' Leaving:'||l_proc, 22);
2845   --
2846   when others then
2847   --
2848   --
2849   ROLLBACK TO delete_batch_header;
2850   --
2851   raise;
2852   --
2853 end delete_batch_header;
2854 --
2855 --
2856 -- ----------------------------------------------------------------------------
2857 -- |-------------------------< delete_batch_line >--------------------------|
2858 -- ----------------------------------------------------------------------------
2859 --
2860 procedure delete_batch_line
2861   (p_validate                      in     boolean  default false
2862   ,p_batch_line_id                 in     number
2863   ,p_object_version_number         in     number
2864   ) is
2865   --
2866   -- Declare cursors and local variables
2867   --
2868   l_proc                  varchar2(72) := g_package||'delete_batch_line';
2869   --
2870 begin
2871   hr_utility.set_location('Entering:'|| l_proc, 5);
2872   --
2873   -- Issue a savepoint if operating in validation only mode.
2874   --
2875   savepoint delete_batch_line;
2876   --
2877   -- Call Before Process User Hook
2878   --
2879   begin
2880     pay_batch_element_entry_bk8.delete_batch_line_b
2881       (p_batch_line_id                  => p_batch_line_id
2882       ,p_object_version_number          => p_object_version_number
2883       );
2884   exception
2885     when hr_api.cannot_find_prog_unit then
2886       hr_api.cannot_find_prog_unit_error
2887         (p_module_name => 'delete_batch_line_b'
2888         ,p_hook_type   => 'BP'
2889         );
2890   end;
2891   --
2892   --
2893   hr_utility.set_location(l_proc, 7);
2894   --
2895   -- Process Logic
2896   --
2897   --
2898   -- Deletes all messages
2899   --
2900   delete from pay_message_lines
2901    where SOURCE_TYPE = 'L'
2902      and SOURCE_ID = p_batch_line_id;
2903   --
2904   -- Deletes the batch line
2905   --
2906   pay_btl_del.del
2907   (p_batch_line_id                 => p_batch_line_id
2908   ,p_object_version_number         => p_object_version_number
2909   );
2910   --
2911   hr_utility.set_location(l_proc, 20);
2912   --
2913   --
2914   -- Call After Process User Hook
2915   --
2916   begin
2917     pay_batch_element_entry_bk8.delete_batch_line_a
2918       (p_batch_line_id                  => p_batch_line_id
2919       ,p_object_version_number          => p_object_version_number
2920       );
2921   exception
2922     when hr_api.cannot_find_prog_unit then
2923       hr_api.cannot_find_prog_unit_error
2924         (p_module_name => 'delete_batch_line_a'
2925         ,p_hook_type   => 'AP'
2926         );
2927   end;
2928   --
2929   -- When in validation only mode raise the Validate_Enabled exception
2930   --
2931   if p_validate then
2932     raise hr_api.validate_enabled;
2933   end if;
2934   --
2935   hr_utility.set_location(' Leaving:'||l_proc, 21);
2936 exception
2937   when hr_api.validate_enabled then
2938     --
2939     -- As the Validate_Enabled exception has been raised
2940     -- we must rollback to the savepoint
2941     --
2942     ROLLBACK TO delete_batch_line;
2943     --
2944     hr_utility.set_location(' Leaving:'||l_proc, 22);
2945   --
2946   when others then
2947   --
2948   --
2949   ROLLBACK TO delete_batch_line;
2950   --
2951   raise;
2952   --
2953 end delete_batch_line;
2954 --
2955 --
2956 -- ----------------------------------------------------------------------------
2957 -- |------------------------< delete_batch_total >--------------------------|
2958 -- ----------------------------------------------------------------------------
2959 --
2960 procedure delete_batch_total
2961   (p_validate                      in     boolean  default false
2962   ,p_batch_control_id              in     number
2963   ,p_object_version_number         in     number
2964   ) is
2965   --
2966   -- Declare cursors and local variables
2967   --
2968   l_proc                  varchar2(72) := g_package||'delete_batch_total';
2969   --
2970 begin
2971   hr_utility.set_location('Entering:'|| l_proc, 5);
2972   --
2973   -- Issue a savepoint if operating in validation only mode.
2974   --
2975   savepoint delete_batch_total;
2976   --
2977   -- Call Before Process User Hook
2978   --
2979   begin
2980     pay_batch_element_entry_bk9.delete_batch_total_b
2981       (p_batch_control_id               => p_batch_control_id
2982       ,p_object_version_number          => p_object_version_number
2983       );
2984   exception
2985     when hr_api.cannot_find_prog_unit then
2986       hr_api.cannot_find_prog_unit_error
2987         (p_module_name => 'delete_batch_total_b'
2988         ,p_hook_type   => 'BP'
2989         );
2990   end;
2991   --
2992   --
2993   hr_utility.set_location(l_proc, 7);
2994   --
2995   -- Process Logic
2996   --
2997   --
2998   -- Deletes all messages
2999   --
3000   delete from pay_message_lines
3001    where SOURCE_TYPE = 'C'
3002      and SOURCE_ID = p_batch_control_id;
3003   --
3004   -- Deletes the batch header
3005   --
3006   pay_bct_del.del
3007   (p_batch_control_id              => p_batch_control_id
3008   ,p_object_version_number         => p_object_version_number
3009   );
3010   --
3011   hr_utility.set_location(l_proc, 20);
3012   --
3013   --
3014   -- Call After Process User Hook
3015   --
3016   begin
3017     pay_batch_element_entry_bk9.delete_batch_total_a
3018       (p_batch_control_id               => p_batch_control_id
3019       ,p_object_version_number          => p_object_version_number
3020       );
3021   exception
3022     when hr_api.cannot_find_prog_unit then
3023       hr_api.cannot_find_prog_unit_error
3024         (p_module_name => 'delete_batch_total_a'
3025         ,p_hook_type   => 'AP'
3026         );
3027   end;
3028   --
3029   -- When in validation only mode raise the Validate_Enabled exception
3030   --
3031   if p_validate then
3032     raise hr_api.validate_enabled;
3033   end if;
3034   --
3035   hr_utility.set_location(' Leaving:'||l_proc, 21);
3036 exception
3037   when hr_api.validate_enabled then
3038     --
3039     -- As the Validate_Enabled exception has been raised
3040     -- we must rollback to the savepoint
3041     --
3042     ROLLBACK TO delete_batch_total;
3043     --
3044     hr_utility.set_location(' Leaving:'||l_proc, 22);
3045   --
3046   when others then
3047   --
3048   --
3049   ROLLBACK TO delete_batch_total;
3050   --
3051   raise;
3052   --
3053 end delete_batch_total;
3054 --
3055 end PAY_BATCH_ELEMENT_ENTRY_API;