[Home] [Help]
PACKAGE BODY: APPS.HXC_ERR_SHD
Source
1 Package Body hxc_err_shd as
2 /* $Header: hxcerrrhi.pkb 120.2 2005/09/23 08:08:12 sechandr noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' hxc_err_shd.'; -- Global package name
9 g_debug boolean := hr_utility.debug_enabled;
10 --
11 -- ----------------------------------------------------------------------------
12 -- |---------------------------< constraint_error >---------------------------|
13 -- ----------------------------------------------------------------------------
14 Procedure constraint_error
15 (p_constraint_name in all_constraints.constraint_name%TYPE
16 ) Is
17 --
18 l_proc varchar2(72) := g_package||'constraint_error';
19 --
20 Begin
21 --
22 If (p_constraint_name = 'HXC_ERRORS_PK') Then
23 fnd_message.set_name('PAY', 'HR_6153_ALL_PROCEDURE_FAIL');
24 fnd_message.set_token('PROCEDURE', l_proc);
25 fnd_message.set_token('STEP','5');
26 fnd_message.raise_error;
27 Else
28 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
29 fnd_message.set_token('PROCEDURE', l_proc);
30 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
31 fnd_message.raise_error;
32 End If;
33 --
34 End constraint_error;
35 --
36 -- ----------------------------------------------------------------------------
37 -- |-----------------------------< api_updating >-----------------------------|
38 -- ----------------------------------------------------------------------------
39 Function api_updating
40 (p_error_id in number
41 ,p_object_version_number in number
42 )
43 Return Boolean Is
44 --
45 --
46 -- Cursor selects the 'current' row from the HR Schema
47 --
48 Cursor C_Sel1 is
49 select
50 error_id
51 ,transaction_detail_id
52 ,time_building_block_id
53 ,time_building_block_ovn
54 ,time_attribute_id
55 ,time_attribute_ovn
56 ,message_name
57 ,message_level
58 ,message_field
59 ,message_tokens
60 ,application_short_name
61 ,object_version_number
62 ,date_from
63 ,date_to
64 from hxc_errors
65 where error_id = p_error_id;
66 --
67 l_fct_ret boolean;
68 --
69 Begin
70 --
71 If (p_error_id is null --p_object_version_number is null
72 ) Then
73 --
74 -- One of the primary key arguments is null therefore we must
75 -- set the returning function value to false
76 --
77 l_fct_ret := false;
78 Else
79 If (p_error_id
80 = hxc_err_shd.g_old_rec.error_id --and
81 --p_object_version_number
82 --= hxc_err_shd.g_old_rec.object_version_number
83 ) Then
84 --
85 -- The g_old_rec is current therefore we must
86 -- set the returning function to true
87 --
88 l_fct_ret := true;
89 Else
90 --
91 -- Select the current row into g_old_rec
92 --
93 Open C_Sel1;
94 Fetch C_Sel1 Into hxc_err_shd.g_old_rec;
95 If C_Sel1%notfound Then
96 Close C_Sel1;
97 --
98 -- The primary key is invalid therefore we must error
99 --
100 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
101 fnd_message.raise_error;
102 End If;
103 Close C_Sel1;
104 -- If (p_object_version_number
105 -- <> hxc_err_shd.g_old_rec.object_version_number) Then
106 -- fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
107 -- fnd_message.raise_error;
108 -- End If;
109 l_fct_ret := true;
110 End If;
111 End If;
112 Return (l_fct_ret);
113 --
114 End api_updating;
115 --
116 -- ----------------------------------------------------------------------------
117 -- |---------------------------------< lck >----------------------------------|
118 -- ----------------------------------------------------------------------------
119 Procedure lck
120 (p_error_id in number
121 ,p_object_version_number in number
122 ) is
123 --
124 -- Cursor selects the 'current' row from the HR Schema
125 --
126 Cursor C_Sel1 is
127 select
128 error_id
129 ,transaction_detail_id
130 ,time_building_block_id
131 ,time_building_block_ovn
132 ,time_attribute_id
133 ,time_attribute_ovn
134 ,message_name
135 ,message_level
136 ,message_field
137 ,message_tokens
138 ,application_short_name
139 ,object_version_number
140 ,date_from
141 ,date_to
142 from hxc_errors
143 where error_id = p_error_id
144 for update nowait;
145 --
146 l_proc varchar2(72);
147 --
148 Begin
149 g_debug:=hr_utility.debug_enabled;
150 if g_debug then
151 l_proc := g_package||'lck';
152 hr_utility.set_location('Entering:'||l_proc, 5);
153 end if;
154 --
155 hr_api.mandatory_arg_error
156 (p_api_name => l_proc
157 ,p_argument => 'ERROR_ID'
158 ,p_argument_value => p_error_id
159 );
160 if g_debug then
161 hr_utility.set_location(l_proc,6);
162 end if;
163 --hr_api.mandatory_arg_error
164 -- (p_api_name => l_proc
165 -- ,p_argument => 'OBJECT_VERSION_NUMBER'
166 --,p_argument_value => p_object_version_number
167 --);
168 --
169 Open C_Sel1;
170 Fetch C_Sel1 Into hxc_err_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 -- <> hxc_err_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 if g_debug then
187 hr_utility.set_location(' Leaving:'||l_proc, 10);
188 end if;
189 --
190 -- We need to trap the ORA LOCK exception
191 --
192 Exception
193 When HR_Api.Object_Locked then
194 --
195 -- The object is locked therefore we need to supply a meaningful
196 -- error message.
197 --
198 fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
199 fnd_message.set_token('TABLE_NAME', 'hxc_errors');
200 fnd_message.raise_error;
201 End lck;
202 --
203 -- ----------------------------------------------------------------------------
204 -- |-----------------------------< convert_args >-----------------------------|
205 -- ----------------------------------------------------------------------------
206 Function convert_args
207 (p_error_id in number
208 ,p_transaction_detail_id in number
209 ,p_time_building_block_id in number
210 ,p_time_building_block_ovn in number
211 ,p_time_attribute_id in number
212 ,p_time_attribute_ovn in number
213 ,p_message_name in varchar2
214 ,p_message_level in varchar2
215 ,p_message_field in varchar2
216 ,p_message_tokens in varchar2
217 ,p_application_short_name in varchar2
218 ,p_object_version_number in number
219 ,p_date_from in date
220 ,p_date_to in date
221 )
222 Return g_rec_type is
223 --
224 l_rec g_rec_type;
225 --
226 Begin
227 --
228 -- Convert arguments into local l_rec structure.
229 --
230 l_rec.error_id := p_error_id;
231 l_rec.transaction_detail_id := p_transaction_detail_id;
232 l_rec.time_building_block_id := p_time_building_block_id;
233 l_rec.time_building_block_ovn := p_time_building_block_ovn;
234 l_rec.time_attribute_id := p_time_attribute_id;
235 l_rec.time_attribute_ovn := p_time_attribute_ovn;
236 l_rec.message_name := p_message_name;
237 l_rec.message_level := p_message_level;
238 l_rec.message_field := p_message_field;
239 l_rec.message_tokens := p_message_tokens;
240 l_rec.application_short_name := p_application_short_name;
241 l_rec.object_version_number := p_object_version_number;
242 l_rec.date_from := p_date_from;
243 l_rec.date_to := p_date_to;
244 --
245 -- Return the plsql record structure.
246 --
247 Return(l_rec);
248 --
249 End convert_args;
250 --
251 end hxc_err_shd;