[Home] [Help]
PACKAGE BODY: APPS.PAY_RCU_SHD
Source
1 Package Body pay_rcu_shd as
2 /* $Header: pyrcurhi.pkb 120.1 2005/06/20 05:01:52 tvankayl noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' pay_rcu_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_RETRO_COMPONENT_USAGES_PK') 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 = 'PAY_RETRO_COMPONENT_USAGES_UK1') 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_retro_component_usage_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 retro_component_usage_id
55 ,business_group_id
56 ,legislation_code
57 ,retro_component_id
58 ,creator_id
59 ,creator_type
60 ,default_component
61 ,reprocess_type
62 ,object_version_number
63 ,replace_run_flag
64 ,use_override_dates
65 from pay_retro_component_usages
66 where retro_component_usage_id = p_retro_component_usage_id;
67 --
68 l_fct_ret boolean;
69 --
70 Begin
71 --
72 If (p_retro_component_usage_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_retro_component_usage_id
82 = pay_rcu_shd.g_old_rec.retro_component_usage_id and
83 p_object_version_number
84 = pay_rcu_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 pay_rcu_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 <> pay_rcu_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_retro_component_usage_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 retro_component_usage_id
131 ,business_group_id
132 ,legislation_code
133 ,retro_component_id
134 ,creator_id
135 ,creator_type
136 ,default_component
137 ,reprocess_type
138 ,object_version_number
139 ,replace_run_flag
140 ,use_override_dates
141 from pay_retro_component_usages
142 where retro_component_usage_id = p_retro_component_usage_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 => 'RETRO_COMPONENT_USAGE_ID'
153 ,p_argument_value => p_retro_component_usage_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 pay_rcu_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 <> pay_rcu_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', 'pay_retro_component_usages');
191 fnd_message.raise_error;
192 End lck;
193 --
194 -- ----------------------------------------------------------------------------
195 -- |-----------------------------< convert_args >-----------------------------|
196 -- ----------------------------------------------------------------------------
197 Function convert_args
198 (p_retro_component_usage_id in number
199 ,p_business_group_id in number
200 ,p_legislation_code in varchar2
201 ,p_retro_component_id in number
202 ,p_creator_id in number
203 ,p_creator_type in varchar2
204 ,p_default_component in varchar2
205 ,p_reprocess_type in varchar2
206 ,p_object_version_number in number
207 ,p_replace_run_flag in varchar2
208 ,p_use_override_dates in varchar2
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.retro_component_usage_id := p_retro_component_usage_id;
219 l_rec.business_group_id := p_business_group_id;
220 l_rec.legislation_code := p_legislation_code;
221 l_rec.retro_component_id := p_retro_component_id;
222 l_rec.creator_id := p_creator_id;
223 l_rec.creator_type := p_creator_type;
224 l_rec.default_component := p_default_component;
225 l_rec.reprocess_type := p_reprocess_type;
226 l_rec.object_version_number := p_object_version_number;
227 l_rec.replace_run_flag := p_replace_run_flag;
228 l_rec.use_override_dates := p_use_override_dates;
229 --
230 -- Return the plsql record structure.
231 --
232 Return(l_rec);
233 --
234 End convert_args;
235 --
236 end pay_rcu_shd;