DBA Data[Home] [Help]

PACKAGE BODY: APPS.BEN_ELEMENT_DELETE_CHECK

Source


1 package body ben_element_delete_check as
2 /* $Header: beneedck.pkb 120.1 2011/10/18 06:23:43 pvelvano ship $ */
3 procedure check_element_delete(p_element_entry_id IN NUMBER) is
4 --
5 -- This cursor checks that there are no rates
6 -- that are attached to the same element we are trying to
7 -- delete the element entry for.
8 -- If element entry is for a rate, error condition is thrown
9 --
10 cursor c_abr is
11 select 1
12 from   ben_acty_base_rt_f
13 where  element_type_id in
14     (select el.element_type_id
15      from   pay_element_entries_f ee
16           , pay_element_links_f el
17      where el.element_link_id = ee.element_link_id
18      and   ee.element_entry_id = p_element_entry_id
19      --Bug 2673501 fixes added this to see if it is creation by benefits process.
20      --We show this error for the rows created by the benefits process.
21      /* Bug 13081572: For element entries created because of Benefist Enrollment, creator_type = 'F' and entry_type = 'E' */
22      and ee.creator_type = 'F'
23      and ee.entry_type = 'E'
24      and   ee.creator_id in
25        ( select pen.prtt_enrt_rslt_id
26          from ben_prtt_enrt_rslt_f pen
27 	 where prtt_enrt_rslt_stat_cd is NULL));
28 l_temp number;
29 begin
30   open c_abr;
31   fetch c_abr into l_temp;
32   if c_abr%FOUND then
33     close c_abr;
34     fnd_message.set_name('BEN','BEN_93109_ELEMENT_USED_BY_RT');
35     fnd_message.raise_error;
36   else
37     close c_abr;
38   end if;
39 end check_element_delete;
40 end ben_element_delete_check;