DBA Data[Home] [Help]

PACKAGE BODY: APPS.HXC_TKG_BUS

Source


1 Package Body hxc_tkg_bus as
2 /* $Header: hxctkgrhi.pkb 120.2 2005/09/23 05:28:58 rchennur noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)	:= '  hxc_tkg_bus.';  -- Global package name
9 g_debug boolean := hr_utility.debug_enabled;
10 --
11 -- The following two global variables are only to be
12 -- used by the return_legislation_code function.
13 --
14 g_legislation_code            varchar2(150)  default null;
15 g_tk_group_id             number         default null;
16 --
17 -- ----------------------------------------------------------------------------
18 -- |-----------------------< chk_non_updateable_args >------------------------|
19 -- ----------------------------------------------------------------------------
20 --
21 -- Description:
22 --   This procedure is used to ensure that non updateable attributes have
23 --   not been updated. If an attribute has been updated an error is generated.
24 --
25 -- Pre Conditions:
26 --   g_old_rec has been populated with details of the values currently in
27 --   the database.
28 --
29 -- In Arguments:
30 --   p_rec has been populated with the updated values the user would like the
31 --   record set to.
32 --
33 -- Post Success:
34 --   Processing continues if all the non updateable attributes have not
35 --   changed.
36 --
37 -- Post Failure:
38 --   An application error is raised if any of the non updatable attributes
39 --   have been altered.
40 --
41 -- ----------------------------------------------------------------------------
42 Procedure chk_non_updateable_args
43   (p_rec in hxc_tkg_shd.g_rec_type
44   ) IS
45 --
46   l_proc     varchar2(72) := g_package || 'chk_non_updateable_args';
47   l_error    EXCEPTION;
48   l_argument varchar2(30);
49 --
50 Begin
51   --
52   -- Only proceed with the validation if a row exists for the current
53   -- record in the HR Schema.
54   --
55   IF NOT hxc_tkg_shd.api_updating
56       (p_tk_group_id                      => p_rec.tk_group_id
57       ,p_object_version_number                => p_rec.object_version_number
58       ) THEN
59      fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
60      fnd_message.set_token('PROCEDURE ', l_proc);
61      fnd_message.set_token('STEP ', '5');
62      fnd_message.raise_error;
63   END IF;
64   --
65   EXCEPTION
66     WHEN l_error THEN
67        hr_api.argument_changed_error
68          (p_api_name => l_proc
69          ,p_argument => l_argument);
70     WHEN OTHERS THEN
71        RAISE;
72 End chk_non_updateable_args;
73 --
74 -- ----------------------------------------------------------------------------
75 -- |---------------------------< insert_validate >----------------------------|
76 -- ----------------------------------------------------------------------------
77 Procedure insert_validate
78   (p_rec                          in hxc_tkg_shd.g_rec_type
79   ) is
80 --
81   l_proc  varchar2(72) ;
82 --
83 Begin
84   g_debug :=hr_utility.debug_enabled;
85   if g_debug then
86   	l_proc := g_package||'insert_validate';
87   	hr_utility.set_location('Entering:'||l_proc, 5);
88   end if;
89   --
90   -- Call all supporting business operations
91   --
92 chk_business_group_id(p_rec.business_group_id);
93   --
94   if g_debug then
95   	hr_utility.set_location(' Leaving:'||l_proc, 10);
96   end if;
97 End insert_validate;
98 --
99 -- ----------------------------------------------------------------------------
100 -- |---------------------------< update_validate >----------------------------|
101 -- ----------------------------------------------------------------------------
102 Procedure update_validate
103   (p_rec                          in hxc_tkg_shd.g_rec_type
104   ) is
105 --
106   l_proc  varchar2(72) ;
107 --
108 Begin
109   g_debug :=hr_utility.debug_enabled;
110   if g_debug then
111   	l_proc := g_package||'update_validate';
112   	hr_utility.set_location('Entering:'||l_proc, 5);
113   end if;
114   --
115   -- Call all supporting business operations
116   --
117   hr_api.mandatory_arg_error
118     (p_api_name           => l_proc
119     ,p_argument           => 'TK_GROUP_ID'
120     ,p_argument_value     => p_rec.tk_group_id
121     );
122   --
123   chk_business_group_id(p_rec.business_group_id);
124   --
125   chk_non_updateable_args
126     (p_rec              => p_rec
127     );
128   --
129   --
130   if g_debug then
131   	hr_utility.set_location(' Leaving:'||l_proc, 10);
132   end if;
133 End update_validate;
134 --
135 -- ----------------------------------------------------------------------------
136 -- |---------------------------< delete_validate >----------------------------|
137 -- ----------------------------------------------------------------------------
138 Procedure delete_validate
139   (p_rec                          in hxc_tkg_shd.g_rec_type
140   ) is
141 --
142   l_proc  varchar2(72) ;
143 --
144 Begin
145   g_debug :=hr_utility.debug_enabled;
146   if g_debug then
147   	l_proc := g_package||'delete_validate';
148   	hr_utility.set_location('Entering:'||l_proc, 5);
149   end if;
150   --
151   -- Call all supporting business operations
152   --
153 null;
154   --
155   if g_debug then
156   	hr_utility.set_location(' Leaving:'||l_proc, 10);
157   end if;
158 End delete_validate;
159 --
160 -- ----------------------------------------------------------------------------
161 -- |-------------------< chk_business_group_id >-- ----------------------------|
162 -- ----------------------------------------------------------------------------
163 --
164 -- Description
165 --   This procedure checks if the business group id is existing.
166 --
167 -- Pre-Conditions
168 --   None.
169 --
170 -- In Parameters
171 --   p_business_group_id
172 --
173 -- Post Success
174 --   Processing continues
175 --
176 -- Post Failure
177 --   Error raised.
178 --
179 -- Access Status
180 --   Internal table handler use only.
181 --
182 Procedure chk_business_group_id (p_business_group_id in number
183                             ) is
184   --
185   l_dummy        varchar2(1);
186   --
187   cursor c1 is
188     select null
189     from   hr_organization_information h1
190     where  h1.org_information_context = 'Business Group Information'
191       and  h1.organization_id = p_business_group_id;
192   --
193 Begin
194   --
195   if(p_business_group_id is not null) then
196   -- check if business_group_id value exists in per_business_groups view
197     --
198     open c1;
199       --
200       fetch c1 into l_dummy;
201       if c1%notfound then
202         --
203         close c1;
204         --
205         -- raise error as business group not found
206         --
207         --
208         hr_utility.set_message(809,'HXC_TKG_INV_BG_ID');
209         hr_utility.raise_error;
210         --
211       end if;
212       --
213     close c1;
214     --
215   else
216         hr_utility.set_message(809,'HXC_TKG_INV_BG_ID');
217         hr_utility.raise_error;
218   end if;
219   --
220     --
221 End chk_business_group_id;
222 --
223 end hxc_tkg_bus;