[Home] [Help]
PACKAGE BODY: APPS.PQH_RMN_SHD
Source
1 Package Body pqh_rmn_shd as
2 /* $Header: pqrmnrhi.pkb 120.0 2005/05/29 02:33 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pqh_rmn_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_MATRIX_NODES_FK3') 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 = 'SYS_C00165988') 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 Else
32 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
33 fnd_message.set_token('PROCEDURE', l_proc);
34 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
35 fnd_message.raise_error;
36 End If;
37 --
38 End constraint_error;
39 --
40 -- ----------------------------------------------------------------------------
41 -- |-----------------------------< api_updating >-----------------------------|
42 -- ----------------------------------------------------------------------------
43 Function api_updating
44 (p_rate_matrix_node_id in number
45 ,p_object_version_number in number
46 )
47 Return Boolean Is
48 --
49 --
50 -- Cursor selects the 'current' row from the HR Schema
51 --
52 Cursor C_Sel1 is
53 select
54 rate_matrix_node_id
55 ,short_code
56 ,pl_id
57 ,level_number
58 ,criteria_short_code
59 ,node_name
60 ,parent_node_id
61 ,eligy_prfl_id
62 ,business_group_id
63 ,legislation_code
64 ,object_version_number
65 from pqh_rate_matrix_nodes
66 where rate_matrix_node_id = p_rate_matrix_node_id;
67 --
68 l_fct_ret boolean;
69 --
70 Begin
71 --
72 If (p_rate_matrix_node_id is null and
73 p_object_version_number is null
74 ) Then
75 --
76 -- One of the primary key arguments is null therefore we must
77 -- set the returning function value to false
78 --
79 l_fct_ret := false;
80 Else
81 If (p_rate_matrix_node_id
82 = pqh_rmn_shd.g_old_rec.rate_matrix_node_id and
83 p_object_version_number
84 = pqh_rmn_shd.g_old_rec.object_version_number
85 ) Then
86 --
87 -- The g_old_rec is current therefore we must
88 -- set the returning function to true
89 --
90 l_fct_ret := true;
91 Else
92 --
93 -- Select the current row into g_old_rec
94 --
95 Open C_Sel1;
96 Fetch C_Sel1 Into pqh_rmn_shd.g_old_rec;
97 If C_Sel1%notfound Then
98 Close C_Sel1;
99 --
100 -- The primary key is invalid therefore we must error
101 --
102 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
103 fnd_message.raise_error;
104 End If;
105 Close C_Sel1;
106 If (p_object_version_number
107 <> pqh_rmn_shd.g_old_rec.object_version_number) Then
108 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
109 fnd_message.raise_error;
110 End If;
111 l_fct_ret := true;
112 End If;
113 End If;
114 Return (l_fct_ret);
115 --
116 End api_updating;
117 --
118 -- ----------------------------------------------------------------------------
119 -- |---------------------------------< lck >----------------------------------|
120 -- ----------------------------------------------------------------------------
121 Procedure lck
122 (p_rate_matrix_node_id in number
123 ,p_object_version_number in number
124 ) is
125 --
126 -- Cursor selects the 'current' row from the HR Schema
127 --
128 Cursor C_Sel1 is
129 select
130 rate_matrix_node_id
131 ,short_code
132 ,pl_id
133 ,level_number
134 ,criteria_short_code
135 ,node_name
136 ,parent_node_id
137 ,eligy_prfl_id
138 ,business_group_id
139 ,legislation_code
140 ,object_version_number
141 from pqh_rate_matrix_nodes
142 where rate_matrix_node_id = p_rate_matrix_node_id
143 for update nowait;
144 --
145 l_proc varchar2(72) := g_package||'lck';
146 --
147 Begin
148 hr_utility.set_location('Entering:'||l_proc, 5);
149 --
150 hr_api.mandatory_arg_error
151 (p_api_name => l_proc
152 ,p_argument => 'RATE_MATRIX_NODE_ID'
153 ,p_argument_value => p_rate_matrix_node_id
154 );
155 hr_utility.set_location(l_proc,6);
156 hr_api.mandatory_arg_error
157 (p_api_name => l_proc
158 ,p_argument => 'OBJECT_VERSION_NUMBER'
159 ,p_argument_value => p_object_version_number
160 );
161 --
162 Open C_Sel1;
163 Fetch C_Sel1 Into pqh_rmn_shd.g_old_rec;
164 If C_Sel1%notfound then
165 Close C_Sel1;
166 --
167 -- The primary key is invalid therefore we must error
168 --
169 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
170 fnd_message.raise_error;
171 End If;
172 Close C_Sel1;
173 If (p_object_version_number
174 <> pqh_rmn_shd.g_old_rec.object_version_number) Then
175 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
176 fnd_message.raise_error;
177 End If;
178 --
179 hr_utility.set_location(' Leaving:'||l_proc, 10);
180 --
181 -- We need to trap the ORA LOCK exception
182 --
183 Exception
184 When HR_Api.Object_Locked then
185 --
186 -- The object is locked therefore we need to supply a meaningful
187 -- error message.
188 --
189 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
190 fnd_message.set_token('TABLE_NAME', 'pqh_rate_matrix_nodes');
191 fnd_message.raise_error;
192 End lck;
193 --
194 -- ----------------------------------------------------------------------------
195 -- |-----------------------------< convert_args >-----------------------------|
196 -- ----------------------------------------------------------------------------
197 Function convert_args
198 (p_rate_matrix_node_id in number
199 ,p_short_code in varchar2
200 ,p_pl_id in number
201 ,p_level_number in number
202 ,p_criteria_short_code in varchar2
203 ,p_node_name in varchar2
204 ,p_parent_node_id in number
205 ,p_eligy_prfl_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.rate_matrix_node_id := p_rate_matrix_node_id;
219 l_rec.short_code := p_short_code;
220 l_rec.pl_id := p_pl_id;
221 l_rec.level_number := p_level_number;
222 l_rec.criteria_short_code := p_criteria_short_code;
223 l_rec.node_name := p_node_name;
224 l_rec.parent_node_id := p_parent_node_id;
225 l_rec.eligy_prfl_id := p_eligy_prfl_id;
226 l_rec.business_group_id := p_business_group_id;
227 l_rec.legislation_code := p_legislation_code;
228 l_rec.object_version_number := p_object_version_number;
229 --
230 -- Return the plsql record structure.
231 --
232 Return(l_rec);
233 --
234 End convert_args;
235 --
236 end pqh_rmn_shd;