DBA Data[Home] [Help]

PACKAGE BODY: APPS.PSP_PEE_SHD

Source


1 Package Body psp_pee_shd as
2 /* $Header: PSPEERHB.pls 120.3 2006/02/08 05:35 dpaudel noship $ */
3 --
4 -- ----------------------------------------------------------------------------
5 -- |                     Private Global Definitions                           |
6 -- ----------------------------------------------------------------------------
7 --
8 g_package  varchar2(33) := '  psp_pee_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_C00145474') 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_external_effort_line_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        external_effort_line_id
50       ,batch_name
51       ,object_version_number
52       ,distribution_date
53       ,person_id
54       ,assignment_id
55       ,currency_code
56       ,distribution_amount
57       ,business_group_id
58       ,set_of_books_id
59       ,gl_code_combination_id
60       ,project_id
61       ,task_id
62       ,award_id
63       ,expenditure_organization_id
64       ,expenditure_type
65       ,attribute_category
66       ,attribute1
67       ,attribute2
68       ,attribute3
69       ,attribute4
70       ,attribute5
71       ,attribute6
72       ,attribute7
73       ,attribute8
74       ,attribute9
75       ,attribute10
76       ,attribute11
77       ,attribute12
78       ,attribute13
79       ,attribute14
80       ,attribute15
81     from        psp_external_effort_lines
82     where       external_effort_line_id = p_external_effort_line_id;
83   --
84   l_fct_ret     boolean;
85   --
86 Begin
87   --
88   If (p_external_effort_line_id is null and
89       p_object_version_number is null
90      ) Then
91     --
92     -- One of the primary key arguments is null therefore we must
93     -- set the returning function value to false
94     --
95     l_fct_ret := false;
96   Else
97     If (p_external_effort_line_id
98         = psp_pee_shd.g_old_rec.external_effort_line_id and
99         p_object_version_number
100         = psp_pee_shd.g_old_rec.object_version_number
101        ) Then
102       --
103       -- The g_old_rec is current therefore we must
104       -- set the returning function to true
105       --
106       l_fct_ret := true;
107     Else
108       --
109       -- Select the current row into g_old_rec
110       --
111       Open C_Sel1;
112       Fetch C_Sel1 Into psp_pee_shd.g_old_rec;
113       If C_Sel1%notfound Then
114         Close C_Sel1;
115         --
116         -- The primary key is invalid therefore we must error
117         --
118         fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
119         fnd_message.raise_error;
120       End If;
121       Close C_Sel1;
122       If (p_object_version_number
123           <> psp_pee_shd.g_old_rec.object_version_number) Then
124         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
125         fnd_message.raise_error;
126       End If;
127       l_fct_ret := true;
128     End If;
129   End If;
130   Return (l_fct_ret);
131 --
132 End api_updating;
133 --
134 -- ----------------------------------------------------------------------------
135 -- |---------------------------------< lck >----------------------------------|
136 -- ----------------------------------------------------------------------------
137 Procedure lck
138   (p_external_effort_line_id              in     number
139   ,p_object_version_number                in     number
140   ) is
141 --
142 -- Cursor selects the 'current' row from the HR Schema
143 --
144   Cursor C_Sel1 is
145     select
146        external_effort_line_id
147       ,batch_name
148       ,object_version_number
149       ,distribution_date
150       ,person_id
151       ,assignment_id
152       ,currency_code
153       ,distribution_amount
154       ,business_group_id
155       ,set_of_books_id
156       ,gl_code_combination_id
157       ,project_id
158       ,task_id
159       ,award_id
160       ,expenditure_organization_id
161       ,expenditure_type
162       ,attribute_category
163       ,attribute1
164       ,attribute2
165       ,attribute3
166       ,attribute4
167       ,attribute5
168       ,attribute6
169       ,attribute7
170       ,attribute8
171       ,attribute9
172       ,attribute10
173       ,attribute11
174       ,attribute12
175       ,attribute13
176       ,attribute14
177       ,attribute15
178     from        psp_external_effort_lines
179     where       external_effort_line_id = p_external_effort_line_id
180     for update nowait;
181 --
182   l_proc        varchar2(72) := g_package||'lck';
183 --
184 Begin
185   hr_utility.set_location('Entering:'||l_proc, 5);
186   --
187   hr_api.mandatory_arg_error
188     (p_api_name           => l_proc
189     ,p_argument           => 'EXTERNAL_EFFORT_LINE_ID'
190     ,p_argument_value     => p_external_effort_line_id
191     );
192   hr_utility.set_location(l_proc,6);
193   hr_api.mandatory_arg_error
194     (p_api_name           => l_proc
195     ,p_argument           => 'OBJECT_VERSION_NUMBER'
196     ,p_argument_value     => p_object_version_number
197     );
198   --
199   Open  C_Sel1;
200   Fetch C_Sel1 Into psp_pee_shd.g_old_rec;
201   If C_Sel1%notfound then
202     Close C_Sel1;
203     --
204     -- The primary key is invalid therefore we must error
205     --
206     fnd_message.set_name('PAY', 'HR_7220_INVALID_PRIMARY_KEY');
207     fnd_message.raise_error;
208   End If;
209   Close C_Sel1;
210   If (p_object_version_number
211       <> psp_pee_shd.g_old_rec.object_version_number) Then
212         fnd_message.set_name('PAY', 'HR_7155_OBJECT_INVALID');
213         fnd_message.raise_error;
214   End If;
215   --
216   hr_utility.set_location(' Leaving:'||l_proc, 10);
217   --
218   -- We need to trap the ORA LOCK exception
219   --
220 Exception
221   When HR_Api.Object_Locked then
222     --
223     -- The object is locked therefore we need to supply a meaningful
224     -- error message.
225     --
226     fnd_message.set_name('PAY', 'HR_7165_OBJECT_LOCKED');
227     fnd_message.set_token('TABLE_NAME', 'psp_external_effort_lines');
228     fnd_message.raise_error;
229 End lck;
230 --
231 -- ----------------------------------------------------------------------------
232 -- |-----------------------------< convert_args >-----------------------------|
233 -- ----------------------------------------------------------------------------
234 Function convert_args
235   (p_external_effort_line_id        in number
236   ,p_batch_name                     in varchar2
237   ,p_object_version_number          in number
238   ,p_distribution_date              in date
239   ,p_person_id                      in number
240   ,p_assignment_id                  in number
241   ,p_currency_code                  in varchar2
242   ,p_distribution_amount            in number
243   ,p_business_group_id              in number
244   ,p_set_of_books_id                in number
245   ,p_gl_code_combination_id         in number
246   ,p_project_id                     in number
247   ,p_task_id                        in number
248   ,p_award_id                       in number
249   ,p_expenditure_organization_id    in number
250   ,p_expenditure_type               in varchar2
251   ,p_attribute_category             in varchar2
252   ,p_attribute1                     in varchar2
253   ,p_attribute2                     in varchar2
254   ,p_attribute3                     in varchar2
255   ,p_attribute4                     in varchar2
256   ,p_attribute5                     in varchar2
257   ,p_attribute6                     in varchar2
258   ,p_attribute7                     in varchar2
259   ,p_attribute8                     in varchar2
260   ,p_attribute9                     in varchar2
261   ,p_attribute10                    in varchar2
262   ,p_attribute11                    in varchar2
263   ,p_attribute12                    in varchar2
264   ,p_attribute13                    in varchar2
265   ,p_attribute14                    in varchar2
266   ,p_attribute15                    in varchar2
267   )
268   Return g_rec_type is
269 --
270   l_rec   g_rec_type;
271 --
272 Begin
273   --
274   -- Convert arguments into local l_rec structure.
275   --
276   l_rec.external_effort_line_id          := p_external_effort_line_id;
277   l_rec.batch_name                       := p_batch_name;
278   l_rec.object_version_number            := p_object_version_number;
279   l_rec.distribution_date                := p_distribution_date;
280   l_rec.person_id                        := p_person_id;
281   l_rec.assignment_id                    := p_assignment_id;
282   l_rec.currency_code                    := p_currency_code;
283   l_rec.distribution_amount              := p_distribution_amount;
284   l_rec.business_group_id                := p_business_group_id;
285   l_rec.set_of_books_id                  := p_set_of_books_id;
286   l_rec.gl_code_combination_id           := p_gl_code_combination_id;
287   l_rec.project_id                       := p_project_id;
288   l_rec.task_id                          := p_task_id;
289   l_rec.award_id                         := p_award_id;
290   l_rec.expenditure_organization_id      := p_expenditure_organization_id;
291   l_rec.expenditure_type                 := p_expenditure_type;
292   l_rec.attribute_category               := p_attribute_category;
293   l_rec.attribute1                       := p_attribute1;
294   l_rec.attribute2                       := p_attribute2;
295   l_rec.attribute3                       := p_attribute3;
296   l_rec.attribute4                       := p_attribute4;
297   l_rec.attribute5                       := p_attribute5;
298   l_rec.attribute6                       := p_attribute6;
299   l_rec.attribute7                       := p_attribute7;
300   l_rec.attribute8                       := p_attribute8;
301   l_rec.attribute9                       := p_attribute9;
302   l_rec.attribute10                      := p_attribute10;
303   l_rec.attribute11                      := p_attribute11;
304   l_rec.attribute12                      := p_attribute12;
305   l_rec.attribute13                      := p_attribute13;
306   l_rec.attribute14                      := p_attribute14;
307   l_rec.attribute15                      := p_attribute15;
308   --
309   -- Return the plsql record structure.
310   --
311   Return(l_rec);
312 --
313 End convert_args;
314 --
315 end psp_pee_shd;