[Home] [Help]
PACKAGE BODY: APPS.PQH_RFE_SHD
Source
1 Package Body pqh_rfe_shd as
2 /* $Header: pqrferhi.pkb 120.0 2005/10/06 14:54 srajakum noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_rfe_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 = 'PQH_RATE_FACTOR_ON_ELMNTS_FK1') Then
22 hr_utility.set_message(8302, 'PQH_RBC_INVALID_CRT_RT_ELMNT');
23 hr_utility.raise_error;
24 /*fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
25 fnd_message.set_token('PROCEDURE', l_proc);
26 fnd_message.set_token('STEP','5');
27 fnd_message.raise_error;*/
28 ElsIf (p_constraint_name = 'PQH_RATE_FACTOR_ON_ELMNTS_FK2') Then
29 hr_utility.set_message(8302, 'PQH_RBC_INVALID_CRT_RT_FACTOR');
30 hr_utility.raise_error;
31 /*fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
32 fnd_message.set_token('PROCEDURE', l_proc);
33 fnd_message.set_token('STEP','10');
34 fnd_message.raise_error;*/
35 ElsIf (p_constraint_name = 'PQH_RATE_FACTOR_ON_ELMNTS_FK3') Then
36 hr_utility.set_message(8302, 'PQH_RBC_INVALID_BUSINESS_GRP');
37 hr_utility.raise_error;
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','15');
41 fnd_message.raise_error;*/
42 ElsIf (p_constraint_name = 'PQH_RATE_FACTOR_ON_ELMNTS_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','20');
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 --
55 End constraint_error;
56 --
57 -- ----------------------------------------------------------------------------
58 -- |-----------------------------< api_updating >-----------------------------|
59 -- ----------------------------------------------------------------------------
60 Function api_updating
61 (p_rate_factor_on_elmnt_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 rate_factor_on_elmnt_id
72 ,criteria_rate_element_id
73 ,criteria_rate_factor_id
74 ,rate_factor_val_record_tbl
75 ,rate_factor_val_record_col
76 ,business_group_id
77 ,legislation_code
78 ,object_version_number
79 from pqh_rate_factor_on_elmnts
80 where rate_factor_on_elmnt_id = p_rate_factor_on_elmnt_id;
81 --
82 l_fct_ret boolean;
83 --
84 Begin
85 --
86 If (p_rate_factor_on_elmnt_id is null and
87 p_object_version_number is null
88 ) Then
89 --
90 -- One of the primary key arguments is null therefore we must
91 -- set the returning function value to false
92 --
93 l_fct_ret := false;
94 Else
95 If (p_rate_factor_on_elmnt_id
96 = pqh_rfe_shd.g_old_rec.rate_factor_on_elmnt_id and
97 p_object_version_number
98 = pqh_rfe_shd.g_old_rec.object_version_number
99 ) Then
100 --
101 -- The g_old_rec is current therefore we must
102 -- set the returning function to true
103 --
104 l_fct_ret := true;
105 Else
106 --
107 -- Select the current row into g_old_rec
108 --
109 Open C_Sel1;
110 Fetch C_Sel1 Into pqh_rfe_shd.g_old_rec;
111 If C_Sel1%notfound Then
112 Close C_Sel1;
113 --
114 -- The primary key is invalid therefore we must error
115 --
116 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
117 fnd_message.raise_error;
118 End If;
119 Close C_Sel1;
120 If (p_object_version_number
121 <> pqh_rfe_shd.g_old_rec.object_version_number) Then
122 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
123 fnd_message.raise_error;
124 End If;
125 l_fct_ret := true;
126 End If;
127 End If;
128 Return (l_fct_ret);
129 --
130 End api_updating;
131 --
132 -- ----------------------------------------------------------------------------
133 -- |---------------------------------< lck >----------------------------------|
134 -- ----------------------------------------------------------------------------
135 Procedure lck
136 (p_rate_factor_on_elmnt_id in number
137 ,p_object_version_number in number
138 ) is
139 --
140 -- Cursor selects the 'current' row from the HR Schema
141 --
142 Cursor C_Sel1 is
143 select
144 rate_factor_on_elmnt_id
145 ,criteria_rate_element_id
146 ,criteria_rate_factor_id
147 ,rate_factor_val_record_tbl
148 ,rate_factor_val_record_col
149 ,business_group_id
150 ,legislation_code
151 ,object_version_number
152 from pqh_rate_factor_on_elmnts
153 where rate_factor_on_elmnt_id = p_rate_factor_on_elmnt_id
154 for update nowait;
155 --
156 l_proc varchar2(72) := g_package||'lck';
157 --
158 Begin
159 hr_utility.set_location('Entering:'||l_proc, 5);
160 --
161 hr_api.mandatory_arg_error
162 (p_api_name => l_proc
163 ,p_argument => 'RATE_FACTOR_ON_ELMNT_ID'
164 ,p_argument_value => p_rate_factor_on_elmnt_id
165 );
166 hr_utility.set_location(l_proc,6);
167 hr_api.mandatory_arg_error
168 (p_api_name => l_proc
169 ,p_argument => 'OBJECT_VERSION_NUMBER'
170 ,p_argument_value => p_object_version_number
171 );
172 --
173 Open C_Sel1;
174 Fetch C_Sel1 Into pqh_rfe_shd.g_old_rec;
175 If C_Sel1%notfound then
176 Close C_Sel1;
177 --
178 -- The primary key is invalid therefore we must error
179 --
180 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
181 fnd_message.raise_error;
182 End If;
183 Close C_Sel1;
184 If (p_object_version_number
185 <> pqh_rfe_shd.g_old_rec.object_version_number) Then
186 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
187 fnd_message.raise_error;
188 End If;
189 --
190 hr_utility.set_location(' Leaving:'||l_proc, 10);
191 --
192 -- We need to trap the ORA LOCK exception
193 --
194 Exception
195 When HR_Api.Object_Locked then
196 --
197 -- The object is locked therefore we need to supply a meaningful
198 -- error message.
199 --
200 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
201 fnd_message.set_token('TABLE_NAME', 'pqh_rate_factor_on_elmnts');
202 fnd_message.raise_error;
203 End lck;
204 --
205 -- ----------------------------------------------------------------------------
206 -- |-----------------------------< convert_args >-----------------------------|
207 -- ----------------------------------------------------------------------------
208 Function convert_args
209 (p_rate_factor_on_elmnt_id in number
210 ,p_criteria_rate_element_id in number
211 ,p_criteria_rate_factor_id in number
212 ,p_rate_factor_val_record_tbl in varchar2
213 ,p_rate_factor_val_record_col in varchar2
214 ,p_business_group_id in number
215 ,p_legislation_code in varchar2
216 ,p_object_version_number in number
217 )
218 Return g_rec_type is
219 --
220 l_rec g_rec_type;
221 --
222 Begin
223 --
224 -- Convert arguments into local l_rec structure.
225 --
226 l_rec.rate_factor_on_elmnt_id := p_rate_factor_on_elmnt_id;
227 l_rec.criteria_rate_element_id := p_criteria_rate_element_id;
228 l_rec.criteria_rate_factor_id := p_criteria_rate_factor_id;
229 l_rec.rate_factor_val_record_tbl := p_rate_factor_val_record_tbl;
230 l_rec.rate_factor_val_record_col := p_rate_factor_val_record_col;
231 l_rec.business_group_id := p_business_group_id;
232 l_rec.legislation_code := p_legislation_code;
233 l_rec.object_version_number := p_object_version_number;
234 --
235 -- Return the plsql record structure.
236 --
237 Return(l_rec);
238 --
239 End convert_args;
240 --
241 end pqh_rfe_shd;