[Home] [Help]
PACKAGE BODY: APPS.PAY_SPR_SHD
Source
1 Package Body pay_spr_shd as
2 /* $Header: pysprrhi.pkb 120.0 2005/05/29 08:54:06 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_spr_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_SECURITY_PAYROLLS_FK1') 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_SECURITY_PAYROLLS_FK2') 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 ElsIf (p_constraint_name = 'SECURITY_PAYROLL_ID_PK') Then
43 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
44 fnd_message.set_token('PROCEDURE', l_proc);
45 fnd_message.set_token('STEP','15');
46 fnd_message.raise_error;
47 Else
48 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
49 fnd_message.set_token('PROCEDURE', l_proc);
50 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
51 fnd_message.raise_error;
52 End If;
53 --
54 End constraint_error;
55 --
56 -- ----------------------------------------------------------------------------
57 -- |-----------------------------< api_updating >-----------------------------|
58 -- ----------------------------------------------------------------------------
59 Function api_updating
60 (p_security_profile_id in number
61 ,p_payroll_id in number
62 ,p_object_version_number in number
63 )
64 Return Boolean Is
65 --
66 --
67 -- Cursor selects the 'current' row from the HR Schema
68 --
69 Cursor C_Sel1 is
70 select
71 business_group_id
72 ,security_profile_id
73 ,payroll_id
74 ,request_id
75 ,program_application_id
76 ,program_id
77 ,program_update_date
78 ,object_version_number
79 from pay_security_payrolls
80 where security_profile_id = p_security_profile_id
81 and payroll_id = p_payroll_id;
82 --
83 l_fct_ret boolean;
84 --
85 Begin
86 --
87 If (p_security_profile_id is null and
88 p_payroll_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_security_profile_id
98 = pay_spr_shd.g_old_rec.security_profile_id and
99 p_payroll_id
100 = pay_spr_shd.g_old_rec.payroll_id and
101 p_object_version_number
102 = pay_spr_shd.g_old_rec.object_version_number
103 ) Then
104 --
105 -- The g_old_rec is current therefore we must
106 -- set the returning function to true
107 --
108 l_fct_ret := true;
109 Else
110 --
111 -- Select the current row into g_old_rec
112 --
113 Open C_Sel1;
114 Fetch C_Sel1 Into pay_spr_shd.g_old_rec;
115 If C_Sel1%notfound Then
116 Close C_Sel1;
117 --
118 -- The primary key is invalid therefore we must error
119 --
120 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
121 fnd_message.raise_error;
122 End If;
123 Close C_Sel1;
124 If (p_object_version_number
125 <> pay_spr_shd.g_old_rec.object_version_number) Then
126 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
127 fnd_message.raise_error;
128 End If;
129 l_fct_ret := true;
130 End If;
131 End If;
132 Return (l_fct_ret);
133 --
134 End api_updating;
135 --
136 -- ----------------------------------------------------------------------------
137 -- |---------------------------------< lck >----------------------------------|
138 -- ----------------------------------------------------------------------------
139 Procedure lck
140 (p_security_profile_id in number
141 ,p_payroll_id in number
142 ,p_object_version_number in number
143 ) is
144 --
145 -- Cursor selects the 'current' row from the HR Schema
146 --
147 Cursor C_Sel1 is
148 select
149 business_group_id
150 ,security_profile_id
151 ,payroll_id
152 ,request_id
153 ,program_application_id
154 ,program_id
155 ,program_update_date
156 ,object_version_number
157 from pay_security_payrolls
158 where security_profile_id = p_security_profile_id
159 and payroll_id = p_payroll_id
160 for update nowait;
161 --
162 l_proc varchar2(72) := g_package||'lck';
163 --
164 Begin
165 hr_utility.set_location('Entering:'||l_proc, 5);
166 --
167 hr_api.mandatory_arg_error
168 (p_api_name => l_proc
169 ,p_argument => 'SECURITY_PROFILE_ID'
170 ,p_argument_value => p_security_profile_id
171 );
172 hr_utility.set_location(l_proc,6);
173 hr_api.mandatory_arg_error
174 (p_api_name => l_proc
175 ,p_argument => 'PAYROLL_ID'
176 ,p_argument_value => p_payroll_id
177 );
178 hr_utility.set_location(l_proc,7);
179 hr_api.mandatory_arg_error
180 (p_api_name => l_proc
181 ,p_argument => 'OBJECT_VERSION_NUMBER'
182 ,p_argument_value => p_object_version_number
183 );
184 --
185 Open C_Sel1;
186 Fetch C_Sel1 Into pay_spr_shd.g_old_rec;
187 If C_Sel1%notfound then
188 Close C_Sel1;
189 --
190 -- The primary key is invalid therefore we must error
191 --
192 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
193 fnd_message.raise_error;
194 End If;
195 Close C_Sel1;
196 If (p_object_version_number
197 <> pay_spr_shd.g_old_rec.object_version_number) Then
198 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
199 fnd_message.raise_error;
200 End If;
201 --
202 hr_utility.set_location(' Leaving:'||l_proc, 10);
203 --
204 -- We need to trap the ORA LOCK exception
205 --
206 Exception
207 When HR_Api.Object_Locked then
208 --
209 -- The object is locked therefore we need to supply a meaningful
210 -- error message.
211 --
212 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
213 fnd_message.set_token('TABLE_NAME', 'pay_security_payrolls');
214 fnd_message.raise_error;
215 End lck;
216 --
217 -- ----------------------------------------------------------------------------
218 -- |-----------------------------< convert_args >-----------------------------|
219 -- ----------------------------------------------------------------------------
220 Function convert_args
221 (p_business_group_id in number
222 ,p_security_profile_id in number
223 ,p_payroll_id in number
224 ,p_object_version_number in number
225 )
226 Return g_rec_type is
227 --
228 l_rec g_rec_type;
229 --
230 Begin
231 --
232 -- Convert arguments into local l_rec structure.
233 --
234 l_rec.business_group_id := p_business_group_id;
235 l_rec.security_profile_id := p_security_profile_id;
236 l_rec.payroll_id := p_payroll_id;
237 l_rec.object_version_number := p_object_version_number;
238 --
239 -- Return the plsql record structure.
240 --
241 Return(l_rec);
242 --
243 End convert_args;
244 --
245 end pay_spr_shd;