[Home] [Help]
PACKAGE BODY: APPS.PQH_BCE_SHD
Source
1 Package Body pqh_bce_shd as
2 /* $Header: pqbcerhi.pkb 115.7 2004/04/28 17:17:08 rthiagar ship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_bce_shd.'; -- Global package name
9 --
10 --
11 -- ----------------------------------------------------------------------------
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ----------------------------------------------------------------------------
14 Procedure constraint_error
15 (p_constraint_name in all_constraints.constraint_name%TYPE) Is
16 --
17 l_proc varchar2(72) := g_package||'constraint_error';
18 --
19 Begin
20 hr_utility.set_location('Entering:'||l_proc, 5);
21 --
22 If (p_constraint_name = 'PQH_BDGT_CMMTMNT_ELMNTS_FK1') Then
23 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
24 hr_utility.set_message_token('PROCEDURE', l_proc);
25 hr_utility.set_message_token('STEP','5');
26 hr_utility.raise_error;
27 ElsIf (p_constraint_name = 'PQH_BDGT_CMMTMNT_ELMNTS_FK2') Then
28 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
29 hr_utility.set_message_token('PROCEDURE', l_proc);
30 hr_utility.set_message_token('STEP','10');
31 hr_utility.raise_error;
32 ElsIf (p_constraint_name = 'PQH_BDGT_CMMTMNT_ELMNTS_PK') Then
33 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
34 hr_utility.set_message_token('PROCEDURE', l_proc);
35 hr_utility.set_message_token('STEP','15');
36 hr_utility.raise_error;
37 Else
38 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
39 hr_utility.set_message_token('PROCEDURE', l_proc);
40 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
41 hr_utility.raise_error;
42 End If;
43 --
44 hr_utility.set_location(' Leaving:'||l_proc, 10);
45 End constraint_error;
46 --
47 -- ----------------------------------------------------------------------------
48 -- |-----------------------------< api_updating >-----------------------------|
49 -- ----------------------------------------------------------------------------
50 Function api_updating
51 (
52 p_bdgt_cmmtmnt_elmnt_id in number,
53 p_object_version_number in number
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 bdgt_cmmtmnt_elmnt_id,
62 budget_id,
63 actual_commitment_type,
64 element_type_id,
65 salary_basis_flag,
66 element_input_value_id,
67 balance_type_id,
68 frequency_input_value_id,
69 formula_id,
70 dflt_elmnt_frequency,
71 overhead_percentage,
72 object_version_number
73 from pqh_bdgt_cmmtmnt_elmnts
74 where bdgt_cmmtmnt_elmnt_id = p_bdgt_cmmtmnt_elmnt_id;
75 --
76 l_proc varchar2(72) := g_package||'api_updating';
77 l_fct_ret boolean;
78 --
79 Begin
80 hr_utility.set_location('Entering:'||l_proc, 5);
81 --
82 If (
83 p_bdgt_cmmtmnt_elmnt_id is null and
84 p_object_version_number is null
85 ) Then
86 --
87 -- One of the primary key arguments is null therefore we must
88 -- set the returning function value to false
89 --
90 l_fct_ret := false;
91 Else
92 If (
93 p_bdgt_cmmtmnt_elmnt_id = g_old_rec.bdgt_cmmtmnt_elmnt_id and
94 p_object_version_number = g_old_rec.object_version_number
95 ) Then
96 hr_utility.set_location(l_proc, 10);
97 --
98 -- The g_old_rec is current therefore we must
99 -- set the returning function to true
100 --
101 l_fct_ret := true;
102 Else
103 --
104 -- Select the current row into g_old_rec
105 --
106 Open C_Sel1;
107 Fetch C_Sel1 Into g_old_rec;
108 If C_Sel1%notfound Then
109 Close C_Sel1;
110 --
111 -- The primary key is invalid therefore we must error
112 --
113 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
114 hr_utility.raise_error;
115 End If;
116 Close C_Sel1;
117 If (p_object_version_number <> g_old_rec.object_version_number) Then
118 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
119 hr_utility.raise_error;
120 End If;
121 hr_utility.set_location(l_proc, 15);
122 l_fct_ret := true;
123 End If;
124 End If;
125 hr_utility.set_location(' Leaving:'||l_proc, 20);
126 Return (l_fct_ret);
127 --
128 End api_updating;
129 --
130 -- ----------------------------------------------------------------------------
131 -- |---------------------------------< lck >----------------------------------|
132 -- ----------------------------------------------------------------------------
133 Procedure lck
134 (
135 p_bdgt_cmmtmnt_elmnt_id in number,
136 p_object_version_number in number
137 ) is
138 --
139 -- Cursor selects the 'current' row from the HR Schema
140 --
141 Cursor C_Sel1 is
142 select bdgt_cmmtmnt_elmnt_id,
143 budget_id,
144 actual_commitment_type,
145 element_type_id,
146 salary_basis_flag,
147 element_input_value_id,
148 balance_type_id,
149 frequency_input_value_id,
150 formula_id,
151 dflt_elmnt_frequency,
152 overhead_percentage,
153 object_version_number
154 from pqh_bdgt_cmmtmnt_elmnts
155 where bdgt_cmmtmnt_elmnt_id = p_bdgt_cmmtmnt_elmnt_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 -- Add any mandatory argument checking here:
164 -- Example:
165 -- hr_api.mandatory_arg_error
166 -- (p_api_name => l_proc,
167 -- p_argument => 'object_version_number',
168 -- p_argument_value => p_object_version_number);
169 --
170 Open C_Sel1;
171 Fetch C_Sel1 Into g_old_rec;
172 If C_Sel1%notfound then
173 Close C_Sel1;
174 --
175 -- The primary key is invalid therefore we must error
176 --
177 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
178 hr_utility.raise_error;
179 End If;
180 Close C_Sel1;
181 If (p_object_version_number <> g_old_rec.object_version_number) Then
182 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
183 hr_utility.raise_error;
184 End If;
185 --
186 hr_utility.set_location(' Leaving:'||l_proc, 10);
187 --
188 -- We need to trap the ORA LOCK exception
189 --
190 Exception
191 When HR_Api.Object_Locked then
192 --
193 -- The object is locked therefore we need to supply a meaningful
194 -- error message.
195 --
196 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
197 hr_utility.set_message_token('TABLE_NAME', 'pqh_bdgt_cmmtmnt_elmnts');
198 hr_utility.raise_error;
199 End lck;
200 --
201 -- ----------------------------------------------------------------------------
202 -- |-----------------------------< convert_args >-----------------------------|
203 -- ----------------------------------------------------------------------------
204 Function convert_args
205 (
206 p_bdgt_cmmtmnt_elmnt_id in number,
207 p_budget_id in number,
208 p_actual_commitment_type in varchar2,
209 p_element_type_id in number,
210 p_salary_basis_flag in varchar2,
211 p_element_input_value_id in number,
212 p_balance_type_id in number,
213 p_frequency_input_value_id in number,
214 p_formula_id in number,
215 p_dflt_elmnt_frequency in varchar2,
216 p_overhead_percentage in number,
217 p_object_version_number in number
218 )
219 Return g_rec_type is
220 --
221 l_rec g_rec_type;
222 l_proc varchar2(72) := g_package||'convert_args';
223 --
224 Begin
225 --
226 hr_utility.set_location('Entering:'||l_proc, 5);
227 --
228 -- Convert arguments into local l_rec structure.
229 --
230 l_rec.bdgt_cmmtmnt_elmnt_id := p_bdgt_cmmtmnt_elmnt_id;
231 l_rec.budget_id := p_budget_id;
232 l_rec.actual_commitment_type := p_actual_commitment_type;
233 l_rec.element_type_id := p_element_type_id;
234 l_rec.salary_basis_flag := p_salary_basis_flag;
235 l_rec.element_input_value_id := p_element_input_value_id;
236 l_rec.balance_type_id := p_balance_type_id;
237 l_rec.frequency_input_value_id := p_frequency_input_value_id;
238 l_rec.formula_id := p_formula_id;
239 l_rec.dflt_elmnt_frequency := p_dflt_elmnt_frequency;
240 l_rec.overhead_percentage := p_overhead_percentage;
241 l_rec.object_version_number := p_object_version_number;
242 --
243 -- Return the plsql record structure.
244 --
245 hr_utility.set_location(' Leaving:'||l_proc, 10);
246 Return(l_rec);
247 --
248 End convert_args;
249 --
250 end pqh_bce_shd;