DBA Data[Home] [Help]

PACKAGE BODY: APPS.PER_RET_SHD

Source


1 Package Body per_ret_shd as
2 /* $Header: peretrhi.pkb 115.1 2002/12/06 11:29:20 eumenyio noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  per_ret_shd.';  -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |---------------------------< constraint_error >---------------------------|
12 -- ----------------------------------------------------------------------------
13 Procedure constraint_error
14   (p_constraint_name in all_constraints.constraint_name%TYPE
15   ) Is
16 --
17   l_proc        varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20   --
21   If (p_constraint_name = 'PER_CAGR_RETAINED_RIGHTS_PK') Then
22     fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
23     fnd_message.set_token('PROCEDURE', l_proc);
24     fnd_message.set_token('STEP','5');
25     fnd_message.raise_error;
26   Else
27     fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
28     fnd_message.set_token('PROCEDURE', l_proc);
29     fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
30     fnd_message.raise_error;
31   End If;
32   --
33 End constraint_error;
34 --
35 -- ----------------------------------------------------------------------------
36 -- |-----------------------------< api_updating >-----------------------------|
37 -- ----------------------------------------------------------------------------
38 Function api_updating
39   (p_cagr_retained_right_id              in     number
40   ,p_object_version_number                in     number
41   )
42   Return Boolean Is
43   --
44   --
45   -- Cursor selects the 'current' row from the HR Schema
46   --
47   Cursor C_Sel1 is
48     select
49        cagr_retained_right_id
50       ,assignment_id
51       ,cagr_entitlement_item_id
52       ,collective_agreement_id
53       ,cagr_entitlement_id
54       ,category_name
55       ,element_type_id
56       ,input_value_id
57       ,cagr_api_id
58       ,cagr_api_param_id
59       ,cagr_entitlement_line_id
60       ,freeze_flag
61       ,value
62       ,units_of_measure
63       ,start_date
64       ,end_date
65       ,parent_spine_id
66       ,formula_id
67       ,oipl_id
68       ,step_id
69       ,grade_spine_id
70       ,column_type
71       ,column_size
72       ,eligy_prfl_id
73       ,object_version_number
74       ,cagr_entitlement_result_id
75       ,business_group_id
76       ,flex_value_set_id
77     from        per_cagr_retained_rights
78     where       cagr_retained_right_id = p_cagr_retained_right_id;
79   --
80   l_fct_ret     boolean;
81   --
82 Begin
83   --
84   If (p_cagr_retained_right_id is null and
85       p_object_version_number is null
86      ) Then
87     --
88     -- One of the primary key arguments is null therefore we must
89     -- set the returning function value to false
90     --
91     l_fct_ret := false;
92   Else
93     If (p_cagr_retained_right_id
94         = per_ret_shd.g_old_rec.cagr_retained_right_id and
95         p_object_version_number
96         = per_ret_shd.g_old_rec.object_version_number
97        ) Then
98       --
99       -- The g_old_rec is current therefore we must
100       -- set the returning function to true
101       --
102       l_fct_ret := true;
103     Else
104       --
105       -- Select the current row into g_old_rec
106       --
107       Open C_Sel1;
108       Fetch C_Sel1 Into per_ret_shd.g_old_rec;
109       If C_Sel1%notfound Then
110         Close C_Sel1;
111         --
112         -- The primary key is invalid therefore we must error
113         --
114         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
115         fnd_message.raise_error;
116       End If;
117       Close C_Sel1;
118       If (p_object_version_number
119           <> per_ret_shd.g_old_rec.object_version_number) Then
120         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
121         fnd_message.raise_error;
122       End If;
123       l_fct_ret := true;
124     End If;
125   End If;
126   Return (l_fct_ret);
127 --
128 End api_updating;
129 --
130 -- ----------------------------------------------------------------------------
131 -- |---------------------------------< lck >----------------------------------|
132 -- ----------------------------------------------------------------------------
133 Procedure lck
134   (p_cagr_retained_right_id              in     number
135   ,p_object_version_number                in     number
136   ) is
137 --
138 -- Cursor selects the 'current' row from the HR Schema
139 --
140   Cursor C_Sel1 is
141     select
142        cagr_retained_right_id
143       ,assignment_id
144       ,cagr_entitlement_item_id
145       ,collective_agreement_id
146       ,cagr_entitlement_id
147       ,category_name
148       ,element_type_id
149       ,input_value_id
150       ,cagr_api_id
151       ,cagr_api_param_id
152       ,cagr_entitlement_line_id
153       ,freeze_flag
154       ,value
155       ,units_of_measure
156       ,start_date
157       ,end_date
158       ,parent_spine_id
159       ,formula_id
160       ,oipl_id
161       ,step_id
162       ,grade_spine_id
163       ,column_type
164       ,column_size
165       ,eligy_prfl_id
166       ,object_version_number
167       ,cagr_entitlement_result_id
168       ,business_group_id
169       ,flex_value_set_id
170     from        per_cagr_retained_rights
171     where       cagr_retained_right_id = p_cagr_retained_right_id
172     for update nowait;
173 --
174   l_proc        varchar2(72) := g_package||'lck';
175 --
176 Begin
177   hr_utility.set_location('Entering:'||l_proc, 5);
178   --
179   hr_api.mandatory_arg_error
180     (p_api_name           => l_proc
181     ,p_argument           => 'CAGR_RETAINED_RIGHTS_ID'
182     ,p_argument_value     => p_cagr_retained_right_id
183     );
184   hr_utility.set_location(l_proc,6);
185   hr_api.mandatory_arg_error
186     (p_api_name           => l_proc
187     ,p_argument           => 'OBJECT_VERSION_NUMBER'
188     ,p_argument_value     => p_object_version_number
189     );
190   --
191   Open  C_Sel1;
192   Fetch C_Sel1 Into per_ret_shd.g_old_rec;
193   If C_Sel1%notfound then
194     Close C_Sel1;
195     --
196     -- The primary key is invalid therefore we must error
197     --
198     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
199     fnd_message.raise_error;
200   End If;
201   Close C_Sel1;
202   If (p_object_version_number
203       <> per_ret_shd.g_old_rec.object_version_number) Then
204         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
205         fnd_message.raise_error;
206   End If;
207   --
208   hr_utility.set_location(' Leaving:'||l_proc, 10);
209   --
210   -- We need to trap the ORA LOCK exception
211   --
212 Exception
213   When HR_Api.Object_Locked then
214     --
215     -- The object is locked therefore we need to supply a meaningful
216     -- error message.
217     --
218     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
219     fnd_message.set_token('TABLE_NAME', 'per_cagr_retained_rights');
220     fnd_message.raise_error;
221 End lck;
222 --
223 -- ----------------------------------------------------------------------------
224 -- |-----------------------------< convert_args >-----------------------------|
225 -- ----------------------------------------------------------------------------
226 Function convert_args
227   (p_cagr_retained_right_id        in number
228   ,p_assignment_id                  in number
229   ,p_cagr_entitlement_item_id       in number
230   ,p_collective_agreement_id        in number
231   ,p_cagr_entitlement_id            in number
232   ,p_category_name                  in varchar2
233   ,p_element_type_id                in number
234   ,p_input_value_id                 in number
235   ,p_cagr_api_id                    in number
236   ,p_cagr_api_param_id              in number
237   ,p_cagr_entitlement_line_id       in number
238   ,p_freeze_flag                    in varchar2
239   ,p_value                          in varchar2
240   ,p_units_of_measure               in varchar2
241   ,p_start_date                     in date
242   ,p_end_date                       in date
243   ,p_parent_spine_id                in number
244   ,p_formula_id                     in number
245   ,p_oipl_id                        in number
246   ,p_step_id                        in number
247   ,p_grade_spine_id                 in number
248   ,p_column_type                    in varchar2
249   ,p_column_size                    in number
250   ,p_eligy_prfl_id                  in number
251   ,p_object_version_number          in number
252   ,p_cagr_entitlement_result_id     in number
253   ,p_business_group_id              in number
254   ,p_flex_value_set_id              in number
255   )
256   Return g_rec_type is
257 --
258   l_rec   g_rec_type;
259 --
260 Begin
261   --
262   -- Convert arguments into local l_rec structure.
263   --
264   l_rec.cagr_retained_right_id          := p_cagr_retained_right_id;
265   l_rec.assignment_id                    := p_assignment_id;
266   l_rec.cagr_entitlement_item_id         := p_cagr_entitlement_item_id;
267   l_rec.collective_agreement_id          := p_collective_agreement_id;
268   l_rec.cagr_entitlement_id              := p_cagr_entitlement_id;
269   l_rec.category_name                    := p_category_name;
270   l_rec.element_type_id                  := p_element_type_id;
271   l_rec.input_value_id                   := p_input_value_id;
272   l_rec.cagr_api_id                      := p_cagr_api_id;
273   l_rec.cagr_api_param_id                := p_cagr_api_param_id;
274   l_rec.cagr_entitlement_line_id         := p_cagr_entitlement_line_id;
275   l_rec.freeze_flag                      := p_freeze_flag;
276   l_rec.value                            := p_value;
277   l_rec.units_of_measure                 := p_units_of_measure;
278   l_rec.start_date                       := p_start_date;
279   l_rec.end_date                         := p_end_date;
280   l_rec.parent_spine_id                  := p_parent_spine_id;
281   l_rec.formula_id                       := p_formula_id;
282   l_rec.oipl_id                          := p_oipl_id;
283   l_rec.step_id                          := p_step_id;
284   l_rec.grade_spine_id                   := p_grade_spine_id;
285   l_rec.column_type                      := p_column_type;
286   l_rec.column_size                      := p_column_size;
287   l_rec.eligy_prfl_id                    := p_eligy_prfl_id;
288   l_rec.object_version_number            := p_object_version_number;
289   l_rec.cagr_entitlement_result_id       := p_cagr_entitlement_result_id;
290   l_rec.business_group_id                := p_business_group_id;
291   l_rec.flex_value_set_id                := p_flex_value_set_id;
292   --
293   -- Return the plsql record structure.
294   --
295   Return(l_rec);
296 --
297 End convert_args;
298 --
299 end per_ret_shd;