DBA Data[Home] [Help]

PACKAGE BODY: APPS.AME_ITU_BUS

Source


1 Package Body ame_itu_bus as
2 /* $Header: amiturhi.pkb 120.6 2006/10/05 16:11:40 pvelugul noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  ame_itu_bus.';  -- Global package name
9 -- ----------------------------------------------------------------------------
10 -- |-------------------------< CHK_APPLICATION_ID >-----------------------------|
11 -- ----------------------------------------------------------------------------
12 -- {Start Of Comments}
13 --
14 -- Description:
15 --   This procedure ensure that application_id must be already defined in
16 --   ame_calling_apps table and must be valid over the given date ranges
17 --
18 -- Pre-Requisites:
19 --   None
20 --
21 -- In Parameters:
22 --   p_application_id
23 --   p_effective_date
24 --
25 -- Post Success:
26 --   Processing continues if a valid application_id has been entered.
27 --
28 -- Post Failure:
29 --   An application error is raised if the application_id is not defined in
30 --   ame_calling_apps table
31 --
32 -- Access Status:
33 --   Internal Row Handler Use Only.
34 --
35 -- {End Of Comments}
36 -- ----------------------------------------------------------------------------
37 procedure chk_application_id(p_application_id                  in   number
38                             ,p_effective_date                  in   date
39                             ) IS
40 --
41   cursor csr_application_id is
42          select null
43            from ame_calling_apps
44           where application_id = p_application_id
45             and p_effective_date between start_date
46                   and nvl(end_date - ame_util.oneSecond, p_effective_date);
47   l_proc     varchar2(72) := g_package || 'CHK_APPLICATION_ID';
48   l_dummy    varchar2(1);
49 --
50   Begin
51     hr_utility.set_location(' Entering:'||l_proc,10);
52 
53     hr_api.mandatory_arg_error(p_api_name           => l_proc
54                               ,p_argument           => 'APPLICATION_ID'
55                               ,p_argument_value     => p_application_id
56                               );
57     open csr_application_id;
58     fetch csr_application_id into l_dummy;
59     if(csr_application_id%notfound) then
60       close csr_application_id;
61       fnd_message.set_name('PER','AME_400732_INV_APPLICATION_ID');
62       fnd_message.raise_error;
63     end if;
64     close csr_application_id;
65     hr_utility.set_location(' Leaving:'||l_proc,30);
66   exception
67     when app_exception.application_exception then
68       if hr_multi_message.exception_add
69                      (p_associated_column1 => 'AME_ITEM_CLASS_USAGES.APPLICATION_ID'
70                      ) then
71       hr_utility.set_location(' Leaving:'||l_proc, 40);
72       raise;
73       end if;
74       hr_utility.set_location(' Leaving:'||l_proc,50);
75     End chk_application_id;
76 -- ----------------------------------------------------------------------------
77 -- |-------------------------< CHK_ITEM_CLASS_ID >----------------------------|
78 -- ----------------------------------------------------------------------------
79 -- {Start Of Comments}
80 --
81 -- Description:
82 --   This procedure ensure that item_class_id must be already defined in
83 --   ame_item_classes table and must be valid over the given date ranges
84 --
85 -- Pre-Requisites:
86 --   None
87 --
88 -- In Parameters:
89 --   p_item_class_id
90 --   p_effective_date
91 --
92 -- Post Success:
93 --   Processing continues if a valid item_class_id has been entered.
94 --
95 -- Post Failure:
96 --   An application error is raised if the item_class_id is not defined in
97 --   ame_item_classes table
98 --
99 -- Access Status:
100 --   Internal Row Handler Use Only.
101 --
102 -- {End Of Comments}
103 -- ----------------------------------------------------------------------------
104 procedure chk_item_class_id(p_item_class_id                    in   number
105                            ,p_effective_date                   in   date
106                             ) IS
107 --
108   cursor csr_item_class_id is
109          select null
110            from ame_item_classes
111           where item_class_id = p_item_class_id
112             and p_effective_date between start_date
113                   and nvl(end_date - ame_util.oneSecond, p_effective_date);
114   l_proc     varchar2(72) := g_package || 'CHK_ITEM_CLASS_ID';
115   l_dummy    varchar2(1);
116 --
117   Begin
118     hr_utility.set_location(' Entering:'||l_proc,10);
119 
120     hr_api.mandatory_arg_error(p_api_name           => l_proc
121                               ,p_argument           => 'ITEM_CLASS_ID'
122                               ,p_argument_value     => p_item_class_id
123                               );
124     open csr_item_class_id;
125     fetch csr_item_class_id into l_dummy;
126     if(csr_item_class_id%notfound) then
127       close csr_item_class_id;
128       fnd_message.set_name('PER','AME_400740_INV_ITEM_CLASS_ID');
129       fnd_message.raise_error;
130     end if;
131     close csr_item_class_id;
132     hr_utility.set_location(' Leaving:'||l_proc,30);
133   exception
134     when app_exception.application_exception then
135       if hr_multi_message.exception_add
136                      (p_associated_column1 => 'AME_ITEM_CLASS_USAGES.ITEM_CLASS_ID'
137                      ) then
138       hr_utility.set_location(' Leaving:'||l_proc, 40);
139       raise;
140       end if;
141       hr_utility.set_location(' Leaving:'||l_proc,50);
142     End chk_item_class_id;
143 -- ----------------------------------------------------------------------------
144 -- |-------------------------< CHK_ITEM_CLASS_USAGE >----------------------------|
145 -- ----------------------------------------------------------------------------
146 -- {Start Of Comments}
147 --
148 -- Description:
149 --   This procedure ensure that the item class usage being created is not
150 --   already present for the given transaction type.
151 --
152 -- Pre-Requisites:
153 --   None
154 --
155 -- In Parameters:
156 --   p_item_class_id
157 --   p_application_id
158 --   p_effective_date
159 --
160 -- Post Success:
161 --   Processing continues if a valid item_class_usage is not already present
162 --
163 -- Post Failure:
164 --   An application error is raised if the item_class_usage is already defined
165 --
166 -- Access Status:
167 --   Internal Row Handler Use Only.
168 --
169 -- {End Of Comments}
170 -- ----------------------------------------------------------------------------
171 procedure chk_item_class_usage
172             (p_item_class_id                    in   number
173             ,p_application_id                   in   number
174             ,p_effective_date                   in   date
175             ) is
176 --
177   cursor csr_item_class_usage is
178          select null
179            from ame_item_class_usages
180           where item_class_id = p_item_class_id
181             and application_id = p_application_id
182             and p_effective_date between start_date
183                   and nvl(end_date - ame_util.oneSecond, p_effective_date);
184   l_proc     varchar2(72) := g_package || 'CHK_ITEM_CLASS_USAGE';
185   l_dummy    varchar2(1);
186 --
187   Begin
188     hr_utility.set_location(' Entering:'||l_proc,10);
189     open csr_item_class_usage;
190     fetch csr_item_class_usage into l_dummy;
191     if(csr_item_class_usage%found) then
192       close csr_item_class_usage;
193       fnd_message.set_name('PER','AME_400745_ITC_NAME_NOT_UNQ');
194       fnd_message.raise_error;
195     end if;
196     close csr_item_class_usage;
197     hr_utility.set_location(' Leaving:'||l_proc,30);
198   exception
199     when app_exception.application_exception then
200       if hr_multi_message.exception_add
201                      (p_associated_column1 => 'AME_ITEM_CLASS_USAGES.ITEM_CLASS_ID'
202                      ) then
203       hr_utility.set_location(' Leaving:'||l_proc, 40);
204       raise;
205       end if;
206       hr_utility.set_location(' Leaving:'||l_proc,50);
207     End chk_item_class_usage;
208 --
209 -- ----------------------------------------------------------------------------
210 -- |-------------------------< CHK_MANDATORY_ARGS >-----------------------------|
211 -- ----------------------------------------------------------------------------
212 -- {Start Of Comments}
213 --
214 -- Description:
215 --   This procedure ensure that not null values are passed for the following
216 --   arguments:ITEM_ID_QUERY, ITEM_CLASS_PAR_MODE, ITEM_CLASS_SUBLIST_MODE
217 --
218 -- Pre-Requisites:
219 --   chk_application_id and chk_item_class_id must have been validated
220 --
221 -- In Parameters:
222 --   p_rec
223 --
224 -- Post Success:
225 --   Processing continues if a valid not null value has been entered for the
226 --   above mentioned arguments
227 --
228 -- Post Failure:
229 --   An application error is raised if null value is passed for any of the
230 --   above mentioned argument
231 --
232 -- Access Status:
233 --   Internal Row Handler Use Only.
234 --
235 -- {End Of Comments}
236 -- ----------------------------------------------------------------------------
237 procedure chk_mandatory_args(p_rec         ame_itu_shd.g_rec_type) IS
238 --
239   l_proc                 varchar2(72) := g_package || 'CHK_MANDATORY_ARGS';
240 --
241   Begin
242     hr_utility.set_location(' Entering:'||l_proc,10);
243     if hr_multi_message.no_all_inclusive_error
244                (p_check_column1 => 'AME_ITEM_CLASS_USAGES.APPLICATION_ID') and
245        hr_multi_message.no_all_inclusive_error
246                (p_check_column1 => 'AME_ITEM_CLASS_USAGES.ITEM_CLASS_ID') then
247       hr_api.mandatory_arg_error(p_api_name           => l_proc
248                                 ,p_argument           => 'ITEM_ID_QUERY'
249                                 ,p_argument_value     => p_rec.item_id_query
250                                 );
251       hr_api.mandatory_arg_error(p_api_name           => l_proc
252                                 ,p_argument           => 'ITEM_CLASS_ORDER_NUMBER'
253                                 ,p_argument_value     => p_rec.item_class_order_number
254                                 );
255       hr_api.mandatory_arg_error(p_api_name           => l_proc
259       hr_api.mandatory_arg_error(p_api_name           => l_proc
256                                 ,p_argument           => 'ITEM_CLASS_PAR_MODE'
257                                 ,p_argument_value     => p_rec.item_class_par_mode
258                                 );
260                                 ,p_argument           => 'ITEM_CLASS_SUBLIST_MODE'
261                                 ,p_argument_value     => p_rec.item_class_sublist_mode
262                                 );
263     end if;
264     hr_utility.set_location(' Leaving:'||l_proc,30);
265   End chk_mandatory_args;
266 --
267 -- ----------------------------------------------------------------------------
268 -- |-------------------------< CHK_ITEM_ID_QUERY >-----------------------------|
269 -- ----------------------------------------------------------------------------
270 -- {Start Of Comments}
271 --
272 -- Description:
273 --   This procedure ensure that item_id_query must not contain any special
274 --   characters like ';','--','/*','*/ and any place holder column other
275 --   than the one for transaction ID
276 --
277 -- Pre-Requisites:
278 --   chk_application_id and chk_item_class_id must have been validated
279 --
280 -- In Parameters:
281 --   p_item_id_query
282 --
283 -- Post Success:
284 --   Processing continues if a valid item_id_query has been entered.
285 --
286 -- Post Failure:
287 --   An application error is raised if item_id_query is not valid
288 --
289 -- Access Status:
290 --   Internal Row Handler Use Only.
291 --
292 -- {End Of Comments}
293 -- ----------------------------------------------------------------------------
294 procedure chk_item_id_query(p_item_id_query             in   varchar2) IS
295 --
296   l_proc                       varchar2(72) := g_package || 'CHK_ITEM_ID_QUERY';
297   l_upper_item_id_query        ame_item_class_usages.item_id_query%type;
298   l_trans_id_placeholder_pos   integer;
299   l_trans_id_placeholder_pos2  integer;
300   l_temp_count                 integer;
301   l_upper_trans_id_placeholder ame_util.stringType;
302   l_query_validation           varchar2(1000);
303 --
304   Begin
305     hr_utility.set_location(' Entering:'||l_proc,10);
306     if hr_multi_message.no_all_inclusive_error
307                (p_check_column1 => 'AME_ITEM_CLASS_USAGES.APPLICATION_ID') and
308        hr_multi_message.no_all_inclusive_error
309                (p_check_column1 => 'AME_ITEM_CLASS_USAGES.ITEM_CLASS_ID') then
310       if nvl(p_item_id_query, hr_api.g_varchar2) <> hr_api.g_varchar2 then
311         -- Check for special characters in item_id_query
312         if(instrb(p_item_id_query, ';', 1, 1) > 0) or
313           (instrb(p_item_id_query, '--', 1, 1) > 0) or
314           (instrb(p_item_id_query, '/*', 1, 1) > 0) or
315           (instrb(p_item_id_query, '*/', 1, 1) > 0) then
316           fnd_message.set_name('PER','QUERY_CONTAINS_SPL_CHARS');
317           fnd_message.raise_error;
318         end if;
319         -- Check for any other place holder columns other than place holder
320         -- column for transaction ID
321         l_temp_count := 1;
322         l_upper_item_id_query        := upper(p_item_id_query);
323         l_upper_trans_id_placeholder := upper(ame_util.transactionIdPlaceholder);
324         loop
325           l_trans_id_placeholder_pos :=
326             instrb(l_upper_item_id_query, l_upper_trans_id_placeholder, 1, l_temp_count);
327           if(l_trans_id_placeholder_pos = 0) then
328             exit;
329           end if;
330           l_trans_id_placeholder_pos2 :=
331             instrb(p_item_id_query, ame_util.transactionIdPlaceholder, 1, l_temp_count);
332           if(l_trans_id_placeholder_pos <> l_trans_id_placeholder_pos2) then
333             fnd_message.set_name('PER','AME_400377_ADM_IC_QUERY2');
334             fnd_message.raise_error;
335           end if;
336           l_temp_count := l_temp_count + 1;
337         end loop;
338         select ame_utility_pkg.validate_query(p_item_id_query,'1',ame_util2.itemClassObject)
339           into l_query_validation
340           from dual;
341         if l_query_validation <> 'Y' then
342           fnd_message.raise_error;
343         end if;
344       end if;
345     end if;
346     hr_utility.set_location(' Leaving:'||l_proc,30);
347   exception
348     when app_exception.application_exception then
349       if hr_multi_message.exception_add
350                      (p_associated_column1 => 'AME_ITEM_CLASS_USAGES.ITEM_ID_QUERY'
351                      ) then
352       hr_utility.set_location(' Leaving:'||l_proc, 40);
353       raise;
354       end if;
355       hr_utility.set_location(' Leaving:'||l_proc,50);
356     End chk_item_id_query;
357 --
358 -- ----------------------------------------------------------------------------
359 -- |-------------------------< CHK_ITEM_CLASS_PAR_MODE >-----------------------------|
360 -- ----------------------------------------------------------------------------
361 -- {Start Of Comments}
362 --
363 -- Description:
364 --   This procedure ensures that no other value is entered other than
365 --   ame_util.serialItems and ame_util.parallelItems for item_class_par_mode
366 --
367 -- Pre-Requisites:
368 --   chk_application_id and chk_item_class_id must have been validated
369 --
370 -- In Parameters:
371 --   p_item_class_par_mode
372 --
373 -- Post Success:
374 --   Processing continues if a valid item_class_par_mode has been entered.
375 --
376 -- Post Failure:
377 --   An application error is raised if other values are passed for
378 --   item_class_par_mode except the two mentioned above
379 --
380 -- Access Status:
381 --   Internal Row Handler Use Only.
382 --
383 -- {End Of Comments}
384 -- ----------------------------------------------------------------------------
388 --
385 procedure chk_item_class_par_mode(p_item_class_par_mode   in   varchar2) IS
386 --
387   l_proc                       varchar2(72) := g_package || 'CHK_ITEM_CLASS_PAR_MODE';
389   Begin
390     hr_utility.set_location(' Entering:'||l_proc,10);
391     if hr_multi_message.no_all_inclusive_error
392                (p_check_column1 => 'AME_ITEM_CLASS_USAGES.APPLICATION_ID') and
393        hr_multi_message.no_all_inclusive_error
394                (p_check_column1 => 'AME_ITEM_CLASS_USAGES.ITEM_CLASS_ID') then
395         if nvl(p_item_class_par_mode, hr_api.g_varchar2) <> hr_api.g_varchar2 and
396            p_item_class_par_mode not in (ame_util.serialItems,
397                                          ame_util.parallelItems
398                                          ) then
399           fnd_message.set_name('PER','AME_400766_INV_PARAM_MODE');
400           fnd_message.raise_error;
401         end if;
402     end if;
403     hr_utility.set_location(' Leaving:'||l_proc,30);
404   exception
405     when app_exception.application_exception then
406       if hr_multi_message.exception_add
407                      (p_associated_column1 => 'AME_ITEM_CLASS_USAGES.ITEM_CLASS_PAR_MODE'
408                      ) then
409       hr_utility.set_location(' Leaving:'||l_proc, 40);
410       raise;
411       end if;
412       hr_utility.set_location(' Leaving:'||l_proc,50);
413     End chk_item_class_par_mode;
414 -- ----------------------------------------------------------------------------
415 -- |-------------------------< CHK_ITEM_CLASS_SUBLIST_MODE >-----------------------------|
416 -- ----------------------------------------------------------------------------
417 -- {Start Of Comments}
418 --
419 -- Description:
420 --   This procedure ensures that no other value is entered other than
421 --   ame_util.serialSublists, ame_util.parallelSublists, ame_util.preFirst
422 --   and ame_util.preAndAuthorityFirst for item_class_sublist_mode
423 --
424 -- Pre-Requisites:
425 --   chk_application_id and chk_item_class_id must have been validated
426 --
427 -- In Parameters:
428 --   p_item_class_sublist_mode
429 --
430 -- Post Success:
431 --   Processing continues if a valid item_class_sublist_mode has been entered.
432 --
433 -- Post Failure:
434 --   An application error is raised if other values are passed for
435 --   item_class_sublist_mode except the four mentioned above
436 --
437 -- Access Status:
438 --   Internal Row Handler Use Only.
439 --
440 -- {End Of Comments}
441 -- ----------------------------------------------------------------------------
442 procedure chk_item_class_sublist_mode(p_item_class_sublist_mode in varchar2) IS
443 --
444   l_proc          varchar2(72) := g_package || 'CHK_ITEM_CLASS_SUBLIST_MODE';
445 --
446   Begin
447     hr_utility.set_location(' Entering:'||l_proc,10);
448     if hr_multi_message.no_all_inclusive_error
449                (p_check_column1 => 'AME_ITEM_CLASS_USAGES.APPLICATION_ID') and
450        hr_multi_message.no_all_inclusive_error
451                (p_check_column1 => 'AME_ITEM_CLASS_USAGES.ITEM_CLASS_ID') then
452         if nvl(p_item_class_sublist_mode, hr_api.g_varchar2) <>
453               hr_api.g_varchar2 and
454               p_item_class_sublist_mode not in (ame_util.serialSublists
455                                                 ,ame_util.parallelSublists
456                                                 ,ame_util.preFirst
457                                                 ,ame_util.preAndAuthorityFirst
458                                                ) then
459           fnd_message.set_name('PER','AME_400767_INV_SUBLIST_MODE');
460           fnd_message.raise_error;
461         end if;
462     end if;
463     hr_utility.set_location(' Leaving:'||l_proc,30);
464   exception
465     when app_exception.application_exception then
466       if hr_multi_message.exception_add
467                      (p_associated_column1 => 'AME_ITEM_CLASS_USAGES.ITEM_CLASS_SUBLIST_MODE'
468                      ) then
469       hr_utility.set_location(' Leaving:'||l_proc, 40);
470       raise;
471       end if;
472       hr_utility.set_location(' Leaving:'||l_proc,50);
473     End chk_item_class_sublist_mode;
474 -- ----------------------------------------------------------------------------
475 -- |-------------------------< CHK_ORDER_NUMBER>---------------------------|
476 -- ----------------------------------------------------------------------------
477 -- {Start Of Comments}
478 --
479 -- Description:
480 --  This procedure validates order_number which should be positive integer.
481 --
482 -- Pre-Requisites:
483 --   None
484 --
485 -- In Parameters:
486 --   p_order_number
487 --
488 -- Post Success:
489 --   Processing continues if order_number has valid value.
490 --
491 -- Post Failure:
492 --   An application error is raised.
493 --
494 -- Access Status:
495 --   Internal Row Handler Use Only.
496 --
497 -- {End Of Comments}
498 -- ----------------------------------------------------------------------------
499 procedure chk_order_number(
500                            p_order_number   in   number
501                           ) IS
502 --
503   l_proc     varchar2(72) := g_package || 'CHK_ORDER_NUMBER';
504   Begin
505     hr_utility.set_location('Entering:'||l_proc,10);
506     hr_api.mandatory_arg_error(p_api_name           => l_proc
507                               ,p_argument           => 'ORDER_NUMBER'
508                               ,p_argument_value     => p_order_number
509                               );
510     -- check if order_number is negative
511     --
512     if p_order_number <=0  then
513       fnd_message.set_name('PER','AME_400565_INVALID_ORDER_NUM');
514       fnd_message.raise_error;
518     when app_exception.application_exception then
515     end if;
516     hr_utility.set_location(' Leaving:'||l_proc,30);
517   exception
519       if hr_multi_message.exception_add
520                 (p_associated_column1 => 'AME_ITEM_CLASS_USAGES.ITEM_CLASS_ORDER_NUMBER'
521                  ) then
522         hr_utility.set_location(' Leaving:'||l_proc, 40);
523         raise;
524       end if;
525       hr_utility.set_location( ' Leaving:'||l_proc,50 );
526   End chk_order_number;
527 --
528 -- ----------------------------------------------------------------------------
529 -- |-----------------------< chk_non_updateable_args >------------------------|
530 -- ----------------------------------------------------------------------------
531 -- {Start Of Comments}
532 --
533 -- Description:
534 --   This procedure is used to ensure that non updateable attributes have
535 --   not been updated. If an attribute has been updated an error is generated.
536 --
537 -- Pre Conditions:
538 --   g_old_rec has been populated with details of the values currently in
539 --   the database.
540 --
541 -- In Arguments:
542 --   p_rec has been populated with the updated values the user would like the
543 --   record set to.
544 --
545 -- Post Success:
546 --   Processing continues if all the non updateable attributes have not
547 --   changed.
548 --
549 -- Post Failure:
550 --   An application error is raised if any of the non updatable attributes
551 --   have been altered.
552 --
553 -- {End Of Comments}
554 -- ----------------------------------------------------------------------------
555 Procedure chk_non_updateable_args
556   (p_effective_date  in date
557   ,p_rec             in ame_itu_shd.g_rec_type
558   ) IS
559 --
560   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
561 --
562 Begin
563   --
564   -- Only proceed with the validation if a row exists for the current
565   -- record in the HR Schema.
566   --
567   IF NOT ame_itu_shd.api_updating
568       (p_item_class_id         => p_rec.item_class_id
569       ,p_application_id        => p_rec.application_id
570       ,p_effective_date        => p_effective_date
571       ,p_object_version_number => p_rec.object_version_number
572       ) THEN
573      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
574      fnd_message.set_token('PROCEDURE ', l_proc);
575      fnd_message.set_token('STEP ', '5');
576      fnd_message.raise_error;
577   END IF;
578   --
579   -- EDIT_HERE: Add checks to ensure non-updateable args have
580   --            not been updated.
581   --
582 End chk_non_updateable_args;
583 
584 procedure chk_delete
585   (p_item_class_id   in number
586   ,p_application_id in number) is
587   l_proc              varchar2(72)  :=  g_package||'chk_delete';
588 	cursor c_sel1 Is
589     select null
590       from ame_item_class_usages
591       where
592         ame_utility_pkg.check_seeddb = 'N' and
593         ame_utility_pkg.is_seed_user(created_by) = ame_util.seededDataCreatedById and
594 		    item_class_id = p_item_class_id and
595         application_id = p_application_id ;
596 	l_exists varchar2(1);
597 begin
598   null;
599 exception
600    when app_exception.application_exception then
601      if hr_multi_message.exception_add
602        (p_associated_column1 => 'ITEM_CLASS_ID') then
603        hr_utility.set_location(' Leaving:'|| l_proc, 50);
604        raise;
605      end if;
606      hr_utility.set_location(' Leaving:'|| l_proc, 60);
607 end chk_delete;
608 
609 
610 --
611 -- ----------------------------------------------------------------------------
612 -- |--------------------------< dt_update_validate >--------------------------|
613 -- ----------------------------------------------------------------------------
614 -- {Start Of Comments}
615 --
616 -- Description:
617 --   This procedure is used for referential integrity of datetracked
618 --   parent entities when a datetrack update operation is taking place
619 --   and where there is no cascading of update defined for this entity.
620 --
621 -- Prerequisites:
622 --   This procedure is called from the update_validate.
623 --
624 -- In Parameters:
625 --
626 -- Post Success:
627 --   Processing continues.
628 --
629 -- Post Failure:
630 --
631 -- Developer Implementation Notes:
632 --   This procedure should not need maintenance unless the HR Schema model
633 --   changes.
634 --
635 -- Access Status:
636 --   Internal Row Handler Use Only.
637 --
638 -- {End Of Comments}
639 -- ----------------------------------------------------------------------------
640 Procedure dt_update_validate
641   (p_item_class_id                 in number default hr_api.g_number
642   ,p_datetrack_mode                in varchar2
643   ,p_validation_start_date         in date
644   ,p_validation_end_date           in date
645   ) Is
646 --
650   --
647   l_proc  varchar2(72) := g_package||'dt_update_validate';
648 --
649 Begin
651   -- Ensure that the p_datetrack_mode argument is not null
652   --
653   hr_api.mandatory_arg_error
654     (p_api_name       => l_proc
655     ,p_argument       => 'datetrack_mode'
656     ,p_argument_value => p_datetrack_mode
657     );
658   --
659   -- Mode will be valid, as this is checked at the start of the upd.
660   --
661   -- Ensure the arguments are not null
662   --
663   hr_api.mandatory_arg_error
664     (p_api_name       => l_proc
665     ,p_argument       => 'validation_start_date'
666     ,p_argument_value => p_validation_start_date
667     );
668   --
669   /*hr_api.mandatory_arg_error
670     (p_api_name       => l_proc
671     ,p_argument       => 'validation_end_date'
672     ,p_argument_value => p_validation_end_date
673     );*/
674   --
675 Exception
676   When Others Then
677     --
678     -- An unhandled or unexpected error has occurred which
679     -- we must report
680     --
681     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
682     fnd_message.set_token('PROCEDURE', l_proc);
683     fnd_message.set_token('STEP','15');
684     fnd_message.raise_error;
685 End dt_update_validate;
686 --
687 -- ----------------------------------------------------------------------------
688 -- |--------------------------< dt_delete_validate >--------------------------|
689 -- ----------------------------------------------------------------------------
690 -- {Start Of Comments}
691 --
692 -- Description:
693 --   This procedure is used for referential integrity of datetracked
694 --   child entities when either a datetrack DELETE or ZAP is in operation
695 --   and where there is no cascading of delete defined for this entity.
696 --   For the datetrack mode of DELETE or ZAP we must ensure that no
697 --   datetracked child rows exist between the validation start and end
698 --   dates.
699 --
700 -- Prerequisites:
701 --   This procedure is called from the delete_validate.
702 --
703 -- In Parameters:
704 --
705 -- Post Success:
706 --   Processing continues.
707 --
708 -- Post Failure:
709 --   If a row exists by determining the returning Boolean value from the
710 --   generic dt_api.rows_exist function then we must supply an error via
711 --   the use of the local exception handler l_rows_exist.
712 --
713 -- Developer Implementation Notes:
714 --   This procedure should not need maintenance unless the HR Schema model
715 --   changes.
716 --
717 -- Access Status:
718 --   Internal Row Handler Use Only.
719 --
720 -- {End Of Comments}
721 -- ----------------------------------------------------------------------------
722 Procedure dt_delete_validate
723   (p_application_id                   in number
724   ,p_item_class_id                    in number
725   ,p_datetrack_mode                   in varchar2
726   ,p_validation_start_date            in date
727   ,p_validation_end_date              in date
728   ) Is
729 --
730   l_proc        varchar2(72)    := g_package||'dt_delete_validate';
731 --
732 Begin
733   --
734   -- Ensure that the p_datetrack_mode argument is not null
735   --
736   hr_api.mandatory_arg_error
737     (p_api_name       => l_proc
738     ,p_argument       => 'datetrack_mode'
739     ,p_argument_value => p_datetrack_mode
740     );
741   --
742   -- Only perform the validation if the datetrack mode is either
743   -- DELETE or ZAP
744   --
745   If (p_datetrack_mode = hr_api.g_delete or
746       p_datetrack_mode = hr_api.g_zap) then
747     --
748     --
749     -- Ensure the arguments are not null
750     --
751     hr_api.mandatory_arg_error
752       (p_api_name       => l_proc
753       ,p_argument       => 'validation_start_date'
754       ,p_argument_value => p_validation_start_date
755       );
756     --
757     /*hr_api.mandatory_arg_error
758       (p_api_name       => l_proc
759       ,p_argument       => 'validation_end_date'
760       ,p_argument_value => p_validation_end_date
761       );*/
762     --
763     hr_api.mandatory_arg_error
764       (p_api_name       => l_proc
765       ,p_argument       => 'application_id'
766       ,p_argument_value => p_application_id
767       );
768     --
769     hr_api.mandatory_arg_error
770       (p_api_name       => l_proc
771       ,p_argument       => 'item_class_id'
772       ,p_argument_value => p_item_class_id
773       );
774     --
775     -- Ensures no child rows exists for the particular item_class_id and
776     -- application_id
777     --
778     ame_itu_shd.child_rows_exist
779     (p_item_class_id  => p_item_class_id
780     ,p_application_id => p_application_id
781     ,p_start_date     => p_validation_start_date
782     ,p_end_date       => p_validation_end_date);
783 
784   End If;
785   --
786 Exception
787   When Others Then
788     --
789     -- An unhandled or unexpected error has occurred which
790     -- we must report
791     --
792     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
793     fnd_message.set_token('PROCEDURE', l_proc);
794     fnd_message.set_token('STEP','15');
795     fnd_message.raise_error;
796   --
797 End dt_delete_validate;
798 --
799 -- ----------------------------------------------------------------------------
803   (p_rec                   in ame_itu_shd.g_rec_type
800 -- |---------------------------< insert_validate >----------------------------|
801 -- ----------------------------------------------------------------------------
802 Procedure insert_validate
804   ,p_effective_date        in date
805   ,p_datetrack_mode        in varchar2
806   ,p_validation_start_date in date
807   ,p_validation_end_date   in date
808   ) is
809 --
810   l_proc        varchar2(72) := g_package||'insert_validate';
811 --
812 Begin
813   hr_utility.set_location('Entering:'||l_proc, 5);
814   --
815   -- Validate Dependent Attributes
816   --
817   ame_itu_bus.chk_application_id(p_application_id   => p_rec.application_id
818                                 ,p_effective_date   => p_effective_date);
819 
820   ame_itu_bus.chk_item_class_id(p_item_class_id   => p_rec.item_class_id
821                                 ,p_effective_date => p_effective_date);
822 
823   ame_itu_bus.chk_item_class_usage(p_item_class_id   => p_rec.item_class_id
824                                 ,p_application_id  => p_rec.application_id
825                                 ,p_effective_date => p_effective_date);
826 
827   ame_itu_bus.chk_mandatory_args(p_rec   => p_rec);
828 
829   ame_itu_bus.chk_item_id_query(p_item_id_query   => p_rec.item_id_query);
830 
831   ame_itu_bus.chk_item_class_par_mode(
832                       p_item_class_par_mode  => p_rec.item_class_par_mode
833                       );
834 
835   ame_itu_bus.chk_item_class_sublist_mode(
836               p_item_class_sublist_mode  => p_rec.item_class_sublist_mode
837               );
838   ame_itu_bus.chk_order_number(p_order_number   => p_rec.item_class_order_number);
839 
840   --
841   hr_utility.set_location(' Leaving:'||l_proc, 10);
842 End insert_validate;
843 --
844 -- ----------------------------------------------------------------------------
845 -- |---------------------------< update_validate >----------------------------|
846 -- ----------------------------------------------------------------------------
847 Procedure update_validate
848   (p_rec                     in ame_itu_shd.g_rec_type
849   ,p_effective_date          in date
850   ,p_datetrack_mode          in varchar2
851   ,p_validation_start_date   in date
852   ,p_validation_end_date     in date
853   ) is
854 --
855   l_proc        varchar2(72) := g_package||'update_validate';
856 --
857 Begin
858   hr_utility.set_location('Entering:'||l_proc, 5);
859   --
860   -- Validate Dependent Attributes
861   --
862   -- Call the datetrack update integrity operation
863   --
864   dt_update_validate
865     (p_item_class_id                  => p_rec.item_class_id
866     ,p_datetrack_mode                 => p_datetrack_mode
867     ,p_validation_start_date          => p_validation_start_date
868     ,p_validation_end_date            => p_validation_end_date
869     );
870   --
871   chk_non_updateable_args
872     (p_effective_date  => p_effective_date
873     ,p_rec             => p_rec
874     );
875   ame_itu_bus.chk_item_id_query(p_item_id_query   => p_rec.item_id_query);
876 
877   ame_itu_bus.chk_item_class_par_mode(
878                       p_item_class_par_mode  => p_rec.item_class_par_mode
879                       );
880 
881   ame_itu_bus.chk_item_class_sublist_mode(
882               p_item_class_sublist_mode  => p_rec.item_class_sublist_mode
883               );
884   ame_itu_bus.chk_order_number(p_order_number   => p_rec.item_class_order_number);
885   --
886   --
887   hr_utility.set_location(' Leaving:'||l_proc, 10);
888 End update_validate;
889 --
890 -- ----------------------------------------------------------------------------
891 -- |---------------------------< delete_validate >----------------------------|
892 -- ----------------------------------------------------------------------------
893 Procedure delete_validate
894   (p_rec                    in ame_itu_shd.g_rec_type
895   ,p_effective_date         in date
896   ,p_datetrack_mode         in varchar2
897   ,p_validation_start_date  in date
898   ,p_validation_end_date    in date
899   ) is
900 --
901   l_proc        varchar2(72) := g_package||'delete_validate';
902 --
903 Begin
904   hr_utility.set_location('Entering:'||l_proc, 5);
905   --
906   -- Call all supporting business operations
907   --
908   dt_delete_validate
909     (p_datetrack_mode                   => p_datetrack_mode
910     ,p_validation_start_date            => p_validation_start_date
911     ,p_validation_end_date              => p_validation_end_date
912     ,p_item_class_id                    =>  p_rec.item_class_id
913     ,p_application_id                   =>  p_rec.application_id
914     );
915   --
916     chk_delete(p_item_class_id => p_rec.item_class_id
917               ,p_application_id => p_rec.application_id
918               );
919   --
920   hr_utility.set_location(' Leaving:'||l_proc, 10);
921 End delete_validate;
922 --
923 end ame_itu_bus;