[Home] [Help]
PACKAGE BODY: APPS.PAY_RAN_SHD
Source
1 Package Body pay_ran_shd as
2 /* $Header: pyranrhi.pkb 120.0.12000000.2 2007/02/10 10:03:01 vetsrini noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_ran_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 = 'PAY_RANGES_FK') 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 ElsIf (p_constraint_name = 'PAY_RANGES_PK') Then
27 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
28 fnd_message.set_token('PROCEDURE', l_proc);
29 fnd_message.set_token('STEP','10');
30 fnd_message.raise_error;
31 ElsIf (p_constraint_name = 'PAY_RANGES_UK') Then
32 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
33 fnd_message.set_token('PROCEDURE', l_proc);
34 fnd_message.set_token('STEP','15');
35 fnd_message.raise_error;
36 Else
37 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
38 fnd_message.set_token('PROCEDURE', l_proc);
39 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
40 fnd_message.raise_error;
41 End If;
42 --
43 End constraint_error;
44 --
45 -- ----------------------------------------------------------------------------
46 -- |-----------------------------< api_updating >-----------------------------|
47 -- ----------------------------------------------------------------------------
48 Function api_updating
49 (p_range_id in number
50 ,p_object_version_number in number
51 )
52 Return Boolean Is
53 --
54 --
55 -- Cursor selects the 'current' row from the HR Schema
56 --
57 Cursor C_Sel1 is
58 select
59 range_id
60 ,range_table_id
61 ,low_band
62 ,high_band
63 ,amount1
64 ,amount2
65 ,amount3
66 ,amount4
67 ,amount5
68 ,amount6
69 ,amount7
70 ,amount8
71 ,effective_start_date
72 ,effective_end_date
73 ,object_version_number
74 from pay_ranges_f
75 where range_id = p_range_id;
76 --
77 l_fct_ret boolean;
78 --
79 Begin
80 --
81 If (p_range_id is null and
82 p_object_version_number is null
83 ) Then
84 --
85 -- One of the primary key arguments is null therefore we must
86 -- set the returning function value to false
87 --
88 l_fct_ret := false;
89 Else
90 If (p_range_id
91 = pay_ran_shd.g_old_rec.range_id and
92 p_object_version_number
93 = pay_ran_shd.g_old_rec.object_version_number
94 ) Then
95 --
96 -- The g_old_rec is current therefore we must
97 -- set the returning function to true
98 --
99 l_fct_ret := true;
100 Else
101 --
102 -- Select the current row into g_old_rec
103 --
104 Open C_Sel1;
105 Fetch C_Sel1 Into pay_ran_shd.g_old_rec;
106 If C_Sel1%notfound Then
107 Close C_Sel1;
108 --
109 -- The primary key is invalid therefore we must error
110 --
111 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
112 fnd_message.raise_error;
113 End If;
114 Close C_Sel1;
115 If (p_object_version_number
116 <> pay_ran_shd.g_old_rec.object_version_number) Then
117 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
118 fnd_message.raise_error;
119 End If;
120 l_fct_ret := true;
121 End If;
122 End If;
123 Return (l_fct_ret);
124 --
125 End api_updating;
126 --
127 -- ----------------------------------------------------------------------------
128 -- |---------------------------------< lck >----------------------------------|
129 -- ----------------------------------------------------------------------------
130 Procedure lck
131 (p_range_id in number
132 ,p_object_version_number in number
133 ) is
134 --
135 -- Cursor selects the 'current' row from the HR Schema
136 --
137 Cursor C_Sel1 is
138 select
139 range_id
140 ,range_table_id
141 ,low_band
142 ,high_band
143 ,amount1
144 ,amount2
145 ,amount3
146 ,amount4
147 ,amount5
148 ,amount6
149 ,amount7
150 ,amount8
151 ,effective_start_date
152 ,effective_end_date
153 ,object_version_number
154 from pay_ranges_f
155 where range_id = p_range_id
156 for update nowait;
157 --
158 l_proc varchar2(72) := g_package||'lck';
159 --
160 Begin
161 hr_utility.set_location('Entering:'||l_proc, 5);
162 --
163 hr_api.mandatory_arg_error
164 (p_api_name => l_proc
165 ,p_argument => 'RANGE_ID'
166 ,p_argument_value => p_range_id
167 );
168 hr_utility.set_location(l_proc,6);
169 hr_api.mandatory_arg_error
170 (p_api_name => l_proc
171 ,p_argument => 'OBJECT_VERSION_NUMBER'
172 ,p_argument_value => p_object_version_number
173 );
174 --
175 Open C_Sel1;
176 Fetch C_Sel1 Into pay_ran_shd.g_old_rec;
177 If C_Sel1%notfound then
178 Close C_Sel1;
179 --
180 -- The primary key is invalid therefore we must error
181 --
182 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
183 fnd_message.raise_error;
184 End If;
185 Close C_Sel1;
186 If (p_object_version_number
187 <> pay_ran_shd.g_old_rec.object_version_number) Then
188 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
189 fnd_message.raise_error;
190 End If;
191 --
192 hr_utility.set_location(' Leaving:'||l_proc, 10);
193 --
194 -- We need to trap the ORA LOCK exception
195 --
196 Exception
197 When HR_Api.Object_Locked then
198 --
199 -- The object is locked therefore we need to supply a meaningful
200 -- error message.
201 --
202 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
203 fnd_message.set_token('TABLE_NAME', 'pay_ranges_f');
204 fnd_message.raise_error;
205 End lck;
206 --
207 -- ----------------------------------------------------------------------------
208 -- |-----------------------------< convert_args >-----------------------------|
209 -- ----------------------------------------------------------------------------
210 Function convert_args
211 (p_range_id in number
212 ,p_range_table_id in number
213 ,p_low_band in number
214 ,p_high_band in number
215 ,p_amount1 in number
216 ,p_amount2 in number
217 ,p_amount3 in number
218 ,p_amount4 in number
219 ,p_amount5 in number
220 ,p_amount6 in number
221 ,p_amount7 in number
222 ,p_amount8 in number
223 ,p_effective_start_date in date
224 ,p_effective_end_date in date
225 ,p_object_version_number in number
226 )
227 Return g_rec_type is
228 --
229 l_rec g_rec_type;
230 --
231 Begin
232 --
233 -- Convert arguments into local l_rec structure.
234 --
235 l_rec.range_id := p_range_id;
236 l_rec.range_table_id := p_range_table_id;
237 l_rec.low_band := p_low_band;
238 l_rec.high_band := p_high_band;
239 l_rec.amount1 := p_amount1;
240 l_rec.amount2 := p_amount2;
241 l_rec.amount3 := p_amount3;
242 l_rec.amount4 := p_amount4;
243 l_rec.amount5 := p_amount5;
244 l_rec.amount6 := p_amount6;
245 l_rec.amount7 := p_amount7;
246 l_rec.amount8 := p_amount8;
247 l_rec.effective_start_date := p_effective_start_date;
248 l_rec.effective_end_date := p_effective_end_date;
249 l_rec.object_version_number := p_object_version_number;
250 --
251 -- Return the plsql record structure.
252 --
253 Return(l_rec);
254 --
255 End convert_args;
256 --
257 end pay_ran_shd;