[Home] [Help]
PACKAGE BODY: APPS.BEN_AUD_SHD
Source
1 Package Body ben_aud_shd as
2 /* $Header: beaudrhi.pkb 120.0 2005/05/28 00:31 appldev noship $ */
3 --
4 -- --------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- --------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_aud_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 = 'SYS_C00163503') 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 Else
27 fnd_message.set_name('PAY', 'HR_7877_API_INVALID_CONSTRAINT');
28 fnd_message.set_token('PROCEDURE', l_proc);
29 fnd_message.set_token('CONSTRAINT_NAME', p_constraint_name);
30 fnd_message.raise_error;
31 End If;
32 --
33 End constraint_error;
34 --
35 -- --------------------------------------------------------------------------
36 -- |-----------------------------< api_updating >---------------------------|
37 -- --------------------------------------------------------------------------
38 Function api_updating
39 (p_cwb_audit_id in number
40 ,p_object_version_number in number
41 )
42 Return Boolean Is
43 --
44 --
45 -- Cursor selects the 'current' row from the HR Schema
46 --
47 Cursor C_Sel1 is
48 select
49 cwb_audit_id
50 ,group_per_in_ler_id
51 ,group_pl_id
52 ,lf_evt_ocrd_dt
53 ,pl_id
54 ,group_oipl_id
55 ,audit_type_cd
56 ,old_val_varchar
57 ,new_val_varchar
58 ,old_val_number
59 ,new_val_number
60 ,old_val_date
61 ,new_val_date
62 ,date_stamp
63 ,change_made_by_person_id
64 ,supporting_information
65 ,request_id
66 ,object_version_number
67 from ben_cwb_audit
68 where cwb_audit_id = p_cwb_audit_id;
69 --
70 l_fct_ret boolean;
71 --
72 Begin
73 --
74 If (p_cwb_audit_id is null and
75 p_object_version_number is null
76 ) Then
77 --
78 -- One of the primary key arguments is null therefore we must
79 -- set the returning function value to false
80 --
81 l_fct_ret := false;
82 Else
83 If (p_cwb_audit_id
84 = ben_aud_shd.g_old_rec.cwb_audit_id and
85 p_object_version_number
86 = ben_aud_shd.g_old_rec.object_version_number
87 ) Then
88 --
92 l_fct_ret := true;
89 -- The g_old_rec is current therefore we must
90 -- set the returning function to true
91 --
93 Else
94 --
95 -- Select the current row into g_old_rec
96 --
97 Open C_Sel1;
98 Fetch C_Sel1 Into ben_aud_shd.g_old_rec;
99 If C_Sel1%notfound Then
100 Close C_Sel1;
101 --
102 -- The primary key is invalid therefore we must error
103 --
104 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
105 fnd_message.raise_error;
106 End If;
107 Close C_Sel1;
108 If (p_object_version_number
109 <> ben_aud_shd.g_old_rec.object_version_number) Then
110 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
111 fnd_message.raise_error;
112 End If;
113 l_fct_ret := true;
114 End If;
115 End If;
116 Return (l_fct_ret);
117 --
118 End api_updating;
119 --
120 -- -------------------------------------------------------------------------
121 -- |---------------------------------< lck >-------------------------------|
122 -- -------------------------------------------------------------------------
123 Procedure lck
124 (p_cwb_audit_id in number
125 ,p_object_version_number in number
126 ) is
127 --
128 -- Cursor selects the 'current' row from the HR Schema
129 --
130 Cursor C_Sel1 is
131 select
132 cwb_audit_id
133 ,group_per_in_ler_id
134 ,group_pl_id
135 ,lf_evt_ocrd_dt
136 ,pl_id
137 ,group_oipl_id
138 ,audit_type_cd
139 ,old_val_varchar
140 ,new_val_varchar
141 ,old_val_number
142 ,new_val_number
143 ,old_val_date
144 ,new_val_date
145 ,date_stamp
146 ,change_made_by_person_id
147 ,supporting_information
148 ,request_id
149 ,object_version_number
150 from ben_cwb_audit
151 where cwb_audit_id = p_cwb_audit_id
152 for update nowait;
153 --
154 l_proc varchar2(72) := g_package||'lck';
155 --
156 Begin
157 hr_utility.set_location('Entering:'||l_proc, 5);
158 --
159 hr_api.mandatory_arg_error
160 (p_api_name => l_proc
161 ,p_argument => 'CWB_AUDIT_ID'
162 ,p_argument_value => p_cwb_audit_id
163 );
164 hr_utility.set_location(l_proc,6);
165 hr_api.mandatory_arg_error
166 (p_api_name => l_proc
167 ,p_argument => 'OBJECT_VERSION_NUMBER'
168 ,p_argument_value => p_object_version_number
169 );
170 --
171 Open C_Sel1;
172 Fetch C_Sel1 Into ben_aud_shd.g_old_rec;
173 If C_Sel1%notfound then
174 Close C_Sel1;
175 --
176 -- The primary key is invalid therefore we must error
177 --
178 fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
179 fnd_message.raise_error;
180 End If;
181 Close C_Sel1;
182 If (p_object_version_number
183 <> ben_aud_shd.g_old_rec.object_version_number) Then
184 fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
185 fnd_message.raise_error;
186 End If;
187 --
188 hr_utility.set_location(' Leaving:'||l_proc, 10);
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', 'ben_cwb_audit');
200 fnd_message.raise_error;
201 End lck;
202 --
203 -- -------------------------------------------------------------------------
204 -- |-----------------------------< convert_args >--------------------------|
205 -- -------------------------------------------------------------------------
206 Function convert_args
207 (p_cwb_audit_id in number
208 ,p_group_per_in_ler_id in number
209 ,p_group_pl_id in number
210 ,p_lf_evt_ocrd_dt in date
211 ,p_pl_id in number
212 ,p_group_oipl_id in number
213 ,p_audit_type_cd in varchar2
214 ,p_old_val_varchar in varchar2
215 ,p_new_val_varchar in varchar2
216 ,p_old_val_number in number
217 ,p_new_val_number in number
218 ,p_old_val_date in date
219 ,p_new_val_date in date
220 ,p_date_stamp in date
221 ,p_change_made_by_person_id in number
222 ,p_supporting_information in varchar2
223 ,p_request_id in number
224 ,p_object_version_number in number
225 )
226 Return g_rec_type is
227 --
228 l_rec g_rec_type;
229 --
230 Begin
231 --
232 -- Convert arguments into local l_rec structure.
233 --
234 l_rec.cwb_audit_id := p_cwb_audit_id;
235 l_rec.group_per_in_ler_id := p_group_per_in_ler_id;
236 l_rec.group_pl_id := p_group_pl_id;
237 l_rec.lf_evt_ocrd_dt := p_lf_evt_ocrd_dt;
238 l_rec.pl_id := p_pl_id;
239 l_rec.group_oipl_id := p_group_oipl_id;
240 l_rec.audit_type_cd := p_audit_type_cd;
244 l_rec.new_val_number := p_new_val_number;
241 l_rec.old_val_varchar := p_old_val_varchar;
242 l_rec.new_val_varchar := p_new_val_varchar;
243 l_rec.old_val_number := p_old_val_number;
245 l_rec.old_val_date := p_old_val_date;
246 l_rec.new_val_date := p_new_val_date;
247 l_rec.date_stamp := p_date_stamp;
248 l_rec.change_made_by_person_id := p_change_made_by_person_id;
249 l_rec.supporting_information := p_supporting_information;
250 l_rec.request_id := p_request_id;
251 l_rec.object_version_number := p_object_version_number;
252 --
253 -- Return the plsql record structure.
254 --
255 Return(l_rec);
256 --
257 End convert_args;
258 --
259 end ben_aud_shd;