[Home] [Help]
PACKAGE BODY: APPS.PAY_TDF_SHD
Source
1 Package Body pay_tdf_shd as
2 /* $Header: pytdfrhi.pkb 120.4 2005/09/20 06:56 adkumar noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_tdf_shd.'; -- Global package name
9 --
10 -- ----------------------------------------------------------------------------
11 -- |------------------------< return_api_dml_status >-------------------------|
12 -- ----------------------------------------------------------------------------
13 Function return_api_dml_status Return Boolean Is
14 --
15 Begin
16 --
17 Return (nvl(g_api_dml, false));
18 --
19 End return_api_dml_status;
20 --
21 -- ----------------------------------------------------------------------------
22 -- |---------------------------< constraint_error >---------------------------|
23 -- ----------------------------------------------------------------------------
24 Procedure constraint_error
25 (p_constraint_name in all_constraints.constraint_name%TYPE
26 ) Is
27 --
28 l_proc varchar2(72) := g_package||'constraint_error';
29 --
30 Begin
31 --
32 If (p_constraint_name = 'PAY_TIME_DEFINITIONS_PK') Then
33 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
34 fnd_message.set_token('PROCEDURE', l_proc);
35 fnd_message.set_token('STEP','5');
36 fnd_message.raise_error;
37 ElsIf (p_constraint_name = 'PAY_TIME_DEFINITIONS_UK1') Then
38 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
39 fnd_message.set_token('PROCEDURE', l_proc);
40 fnd_message.set_token('STEP','10');
41 fnd_message.raise_error;
42 Else
43 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
44 fnd_message.set_token('PROCEDURE', l_proc);
45 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
46 fnd_message.raise_error;
47 End If;
48 --
49 End constraint_error;
50 --
51 -- ----------------------------------------------------------------------------
52 -- |-----------------------------< api_updating >-----------------------------|
53 -- ----------------------------------------------------------------------------
54 Function api_updating
55 (p_time_definition_id in number
56 ,p_object_version_number in number
57 )
58 Return Boolean Is
59 --
60 --
61 -- Cursor selects the 'current' row from the HR Schema
62 --
63 Cursor C_Sel1 is
64 select
65 time_definition_id
66 ,short_name
67 ,definition_name
68 ,period_type
69 ,period_unit
70 ,day_adjustment
71 ,dynamic_code
72 ,business_group_id
73 ,legislation_code
74 ,definition_type
75 ,number_of_years
76 ,start_date
77 ,period_time_definition_id
78 ,creator_id
79 ,creator_type
80 ,object_version_number
81 from pay_time_definitions
82 where time_definition_id = p_time_definition_id;
83 --
84 l_fct_ret boolean;
85 --
86 Begin
87 --
88 If (p_time_definition_id is null and
89 p_object_version_number is null
90 ) Then
91 --
92 -- One of the primary key arguments is null therefore we must
93 -- set the returning function value to false
94 --
95 l_fct_ret := false;
96 Else
97 If (p_time_definition_id
98 = pay_tdf_shd.g_old_rec.time_definition_id and
99 p_object_version_number
100 = pay_tdf_shd.g_old_rec.object_version_number
101 ) Then
102 --
103 -- The g_old_rec is current therefore we must
104 -- set the returning function to true
105 --
106 l_fct_ret := true;
107 Else
108 --
109 -- Select the current row into g_old_rec
110 --
111 Open C_Sel1;
112 Fetch C_Sel1 Into pay_tdf_shd.g_old_rec;
113 If C_Sel1%notfound Then
114 Close C_Sel1;
115 --
116 -- The primary key is invalid therefore we must error
117 --
118 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
119 fnd_message.raise_error;
120 End If;
121 Close C_Sel1;
122 If (p_object_version_number
123 <> pay_tdf_shd.g_old_rec.object_version_number) Then
124 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
125 fnd_message.raise_error;
126 End If;
127 l_fct_ret := true;
128 End If;
129 End If;
130 Return (l_fct_ret);
131 --
132 End api_updating;
133 --
134 -- ----------------------------------------------------------------------------
135 -- |---------------------------------< lck >----------------------------------|
136 -- ----------------------------------------------------------------------------
137 Procedure lck
138 (p_time_definition_id in number
139 ,p_object_version_number in number
140 ) is
141 --
142 -- Cursor selects the 'current' row from the HR Schema
143 --
144 Cursor C_Sel1 is
145 select
146 time_definition_id
147 ,short_name
148 ,definition_name
149 ,period_type
150 ,period_unit
151 ,day_adjustment
152 ,dynamic_code
153 ,business_group_id
154 ,legislation_code
155 ,definition_type
156 ,number_of_years
157 ,start_date
158 ,period_time_definition_id
159 ,creator_id
160 ,creator_type
161 ,object_version_number
162 from pay_time_definitions
163 where time_definition_id = p_time_definition_id
164 for update nowait;
165 --
166 l_proc varchar2(72) := g_package||'lck';
167 --
168 Begin
169 hr_utility.set_location('Entering:'||l_proc, 5);
170 --
171 hr_api.mandatory_arg_error
172 (p_api_name => l_proc
173 ,p_argument => 'TIME_DEFINITION_ID'
174 ,p_argument_value => p_time_definition_id
175 );
176 hr_utility.set_location(l_proc,6);
177 hr_api.mandatory_arg_error
178 (p_api_name => l_proc
179 ,p_argument => 'OBJECT_VERSION_NUMBER'
180 ,p_argument_value => p_object_version_number
181 );
182 --
183 Open C_Sel1;
184 Fetch C_Sel1 Into pay_tdf_shd.g_old_rec;
185 If C_Sel1%notfound then
186 Close C_Sel1;
187 --
188 -- The primary key is invalid therefore we must error
189 --
190 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
191 fnd_message.raise_error;
192 End If;
193 Close C_Sel1;
194 If (p_object_version_number
195 <> pay_tdf_shd.g_old_rec.object_version_number) Then
196 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
197 fnd_message.raise_error;
198 End If;
199 --
200 hr_utility.set_location(' Leaving:'||l_proc, 10);
201 --
202 -- We need to trap the ORA LOCK exception
203 --
204 Exception
205 When HR_Api.Object_Locked then
206 --
207 -- The object is locked therefore we need to supply a meaningful
208 -- error message.
209 --
210 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
211 fnd_message.set_token('TABLE_NAME', 'pay_time_definitions');
212 fnd_message.raise_error;
213 End lck;
214 --
215 -- ----------------------------------------------------------------------------
216 -- |-----------------------------< convert_args >-----------------------------|
217 -- ----------------------------------------------------------------------------
218 Function convert_args
219 (p_time_definition_id in number
220 ,p_short_name in varchar2
221 ,p_definition_name in varchar2
222 ,p_period_type in varchar2
223 ,p_period_unit in varchar2
224 ,p_day_adjustment in varchar2
225 ,p_dynamic_code in varchar2
226 ,p_business_group_id in number
227 ,p_legislation_code in varchar2
228 ,p_definition_type in varchar2
229 ,p_number_of_years in number
230 ,p_start_date in date
231 ,p_period_time_definition_id in number
232 ,p_creator_id in number
233 ,p_creator_type in varchar2
234 ,p_object_version_number in number
235 )
236 Return g_rec_type is
237 --
238 l_rec g_rec_type;
239 --
240 Begin
241 --
242 -- Convert arguments into local l_rec structure.
243 --
244 l_rec.time_definition_id := p_time_definition_id;
245 l_rec.short_name := p_short_name;
246 l_rec.definition_name := p_definition_name;
247 l_rec.period_type := p_period_type;
248 l_rec.period_unit := p_period_unit;
249 l_rec.day_adjustment := p_day_adjustment;
250 l_rec.dynamic_code := p_dynamic_code;
251 l_rec.business_group_id := p_business_group_id;
252 l_rec.legislation_code := p_legislation_code;
253 l_rec.definition_type := p_definition_type;
254 l_rec.number_of_years := p_number_of_years;
255 l_rec.start_date := p_start_date;
256 l_rec.period_time_definition_id := p_period_time_definition_id;
257 l_rec.creator_id := p_creator_id;
258 l_rec.creator_type := p_creator_type;
259 l_rec.object_version_number := p_object_version_number;
260 --
261 -- Return the plsql record structure.
262 --
263 Return(l_rec);
264 --
265 End convert_args;
266 --
267 end pay_tdf_shd;