DBA Data[Home] [Help]

PACKAGE BODY: APPS.PAY_PRT_BUS

Source


1 Package Body pay_prt_bus as
2 /* $Header: pyprtrhi.pkb 115.13 2003/02/28 15:52:21 alogue noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  pay_prt_bus.';  -- Global package name
9 --
10 -- The following two global variables are only to be
11 -- used by the return_legislation_code function.
12 --
13 g_legislation_code            varchar2(150)  default null;
14 g_run_type_id                 number         default null;
15 --
16 --  ---------------------------------------------------------------------------
17 --  |----------------------< set_security_group_id >--------------------------|
18 --  ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21   (p_run_type_id                          in number
22   ) is
23   --
24   -- Declare cursor
25   --
26   cursor csr_sec_grp is
27     select pbg.security_group_id
28       from per_business_groups pbg
29          , pay_run_types_f prt
30      where prt.run_type_id = p_run_type_id
31        and pbg.business_group_id = prt.business_group_id;
32   --
33   -- Declare local variables
34   --
35   l_security_group_id number;
36   l_proc              varchar2(72)  :=  g_package||'set_security_group_id';
37   --
38 begin
39   --
40   hr_utility.set_location('Entering:'|| l_proc, 10);
41   --
42   -- Ensure that all the mandatory parameter are not null
43   --
44   hr_api.mandatory_arg_error
45     (p_api_name           => l_proc
46     ,p_argument           => 'run_type_id'
47     ,p_argument_value     => p_run_type_id
48     );
49   --
50   open csr_sec_grp;
51   fetch csr_sec_grp into l_security_group_id;
52   --
53   if csr_sec_grp%notfound then
54      --
55      close csr_sec_grp;
56      --
57      -- The primary key is invalid therefore we must error
58      --
59      fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
60      fnd_message.raise_error;
61      --
62   end if;
63   close csr_sec_grp;
64   --
65   -- Set the security_group_id in CLIENT_INFO
66   --
67   hr_api.set_security_group_id
68     (p_security_group_id => l_security_group_id
69     );
70   --
71   hr_utility.set_location(' Leaving:'|| l_proc, 20);
72   --
73 end set_security_group_id;
74 --
75 -- ----------------------------------------------------------------------------
76 -- |------------------------< return_legislation_code >-----------------------|
77 -- ----------------------------------------------------------------------------
78 Function return_legislation_code
79   (p_run_type_id                          in     number
80   )
81   Return Varchar2 Is
82   --
83   -- Declare cursor
84   --
85   cursor csr_leg_code is
86     select pbg.legislation_code
87       from per_business_groups pbg
88          , pay_run_types_f prt
89      where prt.run_type_id = p_run_type_id
90        and pbg.business_group_id (+) = prt.business_group_id;
91   --
92   -- Declare local variables
93   --
94   l_legislation_code  varchar2(150);
95   l_proc              varchar2(72)  :=  g_package||'return_legislation_code';
96   --
97 Begin
98   --
99   hr_utility.set_location('Entering:'|| l_proc, 10);
100   --
101   -- Ensure that all the mandatory parameter are not null
102   --
103   hr_api.mandatory_arg_error
104     (p_api_name           => l_proc
105     ,p_argument           => 'run_type_id'
106     ,p_argument_value     => p_run_type_id
107     );
108   --
109   if ( nvl(pay_prt_bus.g_run_type_id, hr_api.g_number)
110        = p_run_type_id) then
111     --
112     -- The legislation code has already been found with a previous
113     -- call to this function. Just return the value in the global
114     -- variable.
115     --
116     l_legislation_code := pay_prt_bus.g_legislation_code;
117     hr_utility.set_location(l_proc, 20);
118   else
119     --
120     -- The ID is different to the last call to this function
121     -- or this is the first call to this function.
122     --
123     open csr_leg_code;
124     fetch csr_leg_code into l_legislation_code;
125     --
126     if csr_leg_code%notfound then
127       --
128       -- The primary key is invalid therefore we must error
129       --
130       close csr_leg_code;
131       fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
132       fnd_message.raise_error;
133     end if;
134     hr_utility.set_location(l_proc,30);
135     --
136     -- Set the global variables so the values are
137     -- available for the next call to this function.
138     --
139     close csr_leg_code;
140     pay_prt_bus.g_run_type_id       := p_run_type_id;
141     pay_prt_bus.g_legislation_code  := l_legislation_code;
142   end if;
143   hr_utility.set_location(' Leaving:'|| l_proc, 40);
144   return l_legislation_code;
145 end return_legislation_code;
146 --
147 /*
148 RET 20th April think this is now obsolete, but won't delete until this is
149 confirmed.
150 --  ---------------------------------------------------------------------------
151 --  |------------------< return_legislation_code_child >----------------------|
152 --  ---------------------------------------------------------------------------
153 --
154 Function return_legislation_code_child
155   (p_run_type_id  in number
156   )
157   Return Varchar2 Is
158   --
159   -- declare cursor
160   --
161   cursor csr_get_bg_id
162   is
163   select prt.business_group_id
164   from   pay_run_types_f prt
165   where  prt.run_type_id = p_run_type_id;
166   --
167   l_legislation_code  varchar2(150);
168   l_bg_id             number(15);
169   l_proc          varchar2(72)  :=  g_package||'return_legislation_code_child';
170 Begin
171 --
172 hr_utility.set_location('Entering:'|| l_proc, 10);
173 --
174 if ( nvl(pay_prt_bus.g_run_type_id, hr_api.g_number) = p_run_type_id) then
175   --
176   -- The legislation code has already been found with a previous
177   -- call to this function. Just return the value in the global
178   -- variable.
179   --
180     l_legislation_code := pay_prt_bus.g_legislation_code;
181     hr_utility.set_location(l_proc, 20);
182 else
183   open  csr_get_bg_id;
184   fetch csr_get_bg_id into l_gb_id;
185   --
186   if get_gb_id%notfound then
187   --
188   -- The primary key is invalid therefore we must error
189   --
190     close csr_get_bg_id;
191     fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
192     fnd_message.raise_error;
193     hr_utility.set_location(l_proc,20);
194   else -- a row is found
195   --
196   -- if bg is null then return null, else get the leg code using the hr_api
197   -- function.
198   --
199     if l_bg_id is null then
200     --
201       l_legislation_code := '';
202       hr_utility.set_location(l_proc,30);
203     else
204       l_legislation_code := hr_api.return_legislation_code
205                                (p_business_group_id => l_bg_id);
206       hr_utility.set_location(l_proc,40);
207     end if;
208   end if; -- cursor not found
209   --
210   close csr_get_bg_id;
211   --
212   -- Set the global variables so the values are
213   -- available for the next call to this function.
214   --
215   pay_prt_bus.g_run_type_id       := p_run_type_id;
216   pay_prt_bus.g_legislation_code  := l_legislation_code;
217 end if;
218   --
219 hr_utility.set_location(' Leaving:'|| l_proc, 50);
220 return l_legislation_code;
221 end return_legislation_code_child;
222 */
223 -- ----------------------------------------------------------------------------
224 -- |---------------------------< chk_run_method >-----------------------------|
225 -- ----------------------------------------------------------------------------
226 -- {Start Of Comments}
227 --
228 -- Description:
229 --   This procedure is used to ensure that the run_method is one of the
230 --   following:
231 --      N - Normal
232 --  C - Cumulative
233 --  S - Separate Payment
234 --  P - Process Separately
235 --
236 -- Pre Conditions:
237 --   g_old_rec has been populated with details of the values currently in
238 --   the database.
239 --
240 -- In Arguments:
241 --   p_rec has been populated with the updated values the user would like the
242 --   record set to.
243 --
244 -- Post Success:
245 --   Processing continues if a valid run_method has been entered.
246 --
247 -- Post Failure:
248 --   An application error is raised if a invalid run_method has been entered.
249 --
250 -- {End Of Comments}
251 -- ----------------------------------------------------------------------------
252 Procedure chk_run_method
253   (p_effective_date  in date
254   ,p_validation_start_date in date
255   ,p_validation_end_date in date
256   ,p_run_method            in varchar2) IS
257 --
258   l_proc     varchar2(72) := g_package || 'chk_run_method';
259   l_error    EXCEPTION;
260   l_argument varchar2(30);
261 --
262 Begin
263 --
264 -- As RUN_METHOD is a system level lookup_type, not extensible, users will
265 -- not be able to add new lookup_codes. Thus only need to validate against
266 -- hr_standard_lookups, even though the table does have a business_group_id
267 -- and would expect to need to validate against hr_lookups.
268 --
269 hr_utility.set_location('Entering: '||l_proc,5);
270 --
271   IF hr_api.not_exists_in_dt_hrstanlookups
272                       (p_effective_date          => p_effective_date
273                       ,p_validation_start_date   => p_validation_start_date
274                       ,p_validation_end_date     => p_validation_end_date
275                       ,p_lookup_type             => 'RUN_METHOD'
276                       ,p_lookup_code             => p_run_method
277                       )
278   THEN
279   --
280   -- The RUN_METHOD for this record is not recognised
281   --
282     fnd_message.set_name('PAY','HR_xxxx_INVALID_RUN_METHOD');
283     fnd_message.raise_error;
284     --
285     hr_utility.set_location(l_proc,10);
286   END IF;
287   --
288 hr_utility.set_location('Leaving: '||l_proc,15);
289 --
290 End chk_run_method;
291 -- ----------------------------------------------------------------------------
292 -- |--------------------------< chk_run_type_name >---------------------------|
293 -- ----------------------------------------------------------------------------
294 -- {Start Of Comments}
295 --
296 -- Description:
297 --   This procedure is used to ensure that the run_type_name is unique within
298 --   a business group and across all modes.
299 --
300 -- Pre Conditions:
301 --   g_old_rec has been populated with details of the values currently in
302 --   the database.
303 --
304 -- In Arguments:
305 --   p_rec has been populated with the updated values the user would like the
306 --   record set to.
307 --
308 -- Post Success:
309 --   Processing continues if a valid run_type_name has been entered.
310 --
311 -- Post Failure:
312 --   An application error is raised if a duplicate run_type_name has been
313 --   entered.
314 --
315 -- {End Of Comments}
316 -- ----------------------------------------------------------------------------
317 Procedure chk_run_type_name
318   (p_run_type_id       in number
319   ,p_run_type_name     in varchar2
320   ,p_effective_date    in date
321   ,p_business_group_id in number default null
322   ,p_legislation_code  in varchar2 default null) IS
323 --
324   l_proc     varchar2(72) := g_package || 'chk_run_type_name';
325   l_error    EXCEPTION;
326   l_argument varchar2(30);
327   l_run_type_name varchar2(80);
328   l_mode     varchar2(30);
329   --
330 /*
331   cursor csr_rt_name is
332   select prt.run_type_name
333   from   pay_run_types_f prt
334   where  prt.run_type_name = p_run_type_name
335   and    nvl(prt.business_group_id, -1) = nvl(p_business_group_id
336                                               , nvl(prt.business_group_id, -1))
337   and    nvl(prt.legislation_code, 'CORE') = nvl(p_legislation_code, 'CORE')
338   and    p_effective_date between prt.effective_start_date
339                               and prt.effective_end_date;
340 */
341   cursor csr_rt_name_u is
342   select prt.run_type_name
343   from   pay_run_types_f prt
344   where  prt.business_group_id = p_business_group_id
345   and    prt.legislation_code is null
346   and    prt.run_type_name = p_run_type_name
347   and    p_effective_date between prt.effective_start_date
348                               and prt.effective_end_date;
349   --
350   cursor csr_rt_name_s is
351   select prt.run_type_name
355   and    prt.run_type_name = p_run_type_name
352   from   pay_run_types_f prt
353   where  prt.legislation_code = p_legislation_code
354   and    prt.business_group_id is null
356   and    p_effective_date between prt.effective_start_date
357                               and prt.effective_end_date;
358   --
359   cursor csr_rt_name_g is
360   select prt.run_type_name
361   from   pay_run_types_f prt
362   where  prt.run_type_name = p_run_type_name
363   and    prt.business_group_id is null
364   and    prt.legislation_code is null
365   and    p_effective_date between prt.effective_start_date
366                               and prt.effective_end_date;
367 --
368 Begin
369 --
370 hr_utility.set_location('Entering: '||l_proc,5);
371 --
372 -- Only execute the cursor if absolutely necessary.
373 -- a) During update, the run_type_name has actually changed to another not
374 --    null value, i,e, the value passed to this procedure is different to the
375 --    g_old_rec value.
376 -- b) During insert, the run_type_name is null.
377 -- Can tell the difference between insert and update by looking at the
378 -- primary key value. For update it will be not null. For insert it will be
379 -- null, because pre_inset has not been called yet.
380 --
381 IF (((p_run_type_id is not null) and
382      nvl(pay_prt_shd.g_old_rec.run_type_name, hr_api.g_varchar2) <>
383      nvl(p_run_type_name, hr_api.g_varchar2))
384    or
385     (p_run_type_id is null)) then
386     --
387       hr_utility.set_location(l_proc, 10);
388       --
389       -- Only need to open the cursor if run_type_name is not null
390       --
391       if p_run_type_name is not null then
392       --
393       -- get mode then open the corresponding cursor
394       --
395       l_mode := hr_startup_data_api_support.return_startup_mode;
396       --
397         if l_mode = 'GENERIC' then
398         --
399           OPEN csr_rt_name_g;
400           FETCH csr_rt_name_g INTO l_run_type_name;
401           IF csr_rt_name_g%FOUND THEN
402             hr_utility.set_message(801,'HR_33592_PRT_DUP_NAME');
403             hr_utility.raise_error;
404           END IF;
405           CLOSE csr_rt_name_g;
406           hr_utility.set_location(l_proc, 15);
407           --
408         elsif l_mode = 'STARTUP' then
409         --
410           OPEN csr_rt_name_s;
411           FETCH csr_rt_name_s INTO l_run_type_name;
412           IF csr_rt_name_s%FOUND THEN
413             hr_utility.set_message(801,'HR_33592_PRT_DUP_NAME');
414             hr_utility.raise_error;
415           END IF;
416           CLOSE csr_rt_name_s;
417           hr_utility.set_location(l_proc, 20);
418         else -- mode is USER
419         --
420           OPEN csr_rt_name_u;
421           FETCH csr_rt_name_u INTO l_run_type_name;
422           IF csr_rt_name_u%FOUND THEN
423             hr_utility.set_message(801,'HR_33592_PRT_DUP_NAME');
424             hr_utility.raise_error;
425           END IF;
426           CLOSE csr_rt_name_u;
427           hr_utility.set_location(l_proc, 25);
428         end if; -- what mode
429 /*
430 Logic has changed back! so that names are unique within a business group
431 and within a legislation. So, you have the same name for an RT in a BG as
432 in a STARTUP row, but you cannot have duplicate rows in a bg or in a particular
433 legislation.
434         OPEN csr_rt_name;
435         FETCH csr_rt_name into l_run_type_name;
436         IF csr_rt_name%FOUND THEN
437           hr_utility.set_message(801,'HR_33592_PRT_DUP_NAME');
438           hr_utility.raise_error;
439         END IF;
440         CLOSE csr_rt_name;
441       end if;
442 */
443       --
444   end if;
445 end if;
446 hr_utility.set_location('Leaving: '||l_proc, 20);
447 --
448 END chk_run_type_name;
449 --
450 -- ----------------------------------------------------------------------------
454 --
451 -- |--------------------------< chk_srs_flag >--------------------------------|
452 -- ----------------------------------------------------------------------------
453 -- {Start Of Comments}
455 -- Description:
456 --   This procedure is used to ensure that srs_flag value is either 'Y' or 'N'.
457 --
458 -- Pre Conditions:
459 --   g_old_rec has been populated with details of the values currently in
460 --   the database.
461 --
462 -- In Arguments:
463 --   p_rec has been populated with the updated values the user would like the
464 --   record set to.
465 --
466 -- Post Success:
467 --   Processing continues if a valid srs_flag value has been entered.
468 --
469 -- Post Failure:
470 --   An application error is raised if an invalid srs_flag has been enetred
471 --
472 -- {End Of Comments}
473 -- ----------------------------------------------------------------------------
474 Procedure chk_srs_flag(p_srs_flag       in varchar2
475                       ,p_effective_date in date)
476 is
477 Begin
478   If p_srs_flag is not null Then
479     If hr_api.not_exists_in_hr_lookups
480       (p_effective_date
481       ,'YES_NO'
482       ,p_srs_flag) Then
483       --
484       fnd_message.set_name('PAY','HR_52966_INVALID_LOOKUP');
485       fnd_message.set_token('COLUMN','SRS_FLAG');
486       fnd_message.set_token('LOOKUP_TYPE','YES_NO');
487       fnd_message.raise_error;
488       --
489     End If;
490   End If;
491 End chk_srs_flag;
492 -- ----------------------------------------------------------------------------
493 -- |-----------------------------< chk_ddf >----------------------------------|
494 -- ----------------------------------------------------------------------------
495 --
496 -- Description:
497 --   Validates all the Developer Descriptive Flexfield values.
498 --
499 -- Prerequisites:
500 --   All other columns have been validated.  Must be called as the
501 --   last step from insert_validate and update_validate.
502 --
503 -- In Arguments:
504 --   p_rec
505 --
506 -- Post Success:
507 --   If the Developer Descriptive Flexfield structure column and data values
508 --   are all valid this procedure will end normally and processing will
509 --   continue.
510 --
511 -- Post Failure:
512 --   If the Developer Descriptive Flexfield structure column value or any of
513 --   the data values are invalid then an application error is raised as
514 --   a PL/SQL exception.
515 --
516 -- Access Status:
517 --   Internal Row Handler Use Only.
518 --
519 -- ----------------------------------------------------------------------------
520 procedure chk_ddf
521   (p_rec in pay_prt_shd.g_rec_type
522   ) is
523 --
524   l_proc   varchar2(72) := g_package || 'chk_ddf';
525 --
526 begin
527   hr_utility.set_location('Entering:'||l_proc,10);
528   --
529   if ((p_rec.run_type_id is not null)  and
530     (nvl(pay_prt_shd.g_old_rec.run_information_category,
531          hr_api.g_varchar2) <>
532     nvl(p_rec.run_information_category, hr_api.g_varchar2)  or
533     nvl(pay_prt_shd.g_old_rec.run_information1, hr_api.g_varchar2) <>
534     nvl(p_rec.run_information1, hr_api.g_varchar2)  or
535     nvl(pay_prt_shd.g_old_rec.run_information2, hr_api.g_varchar2) <>
536     nvl(p_rec.run_information2, hr_api.g_varchar2)  or
537     nvl(pay_prt_shd.g_old_rec.run_information3, hr_api.g_varchar2) <>
538     nvl(p_rec.run_information3, hr_api.g_varchar2)  or
539     nvl(pay_prt_shd.g_old_rec.run_information4, hr_api.g_varchar2) <>
540     nvl(p_rec.run_information4, hr_api.g_varchar2)  or
541     nvl(pay_prt_shd.g_old_rec.run_information5, hr_api.g_varchar2) <>
542     nvl(p_rec.run_information5, hr_api.g_varchar2)  or
543     nvl(pay_prt_shd.g_old_rec.run_information6, hr_api.g_varchar2) <>
544     nvl(p_rec.run_information6, hr_api.g_varchar2)  or
545     nvl(pay_prt_shd.g_old_rec.run_information7, hr_api.g_varchar2) <>
546     nvl(p_rec.run_information7, hr_api.g_varchar2)  or
547     nvl(pay_prt_shd.g_old_rec.run_information8, hr_api.g_varchar2) <>
548     nvl(p_rec.run_information8, hr_api.g_varchar2)  or
549     nvl(pay_prt_shd.g_old_rec.run_information9, hr_api.g_varchar2) <>
550     nvl(p_rec.run_information9, hr_api.g_varchar2)  or
551     nvl(pay_prt_shd.g_old_rec.run_information10, hr_api.g_varchar2) <>
552     nvl(p_rec.run_information10, hr_api.g_varchar2)  or
553     nvl(pay_prt_shd.g_old_rec.run_information11, hr_api.g_varchar2) <>
554     nvl(p_rec.run_information11, hr_api.g_varchar2)  or
555     nvl(pay_prt_shd.g_old_rec.run_information12, hr_api.g_varchar2) <>
556     nvl(p_rec.run_information12, hr_api.g_varchar2)  or
557     nvl(pay_prt_shd.g_old_rec.run_information13, hr_api.g_varchar2) <>
558     nvl(p_rec.run_information13, hr_api.g_varchar2)  or
559     nvl(pay_prt_shd.g_old_rec.run_information14, hr_api.g_varchar2) <>
560     nvl(p_rec.run_information14, hr_api.g_varchar2)  or
561     nvl(pay_prt_shd.g_old_rec.run_information15, hr_api.g_varchar2) <>
562     nvl(p_rec.run_information15, hr_api.g_varchar2)  or
563     nvl(pay_prt_shd.g_old_rec.run_information16, hr_api.g_varchar2) <>
564     nvl(p_rec.run_information16, hr_api.g_varchar2)  or
565     nvl(pay_prt_shd.g_old_rec.run_information17, hr_api.g_varchar2) <>
566     nvl(p_rec.run_information17, hr_api.g_varchar2)  or
570     nvl(p_rec.run_information19, hr_api.g_varchar2)  or
567     nvl(pay_prt_shd.g_old_rec.run_information18, hr_api.g_varchar2) <>
568     nvl(p_rec.run_information18, hr_api.g_varchar2)  or
569     nvl(pay_prt_shd.g_old_rec.run_information19, hr_api.g_varchar2) <>
571     nvl(pay_prt_shd.g_old_rec.run_information20, hr_api.g_varchar2) <>
572     nvl(p_rec.run_information20, hr_api.g_varchar2)  or
573     nvl(pay_prt_shd.g_old_rec.run_information21, hr_api.g_varchar2) <>
574     nvl(p_rec.run_information21, hr_api.g_varchar2)  or
575     nvl(pay_prt_shd.g_old_rec.run_information22, hr_api.g_varchar2) <>
576     nvl(p_rec.run_information22, hr_api.g_varchar2)  or
577     nvl(pay_prt_shd.g_old_rec.run_information23, hr_api.g_varchar2) <>
578     nvl(p_rec.run_information23, hr_api.g_varchar2)  or
579     nvl(pay_prt_shd.g_old_rec.run_information24, hr_api.g_varchar2) <>
580     nvl(p_rec.run_information24, hr_api.g_varchar2)  or
581     nvl(pay_prt_shd.g_old_rec.run_information25, hr_api.g_varchar2) <>
582     nvl(p_rec.run_information25, hr_api.g_varchar2)  or
583     nvl(pay_prt_shd.g_old_rec.run_information26, hr_api.g_varchar2) <>
584     nvl(p_rec.run_information26, hr_api.g_varchar2)  or
585     nvl(pay_prt_shd.g_old_rec.run_information27, hr_api.g_varchar2) <>
586     nvl(p_rec.run_information27, hr_api.g_varchar2)  or
587     nvl(pay_prt_shd.g_old_rec.run_information28, hr_api.g_varchar2) <>
588     nvl(p_rec.run_information28, hr_api.g_varchar2)  or
589     nvl(pay_prt_shd.g_old_rec.run_information29, hr_api.g_varchar2) <>
590     nvl(p_rec.run_information29, hr_api.g_varchar2)  or
591     nvl(pay_prt_shd.g_old_rec.run_information30, hr_api.g_varchar2) <>
592     nvl(p_rec.run_information30, hr_api.g_varchar2))  )
593     or (p_rec.run_type_id is null)  then
594     --
595     -- Only execute the validation if absolutely necessary:
596     -- a) During update, the structure column value or any
597     --    of the attribute values have actually changed.
598     -- b) During insert.
599     --
600 
601     hr_dflex_utility.ins_or_upd_descflex_attribs
602       (p_appl_short_name		  => 'PAY'
603       ,p_descflex_name			  => 'Pay Run Type Developer DF'
604       ,p_attribute_category	          => p_rec.run_information_category
605       ,p_attribute1_name		  => 'RUN_INFORMATION1'
606       ,p_attribute1_value		  => p_rec.run_information1
607       ,p_attribute2_name		  => 'RUN_INFORMATION2'
608       ,p_attribute2_value		  => p_rec.run_information2
609       ,p_attribute3_name		  => 'RUN_INFORMATION3'
610       ,p_attribute3_value		  => p_rec.run_information3
611       ,p_attribute4_name		  => 'RUN_INFORMATION4'
612       ,p_attribute4_value                 => p_rec.run_information4
613       ,p_attribute5_name                  => 'RUN_INFORMATION5'
614       ,p_attribute5_value                 => p_rec.run_information5
615       ,p_attribute6_name                  => 'RUN_INFORMATION6'
616       ,p_attribute6_value                 => p_rec.run_information6
617       ,p_attribute7_name                  => 'RUN_INFORMATION7'
618       ,p_attribute7_value                 => p_rec.run_information7
619       ,p_attribute8_name                  => 'RUN_INFORMATION8'
620       ,p_attribute8_value                 => p_rec.run_information8
621       ,p_attribute9_name                  => 'RUN_INFORMATION9'
622       ,p_attribute9_value                 => p_rec.run_information9
623       ,p_attribute10_name                 => 'RUN_INFORMATION10'
624       ,p_attribute10_value                => p_rec.run_information10
625       ,p_attribute11_name                 => 'RUN_INFORMATION11'
626       ,p_attribute11_value                => p_rec.run_information11
627       ,p_attribute12_name                 => 'RUN_INFORMATION12'
628       ,p_attribute12_value                => p_rec.run_information12
629       ,p_attribute13_name                 => 'RUN_INFORMATION13'
630       ,p_attribute13_value                => p_rec.run_information13
631       ,p_attribute14_name                 => 'RUN_INFORMATION14'
632       ,p_attribute14_value                => p_rec.run_information14
633       ,p_attribute15_name                 => 'RUN_INFORMATION15'
634       ,p_attribute15_value                => p_rec.run_information15
635       ,p_attribute16_name                 => 'RUN_INFORMATION16'
636       ,p_attribute16_value                => p_rec.run_information16
637       ,p_attribute17_name                 => 'RUN_INFORMATION17'
638       ,p_attribute17_value                => p_rec.run_information17
639       ,p_attribute18_name                 => 'RUN_INFORMATION18'
640       ,p_attribute18_value                => p_rec.run_information18
641       ,p_attribute19_name                 => 'RUN_INFORMATION19'
642       ,p_attribute19_value                => p_rec.run_information19
643       ,p_attribute20_name                 => 'RUN_INFORMATION20'
644       ,p_attribute20_value                => p_rec.run_information20
645       ,p_attribute21_name                 => 'RUN_INFORMATION21'
646       ,p_attribute21_value                => p_rec.run_information21
647       ,p_attribute22_name                 => 'RUN_INFORMATION22'
648       ,p_attribute22_value                => p_rec.run_information22
649       ,p_attribute23_name                 => 'RUN_INFORMATION23'
650       ,p_attribute23_value                => p_rec.run_information23
651       ,p_attribute24_name                 => 'RUN_INFORMATION24'
652       ,p_attribute24_value                => p_rec.run_information24
653       ,p_attribute25_name                 => 'RUN_INFORMATION25'
657       ,p_attribute27_name                 => 'RUN_INFORMATION27'
654       ,p_attribute25_value                => p_rec.run_information25
655       ,p_attribute26_name                 => 'RUN_INFORMATION26'
656       ,p_attribute26_value                => p_rec.run_information26
658       ,p_attribute27_value                => p_rec.run_information27
659       ,p_attribute28_name                 => 'RUN_INFORMATION28'
660       ,p_attribute28_value                => p_rec.run_information28
661       ,p_attribute29_name                 => 'RUN_INFORMATION29'
662       ,p_attribute29_value                => p_rec.run_information29
663       ,p_attribute30_name                 => 'RUN_INFORMATION30'
664       ,p_attribute30_value                => p_rec.run_information30
665       );
666 
667   end if;
668   --
669   hr_utility.set_location(' Leaving:'||l_proc,20);
670 end chk_ddf;
671 --
672 -- ----------------------------------------------------------------------------
673 -- ----------------------------------------------------------------------------
674 -- |--------------------------< chk_for_child_actions >-----------------------|
675 -- ----------------------------------------------------------------------------
676 -- {Start Of Comments}
677 --
678 -- Description:
679 --   This procedure is used to ensure that there are no child payroll actions
680 --   or assignment_actions for a run type that is being deleted.
681 --
682 -- Pre Conditions:
683 --   g_old_rec has been populated with details of the values currently in
684 --   the database.
685 --
686 -- In Arguments:
687 --   p_rec has been populated with the updated values the user would like the
688 --   record set to.
689 --
690 -- Post Success:
691 --   Processing continues if no child rows are found.
692 --
693 -- Post Failure:
694 --   An application error is raised if child rows are found, and delete
695 --   processing is halted.
696 --
697 -- {End Of Comments}
698 -- ----------------------------------------------------------------------------
699 Procedure chk_for_child_actions
700   (p_run_type_id       in number
701   ,p_effective_date    in date
702   ,p_business_group_id in number default null
703   ,p_legislation_code in varchar2 default null) is
704 --
705 cursor chk_for_ppa(p_rt_id number
706                   ,p_bg_id number)
707 is
708 select 1
709 from   pay_payroll_actions ppa
710 where  ppa.run_type_id = p_rt_id
711 and    ppa.business_group_id = p_bg_id;
712 --
713 cursor chk_for_ppanb(p_rt_id number)
714 is
715 select 1
716 from   pay_payroll_actions ppa
717 where  ppa.run_type_id = p_rt_id;
718 --
719 cursor chk_for_paa(p_rt_id number
720                   ,p_bg_id number)
721 is
722 select 1
723 from   pay_assignment_actions paa
724 ,      pay_payroll_actions ppa
725 where  paa.run_type_id = p_rt_id
726 and    ppa.payroll_action_id = paa.payroll_action_id
727 and    ppa.business_group_id = p_bg_id;
728 --
729 cursor chk_for_paanb(p_rt_id number)
730 is
731 select 1
732 from   pay_assignment_actions paa
733 where  paa.run_type_id = p_rt_id;
734 --
735 cursor get_bg_id
736 is
737 select business_group_id
738 from   per_business_groups
739 where  legislation_code = p_legislation_code;
740 --
741   l_proc     varchar2(72) := g_package || 'chk_for_child_actions';
742   l_error    EXCEPTION;
743   l_argument varchar2(30);
744   l_exists   number(1);
745 --
746 BEGIN
747 hr_utility.set_location('Entering: '||l_proc,5);
748 --
749 if p_business_group_id is not null then -- user run type
750   open  chk_for_ppa(p_run_type_id, p_business_group_id);
751   fetch chk_for_ppa into l_exists;
752   if chk_for_ppa%FOUND then
753     close chk_for_ppa;
754     fnd_message.set_name('PAY', 'HR_34981_PRT_CHILD_PPA');
755     fnd_message.raise_error;
756     hr_utility.set_location(l_proc, 10);
757   else
758     close chk_for_ppa;
759   end if;
760   --
761   open chk_for_paa(p_run_type_id, p_business_group_id);
762     fetch chk_for_paa into l_exists;
763     if chk_for_paa%FOUND then
764       close chk_for_paa;
765       fnd_message.set_name('PAY', 'HR_34982_PRT_CHILD_PAA');
766       fnd_message.raise_error;
767       hr_utility.set_location(l_proc, 15);
768     else
769       close chk_for_paa;
770     end if;
771 --
772 elsif p_legislation_code is not null then -- startup run type
773    --
774    for each_bg in get_bg_id loop
775      open  chk_for_ppa(p_run_type_id, each_bg.business_group_id);
776      fetch chk_for_ppa into l_exists;
777      if chk_for_ppa%FOUND then
778        close chk_for_ppa;
779        fnd_message.set_name('PAY', 'HR_34981_PRT_CHILD_PPA');
780        fnd_message.raise_error;
781        hr_utility.set_location(l_proc, 20);
782      else
783        close chk_for_ppa;
784      end if;
785      --
786      open chk_for_paa(p_run_type_id, each_bg.business_group_id);
787      fetch chk_for_paa into l_exists;
788      if chk_for_paa%FOUND then
789        close chk_for_paa;
790        fnd_message.set_name('PAY', 'HR_34982_PRT_CHILD_PAA');
791        fnd_message.raise_error;
792        hr_utility.set_location(l_proc, 25);
793      else
794        close chk_for_paa;
795      end if;
796    end loop;
797 --
798 else  -- generic run type
799   open  chk_for_ppanb(p_run_type_id);
800   fetch chk_for_ppanb into l_exists;
804     fnd_message.raise_error;
801   if chk_for_ppanb%FOUND then
802     close chk_for_ppanb;
803     fnd_message.set_name('PAY', 'HR_34981_PRT_CHILD_PPA');
805     hr_utility.set_location(l_proc, 30);
806   else
807     close chk_for_ppanb;
808   end if;
809 --
810   open chk_for_paanb(p_run_type_id);
811   fetch chk_for_paanb into l_exists;
812   if chk_for_paanb%FOUND then
813     close chk_for_paanb;
814     fnd_message.set_name('PAY', 'HR_34982_PRT_CHILD_PAA');
815     fnd_message.raise_error;
816     hr_utility.set_location(l_proc, 35);
817   else
818     close chk_for_paanb;
819   end if;
820 --
821 end if;
822 hr_utility.set_location(l_proc, 40);
823 --
824 end chk_for_child_actions;
825 -- ----------------------------------------------------------------------------
826 -- |-----------------------< chk_non_updateable_args >------------------------|
827 -- ----------------------------------------------------------------------------
828 -- {Start Of Comments}
829 --
830 -- Description:
831 --   This procedure is used to ensure that non updateable attributes have
832 --   not been updated. If an attribute has been updated an error is generated.
833 --
834 -- Pre Conditions:
835 --   g_old_rec has been populated with details of the values currently in
836 --   the database.
837 --
838 -- In Arguments:
839 --   p_rec has been populated with the updated values the user would like the
840 --   record set to.
841 --
842 -- Post Success:
843 --   Processing continues if all the non updateable attributes have not
844 --   changed.
845 --
846 -- Post Failure:
847 --   An application error is raised if any of the non updatable attributes
848 --   have been altered.
849 --
850 -- {End Of Comments}
851 -- ----------------------------------------------------------------------------
852 Procedure chk_non_updateable_args
853   (p_effective_date  in date
854   ,p_rec             in pay_prt_shd.g_rec_type
855   ) IS
856 --
857   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
858   l_error    EXCEPTION;
859   l_argument varchar2(30);
860 --
861 Begin
862   --
863   -- Only proceed with the validation if a row exists for the current
864   -- record in the HR Schema.
865   --
866   IF NOT pay_prt_shd.api_updating
867       (p_run_type_id                      => p_rec.run_type_id
868       ,p_effective_date                   => p_effective_date
869       ,p_object_version_number            => p_rec.object_version_number
870       ) THEN
871      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
872      fnd_message.set_token('PROCEDURE ', l_proc);
873      fnd_message.set_token('STEP ', '5');
874      fnd_message.raise_error;
875   END IF;
876   --
877   hr_utility.set_location(l_proc, 10);
878   --
879   if p_rec.run_type_id <> pay_prt_shd.g_old_rec.run_type_id then
880      l_argument := 'run_type_id';
881      raise l_error;
882   end if;
883   hr_utility.set_location(l_proc, 20);
884   --
885   if nvl(p_rec.business_group_id, hr_api.g_number) <>
886      nvl(pay_prt_shd.g_old_rec.business_group_id, hr_api.g_number) then
887      l_argument := 'business_group_id';
888      raise l_error;
889   end if;
890   hr_utility.set_location(l_proc, 25);
891   --
892   if nvl(p_rec.legislation_code, hr_api.g_varchar2) <>
893      nvl(pay_prt_shd.g_old_rec.legislation_code, hr_api.g_varchar2) then
894      l_argument := 'legislation_code';
895      raise l_error;
896   end if;
897   hr_utility.set_location(l_proc, 30);
898   --
899   if nvl(p_rec.run_method, hr_api.g_varchar2) <>
900      nvl(pay_prt_shd.g_old_rec.run_method, hr_api.g_varchar2) then
901      l_argument := 'run_method';
902      raise l_error;
903   end if;
904   hr_utility.set_location(l_proc, 35);
905   --
906   -- RET 12-DEC-2001 making run_type_name non-updateable as is the key
907   -- for uploading ldts.
908   --
909   if nvl(p_rec.run_type_name, hr_api.g_varchar2) <>
910      nvl(pay_prt_shd.g_old_rec.run_type_name, hr_api.g_varchar2) then
911      l_argument := 'run_type_name';
912      raise l_error;
913   end if;
914   hr_utility.set_location(l_proc, 40);
915   --
916   EXCEPTION
917     WHEN l_error THEN
918        hr_api.argument_changed_error
919          (p_api_name => l_proc
920          ,p_argument => l_argument);
921     WHEN OTHERS THEN
922        RAISE;
923 hr_utility.set_location(' Leaving:'||l_proc, 45);
924 End chk_non_updateable_args;
925 --
926 -- ----------------------------------------------------------------------------
927 -- |--------------------------< dt_update_validate >--------------------------|
928 -- ----------------------------------------------------------------------------
929 -- {Start Of Comments}
930 --
931 -- Description:
932 --   This procedure is used for referential integrity of datetracked
933 --   parent entities when a datetrack update operation is taking place
934 --   and where there is no cascading of update defined for this entity.
935 --
936 -- Prerequisites:
937 --   This procedure is called from the update_validate.
938 --
939 -- In Parameters:
940 --
941 -- Post Success:
942 --   Processing continues.
943 --
944 -- Post Failure:
948 --   changes.
945 --
946 -- Developer Implementation Notes:
947 --   This procedure should not need maintenance unless the HR Schema model
949 --
950 -- Access Status:
951 --   Internal Row Handler Use Only.
952 --
953 -- {End Of Comments}
954 -- ----------------------------------------------------------------------------
955 Procedure dt_update_validate
956   (p_datetrack_mode                in varchar2
957   ,p_validation_start_date         in date
958   ,p_validation_end_date           in date
959   ) Is
960 --
961   l_proc  varchar2(72) := g_package||'dt_update_validate';
962   l_integrity_error Exception;
963   l_table_name      all_tables.table_name%TYPE;
964 --
965 Begin
966   --
967   -- Ensure that the p_datetrack_mode argument is not null
968   --
969   hr_api.mandatory_arg_error
970     (p_api_name       => l_proc
971     ,p_argument       => 'datetrack_mode'
972     ,p_argument_value => p_datetrack_mode
973     );
974   --
975   -- Mode will be valid, as this is checked at the start of the upd.
976   --
977   -- Ensure the arguments are not null
978   --
979   hr_api.mandatory_arg_error
980     (p_api_name       => l_proc
981     ,p_argument       => 'validation_start_date'
982     ,p_argument_value => p_validation_start_date
983     );
984   --
985   hr_api.mandatory_arg_error
986     (p_api_name       => l_proc
987     ,p_argument       => 'validation_end_date'
988     ,p_argument_value => p_validation_end_date
989     );
990   --
991     --
992   --
993 Exception
994   When l_integrity_error Then
995     --
996     -- A referential integrity check was violated therefore
997     -- we must error
998     --
999     fnd_message.set_name('PAY', 'HR_7216_DT_UPD_INTEGRITY_ERR');
1000     fnd_message.set_token('TABLE_NAME', l_table_name);
1001     fnd_message.raise_error;
1002   When Others Then
1003     --
1004     -- An unhandled or unexpected error has occurred which
1005     -- we must report
1006     --
1007     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
1008     fnd_message.set_token('PROCEDURE', l_proc);
1009     fnd_message.set_token('STEP','15');
1010     fnd_message.raise_error;
1011 End dt_update_validate;
1012 --
1013 -- ----------------------------------------------------------------------------
1014 -- |--------------------------< dt_delete_validate >--------------------------|
1015 -- ----------------------------------------------------------------------------
1016 -- {Start Of Comments}
1017 --
1018 -- Description:
1019 --   This procedure is used for referential integrity of datetracked
1020 --   child entities when either a datetrack DELETE or ZAP is in operation
1021 --   and where there is no cascading of delete defined for this entity.
1022 --   For the datetrack mode of DELETE or ZAP we must ensure that no
1023 --   datetracked child rows exist between the validation start and end
1024 --   dates.
1025 --
1026 -- Prerequisites:
1027 --   This procedure is called from the delete_validate.
1028 --
1029 -- In Parameters:
1030 --
1031 -- Post Success:
1032 --   Processing continues.
1033 --
1034 -- Post Failure:
1035 --   If a row exists by determining the returning Boolean value from the
1036 --   generic dt_api.rows_exist function then we must supply an error via
1037 --   the use of the local exception handler l_rows_exist.
1038 --
1039 -- Developer Implementation Notes:
1040 --   This procedure should not need maintenance unless the HR Schema model
1041 --   changes.
1042 --
1043 -- Access Status:
1044 --   Internal Row Handler Use Only.
1045 --
1046 -- {End Of Comments}
1047 -- ----------------------------------------------------------------------------
1048 Procedure dt_delete_validate
1049   (p_run_type_id                      in number
1050   ,p_datetrack_mode                   in varchar2
1051   ,p_validation_start_date            in date
1052   ,p_validation_end_date              in date
1053   ) Is
1054 --
1055   l_proc    varchar2(72)    := g_package||'dt_delete_validate';
1056   l_rows_exist  Exception;
1057   l_table_name  all_tables.table_name%TYPE;
1058 --
1059 Begin
1060   --
1061   -- Ensure that the p_datetrack_mode argument is not null
1062   --
1063   hr_api.mandatory_arg_error
1064     (p_api_name       => l_proc
1065     ,p_argument       => 'datetrack_mode'
1066     ,p_argument_value => p_datetrack_mode
1067     );
1068   --
1069   -- Only perform the validation if the datetrack mode is either
1070   -- DELETE or ZAP
1071   --
1072   If (p_datetrack_mode = hr_api.g_delete or
1073       p_datetrack_mode = hr_api.g_zap) then
1074     --
1075     --
1076     -- Ensure the arguments are not null
1077     --
1078     hr_api.mandatory_arg_error
1079       (p_api_name       => l_proc
1080       ,p_argument       => 'validation_start_date'
1081       ,p_argument_value => p_validation_start_date
1082       );
1083     --
1084     hr_api.mandatory_arg_error
1085       (p_api_name       => l_proc
1086       ,p_argument       => 'validation_end_date'
1087       ,p_argument_value => p_validation_end_date
1088       );
1089     --
1090     hr_api.mandatory_arg_error
1091       (p_api_name       => l_proc
1092       ,p_argument       => 'run_type_id'
1096     If (dt_api.rows_exist
1093       ,p_argument_value => p_run_type_id
1094       );
1095     --
1097        (p_base_table_name => 'pay_element_type_usages_f'
1098        ,p_base_key_column => 'run_type_id'
1099        ,p_base_key_value  => p_run_type_id
1100        ,p_from_date       => p_validation_start_date
1101        ,p_to_date         => p_validation_end_date
1102        )) Then
1103          l_table_name := 'element type usages';
1104          Raise l_rows_exist;
1105     End If;
1106     If (dt_api.rows_exist
1107        (p_base_table_name => 'pay_run_type_org_methods_f'
1108        ,p_base_key_column => 'run_type_id'
1109        ,p_base_key_value  => p_run_type_id
1110        ,p_from_date       => p_validation_start_date
1111        ,p_to_date         => p_validation_end_date
1112        )) Then
1113          l_table_name := 'run type org methods';
1114          Raise l_rows_exist;
1115     End If;
1116     If (dt_api.rows_exist
1117        (p_base_table_name => 'pay_run_type_usages_f'
1118        ,p_base_key_column => 'parent_run_type_id'
1119        ,p_base_key_value  => p_run_type_id
1120        ,p_from_date       => p_validation_start_date
1121        ,p_to_date         => p_validation_end_date
1122        )) Then
1123          l_table_name := 'run type usages';
1124          Raise l_rows_exist;
1125     End If;
1126     If (dt_api.rows_exist
1127        (p_base_table_name => 'pay_run_type_usages_f'
1128        ,p_base_key_column => 'child_run_type_id'
1129        ,p_base_key_value  => p_run_type_id
1130        ,p_from_date       => p_validation_start_date
1131        ,p_to_date         => p_validation_end_date
1132        )) Then
1133          l_table_name := 'run type usages';
1134          Raise l_rows_exist;
1135     End If;
1136     --
1137   End If;
1138   --
1139 Exception
1140   When l_rows_exist Then
1141     --
1142     -- A referential integrity check was violated therefore
1143     -- we must error
1144     --
1145     fnd_message.set_name('PAY', 'HR_7215_DT_CHILD_EXISTS');
1146     fnd_message.set_token('TABLE_NAME', l_table_name);
1147     fnd_message.raise_error;
1148   When Others Then
1149     --
1150     -- An unhandled or unexpected error has occurred which
1151     -- we must report
1152     --
1153     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
1154     fnd_message.set_token('PROCEDURE', l_proc);
1155     fnd_message.set_token('STEP','15');
1156     fnd_message.raise_error;
1157   --
1158 End dt_delete_validate;
1159 --
1160 -- ----------------------------------------------------------------------------
1161 -- |----------------------< chk_startup_action >------------------------------|
1162 -- ----------------------------------------------------------------------------
1163 --
1164 -- Description:
1165 --  This procedure will check that the current action is allowed according
1166 --  to the current startup mode.
1167 --
1168 -- ----------------------------------------------------------------------------
1169 PROCEDURE chk_startup_action
1170   (p_insert               IN boolean
1171   ,p_business_group_id    IN number
1172   ,p_legislation_code     IN varchar2
1173   ,p_legislation_subgroup IN varchar2 DEFAULT NULL) IS
1174 --
1175 BEGIN
1176   --
1177   -- Call the supporting procedure to check startup mode
1178   -- EDIT_HERE: The following call should be edited if certain types of rows
1179   -- are not permitted.
1180   IF (p_insert) THEN
1181   --
1182   -- Call procedure to check startup_action for inserts
1183   --
1184     hr_startup_data_api_support.chk_startup_action
1185       (p_generic_allowed   => TRUE
1186       ,p_startup_allowed   => TRUE
1187       ,p_user_allowed      => TRUE
1188       ,p_business_group_id => p_business_group_id
1189       ,p_legislation_code  => p_legislation_code
1190       ,p_legislation_subgroup => p_legislation_subgroup
1191       );
1192   ELSE
1193   --
1194   -- Call procedure to check startup action for upd and del
1195   --
1196     hr_startup_data_api_support.chk_upd_del_startup_action
1197       (p_generic_allowed   => TRUE
1198       ,p_startup_allowed   => TRUE
1199       ,p_user_allowed      => TRUE
1200       ,p_business_group_id => p_business_group_id
1201       ,p_legislation_code  => p_legislation_code
1202       ,p_legislation_subgroup => p_legislation_subgroup
1203       );
1204   END IF;
1205   --
1206 END chk_startup_action;
1207 --
1208 -- ----------------------------------------------------------------------------
1209 -- |---------------------------< insert_validate >----------------------------|
1210 -- ----------------------------------------------------------------------------
1211 Procedure insert_validate
1212   (p_rec                   in pay_prt_shd.g_rec_type
1213   ,p_effective_date        in date
1214   ,p_datetrack_mode        in varchar2
1215   ,p_validation_start_date in date
1216   ,p_validation_end_date   in date
1217   ) is
1218 --
1219   l_proc    varchar2(72) := g_package||'insert_validate';
1220 --
1221 Begin
1222   hr_utility.set_location('Entering:'||l_proc, 5);
1223   --
1224   -- Call all supporting business operations
1225   --
1226 /* RET removed this in favour of new chk_startup_action
1227   IF p_rec.business_group_id is not null THEN
1228   --
1232 */
1229     hr_api.validate_bus_grp_id(p_rec.business_group_id);  -- Validate Bus Grp
1230     --
1231   END IF;
1233   chk_startup_action(true
1234                     ,p_rec.business_group_id
1235                     ,p_rec.legislation_code
1236                     );
1237   IF hr_startup_data_api_support.g_startup_mode NOT IN ('GENERIC','STARTUP')
1238     THEN
1239     hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate bus_grp
1240   END IF;
1241   --
1242   hr_utility.set_location(l_proc, 10);
1243   --
1244   chk_run_method(p_effective_date        => p_effective_date
1245                 ,p_validation_start_date => p_validation_start_date
1246                 ,p_validation_end_date   => p_validation_end_date
1247                 ,p_run_method            => p_rec.run_method);
1248   --
1249   hr_utility.set_location(l_proc, 15);
1250   --
1251   chk_run_type_name(p_run_type_id        => p_rec.run_type_id
1252                    ,p_run_type_name      => p_rec.run_type_name
1253                    ,p_effective_date     => p_effective_date
1254                    ,p_business_group_id  => p_rec.business_group_id
1255                    ,p_legislation_code   => p_rec.legislation_code);
1256   --
1257   chk_srs_flag(p_srs_flag       => p_rec.srs_flag
1258               ,p_effective_date => p_effective_date);
1259   --
1260   chk_ddf(p_rec		=> p_rec);
1261   --
1262   hr_utility.set_location(' Leaving:'||l_proc, 20);
1263 End insert_validate;
1264 --
1265 -- ----------------------------------------------------------------------------
1266 -- |---------------------------< update_validate >----------------------------|
1267 -- ----------------------------------------------------------------------------
1268 Procedure update_validate
1269   (p_rec                     in pay_prt_shd.g_rec_type
1270   ,p_effective_date          in date
1271   ,p_datetrack_mode          in varchar2
1272   ,p_validation_start_date   in date
1273   ,p_validation_end_date     in date
1274   ) is
1275 --
1276   l_proc    varchar2(72) := g_package||'update_validate';
1277 --
1278 Begin
1279   hr_utility.set_location('Entering:'||l_proc, 5);
1280   --
1281   -- Currently the only columns that can be updated on pay_run_types_f are
1282   -- run_type_name and shortname. These can only be updated in CORRECTION
1283   -- mode, so if a different update mode has been passed in, raise an error
1284   -- NOTE: this will have to be changed if new columns with different update
1285   -- requirements are added to the table.
1286   --
1287   if p_datetrack_mode <> 'CORRECTION' then
1288     hr_utility.set_message(801,'HR_34115_PRT_NOT_CORRECTION');
1289     hr_utility.raise_error;
1290   end if;
1291   --
1292   -- Call all supporting business operations
1293   --
1294   chk_startup_action(false
1295                     ,p_rec.business_group_id
1296                     ,p_rec.legislation_code
1297                     );
1298   IF hr_startup_data_api_support.g_startup_mode NOT IN ('GENERIC','STARTUP')
1299     THEN
1300     hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate bus_grp
1301   END IF;
1302   --
1303   --
1304   hr_utility.set_location(l_proc, 10);
1305   --
1306   chk_run_method(p_effective_date        => p_effective_date
1307                 ,p_validation_start_date => p_validation_start_date
1308                 ,p_validation_end_date   => p_validation_end_date
1309                 ,p_run_method            => p_rec.run_method);
1310   --
1311   hr_utility.set_location(l_proc, 15);
1312   --
1313   chk_run_type_name(p_run_type_id        => p_rec.run_type_id
1314                    ,p_run_type_name      => p_rec.run_type_name
1315                    ,p_effective_date     => p_effective_date
1316                    ,p_business_group_id  => p_rec.business_group_id
1317                    ,p_legislation_code   => p_rec.legislation_code);
1318   --
1319   chk_srs_flag(p_srs_flag       => p_rec.srs_flag
1320               ,p_effective_date => p_effective_date);
1321   --
1322   chk_ddf(p_rec		=> p_rec);
1323   -- Call the datetrack update integrity operation
1324   --
1325   hr_utility.set_location(l_proc, 20);
1326   --
1327   dt_update_validate
1328     (p_datetrack_mode                 => p_datetrack_mode
1329     ,p_validation_start_date          => p_validation_start_date
1330     ,p_validation_end_date            => p_validation_end_date
1331     );
1332   --
1333   hr_utility.set_location(l_proc, 25);
1334   --
1335   chk_non_updateable_args
1336     (p_effective_date  => p_effective_date
1337     ,p_rec             => p_rec
1338     );
1339   --
1340   hr_utility.set_location('Leaving:'||l_proc, 30);
1341 End update_validate;
1342 --
1343 -- ----------------------------------------------------------------------------
1344 -- |---------------------------< delete_validate >----------------------------|
1345 -- ----------------------------------------------------------------------------
1346 Procedure delete_validate
1347   (p_rec                    in pay_prt_shd.g_rec_type
1348   ,p_effective_date         in date
1349   ,p_datetrack_mode         in varchar2
1350   ,p_validation_start_date  in date
1351   ,p_validation_end_date    in date
1352   ) is
1353 --
1354   l_proc    varchar2(72) := g_package||'delete_validate';
1355 --
1356 Begin
1357   hr_utility.set_location('Entering:'||l_proc, 5);
1358   --
1359   -- Call all supporting business operations
1360   --
1361   -- NB. need to use g_old_rec, as p_rec is not pupulated with all the columns
1362   -- for delete mode.
1363   --
1364   chk_for_child_actions
1365               (p_run_type_id       => p_rec.run_type_id
1366               ,p_effective_date    => p_effective_date
1367               ,p_business_group_id => pay_prt_shd.g_old_rec.business_group_id
1368               ,p_legislation_code  => pay_prt_shd.g_old_rec.legislation_code);
1369   --
1370   chk_startup_action(false
1371                     ,pay_prt_shd.g_old_rec.business_group_id
1372                     ,pay_prt_shd.g_old_rec.legislation_code
1373                     );
1374   --
1375   dt_delete_validate
1376     (p_datetrack_mode                   => p_datetrack_mode
1377     ,p_validation_start_date            => p_validation_start_date
1378     ,p_validation_end_date              => p_validation_end_date
1379     ,p_run_type_id                      => p_rec.run_type_id
1380     );
1381   --
1382   hr_utility.set_location(' Leaving:'||l_proc, 10);
1383 End delete_validate;
1384 --
1385 end pay_prt_bus;