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