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