DBA Data[Home] [Help]

PACKAGE BODY: APPS.PA_FP_EXCLUDED_ELEMENTS_PUB

Source


1 PACKAGE BODY pa_fp_excluded_elements_pub as
2 /* $Header: PAFPXEPB.pls 120.1 2005/08/19 16:32:15 mwasowic noship $ */
3 
4 G_PKG_NAME  CONSTANT VARCHAR2(30) := 'PA_FP_EXCLUDED_ELEMENTS_PUB';
5 G_FILE_NAME CONSTANT VARCHAR2(12) := 'PAFPXEPB.pls';
6 
7 --This api will creates record for  p_to_proj_fp_options_id in pa_fp_excluded_elements copying
8 --them from those of p_from_proj_fp_options_id. If the project ids are different for the two
9 --options the records are mapped based on task numbers.
10 PROCEDURE  Copy_Excluded_Elements
11 ( p_from_proj_fp_options_id       IN  pa_proj_fp_options.proj_fp_options_id%TYPE
12  ,p_from_element_type             IN  pa_fp_elements.element_type%TYPE
13  ,p_to_proj_fp_options_id         IN  pa_proj_fp_options.proj_fp_options_id%TYPE
14  ,p_to_element_type               IN  pa_fp_elements.element_type%TYPE
15  ,x_return_status                 OUT NOCOPY VARCHAR2 --File.Sql.39 bug 4440895
16  ,x_msg_count                     OUT NOCOPY NUMBER --File.Sql.39 bug 4440895
17  ,x_msg_data                      OUT NOCOPY VARCHAR2) IS --File.Sql.39 bug 4440895
18 
19 CURSOR fp_options_info_cur
20       (c_proj_fp_options_id pa_proj_fp_options.proj_fp_options_id%TYPE)
21 IS
22 SELECT project_id
23       ,fin_plan_type_id
24       ,fin_plan_version_id
25 FROM   pa_proj_fp_options
26 WHERE  proj_fp_options_id = c_proj_fp_options_id;
27 l_from_fp_option_info_rec         fp_options_info_cur%ROWTYPE;
28 l_to_fp_option_info_rec           fp_options_info_cur%ROWTYPE;
29 
30 l_from_project_id                 pa_projects_all.project_id%TYPE;
31 l_to_project_id                   pa_projects_all.project_id%TYPE;
32 
33 --Declare the variables which are required as a standard
34 l_msg_count                       NUMBER := 0;
35 l_data                            VARCHAR2(2000);
36 l_msg_data                        VARCHAR2(2000);
37 l_msg_index_out                   NUMBER;
38 l_debug_mode                      VARCHAR2(1);
39 
40 L_DEBUG_LEVEL3                    CONSTANT NUMBER   := 3;
41 L_DEBUG_LEVEL5                    CONSTANT NUMBER   := 5;
42 L_PROCEDURE_NAME                  CONSTANT VARCHAR2(100) :='Copy_Excluded_Elements: '||
43                                                          G_PKG_NAME ;
44 BEGIN
45       x_msg_count := 0;
46       x_return_status := FND_API.G_RET_STS_SUCCESS;
47       l_debug_mode  := NVL(FND_PROFILE.value('PA_DEBUG_MODE'),'N');
48 
49       IF l_debug_mode = 'Y' THEN
50             pa_debug.set_curr_function( p_function    => 'Copy_Excluded_Elements',
51                                          p_debug_mode => l_debug_mode );
52       END IF;
53 
54       IF l_debug_mode = 'Y' THEN
55             pa_debug.g_err_stage:= 'Validating input parameters';
56             pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,L_DEBUG_LEVEL3);
57       END IF;
58 
59       IF p_from_proj_fp_options_id    IS NULL OR
60          p_from_element_type          IS NULL OR
61          p_to_proj_fp_options_id      IS NULL OR
62          p_to_element_type            IS NULL
63       THEN
64 
65             IF l_debug_mode = 'Y' THEN
66                   pa_debug.g_err_stage:= 'p_from_proj_fp_options_id = '|| p_from_proj_fp_options_id;
67                   pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,L_DEBUG_LEVEL5);
68 
69                   pa_debug.g_err_stage:= 'p_from_element_type = '|| p_from_element_type;
70                   pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,L_DEBUG_LEVEL5);
71 
72                   pa_debug.g_err_stage:= 'p_to_proj_fp_options_id = '|| p_to_proj_fp_options_id;
73                   pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,L_DEBUG_LEVEL5);
74 
75                   pa_debug.g_err_stage:= 'p_to_element_type = '|| p_to_element_type;
76                   pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,L_DEBUG_LEVEL5);
77             END IF;
78             PA_UTILS.ADD_MESSAGE
79             (p_app_short_name => 'PA',
80              p_msg_name       => 'PA_FP_INV_PARAM_PASSED');
81             RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
82 
83       END IF;
84 
85       --Get the Details of the source and target option Ids
86       OPEN  fp_options_info_cur(p_from_proj_fp_options_id);
87       FETCH fp_options_info_cur INTO l_from_fp_option_info_rec;
88       IF fp_options_info_cur%NOTFOUND THEN
89 
90             IF l_debug_mode = 'Y' THEN
91                   pa_debug.g_err_stage:= 'p_from_proj_fp_options_id  '|| p_from_proj_fp_options_id
92                                            ||' is invalid ';
93                   pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,L_DEBUG_LEVEL5);
94             END IF;
95             CLOSE fp_options_info_cur;
96             RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
97 
98       END IF;
99       CLOSE fp_options_info_cur;
100 
101       OPEN  fp_options_info_cur(p_to_proj_fp_options_id);
102       FETCH fp_options_info_cur INTO l_to_fp_option_info_rec;
103       IF fp_options_info_cur%NOTFOUND THEN
104 
105             IF l_debug_mode = 'Y' THEN
106                   pa_debug.g_err_stage:= 'p_to_proj_fp_options_id  '|| p_to_proj_fp_options_id
107                                            ||' is invalid ';
108                   pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,L_DEBUG_LEVEL5);
109             END IF;
110             CLOSE fp_options_info_cur;
111             RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
112 
113       END IF;
114       CLOSE fp_options_info_cur;
115 
116       IF l_from_fp_option_info_rec.project_id = l_to_fp_option_info_rec.project_id THEN
117 
118             IF l_debug_mode = 'Y' THEN
119                   pa_debug.g_err_stage:= 'project ids are same. inserting into excluded elements';
120                   pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,L_DEBUG_LEVEL3);
121             END IF;
122 
123             INSERT INTO pa_fp_excluded_elements
124                        ( proj_fp_options_id
125                         ,project_id
126                         ,fin_plan_type_id
127                         ,element_type
128                         ,fin_plan_version_id
129                         ,task_id
130                         ,record_version_number
131                         ,last_update_date
132                         ,last_updated_by
133                         ,creation_date
134                         ,created_by
135                         ,last_update_login)
136                  SELECT  p_to_proj_fp_options_id                     proj_fp_options_id
137                         ,l_to_fp_option_info_rec.project_id          project_id
138                         ,l_to_fp_option_info_rec.fin_plan_type_id    fin_plan_type_id
139                         ,DECODE( p_to_element_type,
140                                                    PA_FP_CONSTANTS_PKG.G_ELEMENT_TYPE_BOTH,ee.element_type,
141                                                                                            p_to_element_type)
142                         ,l_to_fp_option_info_rec.fin_plan_version_id fin_plan_version_id
143                         ,ee.task_id                                  task_id
144                         ,1                                           record_version_number
145                         ,sysdate                                     last_update_date
146                         ,fnd_global.user_id                          last_updated_by
147                         ,sysdate                                     creation_date
148                         ,fnd_global.user_id                          created_by
149                         ,fnd_global.login_id                         last_update_login
150                  FROM
151                          pa_fp_excluded_elements  ee
152                  WHERE   ee.proj_fp_options_id = p_from_proj_fp_options_id
153                  AND     ee.element_type = DECODE( p_from_element_type,
154                                                    PA_FP_CONSTANTS_PKG.G_ELEMENT_TYPE_BOTH,ee.element_type,
155                                                                                            p_from_element_type);
156 
157       ELSE
158             IF l_debug_mode = 'Y' THEN
159                   pa_debug.g_err_stage:= 'project ids are DIFFERENT. inserting into excluded elements';
160                   pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,L_DEBUG_LEVEL3);
161             END IF;
162 
163             --Map the tasks from source to project using the task number.
164             INSERT INTO pa_fp_excluded_elements
165                        ( proj_fp_options_id
166                         ,project_id
167                         ,fin_plan_type_id
168                         ,element_type
169                         ,fin_plan_version_id
170                         ,task_id
171                         ,record_version_number
172                         ,last_update_date
173                         ,last_updated_by
174                         ,creation_date
175                         ,created_by
176                         ,last_update_login)
177                  SELECT  p_to_proj_fp_options_id                     proj_fp_options_id
178                         ,l_to_fp_option_info_rec.project_id          project_id
179                         ,l_to_fp_option_info_rec.fin_plan_type_id    fin_plan_type_id
180                         ,DECODE( p_to_element_type,
181                                                    PA_FP_CONSTANTS_PKG.G_ELEMENT_TYPE_BOTH,ee.element_type,
182                                                                                            p_to_element_type)
183                         ,l_to_fp_option_info_rec.fin_plan_version_id fin_plan_version_id
184                         ,target_pt.task_id                           task_id
185                         ,1                                           record_version_number
186                         ,sysdate                                     last_update_date
187                         ,fnd_global.user_id                          last_updated_by
188                         ,sysdate                                     creation_date
189                         ,fnd_global.user_id                          created_by
190                         ,fnd_global.login_id                         last_update_login
191                  FROM    pa_fp_excluded_elements ee,
192                          pa_tasks  source_pt,
193                          pa_tasks  target_pt
194                  WHERE   proj_fp_options_id = p_from_proj_fp_options_id
195                  AND     target_pt.project_id = l_to_fp_option_info_rec.project_id
196                  AND     ee.element_type = DECODE( p_from_element_type,
197                                                    PA_FP_CONSTANTS_PKG.G_ELEMENT_TYPE_BOTH,ee.element_type,
198                                                                                            p_from_element_type)
199                  AND     source_pt.task_id = ee.task_id
200                  AND     target_pt.task_number = source_pt.task_number;
201 
202       END IF;
203 
204       IF l_debug_mode = 'Y' THEN
205             pa_debug.g_err_stage:= 'Exiting Copy_Excluded_Elements';
206             pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,L_DEBUG_LEVEL3);
207             pa_debug.reset_curr_function;
208       END IF;
209 
210 EXCEPTION
211 WHEN PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc THEN
212 
213       x_return_status := FND_API.G_RET_STS_ERROR;
214       l_msg_count := FND_MSG_PUB.count_msg;
215 
216       IF l_msg_count = 1 and x_msg_data IS NULL THEN
217             PA_INTERFACE_UTILS_PUB.get_messages
218               (p_encoded        => FND_API.G_TRUE
219               ,p_msg_index      => 1
220               ,p_msg_count      => l_msg_count
221               ,p_msg_data       => l_msg_data
222               ,p_data           => l_data
223               ,p_msg_index_out  => l_msg_index_out);
224             x_msg_data := l_data;
225             x_msg_count := l_msg_count;
226       ELSE
227             x_msg_count := l_msg_count;
228       END IF;
229       IF l_debug_mode = 'Y' THEN
230             pa_debug.reset_curr_function;
231       END IF;
232 
233       RETURN;
234 
235 WHEN OTHERS THEN
236 
237       x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
238       x_msg_count     := 1;
239       x_msg_data      := SQLERRM;
240 
241       FND_MSG_PUB.add_exc_msg
242                    ( p_pkg_name        => G_PKG_NAME
243                     ,p_procedure_name  => 'Copy_Excluded_Elements'
244                     ,p_error_text      => x_msg_data);
245 
246       IF l_debug_mode = 'Y' THEN
247             pa_debug.g_err_stage:= 'Unexpected Error'||x_msg_data;
248             pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,L_DEBUG_LEVEL5);
249             pa_debug.reset_curr_function;
250       END IF;
251       RAISE;
252 END Copy_Excluded_Elements;
253 
254 /*==================================================================
255   This api is called to delete all the tasks that are made plannable
256   while copying actuals etc., from pa_fp_excluded_elements.
257  ==================================================================*/
258 
259 PROCEDURE Synchronize_Excluded_Elements
260    (  p_proj_fp_options_id    IN   pa_proj_fp_options.proj_fp_options_id%TYPE
261      ,p_element_type          IN   pa_fp_elements.element_type%TYPE
262      ,x_return_status         OUT  NOCOPY VARCHAR2 --File.Sql.39 bug 4440895
263      ,x_msg_count             OUT  NOCOPY NUMBER --File.Sql.39 bug 4440895
264      ,x_msg_data              OUT  NOCOPY VARCHAR2) --File.Sql.39 bug 4440895
265 AS
266 
267 l_msg_count                     NUMBER := 0;
268 l_data                          VARCHAR2(2000);
269 l_msg_data                      VARCHAR2(2000);
270 l_msg_index_out                 NUMBER;
271 l_debug_mode                    VARCHAR2(1);
272 l_procedure_name       CONSTANT VARCHAR2(100) :='Synchronize_Excluded_Elements: '||G_PKG_NAME ;
273 
274 BEGIN
275       x_msg_count := 0;
276       x_return_status := FND_API.G_RET_STS_SUCCESS;
277 
278       PA_DEBUG.Set_Curr_Function( p_function   => 'Synchronize_Excluded_Elements',
279                                   p_debug_mode => l_debug_mode );
280 
281       l_debug_mode  := NVL(FND_PROFILE.value('PA_DEBUG_MODE'),'N');
282 
283       IF l_debug_mode = 'Y' THEN
284               pa_debug.g_err_stage:= 'Inside Synchronize_Excluded_Elements';
285               pa_debug.write(l_procedure_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
286       END IF;
287 
288 
289       -- Check for NOT NULL parameters
290 
291       IF (p_proj_fp_options_id IS NULL) OR (p_element_type IS NULL)
292       THEN
293             IF l_debug_mode = 'Y' THEN
294                 pa_debug.g_err_stage:= 'p_proj_fp_options_id = '|| p_proj_fp_options_id;
295                 pa_debug.write(l_procedure_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
296                 pa_debug.g_err_stage:= 'p_element_type = '|| p_element_type;
297                 pa_debug.write(l_procedure_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
298                 pa_debug.g_err_stage:= 'Invalid Arguments Passed';
299                 pa_debug.write(l_procedure_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL5);
300             END IF;
301             PA_UTILS.ADD_MESSAGE
302                    (p_app_short_name => 'PA',
303                     p_msg_name       => 'PA_FP_INV_PARAM_PASSED');
304             RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
305       END IF;
306 
307       /*
308        * Delete all the tasks that are made plannable from
309        * pa_fp_excluded_elements
310        * Note: Please note that
311        */
312       DELETE FROM pa_fp_excluded_elements fee
313       WHERE  fee.proj_fp_options_id = p_proj_fp_options_id
314         AND  fee.element_type       = p_element_type
315         AND  fee.task_id IN (SELECT pfe.task_id
316                                FROM pa_fp_elements pfe
317                               WHERE pfe.proj_fp_options_id = p_proj_fp_options_id
318                                 AND pfe.element_type       = p_element_type
319                                 AND pfe.plannable_flag     = 'Y'
320                                 AND pfe.resource_list_member_id = 0);
321 
322       IF l_debug_mode = 'Y' THEN
323               pa_debug.g_err_stage:= 'Exiting Synchronize_Excluded_Elements';
324               pa_debug.write(l_procedure_name,pa_debug.g_err_stage,PA_FP_CONSTANTS_PKG.G_DEBUG_LEVEL3);
325       END IF;
326       pa_debug.reset_curr_function;
327   EXCEPTION
328 
329      WHEN PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc THEN
330 
331            x_return_status := FND_API.G_RET_STS_ERROR;
332            l_msg_count := FND_MSG_PUB.count_msg;
333            IF l_msg_count = 1 THEN
334                 PA_INTERFACE_UTILS_PUB.get_messages
335                       (p_encoded        => FND_API.G_TRUE
336                       ,p_msg_index      => 1
337                       ,p_msg_count      => l_msg_count
338                       ,p_msg_data       => l_msg_data
339                       ,p_data           => l_data
340                       ,p_msg_index_out  => l_msg_index_out);
341                 x_msg_data := l_data;
342                 x_msg_count := l_msg_count;
343            ELSE
344                 x_msg_count := l_msg_count;
345            END IF;
346            pa_debug.reset_curr_function;
347            RETURN;
348    WHEN others THEN
349 
350           x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
351           x_msg_count     := 1;
352           x_msg_data      := SQLERRM;
353           FND_MSG_PUB.add_exc_msg
354                           ( p_pkg_name        => G_PKG_NAME
355                            ,p_procedure_name  => 'Synchronize_Excluded_Elements'
356                            ,p_error_text      => sqlerrm);
357           pa_debug.reset_curr_function;
358           RAISE;
359 END Synchronize_Excluded_Elements;
360 
361 /* Called from setup pages to delete from pa_fp_excluded_elements when a task element is
362    made plannable. If the task element is not present in pa_fp_excluded_elements, the
363    delete_Row table handler is not called */
364 
365 PROCEDURE Delete_Excluded_Elements
366      ( p_proj_fp_options_id    IN   pa_fp_excluded_elements.proj_fp_options_id%TYPE
367       ,p_element_type          IN   pa_fp_excluded_elements.element_type%TYPE
368       ,p_task_id               IN   pa_fp_excluded_elements.task_id%TYPE
369       ,x_return_status         OUT  NOCOPY VARCHAR2 --File.Sql.39 bug 4440895
370       ,x_msg_count             OUT  NOCOPY NUMBER --File.Sql.39 bug 4440895
371       ,x_msg_data              OUT  NOCOPY VARCHAR2) --File.Sql.39 bug 4440895
372 AS
373 
374 l_msg_count                     NUMBER := 0;
375 l_data                          VARCHAR2(2000);
376 l_msg_data                      VARCHAR2(2000);
377 l_msg_index_out                 NUMBER;
378 l_debug_mode 			       VARCHAR2(1);
379 
380 L_DEBUG_LEVEL2                  CONSTANT NUMBER := 2;
381 L_DEBUG_LEVEL3                  CONSTANT NUMBER := 3;
382 L_DEBUG_LEVEL4                  CONSTANT NUMBER := 4;
383 L_DEBUG_LEVEL5                  CONSTANT NUMBER := 5;
384 L_PROCEDURE_NAME                CONSTANT VARCHAR2(100) := 'Pa_Fp_Excluded_Elements_Pkg.Delete_Excluded_Elements';
385 
386 CURSOR cur_excl_elems IS
387 SELECT rowid
388 FROM   pa_fp_excluded_elements
389 WHERE  proj_fp_options_id = p_proj_fp_options_id
390 AND    element_type = p_element_type
391 AND    task_id = p_task_id;
392 
393 excl_elems_rec                 cur_excl_elems%ROWTYPE;
394 
395 BEGIN
396 
397      x_msg_count := 0;
398      x_return_status := FND_API.G_RET_STS_SUCCESS;
399      l_debug_mode  := NVL(FND_PROFILE.value('PA_DEBUG_MODE'),'N');
400 
401      IF l_debug_mode = 'Y' THEN
402           pa_debug.set_curr_function( p_function   => 'Delete_Excluded_Elements',
403                                       p_debug_mode => l_debug_mode );
404      END IF;
405 
406      -- Check for business rules violations
407 
408      IF l_debug_mode = 'Y' THEN
409           pa_debug.g_err_stage:= 'Validating input parameters';
410           pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,
411                                      L_DEBUG_LEVEL3);
412      END IF;
413 
414      IF (p_proj_fp_options_id IS NULL) OR
415         (p_element_type IS NULL) OR
416         (p_task_id IS NULL)
417      THEN
418           IF l_debug_mode = 'Y' THEN
419                   pa_debug.g_err_stage:= 'p_proj_fp_options_id = '|| p_proj_fp_options_id;
420                   pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,
421                                            L_DEBUG_LEVEL5);
422                   pa_debug.g_err_stage:= 'p_element_type = '|| p_element_type;
423                   pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,
424                                            L_DEBUG_LEVEL5);
425                   pa_debug.g_err_stage:= 'p_task_id = '|| p_task_id;
426                   pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,
427                                            L_DEBUG_LEVEL5);
428           END IF;
429           PA_UTILS.ADD_MESSAGE
430                 (p_app_short_name => 'PA',
431                  p_msg_name     => 'PA_FP_INV_PARAM_PASSED');
432           RAISE PA_FP_Constants_Pkg.Invalid_Arg_Exc;
433 
434      END IF;
435 
436      OPEN cur_excl_elems;
437      FETCH cur_excl_elems INTO excl_elems_rec;
438 
439      /* Record to be deleted doesnt exists and no need to call delete_row table handler */
440 
441      IF cur_excl_elems%FOUND THEN
442 
443           IF l_debug_mode = 'Y' THEN
444                pa_debug.g_err_stage:= 'Calling PA_FP_EXCLUDED_ELEMENTS_PKG.DELETE_ROW...';
445                pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,
446                                           L_DEBUG_LEVEL3);
447           END IF;
448 
449           PA_FP_EXCLUDED_ELEMENTS_PKG.DELETE_ROW(
450                 p_row_id                      => excl_elems_rec.rowid,
451                 x_return_status               => x_return_status);
452 
453           IF x_return_status <>  FND_API.G_RET_STS_SUCCESS THEN
454                IF l_debug_mode = 'Y' THEN
455                     pa_debug.g_err_stage:= 'Error returned by PA_FP_EXCLUDED_ELEMENTS_PKG.DELETE_ROW';
456                     pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,
457                                                L_DEBUG_LEVEL5);
458                END IF;
459                CLOSE cur_excl_elems;
460                RAISE PA_FP_CONSTANTS_PKG.Invalid_Arg_Exc;
461           END IF;
462 
463      END IF;
464 
465      CLOSE cur_excl_elems;
466 
467      IF l_debug_mode = 'Y' THEN
468           pa_debug.g_err_stage:= 'Exiting Delete_Excluded_Elements';
469           pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,
470                                    L_DEBUG_LEVEL3);
471           pa_debug.reset_curr_function;
472      END IF;
473 EXCEPTION
474 
475 WHEN Pa_Fp_Constants_Pkg.Invalid_Arg_Exc THEN
476 
477      x_return_status := FND_API.G_RET_STS_ERROR;
478      l_msg_count := FND_MSG_PUB.count_msg;
479 
480      IF cur_excl_elems%ISOPEN THEN
481           CLOSE cur_excl_elems;
482      END IF;
483 
484      IF l_msg_count = 1 and x_msg_data IS NULL THEN
485           PA_INTERFACE_UTILS_PUB.get_messages
486               (p_encoded        => FND_API.G_TRUE
487               ,p_msg_index      => 1
488               ,p_msg_count      => l_msg_count
489               ,p_msg_data       => l_msg_data
490               ,p_data           => l_data
491               ,p_msg_index_out  => l_msg_index_out);
492           x_msg_data := l_data;
493           x_msg_count := l_msg_count;
494      ELSE
495           x_msg_count := l_msg_count;
496      END IF;
497      IF l_debug_mode = 'Y' THEN
498           pa_debug.reset_curr_function;
499      END IF;
500 
501      RETURN;
502 
503 WHEN others THEN
504 
505      x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
506      x_msg_count     := 1;
507      x_msg_data      := SQLERRM;
508 
509      IF cur_excl_elems%ISOPEN THEN
510           CLOSE cur_excl_elems;
511      END IF;
512 
513      FND_MSG_PUB.add_exc_msg
514                    ( p_pkg_name        => 'pa_fp_excluded_elements_pub'
515                     ,p_procedure_name  => 'Delete_Excluded_Elements'
516                     ,p_error_text      => x_msg_data);
517 
518      IF l_debug_mode = 'Y' THEN
519           pa_debug.g_err_stage:= 'Unexpected Error'||x_msg_data;
520           pa_debug.write(L_PROCEDURE_NAME,pa_debug.g_err_stage,
521                               L_DEBUG_LEVEL5);
522           pa_debug.reset_curr_function;
523      END IF;
524      RAISE;
525 END Delete_Excluded_Elements;
526 
527 END pa_fp_excluded_elements_pub;