[Home] [Help]
PACKAGE BODY: APPS.BEN_ACT_SHD
Source
1 Package Body ben_act_shd as
2 /* $Header: beactrhi.pkb 120.0 2005/05/28 00:20:33 appldev noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- | Private Global Definitions |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package varchar2(33) := ' ben_act_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_PERSON_ACTIONS_FK1') 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 ElsIf (p_constraint_name = 'BEN_PERSON_ACTIONS_PK') Then
42 hr_utility.set_message(801, 'HR_6153_ALL_PROCEDURE_FAIL');
43 hr_utility.set_message_token('PROCEDURE', l_proc);
44 hr_utility.set_message_token('STEP','10');
45 hr_utility.raise_error;
46 Else
47 hr_utility.set_message(801, 'HR_7877_API_INVALID_CONSTRAINT');
48 hr_utility.set_message_token('PROCEDURE', l_proc);
49 hr_utility.set_message_token('CONSTRAINT_NAME', p_constraint_name);
50 hr_utility.raise_error;
51 End If;
52 --
53 hr_utility.set_location(' Leaving:'||l_proc, 10);
54 End constraint_error;
55 --
56 -- ----------------------------------------------------------------------------
57 -- |-----------------------------< api_updating >-----------------------------|
58 -- ----------------------------------------------------------------------------
59 Function api_updating
60 (
61 p_person_action_id in number,
62 p_object_version_number in number
63 ) Return Boolean Is
64 --
65 --
66 -- Cursor selects the 'current' row from the HR Schema
67 --
68 Cursor C_Sel1 is
69 select
70 person_action_id,
71 person_id,
72 ler_id,
73 benefit_action_id,
74 action_status_cd,
75 chunk_number,
76 object_version_number
77 from ben_person_actions
78 where person_action_id = p_person_action_id;
79 --
80 l_proc varchar2(72) := g_package||'api_updating';
81 l_fct_ret boolean;
82 --
83 Begin
84 hr_utility.set_location('Entering:'||l_proc, 5);
85 --
86 If (
87 p_person_action_id is null and
88 p_object_version_number is null
89 ) Then
90 --
91 -- One of the primary key arguments is null therefore we must
92 -- set the returning function value to false
93 --
94 l_fct_ret := false;
95 Else
96 If (
97 p_person_action_id = g_old_rec.person_action_id and
98 p_object_version_number = g_old_rec.object_version_number
99 ) Then
100 hr_utility.set_location(l_proc, 10);
101 --
102 -- The g_old_rec is current therefore we must
103 -- set the returning function to true
104 --
105 l_fct_ret := true;
106 Else
107 --
108 -- Select the current row into g_old_rec
109 --
110 Open C_Sel1;
111 Fetch C_Sel1 Into g_old_rec;
112 If C_Sel1%notfound Then
113 Close C_Sel1;
114 --
115 -- The primary key is invalid therefore we must error
116 --
117 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
118 hr_utility.raise_error;
119 End If;
120 Close C_Sel1;
121 If (p_object_version_number <> g_old_rec.object_version_number) Then
122 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
123 hr_utility.raise_error;
124 End If;
125 hr_utility.set_location(l_proc, 15);
126 l_fct_ret := true;
127 End If;
128 End If;
129 hr_utility.set_location(' Leaving:'||l_proc, 20);
130 Return (l_fct_ret);
131 --
132 End api_updating;
133 --
134 -- ----------------------------------------------------------------------------
135 -- |---------------------------------< lck >----------------------------------|
136 -- ----------------------------------------------------------------------------
137 Procedure lck
138 (
139 p_person_action_id in number,
140 p_object_version_number in number
141 ) is
142 --
143 -- Cursor selects the 'current' row from the HR Schema
144 --
145 Cursor C_Sel1 is
146 select person_action_id,
147 person_id,
148 ler_id,
149 benefit_action_id,
150 action_status_cd,
151 chunk_number,
152 object_version_number
153 from ben_person_actions
154 where person_action_id = p_person_action_id
155 for update nowait;
156 --
157 l_proc varchar2(72) := g_package||'lck';
158 --
159 Begin
160 hr_utility.set_location('Entering:'||l_proc, 5);
161 --
162 -- Add any mandatory argument checking here:
163 -- Example:
164 -- hr_api.mandatory_arg_error
165 -- (p_api_name => l_proc,
166 -- p_argument => 'object_version_number',
167 -- p_argument_value => p_object_version_number);
168 --
169 Open C_Sel1;
170 Fetch C_Sel1 Into 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 hr_utility.set_message(801, 'HR_7220_INVALID_PRIMARY_KEY');
177 hr_utility.raise_error;
178 End If;
179 Close C_Sel1;
180 If (p_object_version_number <> g_old_rec.object_version_number) Then
181 hr_utility.set_message(801, 'HR_7155_OBJECT_INVALID');
182 hr_utility.raise_error;
183 End If;
184 --
185 hr_utility.set_location(' Leaving:'||l_proc, 10);
186 --
187 -- We need to trap the ORA LOCK exception
188 --
189 Exception
190 When HR_Api.Object_Locked then
191 --
192 -- The object is locked therefore we need to supply a meaningful
193 -- error message.
194 --
195 hr_utility.set_message(801, 'HR_7165_OBJECT_LOCKED');
196 hr_utility.set_message_token('TABLE_NAME', 'ben_person_actions');
197 hr_utility.raise_error;
198 End lck;
199 --
200 -- ----------------------------------------------------------------------------
201 -- |-----------------------------< convert_args >-----------------------------|
202 -- ----------------------------------------------------------------------------
203 Function convert_args
204 (
205 p_person_action_id in number,
206 p_person_id in number,
207 p_ler_id in number,
208 p_benefit_action_id in number,
209 p_action_status_cd in varchar2,
210 p_chunk_number in number,
211 p_object_version_number in number
212 )
213 Return g_rec_type is
214 --
215 l_rec g_rec_type;
216 l_proc varchar2(72) := g_package||'convert_args';
217 --
218 Begin
219 --
220 hr_utility.set_location('Entering:'||l_proc, 5);
221 --
222 -- Convert arguments into local l_rec structure.
223 --
224 l_rec.person_action_id := p_person_action_id;
225 l_rec.person_id := p_person_id;
226 l_rec.ler_id := p_ler_id;
227 l_rec.benefit_action_id := p_benefit_action_id;
228 l_rec.action_status_cd := p_action_status_cd;
229 l_rec.chunk_number := p_chunk_number;
230 l_rec.object_version_number := p_object_version_number;
231 --
232 -- Return the plsql record structure.
233 --
234 hr_utility.set_location(' Leaving:'||l_proc, 10);
235 Return(l_rec);
236 --
237 End convert_args;
238 --
239 end ben_act_shd;