[Home] [Help]
PACKAGE BODY: APPS.PQH_CRF_SHD
Source
1 Package Body pqh_crf_shd as
2 /* $Header: pqcrfrhi.pkb 120.0 2005/10/06 14:52 srajakum noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_crf_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_CRITERIA_RATE_FACTORS_FK3') Then
22 hr_utility.set_message(8302, 'PQH_RBC_INVALID_BUSINESS_GRP');
23 hr_utility.raise_error;
24 ElsIf (p_constraint_name = 'PQH_CRITERIA_RATE_FACTORS_PK') Then
25 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
26 fnd_message.set_token('PROCEDURE', l_proc);
27 fnd_message.set_token('STEP','10');
28 fnd_message.raise_error;
29 ElsIf (p_constraint_name = 'PQH_CRITERIA_RATE_FACTORS_FK1') Then
30 hr_utility.set_message(8302, 'PQH_RBC_CRT_RT_DF_ID_NOT_EXIST');
31 hr_utility.raise_error;
32 ElsIf (p_constraint_name = 'PQH_CRITERIA_RATE_FACTORS_FK4') Then
33 hr_utility.set_message(8302, 'PQH_RBC_BEN_PL_ID_NOT_EXIST');
34 hr_utility.raise_error;
35 ElsIf (p_constraint_name = 'PQH_CRITERIA_RATE_FACTORS_FK3') Then
36 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
37 fnd_message.set_token('PROCEDURE', l_proc);
38 fnd_message.set_token('STEP','5');
39 fnd_message.raise_error;
40
41
42
43 Else
44 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
45 fnd_message.set_token('PROCEDURE', l_proc);
46 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
47 fnd_message.raise_error;
48 End If;
49 --
50 End constraint_error;
51 --
52 -- ----------------------------------------------------------------------------
53 -- |-----------------------------< api_updating >-----------------------------|
54 -- ----------------------------------------------------------------------------
55 Function api_updating
56 (p_criteria_rate_factor_id in number
57 ,p_object_version_number in number
58 )
59 Return Boolean Is
60 --
61 --
62 -- Cursor selects the 'current' row from the HR Schema
63 --
64 Cursor C_Sel1 is
65 select
66 criteria_rate_factor_id
67 ,criteria_rate_defn_id
68 ,parent_rate_matrix_id
69 ,parent_criteria_rate_defn_id
70 ,business_group_id
71 ,legislation_code
72 ,object_version_number
73 from pqh_criteria_rate_factors
74 where criteria_rate_factor_id = p_criteria_rate_factor_id;
75 --
76 l_fct_ret boolean;
77 --
78 Begin
79 --
80 If (p_criteria_rate_factor_id is null and
81 p_object_version_number is null
82 ) Then
83 --
84 -- One of the primary key arguments is null therefore we must
85 -- set the returning function value to false
86 --
87 l_fct_ret := false;
88 Else
89 If (p_criteria_rate_factor_id
90 = pqh_crf_shd.g_old_rec.criteria_rate_factor_id and
91 p_object_version_number
92 = pqh_crf_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 pqh_crf_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 <> pqh_crf_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_criteria_rate_factor_id in number
131 ,p_object_version_number in number
132 ) is
133 --
134 -- Cursor selects the 'current' row from the HR Schema
135 --
136 Cursor C_Sel1 is
137 select
138 criteria_rate_factor_id
139 ,criteria_rate_defn_id
140 ,parent_rate_matrix_id
141 ,parent_criteria_rate_defn_id
142 ,business_group_id
143 ,legislation_code
144 ,object_version_number
145 from pqh_criteria_rate_factors
146 where criteria_rate_factor_id = p_criteria_rate_factor_id
147 for update nowait;
148 --
149 l_proc varchar2(72) := g_package||'lck';
150 --
151 Begin
152 hr_utility.set_location('Entering:'||l_proc, 5);
153 --
154 hr_api.mandatory_arg_error
155 (p_api_name => l_proc
156 ,p_argument => 'CRITERIA_RATE_FACTOR_ID'
157 ,p_argument_value => p_criteria_rate_factor_id
158 );
159 hr_utility.set_location(l_proc,6);
160 hr_api.mandatory_arg_error
161 (p_api_name => l_proc
162 ,p_argument => 'OBJECT_VERSION_NUMBER'
163 ,p_argument_value => p_object_version_number
164 );
165 --
166 Open C_Sel1;
167 Fetch C_Sel1 Into pqh_crf_shd.g_old_rec;
168 If C_Sel1%notfound then
169 Close C_Sel1;
170 --
171 -- The primary key is invalid therefore we must error
172 --
173 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
174 fnd_message.raise_error;
175 End If;
176 Close C_Sel1;
177 If (p_object_version_number
178 <> pqh_crf_shd.g_old_rec.object_version_number) Then
179 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
180 fnd_message.raise_error;
181 End If;
182 --
183 hr_utility.set_location(' Leaving:'||l_proc, 10);
184 --
185 -- We need to trap the ORA LOCK exception
186 --
187 Exception
188 When HR_Api.Object_Locked then
189 --
190 -- The object is locked therefore we need to supply a meaningful
191 -- error message.
192 --
193 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
194 fnd_message.set_token('TABLE_NAME', 'pqh_criteria_rate_factors');
195 fnd_message.raise_error;
196 End lck;
197 --
198 -- ----------------------------------------------------------------------------
199 -- |-----------------------------< convert_args >-----------------------------|
200 -- ----------------------------------------------------------------------------
201 Function convert_args
202 (p_criteria_rate_factor_id in number
203 ,p_criteria_rate_defn_id in number
204 ,p_parent_rate_matrix_id in number
205 ,p_parent_criteria_rate_defn_id in number
206 ,p_business_group_id in number
207 ,p_legislation_code in varchar2
208 ,p_object_version_number in number
209 )
210 Return g_rec_type is
211 --
212 l_rec g_rec_type;
213 --
214 Begin
215 --
216 -- Convert arguments into local l_rec structure.
217 --
218 l_rec.criteria_rate_factor_id := p_criteria_rate_factor_id;
219 l_rec.criteria_rate_defn_id := p_criteria_rate_defn_id;
220 l_rec.parent_rate_matrix_id := p_parent_rate_matrix_id;
221 l_rec.parent_criteria_rate_defn_id := p_parent_criteria_rate_defn_id;
222 l_rec.business_group_id := p_business_group_id;
223 l_rec.legislation_code := p_legislation_code;
224 l_rec.object_version_number := p_object_version_number;
225 --
226 -- Return the plsql record structure.
227 --
228 Return(l_rec);
229 --
230 End convert_args;
231 --
232 end pqh_crf_shd;