[Home] [Help]
PACKAGE BODY: APPS.PAY_BTH_BUS
Source
1 Package Body pay_bth_bus as
2 /* $Header: pybthrhi.pkb 120.2 2005/06/12 16:19:52 susivasu noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_bth_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_batch_id number default null;
15 --
16 -- ---------------------------------------------------------------------------
17 -- |----------------------< set_security_group_id >--------------------------|
18 -- ---------------------------------------------------------------------------
19 --
20 Procedure set_security_group_id
21 (p_batch_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_batch_headers bth
30 where bth.batch_id = p_batch_id
31 and pbg.business_group_id = bth.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 => 'batch_id'
47 ,p_argument_value => p_batch_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 --
79 Function return_legislation_code
80 (p_batch_id in number
81 )
82 Return Varchar2 Is
83 --
84 -- Declare cursor
85 --
86 cursor csr_leg_code is
87 select pbg.legislation_code
88 from per_business_groups pbg
89 , pay_batch_headers bth
90 where bth.batch_id = p_batch_id
91 and pbg.business_group_id = bth.business_group_id;
92 --
93 -- Declare local variables
94 --
95 l_legislation_code varchar2(150);
96 l_proc varchar2(72) := g_package||'return_legislation_code';
97 --
98 Begin
99 --
100 hr_utility.set_location('Entering:'|| l_proc, 10);
101 --
102 -- Ensure that all the mandatory parameter are not null
103 --
104 hr_api.mandatory_arg_error
105 (p_api_name => l_proc
106 ,p_argument => 'batch_id'
107 ,p_argument_value => p_batch_id
108 );
109 --
110 if ( nvl(pay_bth_bus.g_batch_id, hr_api.g_number)
111 = p_batch_id) then
112 --
113 -- The legislation code has already been found with a previous
114 -- call to this function. Just return the value in the global
115 -- variable.
116 --
117 l_legislation_code := pay_bth_bus.g_legislation_code;
118 hr_utility.set_location(l_proc, 20);
119 else
120 --
121 -- The ID is different to the last call to this function
122 -- or this is the first call to this function.
123 --
124 open csr_leg_code;
125 fetch csr_leg_code into l_legislation_code;
126 --
127 if csr_leg_code%notfound then
128 --
129 -- The primary key is invalid therefore we must error
130 --
131 close csr_leg_code;
132 fnd_message.set_name('PAY','HR_7220_INVALID_PRIMARY_KEY');
133 fnd_message.raise_error;
134 end if;
135 hr_utility.set_location(l_proc,30);
136 --
137 -- Set the global variables so the values are
138 -- available for the next call to this function.
139 --
140 close csr_leg_code;
141 pay_bth_bus.g_batch_id := p_batch_id;
142 pay_bth_bus.g_legislation_code := l_legislation_code;
143 end if;
144 hr_utility.set_location(' Leaving:'|| l_proc, 40);
145 return l_legislation_code;
146 end return_legislation_code;
147 --
148 -- ----------------------------------------------------------------------------
149 -- |-----------------------< chk_non_updateable_args >------------------------|
150 -- ----------------------------------------------------------------------------
151 -- {Start Of Comments}
152 --
153 -- Description:
154 -- This procedure is used to ensure that non updateable attributes have
155 -- not been updated. If an attribute has been updated an error is generated.
156 --
157 -- Pre Conditions:
158 -- g_old_rec has been populated with details of the values currently in
159 -- the database.
160 --
161 -- In Arguments:
162 -- p_rec has been populated with the updated values the user would like the
163 -- record set to.
164 --
165 -- Post Success:
166 -- Processing continues if all the non updateable attributes have not
167 -- changed.
168 --
169 -- Post Failure:
170 -- An application error is raised if any of the non updatable attributes
171 -- have been altered.
172 --
173 -- {End Of Comments}
174 -- ----------------------------------------------------------------------------
175 Procedure chk_non_updateable_args
176 (p_rec in pay_bth_shd.g_rec_type
177 ) IS
178 --
179 l_proc varchar2(72) := g_package || 'chk_non_updateable_args';
180 l_error EXCEPTION;
181 l_argument varchar2(30);
182 --
183 Begin
184 --
185 hr_utility.set_location(l_proc, 5);
186 --
187 -- Only proceed with the validation if a row exists for the current
188 -- record in the HR Schema.
189 --
190 IF NOT pay_bth_shd.api_updating
191 (p_batch_id => p_rec.batch_id
192 ,p_object_version_number => p_rec.object_version_number
193 ) THEN
194 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
195 fnd_message.set_token('PROCEDURE ', l_proc);
196 fnd_message.set_token('STEP ', '5');
197 fnd_message.raise_error;
198 END IF;
199 --
200 hr_utility.set_location(l_proc, 10);
201 --
202 if nvl(p_rec.business_group_id, hr_api.g_number) <>
203 pay_bth_shd.g_old_rec.business_group_id then
204 l_argument := 'business_group_id';
205 raise l_error;
206 end if;
207 --
208 hr_utility.set_location(l_proc, 20);
209 --
210 EXCEPTION
211 WHEN l_error THEN
212 hr_api.argument_changed_error
213 (p_api_name => l_proc
214 ,p_argument => l_argument);
215 WHEN OTHERS THEN
216 RAISE;
217 End chk_non_updateable_args;
218 --
219 -- ----------------------------------------------------------------------------
220 -- |-----------------------< chk_transferred_status >-------------------------|
221 -- ----------------------------------------------------------------------------
222 --
223 -- Desciption :
224 --
225 -- Check whether the existing batch header is transferred or not. If it
226 -- is transferred then raise error.
227 -- Also check if the batch is currently being processed too.
228 --
229 --
230 -- Pre-conditions :
231 --
232 --
233 -- In Arguments :
234 -- p_batch_id
235 --
236 -- Post Success :
237 -- Processing continues
238 --
239 -- Post Failure :
240 -- An application error will be raised and processing is
241 -- terminated
242 --
243 -- Access Status :
244 -- Internal Table Handler Use only.
245 --
246 -- {End of Comments}
247 --
248 -- ---------------------------------------------------------------------------
249 Procedure chk_transferred_status (p_batch_id number) Is
250 --
251 cursor csr_status is
252 select pbh.batch_status
253 from pay_batch_headers pbh
254 where pbh.batch_id = p_batch_id;
255 --
256 l_status pay_batch_headers.batch_status%TYPE;
257 --
258 Begin
259 --
260 open csr_status;
261 fetch csr_status into l_status;
262 close csr_status;
263
264 if l_status = 'T' then
265 Fnd_Message.Set_Name('PER', 'HR_289754_BEE_REC_TRANSFERRED');
266 fnd_message.raise_error;
267 elsif l_status = 'P' then
268 Fnd_Message.Set_Name('PER', 'HR_51321_BATCH_AFTER_SUBMITION');
269 fnd_message.raise_error;
270 end if;
271 --
272 End chk_transferred_status;
273 --
274 -- ---------------------------------------------------------------------------
275 -- |----------------------------< chk_batch_name >--------------------------|
276 -- ---------------------------------------------------------------------------
277 --
278 -- Desciption :
279 --
280 -- Validate that on insert and update batch_name is not null.
281 --
282 --
283 -- Pre-conditions :
284 --
285 --
286 -- In Arguments :
287 -- p_batch_name
288 --
289 -- Post Success :
290 -- Processing continues
291 --
292 -- Post Failure :
293 -- An application error will be raised and processing is
294 -- terminated
295 --
296 -- Access Status :
297 -- Internal Table Handler Use only.
298 --
299 -- {End of Comments}
300 --
301 -- ---------------------------------------------------------------------------
302 procedure chk_batch_name
303 (p_batch_name in pay_batch_headers.batch_name%TYPE
304 ) is
305 --
306 l_proc varchar2(72) := g_package||'chk_batch_name';
307 --
308 begin
309 hr_utility.set_location('Entering:'||l_proc, 1);
310 --
311 -- Check mandatory batch_name exists
312 --
313 hr_api.mandatory_arg_error
314 (p_api_name => l_proc
315 ,p_argument => 'batch_name'
316 ,p_argument_value => p_batch_name
317 );
318 --
319 hr_utility.set_location(' Leaving:'||l_proc, 15);
320 --
321 end chk_batch_name;
322 --
323 -- ---------------------------------------------------------------------------
324 -- |----------------------------< chk_batch_status >-------------------------|
325 -- ---------------------------------------------------------------------------
326 --
327 -- Desciption :
328 --
329 -- Validate that on insert and update batch_status is not null.
330 -- Also to validate against HR_LOOKUP.LOOKUP_CODE where LOOKUP_TYPE
331 -- 'BATCH_STATUS'.
332 --
333 --
334 -- Pre-conditions :
335 --
336 --
337 -- In Arguments :
338 -- p_batch_status
339 -- p_session_date
340 -- p_batch_id
341 -- p_object_version_number
342 --
343 -- Post Success :
344 -- Processing continues
345 --
346 -- Post Failure :
347 -- An application error will be raised and processing is
348 -- terminated
349 --
350 -- Access Status :
351 -- Internal Table Handler Use only.
352 --
353 -- {End of Comments}
354 --
355 -- ---------------------------------------------------------------------------
356 procedure chk_batch_status
357 (p_batch_status in pay_batch_headers.batch_status%TYPE,
358 p_session_date in date,
359 p_batch_id in pay_batch_headers.batch_id%TYPE,
360 p_object_version_number in pay_batch_headers.object_version_number%TYPE
361 ) is
362 --
363 l_proc varchar2(72) := g_package||'chk_batch_status';
364 l_api_updating boolean;
365 --
366 begin
367 hr_utility.set_location('Entering:'||l_proc, 1);
368 --
369 -- Check mandatory batch_name exists
370 --
371 hr_api.mandatory_arg_error
372 (p_api_name => l_proc
373 ,p_argument => 'batch_status'
374 ,p_argument_value => p_batch_status
375 );
376 --
377 -- Check mandatory session_date exists
378 --
379 hr_api.mandatory_arg_error
380 (p_api_name => l_proc
381 ,p_argument => 'session_date'
382 ,p_argument_value => p_session_date
383 );
384 --
385 hr_utility.set_location(l_proc, 10);
386 --
387 l_api_updating := pay_bth_shd.api_updating
388 (p_batch_id => p_batch_id,
389 p_object_version_number => p_object_version_number
390 );
391 hr_utility.set_location(l_proc,20);
392 --
393 -- Only proceed with SQL validation if absolutely necessary
394 --
395 if ((l_api_updating and
396 nvl(pay_bth_shd.g_old_rec.batch_status,hr_api.g_varchar2) <>
397 nvl(p_batch_status,hr_api.g_varchar2))
398 or (NOT l_api_updating)) then
399 --
400 hr_utility.set_location(l_proc,30);
401 --
402 -- Validate against the hr_lookup.
403 --
404 if hr_api.not_exists_in_hr_lookups
405 (p_effective_date => p_session_date,
406 p_lookup_type => 'BATCH_STATUS',
407 p_lookup_code => p_batch_status) then
408 pay_bth_shd.constraint_error('PAY_BCH_BATCH_STATUS_CHK');
409 end if;
410 --
411 end if;
412 --
413 hr_utility.set_location(' Leaving:'||l_proc, 40);
414 --
415 end chk_batch_status;
416 --
417 -- ---------------------------------------------------------------------------
418 -- |--------------------------< chk_action_if_exists >-----------------------|
419 -- ---------------------------------------------------------------------------
423 -- Validate that on insert and update action_if_exists is not null.
420 --
421 -- Desciption :
422 --
424 -- Also to validate against HR_LOOKUP.LOOKUP_CODE where LOOKUP_TYPE
425 -- 'ACTION_IF_EXISTS'.
426 --
427 --
428 -- Pre-conditions :
429 --
430 --
431 -- In Arguments :
432 -- p_action_if_exists
433 -- p_session_date
434 -- p_batch_id
435 -- p_object_version_number
436 --
437 -- Post Success :
438 -- Processing continues
439 --
440 -- Post Failure :
441 -- An application error will be raised and processing is
442 -- terminated
443 --
444 -- Access Status :
445 -- Internal Table Handler Use only.
446 --
447 -- {End of Comments}
448 --
449 -- ---------------------------------------------------------------------------
450 procedure chk_action_if_exists
451 (p_action_if_exists in pay_batch_headers.action_if_exists%TYPE,
452 p_session_date in date,
453 p_batch_id in pay_batch_headers.batch_id%TYPE,
454 p_object_version_number in pay_batch_headers.object_version_number%TYPE
455 ) is
456 --
457 l_proc varchar2(72) := g_package||'chk_action_if_exists';
458 l_api_updating boolean;
459 --
460 begin
461 hr_utility.set_location('Entering:'||l_proc, 1);
462 --
463 -- Check mandatory session_date exists
464 --
465 hr_api.mandatory_arg_error
466 (p_api_name => l_proc
467 ,p_argument => 'session_date'
468 ,p_argument_value => p_session_date
469 );
470 --
471 hr_utility.set_location(l_proc, 10);
472 --
473 l_api_updating := pay_bth_shd.api_updating
474 (p_batch_id => p_batch_id,
475 p_object_version_number => p_object_version_number
476 );
477 hr_utility.set_location(l_proc,20);
478 --
479 -- Only proceed with SQL validation if absolutely necessary
480 --
481 if ((l_api_updating and
482 nvl(pay_bth_shd.g_old_rec.action_if_exists,hr_api.g_varchar2) <>
483 nvl(p_action_if_exists,hr_api.g_varchar2))
484 or (NOT l_api_updating)) then
485 --
486 hr_utility.set_location(l_proc,30);
487 --
488 if (p_action_if_exists is not null) then
489 --
490 hr_utility.set_location(l_proc,35);
491 --
492 -- Validate against the hr_lookup.
493 --
494 if hr_api.not_exists_in_hr_lookups
495 (p_effective_date => p_session_date,
496 p_lookup_type => 'ACTION_IF_EXISTS',
497 p_lookup_code => p_action_if_exists) then
498 pay_bth_shd.constraint_error('PAY_BCH_ACTION_IF_EXISTS_CHK');
499 end if;
500 --
501 end if;
502 --
503 end if;
504 --
505 hr_utility.set_location(' Leaving:'||l_proc, 40);
506 --
507 end chk_action_if_exists;
508 --
509 -- ---------------------------------------------------------------------------
510 -- |------------------------< chk_purge_after_transfer >---------------------|
511 -- ---------------------------------------------------------------------------
512 --
513 -- Desciption :
514 --
515 -- Validate that on insert and update purge_after_transfer is not null.
516 -- Also to validate against HR_LOOKUP.LOOKUP_CODE where LOOKUP_TYPE
517 -- 'YES_NO'.
518 --
519 --
520 -- Pre-conditions :
521 --
522 --
523 -- In Arguments :
524 -- p_purge_after_transfer
525 -- p_session_date
526 -- p_batch_id
527 -- p_object_version_number
528 --
529 -- Post Success :
530 -- Processing continues
531 --
532 -- Post Failure :
533 -- An application error will be raised and processing is
534 -- terminated
535 --
536 -- Access Status :
537 -- Internal Table Handler Use only.
538 --
539 -- {End of Comments}
540 --
541 -- ---------------------------------------------------------------------------
542 procedure chk_purge_after_transfer
543 (p_purge_after_transfer in pay_batch_headers.purge_after_transfer%TYPE,
544 p_session_date in date,
545 p_batch_id in pay_batch_headers.batch_id%TYPE,
546 p_object_version_number in pay_batch_headers.object_version_number%TYPE
547 ) is
548 --
549 l_proc varchar2(72) := g_package||'chk_purge_after_transfer';
550 l_api_updating boolean;
551 --
552 begin
553 hr_utility.set_location('Entering:'||l_proc, 1);
554 --
555 -- Check mandatory session_date exists
556 --
557 hr_api.mandatory_arg_error
558 (p_api_name => l_proc
559 ,p_argument => 'session_date'
560 ,p_argument_value => p_session_date
561 );
562 --
563 hr_utility.set_location(l_proc, 10);
564 --
565 l_api_updating := pay_bth_shd.api_updating
566 (p_batch_id => p_batch_id,
567 p_object_version_number => p_object_version_number
568 );
569 hr_utility.set_location(l_proc,20);
570 --
571 -- Only proceed with SQL validation if absolutely necessary
575 nvl(p_purge_after_transfer,hr_api.g_varchar2))
572 --
573 if ((l_api_updating and
574 nvl(pay_bth_shd.g_old_rec.purge_after_transfer,hr_api.g_varchar2) <>
576 or (NOT l_api_updating)) then
577 --
578 hr_utility.set_location(l_proc,30);
579 --
580 if (p_purge_after_transfer is not null) then
581 --
582 hr_utility.set_location(l_proc,35);
583 --
584 -- Validate against the hr_lookup.
585 --
586 if hr_api.not_exists_in_hr_lookups
587 (p_effective_date => p_session_date,
588 p_lookup_type => 'YES_NO',
589 p_lookup_code => p_purge_after_transfer) then
590 pay_bth_shd.constraint_error('PAY_BCH_PURGE_AFTER_TRANSF_CHK');
591 end if;
592 --
593 end if;
594 --
595 end if;
596 --
597 hr_utility.set_location(' Leaving:'||l_proc, 40);
598 --
599 end chk_purge_after_transfer;
600 --
601 -- ---------------------------------------------------------------------------
602 -- |----------------------< chk_reject_if_future_changes >-------------------|
603 -- ---------------------------------------------------------------------------
604 --
605 -- Desciption :
606 --
607 -- Validate that on insert and update reject_if_future_changes is not null.
608 -- Also to validate against HR_LOOKUP.LOOKUP_CODE where LOOKUP_TYPE
609 -- 'YES_NO'.
610 --
611 --
612 -- Pre-conditions :
613 --
614 --
615 -- In Arguments :
616 -- p_reject_if_future_changes
617 -- p_session_date
618 -- p_batch_id
619 -- p_object_version_number
620 --
621 -- Post Success :
622 -- Processing continues
623 --
624 -- Post Failure :
625 -- An application error will be raised and processing is
626 -- terminated
627 --
628 -- Access Status :
629 -- Internal Table Handler Use only.
630 --
631 -- {End of Comments}
632 --
633 -- ---------------------------------------------------------------------------
634 procedure chk_reject_if_future_changes
635 (p_reject_if_future_changes in pay_batch_headers.reject_if_future_changes%TYPE,
636 p_session_date in date,
637 p_batch_id in pay_batch_headers.batch_id%TYPE,
638 p_object_version_number in pay_batch_headers.object_version_number%TYPE
639 ) is
640 --
641 l_proc varchar2(72) := g_package||'chk_reject_if_future_changes';
642 l_api_updating boolean;
643 --
644 begin
645 hr_utility.set_location('Entering:'||l_proc, 1);
646 --
647 -- Check mandatory session_date exists
648 --
649 hr_api.mandatory_arg_error
650 (p_api_name => l_proc
651 ,p_argument => 'session_date'
652 ,p_argument_value => p_session_date
653 );
654 --
655 hr_utility.set_location(l_proc, 10);
656 --
657 l_api_updating := pay_bth_shd.api_updating
658 (p_batch_id => p_batch_id,
659 p_object_version_number => p_object_version_number
660 );
661 hr_utility.set_location(l_proc,20);
662 --
663 -- Only proceed with SQL validation if absolutely necessary
664 --
665 if ((l_api_updating and
666 nvl(pay_bth_shd.g_old_rec.reject_if_future_changes,hr_api.g_varchar2) <>
667 nvl(p_reject_if_future_changes,hr_api.g_varchar2))
668 or (NOT l_api_updating)) then
669 --
670 hr_utility.set_location(l_proc,30);
671 --
672 if (p_reject_if_future_changes is not null) then
673 --
674 hr_utility.set_location(l_proc,35);
675 --
676 -- Validate against the hr_lookup.
677 --
678 if hr_api.not_exists_in_hr_lookups
679 (p_effective_date => p_session_date,
680 p_lookup_type => 'YES_NO',
681 p_lookup_code => p_reject_if_future_changes) then
682 pay_bth_shd.constraint_error('PAY_BCH_REJECT_IF_FUTURE_C_CHK');
683 end if;
684 --
685 end if;
686 --
687 end if;
688 --
689 hr_utility.set_location(' Leaving:'||l_proc, 40);
690 --
691 end chk_reject_if_future_changes;
692 --
693 -- ---------------------------------------------------------------------------
694 -- |----------------------< chk_reject_if_results_exists >-------------------|
695 -- ---------------------------------------------------------------------------
696 --
697 -- Desciption :
698 --
699 -- Validate that on insert and update reject_if_results_exists is not null.
700 -- Also to validate against HR_LOOKUP.LOOKUP_CODE where LOOKUP_TYPE
701 -- 'YES_NO'.
702 --
703 --
704 -- Pre-conditions :
705 --
706 --
707 -- In Arguments :
708 -- p_reject_if_results_exists
709 -- p_session_date
710 -- p_batch_id
711 -- p_object_version_number
712 --
713 -- Post Success :
714 -- Processing continues
715 --
716 -- Post Failure :
717 -- An application error will be raised and processing is
718 -- terminated
719 --
720 -- Access Status :
724 --
721 -- Internal Table Handler Use only.
722 --
723 -- {End of Comments}
725 -- ---------------------------------------------------------------------------
726 procedure chk_reject_if_results_exists
727 (p_reject_if_results_exists in pay_batch_headers.reject_if_results_exists%TYPE,
728 p_session_date in date,
729 p_batch_id in pay_batch_headers.batch_id%TYPE,
730 p_object_version_number in pay_batch_headers.object_version_number%TYPE
731 ) is
732 --
733 l_proc varchar2(72) := g_package||'chk_reject_if_results_exists';
734 l_api_updating boolean;
735 --
736 begin
737 hr_utility.set_location('Entering:'||l_proc, 1);
738 --
739 -- Check mandatory session_date exists
740 --
741 hr_api.mandatory_arg_error
742 (p_api_name => l_proc
743 ,p_argument => 'session_date'
744 ,p_argument_value => p_session_date
745 );
746 --
747 hr_utility.set_location(l_proc, 10);
748 --
749 l_api_updating := pay_bth_shd.api_updating
750 (p_batch_id => p_batch_id,
751 p_object_version_number => p_object_version_number
752 );
753 hr_utility.set_location(l_proc,20);
754 --
755 -- Only proceed with SQL validation if absolutely necessary
756 --
757 if ((l_api_updating and
758 nvl(pay_bth_shd.g_old_rec.reject_if_results_exists,hr_api.g_varchar2) <>
759 nvl(p_reject_if_results_exists,hr_api.g_varchar2))
760 or (NOT l_api_updating)) then
761 --
762 hr_utility.set_location(l_proc,30);
763 --
764 if (p_reject_if_results_exists is not null) then
765 --
766 hr_utility.set_location(l_proc,35);
767 --
768 -- Validate against the hr_lookup.
769 --
770 if hr_api.not_exists_in_hr_lookups
771 (p_effective_date => p_session_date,
772 p_lookup_type => 'YES_NO',
773 p_lookup_code => p_reject_if_results_exists) then
774 pay_bth_shd.constraint_error('PAY_BCH_REJECT_IF_RESULTS_E_CHK');
775 end if;
776 --
777 end if;
778 --
779 end if;
780 --
781 hr_utility.set_location(' Leaving:'||l_proc, 40);
782 --
783 end chk_reject_if_results_exists;
784 --
785 -- ---------------------------------------------------------------------------
786 -- |-------------------------< chk_purge_after_rollback >--------------------|
787 -- ---------------------------------------------------------------------------
788 --
789 -- Desciption :
790 --
791 -- Validate that on insert and update purge_after_rollback is not null.
792 -- Also to validate against HR_LOOKUP.LOOKUP_CODE where LOOKUP_TYPE
793 -- 'YES_NO'.
794 --
795 --
796 -- Pre-conditions :
797 --
798 --
799 -- In Arguments :
800 -- p_purge_after_rollback
801 -- p_session_date
802 -- p_batch_id
803 -- p_object_version_number
804 --
805 -- Post Success :
806 -- Processing continues
807 --
808 -- Post Failure :
809 -- An application error will be raised and processing is
810 -- terminated
811 --
812 -- Access Status :
813 -- Internal Table Handler Use only.
814 --
815 -- {End of Comments}
816 --
817 -- ---------------------------------------------------------------------------
818 procedure chk_purge_after_rollback
819 (p_purge_after_rollback in pay_batch_headers.purge_after_rollback%TYPE,
820 p_session_date in date,
821 p_batch_id in pay_batch_headers.batch_id%TYPE,
822 p_object_version_number in pay_batch_headers.object_version_number%TYPE
823 ) is
824 --
825 l_proc varchar2(72) := g_package||'chk_purge_after_rollback';
826 l_api_updating boolean;
827 --
828 begin
829 hr_utility.set_location('Entering:'||l_proc, 1);
830 --
831 -- Check mandatory session_date exists
832 --
833 hr_api.mandatory_arg_error
834 (p_api_name => l_proc
835 ,p_argument => 'session_date'
836 ,p_argument_value => p_session_date
837 );
838 --
839 hr_utility.set_location(l_proc, 10);
840 --
841 l_api_updating := pay_bth_shd.api_updating
842 (p_batch_id => p_batch_id,
843 p_object_version_number => p_object_version_number
844 );
845 hr_utility.set_location(l_proc,20);
846 --
847 -- Only proceed with SQL validation if absolutely necessary
848 --
849 if ((l_api_updating and
850 nvl(pay_bth_shd.g_old_rec.purge_after_rollback,hr_api.g_varchar2) <>
851 nvl(p_purge_after_rollback,hr_api.g_varchar2))
852 or (NOT l_api_updating)) then
853 --
854 hr_utility.set_location(l_proc,30);
855 --
856 if (p_purge_after_rollback is not null) then
857 --
858 hr_utility.set_location(l_proc,35);
859 --
860 -- Validate against the hr_lookup.
861 --
862 if hr_api.not_exists_in_hr_lookups
863 (p_effective_date => p_session_date,
867 end if;
864 p_lookup_type => 'YES_NO',
865 p_lookup_code => p_purge_after_rollback) then
866 pay_bth_shd.constraint_error('PAY_BCH_PURGE_AFTER_R_CHK');
868 --
869 end if;
870 --
871 end if;
872 --
873 hr_utility.set_location(' Leaving:'||l_proc, 40);
874 --
875 end chk_purge_after_rollback;
876 --
877 -- ---------------------------------------------------------------------------
878 -- |-----------------------< chk_date_effective_changes >--------------------|
879 -- ---------------------------------------------------------------------------
880 --
881 -- Desciption :
882 --
883 -- Validate that on insert and update date_effective_changes is not null.
884 -- Also to validate against HR_LOOKUP.LOOKUP_CODE where LOOKUP_TYPE
885 --
886 --
887 -- Pre-conditions :
888 --
889 --
890 -- In Arguments :
891 -- p_date_effective_changes
892 -- p_session_date
893 -- p_batch_id
894 -- P_object_version_number
895 --
896 -- Post Success :
897 -- Processing continues
898 --
899 -- Post Failure :
900 -- An application error will be raised and processing is
901 -- terminated
902 --
903 -- Access Status :
904 -- Internal Table Handler Use only.
905 --
906 -- {End of Comments}
907 --
908 -- ---------------------------------------------------------------------------
909 procedure chk_date_effective_changes
910 (p_date_effective_changes in pay_batch_headers.date_effective_changes%TYPE,
911 p_session_date in date,
912 p_batch_id in pay_batch_headers.batch_id%TYPE,
913 p_object_version_number in pay_batch_headers.object_version_number%TYPE,
914 p_reject_if_future_changes in pay_batch_headers.reject_if_future_changes%TYPE,
915 p_action_if_exists in pay_batch_headers.action_if_exists%TYPE
916 ) is
917 --
918 l_proc varchar2(72) := g_package||'chk_date_effective_changes';
919 l_api_updating boolean;
920 --
921 begin
922 hr_utility.set_location('Entering:'||l_proc, 1);
923 --
924 -- Check mandatory session_date exists
925 --
926 hr_api.mandatory_arg_error
927 (p_api_name => l_proc
928 ,p_argument => 'session_date'
929 ,p_argument_value => p_session_date
930 );
931 --
932 hr_utility.set_location(l_proc, 10);
933 --
934 l_api_updating := pay_bth_shd.api_updating
935 (p_batch_id => p_batch_id,
936 p_object_version_number => p_object_version_number
937 );
938 hr_utility.set_location(l_proc,20);
939 --
940 -- Only proceed with SQL validation if absolutely necessary
941 --
942 if ((l_api_updating and
943 nvl(pay_bth_shd.g_old_rec.date_effective_changes,hr_api.g_varchar2) <>
944 nvl(p_date_effective_changes,hr_api.g_varchar2))
945 or (NOT l_api_updating)) then
946 --
947 hr_utility.set_location(l_proc,30);
948 --
949 if (p_date_effective_changes is not null) then
950 --
951 hr_utility.set_location(l_proc,35);
952 --
953 -- Validate against the hr_lookup.
954 --
955 if hr_api.not_exists_in_hr_lookups
956 (p_effective_date => p_session_date,
957 p_lookup_type => 'DATE_EFFECTIVE_CHANGES',
958 p_lookup_code => p_date_effective_changes) then
959 pay_bth_shd.constraint_error('PAY_BCH_DATE_EFFECTIVE_CHA_CHK');
960 end if;
961 --
962 end if;
963 --
964 end if;
965 --
966 if (((p_reject_if_future_changes <> 'N' or p_action_if_exists <> 'U') and p_date_effective_changes = 'O')
967 or (p_action_if_exists = 'U' and p_date_effective_changes not in ('O','C','U'))
968 or (p_action_if_exists <> 'U' and p_date_effective_changes in ('O','C','U'))) then
969 --
970 pay_bth_shd.constraint_error('PAY_BCH_DATE_EFFECTIVE_CHA_CHK');
971 --
972 end if;
973 --
974 hr_utility.set_location(' Leaving:'||l_proc, 40);
975 --
976 end chk_date_effective_changes;
977 --
978 -- ---------------------------------------------------------------------------
979 -- |-------------------------------< chk_delete >----------------------------|
980 -- ---------------------------------------------------------------------------
981 --
982 -- Desciption :
983 --
984 -- Check if there is no child row exists in
985 -- PAY_BATCH_LINES,
986 -- PAY_BATCH_CONTROL_TOTALS
987 -- and
988 -- PAY_MESSAGE_LINES.
989 --
990 --
991 -- Pre-conditions :
992 --
993 --
994 -- In Arguments :
995 -- p_batch_id
996 --
997 -- Post Success :
998 -- Processing continues
999 --
1000 -- Post Failure :
1001 -- An application error will be raised and processing is
1002 -- terminated
1003 --
1004 -- Access Status :
1005 -- Internal Table Handler Use only.
1006 --
1007 -- {End of Comments}
1008 --
1009 -- ---------------------------------------------------------------------------
1010 procedure chk_delete
1014 l_proc varchar2(72) := g_package||'chk_delete';
1011 (p_batch_id in pay_batch_headers.batch_id%TYPE
1012 ) is
1013 --
1015 l_exists varchar2(1);
1016 --
1017 cursor csr_batch_lines_exists is
1018 select null
1019 from pay_batch_lines btl
1020 where btl.batch_id = p_batch_id;
1021 --
1022 cursor csr_batch_ctl_totals_exists is
1023 select null
1024 from pay_batch_control_totals bct
1025 where bct.batch_id = p_batch_id;
1026 --
1027 cursor csr_message_lines is
1028 select null
1029 from pay_message_lines pml
1030 where pml.source_id = p_batch_id
1031 and pml.source_type = 'H';
1032 --
1033 begin
1034 hr_utility.set_location('Entering:'||l_proc, 1);
1035 --
1036 -- Check mandatory batch_id exists
1037 --
1038 hr_api.mandatory_arg_error
1039 (p_api_name => l_proc
1040 ,p_argument => 'batch_id'
1041 ,p_argument_value => p_batch_id
1042 );
1043 --
1044 hr_utility.set_location('Entering:'||l_proc, 10);
1045 --
1046 open csr_batch_lines_exists;
1047 --
1048 fetch csr_batch_lines_exists into l_exists;
1049 --
1050 If csr_batch_lines_exists%found Then
1051 --
1052 close csr_batch_lines_exists;
1053 --
1054 fnd_message.set_name('PAY','PAY_52681_BHT_CHILD_EXISTS');
1055 fnd_message.raise_error;
1056 --
1057 End If;
1058 --
1059 close csr_batch_lines_exists;
1060 --
1061 hr_utility.set_location(l_proc, 20);
1062 --
1063 open csr_batch_ctl_totals_exists;
1064 --
1065 fetch csr_batch_ctl_totals_exists into l_exists;
1066 --
1067 If csr_batch_ctl_totals_exists%found Then
1068 --
1069 close csr_batch_ctl_totals_exists;
1070 --
1071 fnd_message.set_name('PAY','PAY_52681_BHT_CHILD_EXISTS');
1072 fnd_message.raise_error;
1073 --
1074 End If;
1075 --
1076 close csr_batch_ctl_totals_exists;
1077 --
1078 hr_utility.set_location(l_proc, 30);
1079 --
1080 open csr_message_lines;
1081 --
1082 fetch csr_message_lines into l_exists;
1083 --
1084 If csr_message_lines%found Then
1085 --
1086 close csr_message_lines;
1087 --
1088 fnd_message.set_name('PAY','PAY_52681_BHT_CHILD_EXISTS');
1089 fnd_message.raise_error;
1090 --
1091 End If;
1092 --
1093 close csr_message_lines;
1094 --
1095 hr_utility.set_location(' Leaving:'||l_proc, 40);
1096 --
1097 end chk_delete;
1098 --
1099 -- ----------------------------------------------------------------------------
1100 -- |---------------------------< insert_validate >----------------------------|
1101 -- ----------------------------------------------------------------------------
1102 Procedure insert_validate
1103 (p_session_date in date,
1104 p_rec in pay_bth_shd.g_rec_type
1105 ) is
1106 --
1107 l_proc varchar2(72) := g_package||'insert_validate';
1108 --
1109 Begin
1110 hr_utility.set_location('Entering:'||l_proc, 5);
1111 --
1112 -- Call all supporting business operations
1113 --
1114 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
1115 --
1116 hr_utility.set_location(l_proc, 20);
1117 --
1118 chk_batch_name(p_batch_name => p_rec.batch_name);
1119 --
1120 hr_utility.set_location(l_proc, 30);
1121 --
1122 chk_batch_status(p_batch_status => p_rec.batch_status
1123 ,p_session_date => p_session_date
1124 ,p_batch_id => p_rec.batch_id
1125 ,p_object_version_number => p_rec.object_version_number);
1126 --
1127 hr_utility.set_location(l_proc, 40);
1128 --
1129 chk_action_if_exists(p_action_if_exists => p_rec.action_if_exists
1130 ,p_session_date => p_session_date
1131 ,p_batch_id => p_rec.batch_id
1132 ,p_object_version_number => p_rec.object_version_number);
1133 --
1134 hr_utility.set_location(l_proc, 50);
1135 --
1136 chk_purge_after_transfer(p_purge_after_transfer => p_rec.purge_after_transfer
1137 ,p_session_date => p_session_date
1138 ,p_batch_id => p_rec.batch_id
1139 ,p_object_version_number => p_rec.object_version_number);
1140 --
1141 hr_utility.set_location(l_proc, 60);
1142 --
1143 chk_reject_if_future_changes(p_reject_if_future_changes => p_rec.reject_if_future_changes
1144 ,p_session_date => p_session_date
1145 ,p_batch_id => p_rec.batch_id
1146 ,p_object_version_number => p_rec.object_version_number);
1147 --
1148 hr_utility.set_location(l_proc, 70);
1149 --
1150 chk_date_effective_changes(p_date_effective_changes => p_rec.date_effective_changes
1151 ,p_session_date => p_session_date
1152 ,p_batch_id => p_rec.batch_id
1153 ,p_object_version_number => p_rec.object_version_number
1154 ,p_reject_if_future_changes => p_rec.reject_if_future_changes
1155 ,p_action_if_exists => p_rec.action_if_exists);
1156 --
1157 hr_utility.set_location(' Leaving:'||l_proc, 80);
1161 -- |---------------------------< update_validate >----------------------------|
1158 End insert_validate;
1159 --
1160 -- ----------------------------------------------------------------------------
1162 -- ----------------------------------------------------------------------------
1163 Procedure update_validate
1164 (p_session_date in date,
1165 p_rec in pay_bth_shd.g_rec_type
1166 ) is
1167 --
1168 l_proc varchar2(72) := g_package||'update_validate';
1169 --
1170 Begin
1171 hr_utility.set_location('Entering:'||l_proc, 5);
1172 --
1173 -- Call all supporting business operations
1174 --
1175 hr_api.validate_bus_grp_id(p_rec.business_group_id); -- Validate Bus Grp
1176 --
1177 chk_non_updateable_args
1178 (p_rec => p_rec
1179 );
1180 --
1181 hr_utility.set_location(l_proc, 20);
1182 --
1183 --
1184 chk_transferred_status(p_batch_id => p_rec.batch_id);
1185 --
1186 hr_utility.set_location(l_proc, 25);
1187 --
1188 chk_batch_name(p_batch_name => p_rec.batch_name);
1189 --
1190 hr_utility.set_location(l_proc, 30);
1191 --
1192 chk_batch_status(p_batch_status => p_rec.batch_status
1193 ,p_session_date => p_session_date
1194 ,p_batch_id => p_rec.batch_id
1195 ,p_object_version_number => p_rec.object_version_number);
1196 --
1197 hr_utility.set_location(l_proc, 40);
1198 --
1199 chk_action_if_exists(p_action_if_exists => p_rec.action_if_exists
1200 ,p_session_date => p_session_date
1201 ,p_batch_id => p_rec.batch_id
1202 ,p_object_version_number => p_rec.object_version_number);
1203 --
1204 hr_utility.set_location(l_proc, 50);
1205 --
1206 chk_purge_after_transfer(p_purge_after_transfer => p_rec.purge_after_transfer
1207 ,p_session_date => p_session_date
1208 ,p_batch_id => p_rec.batch_id
1209 ,p_object_version_number => p_rec.object_version_number);
1210 --
1211 hr_utility.set_location(l_proc, 60);
1212 --
1213 chk_reject_if_future_changes(p_reject_if_future_changes => p_rec.reject_if_future_changes
1214 ,p_session_date => p_session_date
1215 ,p_batch_id => p_rec.batch_id
1216 ,p_object_version_number => p_rec.object_version_number);
1217 --
1218 hr_utility.set_location(l_proc, 70);
1219 --
1220 chk_date_effective_changes(p_date_effective_changes => p_rec.date_effective_changes
1221 ,p_session_date => p_session_date
1222 ,p_batch_id => p_rec.batch_id
1223 ,p_object_version_number => p_rec.object_version_number
1224 ,p_reject_if_future_changes => p_rec.reject_if_future_changes
1225 ,p_action_if_exists => p_rec.action_if_exists);
1226 --
1227 hr_utility.set_location(' Leaving:'||l_proc, 80);
1228 End update_validate;
1229 --
1230 -- ----------------------------------------------------------------------------
1231 -- |---------------------------< delete_validate >----------------------------|
1232 -- ----------------------------------------------------------------------------
1233 Procedure delete_validate
1234 (p_rec in pay_bth_shd.g_rec_type
1235 ) is
1236 --
1237 l_proc varchar2(72) := g_package||'delete_validate';
1238 --
1239 Begin
1240 hr_utility.set_location('Entering:'||l_proc, 5);
1241 --
1242 -- Call all supporting business operations
1243 --
1244 --
1245 if payplnk.g_payplnk_call <> true then
1246 chk_transferred_status(p_batch_id => p_rec.batch_id);
1247 end if;
1248 --
1249 hr_utility.set_location(l_proc, 8);
1250 --
1251 chk_delete(p_batch_id => p_rec.batch_id);
1252 --
1253 hr_utility.set_location(' Leaving:'||l_proc, 10);
1254 End delete_validate;
1255 --
1256 end pay_bth_bus;