[Home] [Help]
PACKAGE BODY: APPS.PER_OSV_SHD
Source
1 Package Body per_osv_shd as
2 /* $Header: peosvrhi.pkb 120.0 2005/05/31 12:37:30 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' per_osv_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 = 'PER_ORG_STRUCTURE_VERSIONS_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 = 'PER_ORG_STRUCTURE_VERSIONS_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 = 'PER_ORG_STRUCTURE_VERSIONS_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_org_structure_version_id in number
61 ,p_object_version_number in number
62 )
63 Return Boolean Is
64 --
65 --
66 -- Cursor selects the 'current' row from the HR Schema
67 --
68 Cursor C_Sel1 is
69 select
70 org_structure_version_id
71 ,business_group_id
72 ,organization_structure_id
73 ,date_from
74 ,version_number
75 ,copy_structure_version_id
76 ,date_to
77 ,request_id
78 ,program_application_id
79 ,program_id
80 ,program_update_date
81 ,object_version_number
82 ,topnode_pos_ctrl_enabled_flag
83 from per_org_structure_versions
84 where org_structure_version_id = p_org_structure_version_id;
85 --
86 l_fct_ret boolean;
87 --
88 Begin
89 --
90 If (p_org_structure_version_id is null and
91 p_object_version_number is null
92 ) Then
93 --
94 -- One of the primary key arguments is null therefore we must
95 -- set the returning function value to false
96 --
97 l_fct_ret := false;
98 Else
99 If (p_org_structure_version_id
100 = per_osv_shd.g_old_rec.org_structure_version_id and
101 p_object_version_number
102 = per_osv_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 per_osv_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 <> per_osv_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_org_structure_version_id in number
141 ,p_object_version_number in number
142 ) is
143 --
144 -- Cursor selects the 'current' row from the HR Schema
145 --
146 Cursor C_Sel1 is
147 select
148 org_structure_version_id
149 ,business_group_id
150 ,organization_structure_id
151 ,date_from
152 ,version_number
153 ,copy_structure_version_id
154 ,date_to
155 ,request_id
156 ,program_application_id
157 ,program_id
158 ,program_update_date
159 ,object_version_number
160 ,topnode_pos_ctrl_enabled_flag
161 from per_org_structure_versions
162 where org_structure_version_id = p_org_structure_version_id
163 for update nowait;
164 --
165 l_proc varchar2(72) := g_package||'lck';
166 --
167 Begin
168 hr_utility.set_location('Entering:'||l_proc, 5);
169 --
170 hr_api.mandatory_arg_error
171 (p_api_name => l_proc
172 ,p_argument => 'ORG_STRUCTURE_VERSION_ID'
173 ,p_argument_value => p_org_structure_version_id
174 );
175 hr_utility.set_location(l_proc,6);
176 hr_api.mandatory_arg_error
177 (p_api_name => l_proc
178 ,p_argument => 'OBJECT_VERSION_NUMBER'
179 ,p_argument_value => p_object_version_number
180 );
181 --
182 Open C_Sel1;
183 Fetch C_Sel1 Into per_osv_shd.g_old_rec;
184 If C_Sel1%notfound then
185 Close C_Sel1;
186 --
187 -- The primary key is invalid therefore we must error
188 --
189 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
190 fnd_message.raise_error;
191 End If;
192 Close C_Sel1;
193 If (p_object_version_number
194 <> per_osv_shd.g_old_rec.object_version_number) Then
195 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
196 fnd_message.raise_error;
197 End If;
198 --
199 hr_utility.set_location(' Leaving:'||l_proc, 10);
200 --
201 -- We need to trap the ORA LOCK exception
202 --
203 Exception
204 When HR_Api.Object_Locked then
205 --
206 -- The object is locked therefore we need to supply a meaningful
207 -- error message.
208 --
209 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
210 fnd_message.set_token('TABLE_NAME', 'per_org_structure_versions');
211 fnd_message.raise_error;
212 End lck;
213 --
214 -- ----------------------------------------------------------------------------
215 -- |-----------------------------< convert_args >-----------------------------|
216 -- ----------------------------------------------------------------------------
217 Function convert_args
218 (p_org_structure_version_id in number
219 ,p_business_group_id in number
220 ,p_organization_structure_id in number
221 ,p_date_from in date
222 ,p_version_number in number
223 ,p_copy_structure_version_id in number
224 ,p_date_to in date
225 ,p_request_id in number
226 ,p_program_application_id in number
227 ,p_program_id in number
228 ,p_program_update_date in date
229 ,p_object_version_number in number
230 ,p_topnode_pos_ctrl_enabled_fla in varchar2
231 )
232 Return g_rec_type is
233 --
234 l_rec g_rec_type;
235 --
236 Begin
237 --
238 -- Convert arguments into local l_rec structure.
239 --
240 l_rec.org_structure_version_id := p_org_structure_version_id;
241 l_rec.business_group_id := p_business_group_id;
242 l_rec.organization_structure_id := p_organization_structure_id;
243 l_rec.date_from := p_date_from;
244 l_rec.version_number := p_version_number;
245 l_rec.copy_structure_version_id := p_copy_structure_version_id;
246 l_rec.date_to := p_date_to;
247 l_rec.request_id := p_request_id;
248 l_rec.program_application_id := p_program_application_id;
249 l_rec.program_id := p_program_id;
250 l_rec.program_update_date := p_program_update_date;
251 l_rec.object_version_number := p_object_version_number;
252 l_rec.topnode_pos_ctrl_enabled_flag := p_topnode_pos_ctrl_enabled_fla;
253 --
254 -- Return the plsql record structure.
255 --
256 Return(l_rec);
257 --
258 End convert_args;
259 --
260 end per_osv_shd;