DBA Data[Home] [Help]

PACKAGE BODY: APPS.PA_EGO_WRAPPER_PUB

Source


1 PACKAGE BODY PA_EGO_WRAPPER_PUB AS
2  /* $Header: PAEGOWPB.pls 120.2 2006/01/12 01:52:25 msachan noship $   */
3 
4 l_pkg_name    VARCHAR2(30) := 'PA_EGO_WRAPPER_PUB';
5 
6 
7 	/*-----------------------------------------------------------+
8 	 | For Details/Comments Refer Package Specification Comments |
9 	 +-----------------------------------------------------------*/
10 
11 PROCEDURE check_delete_phase_ok(
12 	p_api_version			IN	NUMBER   :=1.0			,
13 	p_phase_id 			IN	NUMBER				,
14 	p_init_msg_list			IN	VARCHAR2 := NULL		,
15 	x_delete_ok			OUT	NOCOPY VARCHAR2			, -- NOCOPY change for Bug 4939368
16 	x_return_status			OUT	NOCOPY VARCHAR2			, -- NOCOPY change for Bug 4939368
17 	x_errorcode			OUT	NOCOPY NUMBER				, -- NOCOPY change for Bug 4939368
18 	x_msg_count			OUT	NOCOPY NUMBER				, -- NOCOPY change for Bug 4939368
19 	x_msg_data			OUT	NOCOPY VARCHAR2  -- NOCOPY change for Bug 4939368
20 	)
21 IS
22 	l_api_name	     CONSTANT VARCHAR(30) := 'check_delete_phase_ok';
23 	l_api_version        CONSTANT NUMBER      := 1.0;
24 	l_msg_count                   NUMBER;
25 	l_msg_index_out               NUMBER;
26 	l_data			      VARCHAR2(2000);
27 	l_msg_data		      VARCHAR2(2000);
28 	l_return_status		      VARCHAR2(1);
29 	l_errorcode		      NUMBER;
30 
31 	l_phase_id		      NUMBER;
32         l_delete_ok                   VARCHAR2(1);
33 BEGIN
34 
35         IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version	,
36                                            p_api_version	,
37                                            l_api_name		,
38                                            l_pkg_name)
39         THEN
40 	      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
41         END IF;
42 
43 	x_return_status := FND_API.G_RET_STS_SUCCESS;
44 	x_delete_ok     := FND_API.G_FALSE;
45 
46 	EGO_LIFECYCLE_ADMIN_PUB.check_delete_phase_ok(
47 		p_api_version		=> p_api_version	,
48 		p_phase_id		=> p_phase_id		,
49 		p_init_msg_list		=> p_init_msg_list	,
50 		x_delete_ok		=> l_delete_ok		,
51 		x_return_status		=> l_return_status	,
52 		x_errorcode		=> l_errorcode		,
53 		x_msg_count		=> l_msg_count		,
54 		x_msg_data		=> l_msg_data );
55 
56 /* Bug 2760719 -- Added check for l_delete_ok  <> FND_API.G_TRUE and moved raise statement
57                   outside the IF l_msg_count > 0 */
58 
59 	IF l_delete_ok  <> FND_API.G_TRUE OR l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
60 		l_msg_count := FND_MSG_PUB.count_msg;
61      		If l_msg_count > 0 THEN
62 		     x_msg_count := l_msg_count;
63 		     If l_msg_count = 1 THEN
64 		             pa_interface_utils_pub.get_messages
65 				 (p_encoded        => FND_API.G_TRUE		,
66 			          p_msg_index      => 1				,
67 			          p_msg_count      => l_msg_count		,
68 			          p_msg_data       => l_msg_data		,
69 			          p_data           => l_data			,
70 			          p_msg_index_out  => l_msg_index_out
71 				  );
72 			    x_msg_data := l_data;
73 		     End if;
74 		End if;
75 	        RAISE  FND_API.G_EXC_ERROR;
76 	END IF;
77 x_errorcode          := l_errorcode;
78 x_return_status      := l_return_status;
79 x_delete_ok          := l_delete_ok;
80 
81 EXCEPTION
82 
83 WHEN FND_API.G_EXC_UNEXPECTED_ERROR  THEN
84 
85     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
86     x_delete_ok     := FND_API.G_FALSE;            -- NOCOPY change for Bug 4939368
87     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
88     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
89     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
90     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
91                             p_procedure_name => 'check_delete_phase_ok',
92                             p_error_text     => x_msg_data);
93 
94 WHEN FND_API.G_EXC_ERROR THEN
95     x_return_status := FND_API.G_RET_STS_ERROR;
96     x_delete_ok     := FND_API.G_FALSE;            -- NOCOPY change for Bug 4939368
97     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
98     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
99     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
100     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
101                             p_procedure_name => 'check_delete_phase_ok',
102                             p_error_text     => x_msg_data); -- NOCOPY change for Bug 4939368
103 
104 WHEN OTHERS THEN
105 
106     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
107     x_delete_ok     := FND_API.G_FALSE;            -- NOCOPY change for Bug 4939368
108     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
109     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
110     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
111     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
112                             p_procedure_name => 'check_delete_phase_ok',
113                             p_error_text     => x_msg_data);
114     raise;
115 END check_delete_phase_ok;
116 
117 	/*-----------------------------------------------------------+
118 	 | For Details/Comments Refer Package Specification Comments |
119 	 +-----------------------------------------------------------*/
120 
121 PROCEDURE process_phase_delete(
122 	p_api_version	IN	NUMBER	:= 1.0		,
123 	p_phase_id 	IN	NUMBER			,
124 	p_init_msg_list	IN	VARCHAR2 := NULL	,
125 	p_commit       	IN	VARCHAR2 := NULL	,
126 	x_errorcode   	OUT	NOCOPY NUMBER			, -- NOCOPY change for Bug 4939368
127 	x_return_status	OUT	NOCOPY VARCHAR2		, -- NOCOPY change for Bug 4939368
128 	x_msg_count	OUT	NOCOPY NUMBER			, -- NOCOPY change for Bug 4939368
129 	x_msg_data	OUT	NOCOPY VARCHAR2 -- NOCOPY change for Bug 4939368
130 	)
131 IS
132 	l_api_name	     CONSTANT VARCHAR(30) := 'process_phase_delete';
133 	l_api_version        CONSTANT NUMBER      := 1.0;
134 	l_msg_count                   NUMBER;
135 	l_msg_index_out               NUMBER;
136 	l_data			      VARCHAR2(2000);
137 	l_msg_data		      VARCHAR2(2000);
138 	l_return_status		      VARCHAR2(1);
139 	l_errorcode		      NUMBER;
140 
141 	l_lifecycle_phase_id	      NUMBER;
142 	BEGIN
143 
144 	IF(p_commit = FND_API.G_TRUE) THEN
145 	  SAVEPOINT wrapper_process_phase_delete;
146 	END IF;
147 
148 
149         IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version	,
150                                            p_api_version	,
151                                            l_api_name		,
152                                            l_pkg_name)
153         THEN
154 	      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
155         END IF;
156 
157 
158 	x_return_status := FND_API.G_RET_STS_SUCCESS;
159 
160 	EGO_LIFECYCLE_ADMIN_PUB.process_phase_delete(
161 		p_api_version		=> p_api_version	,
162 		p_phase_id		=> p_phase_id		,
163 		p_init_msg_list		=> p_init_msg_list	,
164 		p_commit		=> p_commit		,
165 		x_errorcode		=> l_errorcode		,
166 		x_msg_count		=> l_msg_count		,
167 		x_return_status 	=> l_return_status	,
168 		x_msg_data		=> l_msg_data
169 		);
170 
171 /* Bug 2760719 -- Added check for l_return_status  <> FND_API.G_RET_STS_SUCCESS and moved raise statement
172                   outside the IF l_msg_count > 0 */
173 
174 	IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
175 		l_msg_count := FND_MSG_PUB.count_msg;
176 		If l_msg_count > 0 THEN
177 		    x_msg_count := l_msg_count;
178 	          If l_msg_count = 1 THEN
179 		     pa_interface_utils_pub.get_messages
180 			 (p_encoded        => FND_API.G_TRUE		,
181 		          p_msg_index      => 1				,
182 		          p_msg_count      => l_msg_count		,
183 		          p_msg_data       => l_msg_data		,
184 		          p_data           => l_data			,
185 		          p_msg_index_out  => l_msg_index_out
186 			  );
187 		    x_msg_data := l_data;
188 		  End if;
189 		End if;
190 	        RAISE  FND_API.G_EXC_ERROR;
191 	END IF;
192 
193 x_errorcode          := l_errorcode;
194 x_return_status      := l_return_status;
195 
196 IF FND_API.TO_BOOLEAN(P_COMMIT) THEN
197         COMMIT;
198 END IF;
199 
200 EXCEPTION
201 
202 WHEN FND_API.G_EXC_UNEXPECTED_ERROR  THEN
203     IF p_commit = FND_API.G_TRUE THEN
204        ROLLBACK TO wrapper_process_phase_delete;
205     END IF;
206     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
207     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
208     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
209     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
210     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
211                             p_procedure_name => 'process_phase_delete',
212                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
213 
214 WHEN FND_API.G_EXC_ERROR THEN
215     x_return_status := FND_API.G_RET_STS_ERROR;
216     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
217     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
218     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
219     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
220                             p_procedure_name => 'process_phase_delete',
221                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
222     IF p_commit = FND_API.G_TRUE THEN
223        ROLLBACK TO wrapper_process_phase_delete;
224     END IF;
225 
226 WHEN OTHERS THEN
227     IF p_commit = FND_API.G_TRUE THEN
228        ROLLBACK TO wrapper_process_phase_delete;
229     END IF;
230     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
231     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
232     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
233     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
234     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
235                             p_procedure_name => 'process_phase_delete',
236                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
237     raise;
238 END process_phase_delete;
239 
240 
241 
242 	/*-----------------------------------------------------------+
243 	 | For Details/Comments Refer Package Specification Comments |
244 	 +-----------------------------------------------------------*/
245 
246 PROCEDURE check_delete_lifecycle_ok(
247 	p_api_version			IN	NUMBER	:= 1.0			,
248 	p_lifecycle_id 			IN	NUMBER				,
249 	p_init_msg_list			IN	VARCHAR2 := NULL		,
250 	x_delete_ok			OUT	NOCOPY VARCHAR2			, -- NOCOPY change for Bug 4939368
251 	x_return_status			OUT	NOCOPY VARCHAR2			, -- NOCOPY change for Bug 4939368
252 	x_errorcode			OUT	NOCOPY NUMBER				, -- NOCOPY change for Bug 4939368
253 	x_msg_count			OUT	NOCOPY NUMBER				, -- NOCOPY change for Bug 4939368
254 	x_msg_data			OUT	NOCOPY VARCHAR2 -- NOCOPY change for Bug 4939368
255 	)
256 IS
257 	l_api_name	     CONSTANT VARCHAR(30) := 'check_delete_lifecycle_ok';
258 	l_api_version        CONSTANT NUMBER      := 1.0;
259 	l_msg_count                   NUMBER;
260 	l_msg_index_out               NUMBER;
261 	l_data			      VARCHAR2(2000);
262 	l_msg_data		      VARCHAR2(2000);
263 	l_return_status		      VARCHAR2(1);
264 	l_errorcode		      NUMBER;
265 
266 	l_lifecycle_id		      NUMBER;
267 	l_delete_ok		      VARCHAR2(1);
268 BEGIN
269 
270         IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version	,
271                                            p_api_version	,
272                                            l_api_name		,
273                                            l_pkg_name)
274         THEN
275 	      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
276         END IF;
277 
278 
279 	x_return_status := FND_API.G_RET_STS_SUCCESS;
280 	x_delete_ok     := FND_API.G_FALSE;
281 
282 	EGO_LIFECYCLE_ADMIN_PUB.check_delete_lifecycle_ok(
283 		p_api_version		=> p_api_version	,
284 		p_lifecycle_id		=> p_lifecycle_id	,
285 		p_init_msg_list		=> p_init_msg_list	,
286 		x_delete_ok		=> l_delete_ok		,
287 		x_return_status		=> l_return_status	,
288 		x_errorcode		=> l_errorcode		,
289 		x_msg_count		=> l_msg_count		,
290 		x_msg_data		=> l_msg_data );
291 
292 /* Bug 2760719 -- Added check for l_delete_ok  <> FND_API.G_TRUE and moved raise statement
293                   outside the IF l_msg_count > 0 */
294 
295 	IF l_delete_ok  <> FND_API.G_TRUE OR l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
296 		l_msg_count := FND_MSG_PUB.count_msg;
297 		If l_msg_count > 0 THEN
298 	          x_msg_count := l_msg_count;
299 		  If l_msg_count = 1 THEN
300 	             pa_interface_utils_pub.get_messages
301 		         (p_encoded        => FND_API.G_TRUE		,
302 		          p_msg_index      => 1				,
303 		          p_msg_count      => l_msg_count		,
304 		          p_msg_data       => l_msg_data		,
305 		          p_data           => l_data			,
306 		          p_msg_index_out  => l_msg_index_out
307 			  );
308 		    x_msg_data := l_data;
309 		 End if;
310 		End if;
311 		RAISE  FND_API.G_EXC_ERROR;
312 	END IF;
313 x_errorcode          := l_errorcode;
314 x_return_status      := l_return_status;
315 x_delete_ok	     := l_delete_ok;
316 
317 
318 EXCEPTION
319 
320 WHEN FND_API.G_EXC_UNEXPECTED_ERROR  THEN
321 
322     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
323     x_delete_ok     := FND_API.G_FALSE;            -- NOCOPY change for Bug 4939368
324     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
325     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
326     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
327     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
328                             p_procedure_name => 'check_delete_lifecycle_ok',
329                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
330 
331 WHEN FND_API.G_EXC_ERROR THEN
332     x_return_status := FND_API.G_RET_STS_ERROR;
333     x_delete_ok     := FND_API.G_FALSE;            -- NOCOPY change for Bug 4939368
334     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
335     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
336     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
337     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
338                             p_procedure_name => 'check_delete_lifecycle_ok',
339                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
340 
341 WHEN OTHERS THEN
342 
343     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
344     x_delete_ok     := FND_API.G_FALSE;            -- NOCOPY change for Bug 4939368
345     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
346     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
347     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
348     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
349                             p_procedure_name => 'check_delete_lifecycle_ok',
350                             p_error_text     =>  x_msg_data);
351     raise;
352 END check_delete_lifecycle_ok;
353 
354 
355 	/*-----------------------------------------------------------+
356 	 | For Details/Comments Refer Package Specification Comments |
357 	 +-----------------------------------------------------------*/
358 
359 
360 PROCEDURE delete_stale_data_for_lc(
361 	p_api_version			IN NUMBER := 1.0			,
362 	p_lifecycle_id 			IN NUMBER				,
363 	p_init_msg_list			IN VARCHAR2 := NULL			,
364 	p_commit       			IN VARCHAR2 := NULL			,
365 	x_errorcode   			OUT NOCOPY NUMBER				, -- NOCOPY change for Bug 4939368
366 	x_return_status			OUT NOCOPY VARCHAR2				, -- NOCOPY change for Bug 4939368
367 	x_msg_count			OUT NOCOPY NUMBER				, -- NOCOPY change for Bug 4939368
368 	x_msg_data			OUT NOCOPY VARCHAR2 -- NOCOPY change for Bug 4939368
369 	)
370 
371 IS
372 	l_api_name	     CONSTANT VARCHAR(30) := 'delete_stale_data_for_lc';
373 	l_api_version        CONSTANT NUMBER      := 1.0;
374 	l_msg_count                   NUMBER;
375 	l_msg_index_out               NUMBER;
376 	l_data			      VARCHAR2(2000);
377 	l_msg_data		      VARCHAR2(2000);
378 	l_return_status		      VARCHAR2(1);
379 	l_errorcode		      NUMBER;
380 
381 	l_lifecycle_id	      NUMBER;
382 	BEGIN
383 
384 	IF(p_commit = FND_API.G_TRUE) THEN
385 	  SAVEPOINT wrapper_delete_data_for_lc;
386 	END IF;
387 
388 
389         IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version	,
390                                            p_api_version	,
391                                            l_api_name		,
392                                            l_pkg_name)
393         THEN
394 	      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
395         END IF;
396 
397 
398 	x_return_status := FND_API.G_RET_STS_SUCCESS;
399 
400 	EGO_LIFECYCLE_ADMIN_PUB.delete_stale_data_for_lc(
401 		p_api_version		=> p_api_version	,
402 		p_lifecycle_id		=> p_lifecycle_id	,
403 		p_init_msg_list		=> p_init_msg_list	,
404 		p_commit		=> p_commit		,
405 		x_errorcode		=> l_errorcode		,
406 		x_msg_count		=> l_msg_count		,
407 		x_return_status 	=> l_return_status	,
408 		x_msg_data		=> l_msg_data
409 		);
410 
411 /* Bug 2760719 -- Added check for l_return_status  <> FND_API.G_RET_STS_SUCCESS and moved raise statement
412                   outside the IF l_msg_count > 0 */
413 
414 	IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
415 		l_msg_count := FND_MSG_PUB.count_msg;
416 		If l_msg_count > 0 THEN
417 	          x_msg_count := l_msg_count;
418 		  If l_msg_count = 1 THEN
419 	             pa_interface_utils_pub.get_messages
420 		         (p_encoded        => FND_API.G_TRUE		,
421 		          p_msg_index      => 1				,
422 		          p_msg_count      => l_msg_count		,
423 		          p_msg_data       => l_msg_data		,
424 		          p_data           => l_data			,
425 		          p_msg_index_out  => l_msg_index_out
426 			  );
427 		    x_msg_data := l_data;
428 		 End if;
429 		End if;
430 		RAISE  FND_API.G_EXC_ERROR;
431 	END IF;
432 
433 x_errorcode          := l_errorcode;
434 x_return_status      := l_return_status;
435 
436 IF FND_API.TO_BOOLEAN(P_COMMIT) THEN
437         COMMIT;
438 END IF;
439 
440 EXCEPTION
441 
442 WHEN FND_API.G_EXC_UNEXPECTED_ERROR  THEN
443     IF p_commit = FND_API.G_TRUE THEN
444        ROLLBACK TO wrapper_delete_data_for_lc;
445     END IF;
446     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
447     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
448     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
449     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
450     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
451                             p_procedure_name => 'delete_stale_data_for_lc',
452                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
453 
454 WHEN FND_API.G_EXC_ERROR THEN
455     x_return_status := FND_API.G_RET_STS_ERROR;
456     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
457     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
458     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
459     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
460                             p_procedure_name => 'delete_stale_data_for_lc',
461                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
462     IF p_commit = FND_API.G_TRUE THEN
463        ROLLBACK TO wrapper_delete_data_for_lc;
464     END IF;
465 
466 WHEN OTHERS THEN
467     IF p_commit = FND_API.G_TRUE THEN
468        ROLLBACK TO wrapper_delete_data_for_lc;
469     END IF;
470     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
471     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
472     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
473     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
474     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
475                             p_procedure_name => 'delete_stale_data_for_lc',
476                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
477     raise;
478 END delete_stale_data_for_lc;
479 
480 
481 	/*-----------------------------------------------------------+
482 	 | For Details/Comments Refer Package Specification Comments |
483 	 +-----------------------------------------------------------*/
484 
485 
486 
487 PROCEDURE get_policy_for_phase_change(
488 	p_api_version			IN	NUMBER	:= 1.0			,
489         p_project_id                    IN      NUMBER                          , -- Bug 2800909
490 	p_current_phase_id		IN	NUMBER				,
491 	p_future_phase_id		IN	NUMBER				,
492 	p_phase_change_code		IN	VARCHAR2			,
493 	p_lifecycle_id			IN	NUMBER				,
494 	x_policy_code			OUT	NOCOPY VARCHAR2			, -- NOCOPY change for Bug 4939368
495 	x_return_status			OUT	NOCOPY VARCHAR2			, -- NOCOPY change for Bug 4939368
496 	x_error_message			OUT	NOCOPY VARCHAR2			, -- Bug 2760719 -- NOCOPY change for Bug 4939368
497 	x_errorcode			OUT	NOCOPY NUMBER				, -- NOCOPY change for Bug 4939368
498 	x_msg_count			OUT	NOCOPY NUMBER				, -- NOCOPY change for Bug 4939368
499 	x_msg_data			OUT	NOCOPY VARCHAR2			 -- NOCOPY change for Bug 4939368
500 	)
501 IS
502 	l_api_name	     CONSTANT VARCHAR(30) := 'get_policy_for_phase_change';
503 	l_api_version        CONSTANT NUMBER      := 1.0;
504 	l_msg_count                   NUMBER;
505 	l_msg_index_out               NUMBER;
506 	l_data			      VARCHAR2(2000);
507 	l_msg_data		      VARCHAR2(2000);
508 	l_return_status		      VARCHAR2(1);
509 	l_errorcode		      NUMBER;
510 	l_policy_code		      VARCHAR2(30);
511 	l_error_message		      VARCHAR2(32);	-- Bug 2760719
512 
513 BEGIN
514 
515         IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version	,
516                                            p_api_version	,
517                                            l_api_name		,
518                                            l_pkg_name)
519         THEN
520 	      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
521         END IF;
522 
523 
524 	x_return_status := FND_API.G_RET_STS_SUCCESS;
525 	x_policy_code   := 'NOT_ALLOWED';
526 
527 	EGO_LIFECYCLE_USER_PUB.get_policy_for_phase_change(
528 		p_api_version		=> p_api_version	,
529 		p_project_id            => p_project_id         ,  -- Bug 2800909
530 		p_curr_phase_id		=> p_current_phase_id	,
531 		p_future_phase_id	=> p_future_phase_id	,
532 		p_phase_change_code	=> p_phase_change_code	,
533 		p_lifecycle_id		=> p_lifecycle_id	,
534 		x_policy_code		=> l_policy_code	,
535 		x_error_message		=> l_error_message	, -- Bug 2760719
536 		x_return_status		=> l_return_status	,
537 		x_errorcode		=> l_errorcode		,
538 		x_msg_count		=> l_msg_count		,
539 		x_msg_data		=> l_msg_data );
540 
541 -- Note that raising and population of error messages is not done here. It is the calling api's
542 -- responsibility to put the error messahe into stack if required.
543 
544 x_errorcode	     := l_errorcode;
545 x_error_message	     :=	l_error_message;
546 x_return_status      := l_return_status;
547 x_policy_code	     := l_policy_code;
548 
549 EXCEPTION
550 
551 WHEN FND_API.G_EXC_UNEXPECTED_ERROR  THEN
552 
553     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
554     x_policy_code   := 'NOT_ALLOWED';              -- NOCOPY change for Bug 4939368
555     x_error_message := SQLERRM;                    -- NOCOPY change for Bug 4939368
556     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
557     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
558     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
559     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
560                             p_procedure_name => 'get_policy_for_phase_change',
561                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
562 
563 WHEN FND_API.G_EXC_ERROR THEN
564     x_return_status := FND_API.G_RET_STS_ERROR;
565     x_policy_code   := 'NOT_ALLOWED';              -- NOCOPY change for Bug 4939368
566     x_error_message := SQLERRM;                    -- NOCOPY change for Bug 4939368
567     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
568     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
569     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
570     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
571                             p_procedure_name => 'get_policy_for_phase_change',
572                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
573 
574 WHEN OTHERS THEN
575 
576     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
577     x_policy_code   := 'NOT_ALLOWED';              -- NOCOPY change for Bug 4939368
578     x_error_message := SQLERRM;                    -- NOCOPY change for Bug 4939368
579     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
580     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
581     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
582     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
583                             p_procedure_name => 'get_policy_for_phase_change',
584                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
585     raise;
586 END get_policy_for_phase_change;
587 
588 
589 	/*-----------------------------------------------------------+
590 	 | For Details/Comments Refer Package Specification Comments |
591 	 +-----------------------------------------------------------*/
592 
593 PROCEDURE sync_phase_change(
594 	p_api_version			IN	NUMBER	:=1.0			,
595 	p_project_id    		IN	NUMBER				,
596 	p_lifecycle_id 			IN	NUMBER				,
597 	p_phase_id 			IN	NUMBER				,
598 	p_effective_date		IN	DATE				,
599 	p_init_msg_list			IN	VARCHAR2 := NULL		,
600 	p_commit       			IN	VARCHAR2 := NULL		,
601 	x_errorcode   			OUT	NOCOPY NUMBER				, -- NOCOPY change for Bug 4939368
602 	x_return_status			OUT	NOCOPY VARCHAR2			, -- NOCOPY change for Bug 4939368
603 	x_msg_count			OUT	NOCOPY NUMBER				, -- NOCOPY change for Bug 4939368
604 	x_msg_data			OUT	NOCOPY VARCHAR2 -- NOCOPY change for Bug 4939368
605 	)
606 IS
607 	l_api_name	     CONSTANT VARCHAR(30) := 'sync_phase_change';
608 	l_api_version        CONSTANT NUMBER      := 1.0;
609 	l_msg_count                   NUMBER;
610 	l_msg_index_out               NUMBER;
611 	l_data			      VARCHAR2(2000);
612 	l_msg_data		      VARCHAR2(2000);
613 	l_return_status		      VARCHAR2(1);
614 	l_errorcode		      NUMBER;
615 
616 BEGIN
617 	IF(p_commit = FND_API.G_TRUE) THEN
618 		  SAVEPOINT wrapper_sync_phase_change;
619 	END IF;
620 
621         IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version	,
622                                            p_api_version	,
623                                            l_api_name		,
624                                            l_pkg_name)
625         THEN
626 	      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
627         END IF;
628 
629 
630 	x_return_status := FND_API.G_RET_STS_SUCCESS;
631 
632 	EGO_LIFECYCLE_USER_PUB.sync_phase_change(
633 		p_api_version		=> p_api_version	,
634 		p_project_id		=> p_project_id		,
635 		p_lifecycle_id		=> p_lifecycle_id	,
636 		p_phase_id		=> p_phase_id		,
637 		p_effective_date	=> p_effective_date	,
638 		p_init_msg_list		=> p_init_msg_list	,
639 		p_commit		=> p_commit		,
640 		x_errorcode		=> l_errorcode		,
641 		x_msg_count		=> l_msg_count		,
642 		x_return_status 	=> l_return_status	,
643 		x_msg_data		=> l_msg_data );
644 
645 /* Bug 2760719 -- Added check for l_return_status  <> FND_API.G_RET_STS_SUCCESS and moved raise statement
646                   outside the IF l_msg_count > 0 */
647 /*** Commented for bug 4049700 the code as this is calling the pa_interface_utils_pub.get_messages
648 even if the l_msg_count is returned as 1
649 
650 	IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
651 		l_msg_count := FND_MSG_PUB.count_msg;
652 		If l_msg_count > 0 THEN
653 	          x_msg_count := l_msg_count;
654 		  If l_msg_count = 1 THEN
655 	             pa_interface_utils_pub.get_messages
656 		         (p_encoded        => FND_API.G_TRUE		,
657 		          p_msg_index      => 1				,
658 		          p_msg_count      => l_msg_count		,
659 		          p_msg_data       => l_msg_data		,
660 		          p_data           => l_data			,
661 		          p_msg_index_out  => l_msg_index_out
662 			  );
663 		    x_msg_data := l_data;
664 		 End if;
665 		End if;
666 	        RAISE  FND_API.G_EXC_ERROR;
667 	END IF;
668 ***/
669 
670 /** Added for 4049700 **/
671 	IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
672 	   IF NVL(l_msg_count,0) = 1 THEN
673 	     x_return_status   := l_return_status;
674 	     x_msg_count       := l_msg_count;
675 	     x_msg_data        := l_msg_data;
676              IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_ERROR) THEN
677 		FND_MESSAGE.SET_NAME('PA','PA_SHOW_EGO_ERROR');
678 		FND_MESSAGE.SET_TOKEN('ERROR_TEXT',l_msg_data);
679 		FND_MSG_PUB.add;
680       	     END IF;
681 	     RAISE  FND_API.G_EXC_ERROR;
682 	   ELSE
683 		l_msg_count := FND_MSG_PUB.count_msg;
684 		If l_msg_count > 0 THEN
685 		  x_msg_count := l_msg_count;
686 		     pa_interface_utils_pub.get_messages
687 			 (p_encoded        => FND_API.G_TRUE		,
688 			  p_msg_index      => 1				,
689 			  p_msg_count      => l_msg_count		,
690 			  p_msg_data       => l_msg_data		,
691 			  p_data           => l_data			,
692 			  p_msg_index_out  => l_msg_index_out
693 			  );
694 		    x_msg_data := l_data;
695 		End if;
696 		RAISE  FND_API.G_EXC_ERROR;
697 	   END IF;
698       END IF;
699 /** End for 4049700 **/
700 
701 x_errorcode	     := l_errorcode;
702 x_return_status      := l_return_status;
703 
704 IF FND_API.TO_BOOLEAN(P_COMMIT) THEN
705         COMMIT;
706 END IF;
707 
708 EXCEPTION
709 
710 WHEN FND_API.G_EXC_UNEXPECTED_ERROR  THEN
711 	IF FND_API.TO_BOOLEAN(P_COMMIT) THEN
712 	      ROLLBACK TO wrapper_sync_phase_change;
713 	END IF;
714 
715     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
716     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
717     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
718     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
719     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
720                             p_procedure_name => 'sync_phase_change',
721                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
722 
723 WHEN FND_API.G_EXC_ERROR THEN
724     x_return_status := FND_API.G_RET_STS_ERROR;
725 	IF FND_API.TO_BOOLEAN(P_COMMIT) THEN
726 	      ROLLBACK TO wrapper_sync_phase_change;
727 	END IF;
728     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
729     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
730     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
731     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
732                             p_procedure_name => 'sync_phase_change',
733                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
734 
735 	/* Added for 4049700 */
736         RAISE;
737 	/** End for 4049700 **/
738 
739 WHEN OTHERS THEN
740 
741 	IF FND_API.TO_BOOLEAN(P_COMMIT) THEN
742 	      ROLLBACK TO wrapper_sync_phase_change;
743 	END IF;
744     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
745     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
746     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
747     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
748     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
749                             p_procedure_name => 'sync_phase_change',
750                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
751     raise;
752 END sync_phase_change;
753 
754 	/*-----------------------------------------------------------+
755 	 | For Details/Comments Refer Package Specification Comments |
756 	 +-----------------------------------------------------------*/
757 
758 PROCEDURE check_lc_tracking_project(
759 	p_api_version			IN	NUMBER	:= 1.0			,
760 	p_project_id			IN	NUMBER				,
761 	x_is_lifecycle_tracking		OUT	NOCOPY VARCHAR2			, -- NOCOPY change for Bug 4939368
762 	x_return_status			OUT	NOCOPY VARCHAR2			, -- NOCOPY change for Bug 4939368
763 	x_errorcode			OUT	NOCOPY NUMBER				, -- NOCOPY change for Bug 4939368
764 	x_msg_count			OUT	NOCOPY NUMBER				, -- NOCOPY change for Bug 4939368
765 	x_msg_data			OUT	NOCOPY VARCHAR2 -- NOCOPY change for Bug 4939368
766 	)
767 IS
768 	l_api_name	     CONSTANT VARCHAR(30) := 'check_lc_tracking_project';
769 	l_api_version        CONSTANT NUMBER      := 1.0;
770 	l_msg_count                   NUMBER;
771 	l_msg_index_out               NUMBER;
772 	l_data			      VARCHAR2(2000);
773 	l_msg_data		      VARCHAR2(2000);
774 	l_return_status		      VARCHAR2(1);
775 	l_errorcode		      NUMBER;
776 	l_is_lifecycle_tracking	      VARCHAR2(30);
777 
778 BEGIN
779 
780         IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version	,
781                                            p_api_version	,
782                                            l_api_name		,
783                                            l_pkg_name)
784         THEN
785 	      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
786         END IF;
787 
788 
789 	x_return_status		  := FND_API.G_RET_STS_SUCCESS;
790 	x_is_lifecycle_tracking   := FND_API.G_TRUE;
791 
792 
793 	EGO_LIFECYCLE_USER_PUB.check_lc_tracking_project(
794 		p_api_version		=> p_api_version		,
795 		p_project_id		=> p_project_id			,
796 		x_is_lifecycle_tracking	=> l_is_lifecycle_tracking	,
797 		x_return_status		=> l_return_status		,
798 		x_errorcode		=> l_errorcode			,
799 		x_msg_count		=> l_msg_count			,
800 		x_msg_data		=> l_msg_data );
801 
802 -- Note that raising and population of error messages is not done here. It is the calling api's
803 -- responsibility to put the error messahe into stack if required.
804 
805 x_errorcode	     := l_errorcode;
806 x_return_status         := l_return_status;
807 x_is_lifecycle_tracking	:= l_is_lifecycle_tracking;
808 
809 EXCEPTION
810 
811 WHEN FND_API.G_EXC_UNEXPECTED_ERROR  THEN
812     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
813     x_is_lifecycle_tracking := FND_API.G_TRUE;     -- NOCOPY change for Bug 4939368
814     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
815     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
816     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
817     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
818                             p_procedure_name => 'check_lc_tracking_project',
819                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
820 
821 WHEN FND_API.G_EXC_ERROR THEN
822     x_return_status := FND_API.G_RET_STS_ERROR;
823     x_is_lifecycle_tracking := FND_API.G_TRUE;     -- NOCOPY change for Bug 4939368
824     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
825     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
826     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
827     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
828                             p_procedure_name => 'check_lc_tracking_project',
829                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
830 
831 WHEN OTHERS THEN
832     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
833     x_is_lifecycle_tracking := FND_API.G_TRUE;     -- NOCOPY change for Bug 4939368
834     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
835     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
836     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
837     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
838                             p_procedure_name => 'check_lc_tracking_project',
839                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
840     raise;
841 END check_lc_tracking_project;
842 
843 
844 	/*-----------------------------------------------------------+
845 	 | For Details/Comments Refer Package Specification Comments |
846 	 +-----------------------------------------------------------*/
847 
848 PROCEDURE check_delete_project_ok(
849 	p_api_version		IN	NUMBER	   :=1.0	,
850 	p_project_id 		IN	NUMBER			,
851 	p_init_msg_list		IN	VARCHAR2   := NULL	,
852 	x_delete_ok		OUT	NOCOPY VARCHAR2		, -- NOCOPY change for Bug 4939368
853 	x_return_status		OUT	NOCOPY VARCHAR2		, -- NOCOPY change for Bug 4939368
854 	x_errorcode		OUT	NOCOPY NUMBER			, -- NOCOPY change for Bug 4939368
855 	x_msg_count		OUT	NOCOPY NUMBER			, -- NOCOPY change for Bug 4939368
856 	x_msg_data		OUT	NOCOPY VARCHAR2  -- NOCOPY change for Bug 4939368
857 	)
858 IS
859 	l_api_name	     CONSTANT VARCHAR(30) := 'check_delete_project_ok';
860 	l_api_version        CONSTANT NUMBER      := 1.0;
861 	l_msg_count                   NUMBER;
862 	l_msg_index_out               NUMBER;
863 	l_data			      VARCHAR2(2000);
864 	l_msg_data		      VARCHAR2(2000);
865 	l_return_status		      VARCHAR2(1);
866 	l_errorcode		      NUMBER;
867 
868 	l_phase_id		      NUMBER;
869         l_delete_ok                   VARCHAR2(1);
870 BEGIN
871 
872         IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version	,
873                                            p_api_version	,
874                                            l_api_name		,
875                                            l_pkg_name)
876         THEN
877 	      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
878         END IF;
879 
880 
881 	x_return_status := FND_API.G_RET_STS_SUCCESS;
882 	x_delete_ok     := FND_API.G_FALSE;
883 
884 	EGO_LIFECYCLE_USER_PUB.check_delete_project_ok(
885 		p_api_version		=> p_api_version	,
886 		p_project_id		=> p_project_id		,
887 		p_init_msg_list		=> p_init_msg_list	,
888 		x_delete_ok		=> l_delete_ok		,
889 		x_return_status		=> l_return_status	,
890 		x_errorcode		=> l_errorcode		,
891 		x_msg_count		=> l_msg_count		,
892 		x_msg_data		=> l_msg_data );
893 
894 	/* Bug 2760719 -- Added check for l_delete_ok  <> FND_API.G_TRUE and moved raise statement
895                   outside the IF l_msg_count > 0 */
896 
897 	IF l_delete_ok  <> FND_API.G_TRUE OR l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
898 		l_msg_count := FND_MSG_PUB.count_msg;
899 		If l_msg_count > 0 THEN
900 	          x_msg_count := l_msg_count;
901 		  If l_msg_count = 1 THEN
902 	             pa_interface_utils_pub.get_messages
903 		         (p_encoded        => FND_API.G_TRUE		,
904 		          p_msg_index      => 1				,
905 		          p_msg_count      => l_msg_count		,
906 		          p_msg_data       => l_msg_data		,
907 		          p_data           => l_data			,
908 		          p_msg_index_out  => l_msg_index_out
909 			  );
910 		    x_msg_data := l_data;
911 		 End if;
912 		End if;
913 		RAISE  FND_API.G_EXC_ERROR;
914 	END IF;
915 x_errorcode	     := l_errorcode;
916 x_return_status      := l_return_status;
917 x_delete_ok          := l_delete_ok;
918 
919 EXCEPTION
920 
921 WHEN FND_API.G_EXC_UNEXPECTED_ERROR  THEN
922 
923     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
924     x_delete_ok     := FND_API.G_FALSE;            -- NOCOPY change for Bug 4939368
925     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
926     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
927     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
928     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
929                             p_procedure_name => 'check_delete_project_ok',
930                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
931 
932 WHEN FND_API.G_EXC_ERROR THEN
933     x_return_status := FND_API.G_RET_STS_ERROR;
934     x_delete_ok     := FND_API.G_FALSE;            -- NOCOPY change for Bug 4939368
935     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
936     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
937     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
938     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
939                             p_procedure_name => 'check_delete_project_ok',
940                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
941 
942 WHEN OTHERS THEN
943 
944     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
945     x_delete_ok     := FND_API.G_FALSE;            -- NOCOPY change for Bug 4939368
946     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
947     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
948     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
949     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
950                             p_procedure_name => 'check_delete_project_ok',
951                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
952     raise;
953 END check_delete_project_ok;
954 
955 
956 
957 
958 	/*-----------------------------------------------------------+
959 	 | For Details/Comments Refer Package Specification Comments |
960 	 +-----------------------------------------------------------*/
961 
962 
963 
964 
965 PROCEDURE delete_all_item_assocs(
966 	p_api_version			IN	NUMBER		:=1.0		,
967 	p_project_id 			IN	NUMBER				,
968 	p_init_msg_list			IN	VARCHAR2 := NULL		,
969 	p_commit       			IN	VARCHAR2 := NULL		,
970 	x_errorcode   			OUT	NOCOPY NUMBER				, -- NOCOPY change for Bug 4939368
971 	x_return_status			OUT	NOCOPY VARCHAR2			, -- NOCOPY change for Bug 4939368
972 	x_msg_count			OUT	NOCOPY NUMBER				, -- NOCOPY change for Bug 4939368
973 	x_msg_data			OUT	NOCOPY VARCHAR2 -- NOCOPY change for Bug 4939368
974 	)
975 IS
976 	l_api_name	     CONSTANT VARCHAR(30) := 'delete_all_item_assocs';
977 	l_api_version        CONSTANT NUMBER      := 1.0;
978 	l_msg_count                   NUMBER;
979 	l_msg_index_out               NUMBER;
980 	l_data			      VARCHAR2(2000);
981 	l_msg_data		      VARCHAR2(2000);
982 	l_return_status		      VARCHAR2(1);
983 	l_errorcode		      NUMBER;
984 
985 
986 	BEGIN
987 
988 	IF(p_commit = FND_API.G_TRUE) THEN
989 	  SAVEPOINT wrapper_delete_all_item_assocs;
990 	END IF;
991 
992 
993         IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version	,
994                                            p_api_version	,
995                                            l_api_name		,
996                                            l_pkg_name)
997         THEN
998 	      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
999         END IF;
1000 
1001 
1002 	x_return_status := FND_API.G_RET_STS_SUCCESS;
1003 
1004 	EGO_LIFECYCLE_USER_PUB.delete_all_item_assocs(
1005 		p_api_version		=> p_api_version	,
1006 		p_project_id		=> p_project_id		,
1007 		p_commit		=> p_commit		,
1008 		x_errorcode		=> l_errorcode		,
1009 		x_msg_count		=> l_msg_count		,
1010 		x_return_status 	=> l_return_status	,
1011 		x_msg_data		=> l_msg_data );
1012 
1013 /* Bug 2760719 -- Added check for l_return_status  <> FND_API.G_RET_STS_SUCCESS and moved raise statement
1014                   outside the IF l_msg_count > 0 */
1015 
1016 	IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1017 		l_msg_count := FND_MSG_PUB.count_msg;
1018 		If l_msg_count > 0 THEN
1019 	          x_msg_count := l_msg_count;
1020 		  If l_msg_count = 1 THEN
1021 	             pa_interface_utils_pub.get_messages
1022 		         (p_encoded        => FND_API.G_TRUE		,
1023 		          p_msg_index      => 1				,
1024 		          p_msg_count      => l_msg_count		,
1025 		          p_msg_data       => l_msg_data		,
1026 		          p_data           => l_data			,
1027 		          p_msg_index_out  => l_msg_index_out
1028 			  );
1029 		    x_msg_data := l_data;
1030 		 End if;
1031 		End if;
1032 	        RAISE  FND_API.G_EXC_ERROR;
1033 	END IF;
1034 
1035 x_errorcode	     := l_errorcode;
1036 x_return_status      := l_return_status;
1037 
1038 IF FND_API.TO_BOOLEAN(P_COMMIT) THEN
1039         COMMIT;
1040 END IF;
1041 
1042 EXCEPTION
1043 
1044 WHEN FND_API.G_EXC_UNEXPECTED_ERROR  THEN
1045     IF p_commit = FND_API.G_TRUE THEN
1046        ROLLBACK TO wrapper_delete_all_item_assocs;
1047     END IF;
1048     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1049     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
1050     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
1051     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
1052     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
1053                             p_procedure_name => 'delete_all_item_assocs',
1054                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
1055 
1056 WHEN FND_API.G_EXC_ERROR THEN
1057     x_return_status := FND_API.G_RET_STS_ERROR;
1058     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
1059     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
1060     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
1061     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
1062                             p_procedure_name => 'delete_all_item_assocs',
1063                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
1064     IF p_commit = FND_API.G_TRUE THEN
1065        ROLLBACK TO wrapper_delete_all_item_assocs;
1066     END IF;
1067 
1068 WHEN OTHERS THEN
1069     IF p_commit = FND_API.G_TRUE THEN
1070        ROLLBACK TO wrapper_delete_all_item_assocs;
1071     END IF;
1072     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1073     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
1074     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
1075     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
1076     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
1077                             p_procedure_name => 'delete_all_item_assocs',
1078                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
1079     raise;
1080 END delete_all_item_assocs;
1081 
1082 	/*-----------------------------------------------------------+
1083 	 | For Details/Comments Refer Package Specification Comments |
1084 	 +-----------------------------------------------------------*/
1085 
1086 
1087 FUNCTION CHECK_PLM_INSTALLED RETURN char
1088  is
1089   cursor get_application_id is
1090   select application_id
1091   from fnd_application
1092   where application_short_name = 'EGO';
1093   x_application_id fnd_application.application_id%TYPE;
1094 
1095   Cursor get_installation_status is
1096   select nvl(status,'N') from fnd_product_installations
1097   where application_id = x_application_id;
1098 
1099   x_status fnd_product_installations.status%TYPE;
1100 
1101 Begin
1102    -- Get the Application_id from the application short name
1103    open get_application_id;
1104    fetch get_application_id into x_application_id;
1105    if(get_application_id%NOTFOUND) then
1106      close get_application_id;
1107      return 'N';
1108    end if;
1109    close get_application_id;
1110  -- Get the application_status I - Installed, S - Installed in shared mode, N - Not Installed
1111    open get_installation_status;
1112    fetch get_installation_status into x_status;
1113    if(get_installation_status%NOTFOUND) then
1114      close get_installation_status;
1115      return 'N';
1116    end if;
1117    close get_installation_status;
1118 
1119    if(x_status <> 'N') then
1120      return 'Y';
1121   else
1122      return 'N';
1123   end if;
1124 
1125 end CHECK_PLM_INSTALLED;
1126 
1127 
1128 
1129 	/*-----------------------------------------------------------+
1130 	 | For Details/Comments Refer Package Specification Comments |
1131 	 +-----------------------------------------------------------*/
1132 
1133 PROCEDURE copy_item_assocs(
1134 	p_api_version			IN	NUMBER		:=1.0		,
1135 	p_project_id_from 		IN	NUMBER				,
1136         p_project_id_to                 IN      NUMBER                          ,
1137 	p_init_msg_list			IN	VARCHAR2 := NULL		,
1138 	p_commit       			IN	VARCHAR2 := NULL		,
1139 	x_return_status			OUT	NOCOPY VARCHAR2			, -- NOCOPY change for Bug 4939368
1140 	x_errorcode   			OUT	NOCOPY NUMBER				, -- NOCOPY change for Bug 4939368
1141 	x_msg_count			OUT	NOCOPY NUMBER				, -- NOCOPY change for Bug 4939368
1142 	x_msg_data			OUT	NOCOPY VARCHAR2 -- NOCOPY change for Bug 4939368
1143 	)
1144 IS
1145 	l_api_name	     CONSTANT VARCHAR(30) := 'copy_item_assocs';
1146 	l_api_version        CONSTANT NUMBER      := 1.0;
1147 	l_msg_count                   NUMBER;
1148 	l_msg_index_out               NUMBER;
1149 	l_data			      VARCHAR2(2000);
1150 	l_msg_data		      VARCHAR2(2000);
1151 	l_return_status		      VARCHAR2(1);
1152 	l_errorcode		      NUMBER;
1153 
1154 
1155 	BEGIN
1156 
1157 	IF(p_commit = FND_API.G_TRUE) THEN
1158 	  SAVEPOINT wrapper_copy_item_assocs;
1159 	END IF;
1160 
1161 
1162         IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version	,
1163                                            p_api_version	,
1164                                            l_api_name		,
1165                                            l_pkg_name)
1166         THEN
1167 	      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1168         END IF;
1169 
1170 
1171 	x_return_status := FND_API.G_RET_STS_SUCCESS;
1172 
1173 	EGO_LIFECYCLE_USER_PUB.copy_item_assocs(
1174 		p_api_version		=> p_api_version	,
1175 		p_project_id_to		=> p_project_id_to	,
1176                 p_project_id_from	=> p_project_id_from    ,
1177 		p_commit		=> p_commit		,
1178 		x_errorcode		=> l_errorcode		,
1179 		x_msg_count		=> l_msg_count		,
1180 		x_return_status 	=> l_return_status	,
1181 		x_msg_data		=> l_msg_data );
1182 
1183 	/* Bug 2760719 -- Added check for l_return_status  <> FND_API.G_RET_STS_SUCCESS and moved raise statement
1184                   outside the IF l_msg_count > 0 */
1185 
1186 	IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1187 		l_msg_count := FND_MSG_PUB.count_msg;
1188 		If l_msg_count > 0 THEN
1189 	          x_msg_count := l_msg_count;
1190 	          If l_msg_count = 1 THEN
1191 	             pa_interface_utils_pub.get_messages
1192 		         (p_encoded        => FND_API.G_TRUE		,
1193 		          p_msg_index      => 1				,
1194 		          p_msg_count      => l_msg_count		,
1195 		          p_msg_data       => l_msg_data		,
1196 		          p_data           => l_data			,
1197 		          p_msg_index_out  => l_msg_index_out
1198 			  );
1199 		    x_msg_data := l_data;
1200 		 End if;
1201 		End if;
1202 	        RAISE  FND_API.G_EXC_ERROR;
1203 	END IF;
1204 x_errorcode	     := l_errorcode;
1205 x_return_status      := l_return_status;
1206 
1207 IF FND_API.TO_BOOLEAN(P_COMMIT) THEN
1208         COMMIT;
1209 END IF;
1210 
1211 EXCEPTION
1212 
1213 WHEN FND_API.G_EXC_UNEXPECTED_ERROR  THEN
1214     IF p_commit = FND_API.G_TRUE THEN
1215        ROLLBACK TO wrapper_copy_item_assocs;
1216     END IF;
1217     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1218     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
1219     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
1220     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
1221     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
1222                             p_procedure_name => 'copy_item_assocs',
1223                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
1224 
1225 WHEN FND_API.G_EXC_ERROR THEN
1226     x_return_status := FND_API.G_RET_STS_ERROR;
1227     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
1228     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
1229     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
1230     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
1231                             p_procedure_name => 'copy_item_assocs',
1232                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
1233     IF p_commit = FND_API.G_TRUE THEN
1234        ROLLBACK TO wrapper_copy_item_assocs;
1235     END IF;
1236 
1237 WHEN OTHERS THEN
1238     IF p_commit = FND_API.G_TRUE THEN
1239        ROLLBACK TO wrapper_copy_item_assocs;
1240     END IF;
1241     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1242     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
1243     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
1244     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
1245     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
1246                             p_procedure_name => 'copy_item_assocs',
1247                             p_error_text     =>  x_msg_data); -- NOCOPY change for Bug 4939368
1248     raise;
1249 END copy_item_assocs;
1250 
1251 /* Start for Changes made for Integration with Eng */
1252 	/*-----------------------------------------------------------+
1253 	 | For Details/Comments Refer Package Specification Comments |
1254 	 +-----------------------------------------------------------*/
1255 
1256 PROCEDURE check_delete_project_ok_eng(
1257 	p_api_version		IN	NUMBER	   :=1.0	,
1258 	p_project_id 		IN	NUMBER			,
1259 	p_init_msg_list		IN	VARCHAR2   := NULL	,
1260 	x_delete_ok		OUT	NOCOPY VARCHAR2		, -- NOCOPY change for Bug 4939368
1261 	x_return_status		OUT	NOCOPY VARCHAR2		, -- NOCOPY change for Bug 4939368
1262 	x_errorcode		OUT	NOCOPY NUMBER			, -- NOCOPY change for Bug 4939368
1263 	x_msg_count		OUT	NOCOPY NUMBER			, -- NOCOPY change for Bug 4939368
1264 	x_msg_data		OUT	NOCOPY VARCHAR2  -- NOCOPY change for Bug 4939368
1265 	)
1266 IS
1267 	l_api_name	     CONSTANT VARCHAR(30) := 'check_delete_project_ok_eng';
1268 	l_api_version        CONSTANT NUMBER      := 1.0;
1269 	l_msg_count                   NUMBER;
1270 	l_msg_index_out               NUMBER;
1271 	l_data			      VARCHAR2(2000);
1272 	l_msg_data		      VARCHAR2(2000);
1273 	l_return_status		      VARCHAR2(1);
1274 	l_errorcode		      NUMBER;
1275 
1276         l_delete_ok                   VARCHAR2(1);
1277 BEGIN
1278 
1279         IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version	,
1280                                            p_api_version	,
1281                                            l_api_name		,
1282                                            l_pkg_name)
1283         THEN
1284 	      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1285         END IF;
1286 
1287 
1288 	x_return_status := FND_API.G_RET_STS_SUCCESS;
1289 	x_delete_ok     := FND_API.G_FALSE;
1290 
1291 	ENG_LIFECYCLE_USER_PUB.check_delete_project_ok(
1292 		p_api_version		=> p_api_version	,
1293 		p_project_id		=> p_project_id		,
1294 		p_init_msg_list		=> p_init_msg_list	,
1295 		x_delete_ok		=> l_delete_ok		,
1296 		x_return_status		=> l_return_status	,
1297 		x_errorcode		=> l_errorcode		,
1298 		x_msg_count		=> l_msg_count		,
1299 		x_msg_data		=> l_msg_data );
1300 
1301 	IF l_delete_ok  <> FND_API.G_TRUE OR l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1302 		l_msg_count := FND_MSG_PUB.count_msg;
1303 		If l_msg_count > 0 THEN
1304 	          x_msg_count := l_msg_count;
1305 		  If l_msg_count = 1 THEN
1306 	             pa_interface_utils_pub.get_messages
1307 		         (p_encoded        => FND_API.G_TRUE		,
1308 		          p_msg_index      => 1				,
1309 		          p_msg_count      => l_msg_count		,
1310 		          p_msg_data       => l_msg_data		,
1311 		          p_data           => l_data			,
1312 		          p_msg_index_out  => l_msg_index_out
1313 			  );
1314 		    x_msg_data := l_data;
1315 		 End if;
1316 		End if;
1317 		RAISE  FND_API.G_EXC_ERROR;
1318 	END IF;
1319 x_errorcode	     := l_errorcode;
1320 x_return_status      := l_return_status;
1321 x_delete_ok          := l_delete_ok;
1322 
1323 EXCEPTION
1324 
1325 WHEN FND_API.G_EXC_UNEXPECTED_ERROR  THEN
1326 
1327     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1328     x_delete_ok     := FND_API.G_FALSE;            -- NOCOPY change for Bug 4939368
1329     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
1330     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
1331     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
1332     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
1333                             p_procedure_name => 'check_delete_project_ok_eng',
1334                             p_error_text     => x_msg_data); -- NOCOPY change for Bug 4939368
1335 
1336 WHEN FND_API.G_EXC_ERROR THEN
1337     x_return_status := FND_API.G_RET_STS_ERROR;
1338     x_delete_ok     := FND_API.G_FALSE;            -- NOCOPY change for Bug 4939368
1339     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
1340     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
1341     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
1342     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
1343                             p_procedure_name => 'check_delete_project_ok_eng',
1344                             p_error_text     => x_msg_data); -- NOCOPY change for Bug 4939368
1345 
1346 WHEN OTHERS THEN
1347 
1348     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1349     x_delete_ok     := FND_API.G_FALSE;            -- NOCOPY change for Bug 4939368
1350     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
1351     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
1352     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
1353     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
1354                             p_procedure_name => 'check_delete_project_ok_eng',
1355                             p_error_text     => x_msg_data); -- NOCOPY change for Bug 4939368
1356     raise;
1357 END check_delete_project_ok_eng;
1358 
1359 
1360 
1361 
1362 
1363 	/*-----------------------------------------------------------+
1364 	 | For Details/Comments Refer Package Specification Comments |
1365 	 +-----------------------------------------------------------*/
1366 
1367 PROCEDURE check_delete_task_ok_eng(
1368 	p_api_version		IN	NUMBER	   :=1.0	,
1369 	p_task_id 		IN	NUMBER			,
1370 	p_init_msg_list		IN	VARCHAR2   := NULL	,
1371 	x_delete_ok		OUT	NOCOPY VARCHAR2		, -- NOCOPY change for Bug 4939368
1372 	x_return_status		OUT	NOCOPY VARCHAR2		, -- NOCOPY change for Bug 4939368
1373 	x_errorcode		OUT	NOCOPY NUMBER			, -- NOCOPY change for Bug 4939368
1374 	x_msg_count		OUT	NOCOPY NUMBER			, -- NOCOPY change for Bug 4939368
1375 	x_msg_data		OUT	NOCOPY VARCHAR2  -- NOCOPY change for Bug 4939368
1376 	)
1377 IS
1378 	l_api_name	     CONSTANT VARCHAR(30) := 'check_delete_task_ok_eng';
1379 	l_api_version        CONSTANT NUMBER      := 1.0;
1380 	l_msg_count                   NUMBER;
1381 	l_msg_index_out               NUMBER;
1382 	l_data			      VARCHAR2(2000);
1383 	l_msg_data		      VARCHAR2(2000);
1384 	l_return_status		      VARCHAR2(1);
1385 	l_errorcode		      NUMBER;
1386         l_delete_ok                   VARCHAR2(1);
1387 BEGIN
1388 
1389         IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version	,
1390                                            p_api_version	,
1391                                            l_api_name		,
1392                                            l_pkg_name)
1393         THEN
1394 	      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1395         END IF;
1396 
1397 
1398 	x_return_status := FND_API.G_RET_STS_SUCCESS;
1399 	x_delete_ok     := FND_API.G_FALSE;
1400 
1401 	ENG_LIFECYCLE_USER_PUB.check_delete_task_ok(
1402 		p_api_version		=> p_api_version	,
1403 		p_task_id		=> p_task_id		,
1404 		p_init_msg_list		=> p_init_msg_list	,
1405 		x_delete_ok		=> l_delete_ok		,
1406 		x_return_status		=> l_return_status	,
1407 		x_errorcode		=> l_errorcode		,
1408 		x_msg_count		=> l_msg_count		,
1409 		x_msg_data		=> l_msg_data );
1410 
1411 	IF l_delete_ok  <> FND_API.G_TRUE OR l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1412 		l_msg_count := FND_MSG_PUB.count_msg;
1413 		If l_msg_count > 0 THEN
1414 	          x_msg_count := l_msg_count;
1415 		  If l_msg_count = 1 THEN
1416 	             pa_interface_utils_pub.get_messages
1417 		         (p_encoded        => FND_API.G_TRUE		,
1418 		          p_msg_index      => 1				,
1419 		          p_msg_count      => l_msg_count		,
1420 		          p_msg_data       => l_msg_data		,
1421 		          p_data           => l_data			,
1422 		          p_msg_index_out  => l_msg_index_out
1423 			  );
1424 		    x_msg_data := l_data;
1425 		 End if;
1426 		End if;
1427 		RAISE  FND_API.G_EXC_ERROR;
1428 	END IF;
1429 x_errorcode	     := l_errorcode;
1430 x_return_status      := l_return_status;
1431 x_delete_ok          := l_delete_ok;
1432 
1433 EXCEPTION
1434 
1435 WHEN FND_API.G_EXC_UNEXPECTED_ERROR  THEN
1436 
1437     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1438     x_delete_ok     := FND_API.G_FALSE;            -- NOCOPY change for Bug 4939368
1439     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
1440     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
1441     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
1442     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
1443                             p_procedure_name => 'check_delete_task_ok_eng',
1444                             p_error_text     => x_msg_data); -- NOCOPY change for Bug 4939368
1445 
1446 WHEN FND_API.G_EXC_ERROR THEN
1447     x_return_status := FND_API.G_RET_STS_ERROR;
1448     x_delete_ok     := FND_API.G_FALSE;            -- NOCOPY change for Bug 4939368
1449     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
1450     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
1451     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
1452     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
1453                             p_procedure_name => 'check_delete_task_ok_eng',
1454                             p_error_text     => x_msg_data); -- NOCOPY change for Bug 4939368
1455 
1456 WHEN OTHERS THEN
1457 
1458     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1459     x_delete_ok     := FND_API.G_FALSE;            -- NOCOPY change for Bug 4939368
1460     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
1461     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
1462     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
1463     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
1464                             p_procedure_name => 'check_delete_task_ok_eng',
1465                             p_error_text     => x_msg_data); -- NOCOPY change for Bug 4939368
1466     raise;
1467 END check_delete_task_ok_eng;
1468 
1469 /* End for Changes made for Integration with Eng */
1470 
1471 /* Start Changes for Bug 2778408 */
1472 
1473 	/*-----------------------------------------------------------+
1474 	 | For Details/Comments Refer Package Specification Comments |
1475 	 +-----------------------------------------------------------*/
1476 
1477 PROCEDURE process_phase_code_delete(
1478 	p_api_version	IN	NUMBER	:= 1.0		        ,
1479 	p_phase_code 	IN	NUMBER			        ,
1480 	p_init_msg_list	IN	VARCHAR2 := FND_API.G_FALSE	,
1481 	p_commit       	IN	VARCHAR2 := FND_API.G_FALSE	,
1482 	x_return_status	OUT	NOCOPY VARCHAR2		        , -- NOCOPY change for Bug 4939368
1483 	x_errorcode   	OUT	NOCOPY NUMBER			        , -- NOCOPY change for Bug 4939368
1484 	x_msg_count	OUT	NOCOPY NUMBER			        , -- NOCOPY change for Bug 4939368
1485 	x_msg_data	OUT	NOCOPY VARCHAR2 -- NOCOPY change for Bug 4939368
1486 	)
1487 IS
1488 	l_api_name	     CONSTANT VARCHAR(30) := 'process_phase_code_delete';
1489 	l_api_version        CONSTANT NUMBER      := 1.0;
1490 	l_msg_count                   NUMBER;
1491 	l_msg_index_out               NUMBER;
1492 	l_data			      VARCHAR2(2000);
1493 	l_msg_data		      VARCHAR2(2000);
1494 	l_return_status		      VARCHAR2(1);
1495 	l_errorcode		      NUMBER;
1496 
1497 
1498 	BEGIN
1499 
1500 	IF(p_commit = FND_API.G_TRUE) THEN
1501 	  SAVEPOINT wrp_process_phase_code_delete;
1502 	END IF;
1503 
1504 
1505         IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version	,
1506                                            p_api_version	,
1507                                            l_api_name		,
1508                                            l_pkg_name)
1509         THEN
1510 	      RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1511         END IF;
1512 
1513 
1514 	x_return_status := FND_API.G_RET_STS_SUCCESS;
1515 	EGO_LIFECYCLE_ADMIN_PUB.process_phase_code_delete(
1516 		p_api_version		=> p_api_version	,
1517 		p_phase_code		=> p_phase_code		,
1518 		p_init_msg_list		=> p_init_msg_list	,
1519 		p_commit		=> p_commit		,
1520 		x_return_status 	=> l_return_status	,
1521 		x_errorcode		=> l_errorcode		,
1522 		x_msg_count		=> l_msg_count		,
1523 		x_msg_data		=> l_msg_data
1524 		);
1525 	IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
1526 		l_msg_count := FND_MSG_PUB.count_msg;
1527 		If l_msg_count > 0 THEN
1528 		    x_msg_count := l_msg_count;
1529 	          If l_msg_count = 1 THEN
1530 		     pa_interface_utils_pub.get_messages
1531 			 (p_encoded        => FND_API.G_TRUE		,
1532 		          p_msg_index      => 1				,
1533 		          p_msg_count      => l_msg_count		,
1534 		          p_msg_data       => l_msg_data		,
1535 		          p_data           => l_data			,
1536 		          p_msg_index_out  => l_msg_index_out
1537 			  );
1538 		    x_msg_data := l_data;
1539 		  End if;
1540 		End if;
1541 	        RAISE  FND_API.G_EXC_ERROR;
1542 	END IF;
1543 
1544 x_errorcode          := l_errorcode;
1545 x_return_status      := l_return_status;
1546 
1547 IF FND_API.TO_BOOLEAN(P_COMMIT) THEN
1548         COMMIT;
1549 END IF;
1550 
1551 EXCEPTION
1552 
1553 WHEN FND_API.G_EXC_UNEXPECTED_ERROR  THEN
1554     IF p_commit = FND_API.G_TRUE THEN
1555        ROLLBACK TO wrp_process_phase_code_delete;
1556     END IF;
1557     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1558     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
1559     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
1560     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
1561     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
1562                             p_procedure_name => 'process_phase_code_delete',
1563                             p_error_text     => x_msg_data); -- NOCOPY change for Bug 4939368
1564 
1565 WHEN FND_API.G_EXC_ERROR THEN
1566     x_return_status := FND_API.G_RET_STS_ERROR;
1567     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
1568     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
1569     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
1570     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
1571                             p_procedure_name => 'process_phase_code_delete',
1572                             p_error_text     => x_msg_data); -- NOCOPY change for Bug 4939368
1573     IF p_commit = FND_API.G_TRUE THEN
1574        ROLLBACK TO wrp_process_phase_code_delete;
1575     END IF;
1576 
1577 WHEN OTHERS THEN
1578     IF p_commit = FND_API.G_TRUE THEN
1579        ROLLBACK TO wrp_process_phase_code_delete;
1580     END IF;
1581     x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1582     x_errorcode     := SQLCODE;                    -- NOCOPY change for Bug 4939368
1583     x_msg_count     := 1;                          -- NOCOPY change for Bug 4939368
1584     x_msg_data      := substrb(SQLERRM,1,240);     -- NOCOPY change for Bug 4939368
1585     fnd_msg_pub.add_exc_msg(p_pkg_name       => 'PA_EGO_WRAPPER_PUB',
1586                             p_procedure_name => 'process_phase_code_delete',
1587                             p_error_text     => x_msg_data); -- NOCOPY change for Bug 4939368
1588     raise;
1589 END process_phase_code_delete;
1590 
1591 /* End of Changes for Bug 2778408 */
1592 
1593 
1594 
1595 
1596 END PA_EGO_WRAPPER_PUB;