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