DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_CEI_SHD

Source


1 PACKAGE BODY per_cei_shd AS
2 /* $Header: peceirhi.pkb 120.1 2006/10/18 08:58:46 grreddy noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33)    := '  per_cei_shd.';  -- Global package name
9 --
10 --
11 --  ---------------------------------------------------------------------------
12 --  |---------------------< entitlement_item_in_use >-------------------------|
13 --  ---------------------------------------------------------------------------
14 --
15 --  Desciption :
16 --
17 --  Check to see if the entitlement item is being used by a collective
18 --  agreement. If it is then it returns TRUE otherwise it returns FALSE
19 --
20 --
21 --  Pre-conditions :
22 --
23 --
24 --  In Arguments :
25 --    p_cagr_entitlement_item_id
26 --    p_item_name
27 --    p_cagr_api_id
28 --
29 --  Post Success :
30 --    Processing continues
31 --
32 --  Post Failure :
33 --    An application error will be raised and processing is
34 --    terminated
35 --
36 --  Access Status :
37 --    Developement use only.
38 --
39 -- {End of Comments}
40 --
41 -- ---------------------------------------------------------------------------
42 --
43 FUNCTION entitlement_item_in_use
44   (p_cagr_entitlement_item_id IN per_cagr_entitlement_items.cagr_entitlement_item_id%TYPE)
45   RETURN BOOLEAN IS
46   --
47   CURSOR csr_get_entitlements IS
48     SELECT pce.cagr_entitlement_item_id
49     FROM   per_cagr_entitlements pce
50     WHERE  pce.cagr_entitlement_item_id = p_cagr_entitlement_item_id;
51   --
52   l_return_value BOOLEAN;
53   l_dummy_item   per_cagr_entitlement_items.cagr_entitlement_item_id%TYPE;
54   l_proc         VARCHAR2(72) := g_package||'entitlement_item_in_use';
55   --
56 BEGIN
57   --
58   hr_utility.set_location('Entering : '||p_cagr_entitlement_item_id||'/'||l_proc,10);
59   --
60   -- Check mandatory parameter is set
61   --
62   hr_api.mandatory_arg_error
63     (p_api_name       => l_proc
64     ,p_argument       => 'cagr_entitlement_item_id'
65     ,p_argument_value => p_cagr_entitlement_item_id
66     );
67   --
68   OPEN  csr_get_entitlements;
69   FETCH csr_get_entitlements INTO l_dummy_item;
70   --
71   IF csr_get_entitlements%FOUND THEN
72     --
73     hr_utility.set_location(l_proc,20);
74     --
75     CLOSE csr_get_entitlements;
76     --
77     l_return_value := TRUE;
78     --
79   ELSE
80     --
81     hr_utility.set_location(l_proc,30);
82     --
83     CLOSE csr_get_entitlements;
84     --
85     l_return_value := FALSE;
86     --
87   END IF;
88   --
89   hr_utility.set_location('Leaving  : '||l_proc,100);
90   --
91   RETURN(l_return_value);
92   --
93 END entitlement_item_in_use;
94 --
95 -- ----------------------------------------------------------------------------
96 -- |---------------------------< constraint_error >---------------------------|
97 -- ----------------------------------------------------------------------------
98 Procedure constraint_error
99   (p_constraint_name in all_constraints.constraint_name%TYPE
100   ) Is
101 --
102   l_proc     varchar2(72) := g_package||'constraint_error';
103 --
104 Begin
105   --
106   If (p_constraint_name = 'PER_CAGR_ENTITLEMENT_ITEMS_PK') Then
107     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
108     fnd_message.set_token('PROCEDURE', l_proc);
109     fnd_message.set_token('STEP','5');
110     fnd_message.raise_error;
111   Else
112     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
113     fnd_message.set_token('PROCEDURE', l_proc);
114     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
115     fnd_message.raise_error;
116   End If;
117   --
118 End constraint_error;
119 --
120 -- ----------------------------------------------------------------------------
121 -- |-----------------------------< api_updating >-----------------------------|
122 -- ----------------------------------------------------------------------------
123 Function api_updating
124   (p_cagr_entitlement_item_id             in     number
125   )
126   Return Boolean Is
127 --
128   --
129   -- Cursor selects the 'current' row from the HR Schema
130   --
131   Cursor C_Sel1 is
132     select
133        cagr_entitlement_item_id
134       ,item_name
135       ,element_type_id
136       ,input_value_id
137 	  ,column_type
138 	  ,column_size
139       ,legislation_code
140       ,cagr_api_id
141       ,cagr_api_param_id
142       ,business_group_id
143       ,beneficial_rule
144       ,category_name
145       ,uom
146       ,flex_value_set_id
147       ,beneficial_formula_id
148       ,object_version_number
149       ,beneficial_rule_value_set_id
150       ,multiple_entries_allowed_flag
151       ,auto_create_entries_flag -- CEI Enh
152       ,opt_id
153     from    per_cagr_entitlement_items
154     where    cagr_entitlement_item_id = p_cagr_entitlement_item_id;
155 --
156   l_fct_ret    boolean;
157 --
158 Begin
159   --
160   If (p_cagr_entitlement_item_id is null
161      ) Then
162     --
163     -- One of the primary key arguments is null therefore we must
164     -- set the returning function value to false
165     --
166     l_fct_ret := false;
167   Else
168     If (p_cagr_entitlement_item_id
169         = per_cei_shd.g_old_rec.cagr_entitlement_item_id
170        ) Then
171       --
172       -- The g_old_rec is current therefore we must
173       -- set the returning function to true
174       --
175       l_fct_ret := true;
176     Else
177       --
178       -- Select the current row into g_old_rec
179       --
180       Open C_Sel1;
181       Fetch C_Sel1 Into per_cei_shd.g_old_rec;
182       If C_Sel1%notfound Then
183         Close C_Sel1;
184         --
185         -- The primary key is invalid therefore we must error
186         --
187         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
188         fnd_message.raise_error;
189       End If;
190       Close C_Sel1;
191       --
192       l_fct_ret := true;
193     End If;
194   End If;
195   Return (l_fct_ret);
196 --
197 End api_updating;
198 --
199 -- ----------------------------------------------------------------------------
200 -- |---------------------------------< lck >----------------------------------|
201 -- ----------------------------------------------------------------------------
202 Procedure lck
203   (p_cagr_entitlement_item_id             in     number ,
204    p_object_version_number              in number
205   ) is
206 --
207 -- Cursor selects the 'current' row from the HR Schema
208 --
209   Cursor C_Sel1 is
210     select
211       cagr_entitlement_item_id
212      ,item_name
213      ,element_type_id
214      ,input_value_id
215 	 ,column_type
216 	 ,column_size
217      ,legislation_code
218      ,cagr_api_id
219      ,cagr_api_param_id
220      ,business_group_id
221      ,beneficial_rule
222      ,category_name
223      ,uom
224      ,flex_value_set_id
225      ,beneficial_formula_id
226      ,object_version_number
227      ,beneficial_rule_value_set_id
228      ,multiple_entries_allowed_flag
229      ,auto_create_entries_flag -- CEI Enh
230      ,opt_id
231     from    per_cagr_entitlement_items
232     where    cagr_entitlement_item_id = p_cagr_entitlement_item_id
233     for    update nowait;
234 --
235   l_proc    varchar2(72) := g_package||'lck';
236 --
237 Begin
238   --
239   hr_utility.set_location('Entering:'||l_proc, 5);
240   --
241   hr_api.mandatory_arg_error
242     (p_api_name           => l_proc
243     ,p_argument           => 'CAGR_ENTITLEMENT_ITEM_ID'
244     ,p_argument_value     => p_cagr_entitlement_item_id
245     );
246   --
247   Open  C_Sel1;
248   Fetch C_Sel1 Into per_cei_shd.g_old_rec;
249   If C_Sel1%notfound then
250     Close C_Sel1;
251     --
252     -- The primary key is invalid therefore we must error
253     --
254     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
255     fnd_message.raise_error;
256   End If;
257   Close C_Sel1;
258   --
259   If (p_object_version_number <> g_old_rec.object_version_number) Then
260         hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
261         hr_utility.raise_error;
262   End If;
263   --
264   hr_utility.set_location(' Leaving:'||l_proc, 10);
265   --
266   -- We need to trap the ORA LOCK exception
267   --
268 Exception
269   When HR_Api.Object_Locked then
270     --
271     -- The object is locked therefore we need to supply a meaningful
272     -- error message.
273     --
274     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
275     fnd_message.set_token('TABLE_NAME', 'per_cagr_entitlement_items');
276     fnd_message.raise_error;
277 End lck;
278 --
279 -- ----------------------------------------------------------------------------
280 -- |-----------------------------< convert_args >-----------------------------|
281 -- ----------------------------------------------------------------------------
282 Function convert_args
283   (p_cagr_entitlement_item_id       in number
284   ,p_item_name                      in varchar2
285   ,p_element_type_id                in number
286   ,p_input_value_id                 in varchar2
287   ,p_column_type                    in varchar2
288   ,p_column_size                    in number
289   ,p_legislation_code               in varchar2
290   ,p_cagr_api_id                    in number
291   ,p_cagr_api_param_id              in number
292   ,p_business_group_id              in number
293   ,p_beneficial_rule                in varchar2
294   ,p_category_name                  in varchar2
295   ,p_uom                            in varchar2
296   ,p_flex_value_set_id              in number
297   ,p_beneficial_formula_id          in number
298   ,p_object_version_number          in number
299   ,p_ben_rule_value_set_id          in number
300   ,p_mult_entries_allowed_flag      in varchar2
301   ,p_auto_create_entries_flag       in varchar2 -- CEI Enh
302   ,p_opt_id                         in number) Return g_rec_type is
303 --
304   l_rec   g_rec_type;
305 --
306 Begin
307   --
308   -- Convert arguments into local l_rec structure.
309   --
310   l_rec.cagr_entitlement_item_id         := p_cagr_entitlement_item_id;
311   l_rec.item_name                        := p_item_name;
312   l_rec.element_type_id                  := p_element_type_id;
313   l_rec.input_value_id                   := p_input_value_id;
314   l_rec.column_type                      := p_column_type;
315   l_rec.column_size                      := p_column_size;
316   l_rec.legislation_code                      := p_legislation_code;
317   l_rec.beneficial_rule                  := p_beneficial_rule;
318   l_rec.cagr_api_id                      := p_cagr_api_id;
319   l_rec.cagr_api_param_id                := p_cagr_api_param_id;
320   l_rec.business_group_id                := p_business_group_id;
321   l_rec.beneficial_rule                  := p_beneficial_rule;
322   l_rec.category_name                    := p_category_name;
323   l_rec.uom                              := p_uom;
324   l_rec.flex_value_set_id                := p_flex_value_set_id;
325   l_rec.object_version_number            := p_object_version_number;
326   l_rec.beneficial_formula_id            := p_beneficial_formula_id;
327   l_rec.ben_rule_value_set_id            := p_ben_rule_value_set_id;
328   l_rec.mult_entries_allowed_flag        := p_mult_entries_allowed_flag;
329   l_rec.auto_create_entries_flag         := p_auto_create_entries_flag; -- CEI Enh
330   l_rec.opt_id                           := p_opt_id;
331   --
332   -- Return the plsql record structure.
333   --
334   Return(l_rec);
335 --
336 End convert_args;
337 --
338 end per_cei_shd;