[Home] [Help]
PACKAGE BODY: APPS.PER_SOS_SHD
Source
1 Package Body per_sos_shd as
2 /* $Header: pesosrhi.pkb 115.2 2003/08/08 00:05:41 vkonda noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_sos_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_SELECTED_SOLUTIONS_FK1') 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 = 'PER_SOLUTIONS_SELECTED_FK2') 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 = 'PER_SOLUTIONS_SELECTED_PK') 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_solution_id in number
50 ,p_solution_set_name in varchar2
51 ,p_user_id in number
52 ,p_object_version_number in number
53 )
54 Return Boolean Is
55 --
56 --
57 -- Cursor selects the 'current' row from the HR Schema
58 --
59 Cursor C_Sel1 is
60 select
61 solution_id
62 ,solution_set_name
63 ,user_id
64 ,object_version_number
65 from per_solutions_selected
66 where solution_id = p_solution_id
67 and solution_set_name = p_solution_set_name
68 and user_id = p_user_id;
69 --
70 l_fct_ret boolean;
71 --
72 Begin
73 --
74 If (p_solution_id is null and
75 p_solution_set_name is null and
76 p_user_id is null and
77 p_object_version_number is null
78 ) Then
79 --
80 -- One of the primary key arguments is null therefore we must
81 -- set the returning function value to false
82 --
83 l_fct_ret := false;
84 Else
85 If (p_solution_id
86 = per_sos_shd.g_old_rec.solution_id and
87 p_solution_set_name
88 = per_sos_shd.g_old_rec.solution_set_name and
89 p_user_id
90 = per_sos_shd.g_old_rec.user_id and
91 p_object_version_number
92 = per_sos_shd.g_old_rec.object_version_number
93 ) Then
94 --
95 -- The g_old_rec is current therefore we must
96 -- set the returning function to true
97 --
98 l_fct_ret := true;
99 Else
100 --
101 -- Select the current row into g_old_rec
102 --
103 Open C_Sel1;
104 Fetch C_Sel1 Into per_sos_shd.g_old_rec;
105 If C_Sel1%notfound Then
106 Close C_Sel1;
107 --
108 -- The primary key is invalid therefore we must error
109 --
110 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
111 fnd_message.raise_error;
112 End If;
113 Close C_Sel1;
114 If (p_object_version_number
115 <> per_sos_shd.g_old_rec.object_version_number) Then
116 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
117 fnd_message.raise_error;
118 End If;
119 l_fct_ret := true;
120 End If;
121 End If;
122 Return (l_fct_ret);
123 --
124 End api_updating;
125 --
126 -- ----------------------------------------------------------------------------
127 -- |---------------------------------< lck >----------------------------------|
128 -- ----------------------------------------------------------------------------
129 Procedure lck
130 (p_solution_id in number
131 ,p_solution_set_name in varchar2
132 ,p_user_id in number
133 ,p_object_version_number in number
134 ) is
135 --
136 -- Cursor selects the 'current' row from the HR Schema
137 --
138 Cursor C_Sel1 is
139 select
140 solution_id
141 ,solution_set_name
142 ,user_id
143 ,object_version_number
144 from per_solutions_selected
145 where solution_id = p_solution_id
146 and solution_set_name = p_solution_set_name
147 and user_id = p_user_id
148 for update nowait;
149 --
150 l_proc varchar2(72) := g_package||'lck';
151 --
152 Begin
153 hr_utility.set_location('Entering:'||l_proc, 5);
154 --
155 hr_api.mandatory_arg_error
156 (p_api_name => l_proc
157 ,p_argument => 'SOLUTION_ID'
158 ,p_argument_value => p_solution_id
159 );
160 hr_utility.set_location(l_proc,6);
161 hr_api.mandatory_arg_error
162 (p_api_name => l_proc
163 ,p_argument => 'SOLUTION_SET_NAME'
164 ,p_argument_value => p_solution_set_name
165 );
166 hr_utility.set_location(l_proc,7);
167 hr_api.mandatory_arg_error
168 (p_api_name => l_proc
169 ,p_argument => 'USER_ID'
170 ,p_argument_value => p_user_id
171 );
172 hr_utility.set_location(l_proc,8);
173 hr_api.mandatory_arg_error
174 (p_api_name => l_proc
175 ,p_argument => 'OBJECT_VERSION_NUMBER'
176 ,p_argument_value => p_object_version_number
177 );
178 --
179 Open C_Sel1;
180 Fetch C_Sel1 Into per_sos_shd.g_old_rec;
181 If C_Sel1%notfound then
182 Close C_Sel1;
183 --
184 -- The primary key is invalid therefore we must error
185 --
186 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
187 fnd_message.raise_error;
188 End If;
189 Close C_Sel1;
190 If (p_object_version_number
191 <> per_sos_shd.g_old_rec.object_version_number) Then
192 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
193 fnd_message.raise_error;
194 End If;
195 --
196 hr_utility.set_location(' Leaving:'||l_proc, 10);
197 --
198 -- We need to trap the ORA LOCK exception
199 --
200 Exception
201 When HR_Api.Object_Locked then
202 --
203 -- The object is locked therefore we need to supply a meaningful
204 -- error message.
205 --
206 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
207 fnd_message.set_token('TABLE_NAME', 'per_solutions_selected');
208 fnd_message.raise_error;
209 End lck;
210 --
211 -- ----------------------------------------------------------------------------
212 -- |-----------------------------< convert_args >-----------------------------|
213 -- ----------------------------------------------------------------------------
214 Function convert_args
215 (p_solution_id in number
216 ,p_solution_set_name in varchar2
217 ,p_user_id in number
218 ,p_object_version_number in number
219 )
220 Return g_rec_type is
221 --
222 l_rec g_rec_type;
223 --
224 Begin
225 --
226 -- Convert arguments into local l_rec structure.
227 --
228 l_rec.solution_id := p_solution_id;
229 l_rec.solution_set_name := p_solution_set_name;
230 l_rec.user_id := p_user_id;
231 l_rec.object_version_number := p_object_version_number;
232 --
233 -- Return the plsql record structure.
234 --
235 Return(l_rec);
236 --
237 End convert_args;
238 --
239 end per_sos_shd;