[Home] [Help]
PACKAGE BODY: APPS.PAY_CNU_SHD
Source
1 Package Body pay_cnu_shd as
2 /* $Header: pycnurhi.pkb 120.0 2005/05/29 04:04:56 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_cnu_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 = 'PAY_FR_CONTRIBUTION_USAGES_FK1') Then
22 fnd_message.set_name('PAY', 'PAY_74895_CNU_BAD_BG');
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 = 'PAY_FR_CONTRIBUTION_USAGES_UK1') Then
27 fnd_message.set_name('PAY', 'PAY_74896_CNU_UNIQUE_VALUES');
28 fnd_message.set_token('PROCEDURE', l_proc);
29 fnd_message.set_token('STEP','10');
30 fnd_message.raise_error;
31 ElsIf (p_constraint_name = 'PAY_FR_CONTRIBUTION_USAG_PK') Then
32 fnd_message.set_name('PER', 'HR_6153_ALL_PROCEDURE_FAIL');
33 fnd_message.set_token('PROCEDURE', l_proc);
34 fnd_message.set_token('STEP','15');
35 fnd_message.raise_error;
36 Else
37 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
38 fnd_message.set_token('PROCEDURE', l_proc);
39 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
40 fnd_message.raise_error;
41 End If;
42 --
43 End constraint_error;
44 --
45 -- ----------------------------------------------------------------------------
46 -- |-----------------------------< api_updating >-----------------------------|
47 -- ----------------------------------------------------------------------------
48 Function api_updating
49 (p_contribution_usage_id in number
50 ,p_object_version_number in number
51 )
52 Return Boolean Is
53 --
54 --
55 -- Cursor selects the 'current' row from the HR Schema
56 --
57 Cursor C_Sel1 is
58 select
59 contribution_usage_id
60 ,date_from
61 ,date_to
62 ,group_code
63 ,process_type
64 ,element_name
65 ,rate_type
66 ,contribution_code
67 ,retro_contribution_code
68 ,contribution_type
69 ,contribution_usage_type
70 ,rate_category
71 ,business_group_id
72 ,object_version_number
73 ,code_Rate_id
74 from pay_fr_contribution_usages
75 where contribution_usage_id = p_contribution_usage_id;
76 --
77 l_fct_ret boolean;
78 --
79 Begin
80 --
81 If (p_contribution_usage_id is null and
82 p_object_version_number is null
83 ) Then
84 --
85 -- One of the primary key arguments is null therefore we must
86 -- set the returning function value to false
87 --
88 l_fct_ret := false;
89 Else
90 If (p_contribution_usage_id
91 = pay_cnu_shd.g_old_rec.contribution_usage_id and
92 p_object_version_number
93 = pay_cnu_shd.g_old_rec.object_version_number
94 ) Then
95 --
96 -- The g_old_rec is current therefore we must
97 -- set the returning function to true
98 --
99 l_fct_ret := true;
100 Else
101 --
102 -- Select the current row into g_old_rec
103 --
104 Open C_Sel1;
105 Fetch C_Sel1 Into pay_cnu_shd.g_old_rec;
106 If C_Sel1%notfound Then
107 Close C_Sel1;
108 --
109 -- The primary key is invalid therefore we must error
110 --
111 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
112 fnd_message.raise_error;
113 End If;
114 Close C_Sel1;
115 If (p_object_version_number
116 <> pay_cnu_shd.g_old_rec.object_version_number) Then
117 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
118 fnd_message.raise_error;
119 End If;
120 l_fct_ret := true;
121 End If;
122 End If;
123 Return (l_fct_ret);
124 --
125 End api_updating;
126 --
127 -- ----------------------------------------------------------------------------
128 -- |---------------------------------< lck >----------------------------------|
129 -- ----------------------------------------------------------------------------
130 Procedure lck
131 (p_contribution_usage_id in number
132 ,p_object_version_number in number
133 ) is
134 --
135 -- Cursor selects the 'current' row from the HR Schema
136 --
137 Cursor C_Sel1 is
138 select
139 contribution_usage_id
140 ,date_from
141 ,date_to
142 ,group_code
143 ,process_type
144 ,element_name
145 ,rate_type
146 ,contribution_code
147 ,retro_contribution_code
148 ,contribution_type
149 ,contribution_usage_type
150 ,rate_category
151 ,business_group_id
152 ,object_version_number
153 ,code_rate_id
154 from pay_fr_contribution_usages
155 where contribution_usage_id = p_contribution_usage_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 hr_api.mandatory_arg_error
164 (p_api_name => l_proc
165 ,p_argument => 'CONTRIBUTION_USAGE_ID'
166 ,p_argument_value => p_contribution_usage_id
167 );
168 --
169 Open C_Sel1;
170 Fetch C_Sel1 Into pay_cnu_shd.g_old_rec;
171 If C_Sel1%notfound then
172 Close C_Sel1;
173 --
174 -- The primary key is invalid therefore we must error
175 --
176 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
177 fnd_message.raise_error;
178 End If;
179 Close C_Sel1;
180 If (p_object_version_number
181 <> pay_cnu_shd.g_old_rec.object_version_number) Then
182 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
183 fnd_message.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 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
197 fnd_message.set_token('TABLE_NAME', 'pay_fr_contribution_usages');
198 fnd_message.raise_error;
199 End lck;
200 --
201 -- ----------------------------------------------------------------------------
202 -- |-----------------------------< convert_args >-----------------------------|
203 -- ----------------------------------------------------------------------------
204 Function convert_args
205 (p_contribution_usage_id in number
206 ,p_date_from in date
207 ,p_date_to in date
208 ,p_group_code in varchar2
209 ,p_process_type in varchar2
210 ,p_element_name in varchar2
211 ,p_rate_type in varchar2
212 ,p_contribution_code in varchar2
213 ,p_retro_contribution_code in varchar2
214 ,p_contribution_type in varchar2
215 ,p_contribution_usage_type in varchar2
216 ,p_rate_category in varchar2
217 ,p_business_group_id in number
218 ,p_object_version_number in number
219 ,p_code_rate_id in number
220 )
221 Return g_rec_type is
222 --
223 l_rec g_rec_type;
224 --
225 Begin
226 --
227 -- Convert arguments into local l_rec structure.
228 --
229 l_rec.contribution_usage_id := p_contribution_usage_id;
230 l_rec.date_from := p_date_from;
231 l_rec.date_to := p_date_to;
232 l_rec.group_code := p_group_code;
233 l_rec.process_type := p_process_type;
234 l_rec.element_name := p_element_name;
235 l_rec.rate_type := p_rate_type;
236 l_rec.contribution_code := p_contribution_code;
237 l_rec.retro_contribution_code := p_retro_contribution_code;
238 l_rec.contribution_type := p_contribution_type;
239 l_rec.contribution_usage_type := p_contribution_usage_type;
240 l_rec.rate_category := p_rate_category;
241 l_rec.business_group_id := p_business_group_id;
242 l_rec.object_version_number := p_object_version_number;
243 l_rec.code_rate_id := p_code_Rate_id;
244 --
245 -- Return the plsql record structure.
246 --
247 Return(l_rec);
248 --
249 End convert_args;
250 --
251 end pay_cnu_shd;