DBA Data[Home] [Help]

PACKAGE BODY: APPS.AHL_MC_NODE_PUB

Source


1 PACKAGE BODY AHL_MC_Node_PUB AS
2 /* $Header: AHLPNODB.pls 120.3 2005/08/09 10:53:26 priyan noship $ */
3 
4 ---------------------
5 -- Spec Procedures --
6 ---------------------
7 PROCEDURE Process_Node
8 (
9 	p_api_version		IN 		NUMBER,
10 	p_init_msg_list       	IN 		VARCHAR2	:= FND_API.G_FALSE,
11 	p_commit              	IN 		VARCHAR2 	:= FND_API.G_FALSE,
12 	p_validation_level    	IN 		NUMBER 		:= FND_API.G_VALID_LEVEL_FULL,
13 	p_module_type		IN		VARCHAR2	:= 'JSP',
14 	x_return_status       	OUT 	NOCOPY  VARCHAR2,
15 	x_msg_count           	OUT 	NOCOPY  NUMBER,
16 	x_msg_data            	OUT 	NOCOPY  VARCHAR2,
17 	p_x_node_rec 	    	IN OUT 	NOCOPY 	AHL_MC_Node_PVT.Node_Rec_Type,
18 	p_x_counter_rules_tbl  	IN OUT 	NOCOPY 	AHL_MC_Node_PVT.Counter_Rules_Tbl_Type,
19 	p_x_subconfig_tbl     	IN OUT 	NOCOPY 	AHL_MC_Node_PVT.SubConfig_Tbl_Type
20 )
21 IS
22 	-- Define validation cursors
23 	CURSOR get_item_group_id
24 	(
25 		p_ig_name in VARCHAR2
26 	)
27 	IS
28 		SELECT 	item_group_id
29 		FROM 	ahl_item_groups_b
30 		WHERE 	upper(name) = upper (p_ig_name) AND
31 			source_item_group_id IS NULL;
32 
33 	-- Added Version Number Senthil.
34 	CURSOR get_subconfig_id
35 	(
36 		p_name in VARCHAR2,
37 		p_version_number NUMBER
38 	)
39 	IS
40 		SELECT 	mc_header_id
41 		FROM	ahl_mc_headers_b
42 		WHERE 	upper(name) = upper (p_name)
43 		  AND   version_number = p_version_number;
44 
45 	-- Declare local variables
46 	l_api_name	CONSTANT	VARCHAR2(30)	:= 'Process_Node';
47 	l_api_version	CONSTANT	NUMBER		:= 1.0;
48 	l_return_status			VARCHAR2(1);
49 	l_msg_count         		NUMBER;
50 	l_msg_data          		VARCHAR2(2000);
51 	l_temp_num			NUMBER;
52 
53 	l_ret_val			BOOLEAN;
54 
55 BEGIN
56 
57 	-- Standard start of API savepoint
58 	SAVEPOINT Process_Node_SP;
59 
60 	-- Standard call to check for call compatibility
61 	IF NOT FND_API.compatible_api_call(l_api_version, p_api_version, l_api_name, G_PKG_NAME)
62 	THEN
63 		RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
64 	END IF;
65 
66 	-- Initialize message list if p_init_msg_list is set to TRUE
67 	IF FND_API.TO_BOOLEAN(p_init_msg_list)
68 	THEN
69 		FND_MSG_PUB.Initialize;
70 	END IF;
71 
72 	-- Initialize API return status to success
73 	x_return_status := FND_API.G_RET_STS_SUCCESS;
74 
75 	-- API body starts here
76 	IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level)
77 	THEN
78 		fnd_log.string
79 		(
80 			fnd_log.level_procedure,
81 			'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||'.begin',
82 			'At the start of PLSQL procedure'
83 		);
84 	END IF;
85 
86 	IF (p_module_type = 'JSP' AND p_x_node_rec.operation_flag <> G_DML_DELETE)
87 	THEN
88 		-- Validate and Convert node position reference meaning to code
89 		p_x_node_rec.position_ref_meaning := RTRIM(p_x_node_rec.position_ref_meaning);
90 
91 		-- This field is represented in UI with an LOV, hence need to check for validity of the meaning only
92 		IF (p_x_node_rec.position_ref_meaning IS NULL)
93 		THEN
94 			-- This is a mandatory field, hence throw error
95 			FND_MESSAGE.Set_Name('AHL','AHL_MC_POSREF_NULL');
96 			FND_MSG_PUB.ADD;
97 			IF (fnd_log.level_exception >= fnd_log.g_current_runtime_level)
98 			THEN
99 				fnd_log.message
100 				(
101 					fnd_log.level_exception,
102 					'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name,
103 					false
104 				);
105 			END IF;
106 		ELSE
107 			AHL_UTIL_MC_PKG.Convert_To_LookupCode
108 			(
109 				'AHL_POSITION_REFERENCE',
110 				p_x_node_rec.position_ref_meaning,
111 				p_x_node_rec.position_ref_code,
112 				l_ret_val
113 			);
114 
115 			IF NOT (l_ret_val)
116 			THEN
117 				FND_MESSAGE.Set_Name('AHL', 'AHL_MC_POSREF_INVALID');
118 				FND_MESSAGE.Set_Token('POSREF', p_x_node_rec.position_ref_meaning);
119 				FND_MSG_PUB.ADD;
120 				IF (fnd_log.level_exception >= fnd_log.g_current_runtime_level)
121 				THEN
122 					fnd_log.message
123 					(
124 						fnd_log.level_exception,
125 						'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name,
126 						false
127 					);
128 				END IF;
129 			END IF;
130 		END IF;
131 
132 		--priyan MEL-CDL
133 		---- Validate and Convert node ata meaning to code
134 			p_x_node_rec.ata_meaning := RTRIM(p_x_node_rec.ata_meaning);
135 
136 		---- This field is represented in UI with an LOV, hence need to check for validity of the meaning only
137 		IF (p_x_node_rec.ata_meaning IS NOT NULL AND p_x_node_rec.ata_meaning <> FND_API.G_MISS_CHAR)
138 		THEN
139 			AHL_UTIL_MC_PKG.Convert_To_LookupCode
140 			(
141 				'AHL_ATA_CODE',
142 				p_x_node_rec.ata_meaning,
143 				p_x_node_rec.ata_code,
144 				l_ret_val
145 			);
146 
147 			IF NOT (l_ret_val)
148 			THEN
149 			 	FND_MESSAGE.Set_Name('AHL', 'AHL_MC_ATASEQ_INVALID');
150 				FND_MESSAGE.Set_Token('ATAMEANING', p_x_node_rec.ata_meaning);
151 				FND_MSG_PUB.ADD;
152 				IF (fnd_log.level_exception >= fnd_log.g_current_runtime_level)
153 				THEN
154 					fnd_log.message
155 					(
156 						fnd_log.level_exception,
157 						'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name,
158 						false
159 					);
160 				END IF;
161 			END IF;
162 		ELSE
163 			-- Not a mandatory field, hence ensure no ID is passed to PVT if there is no name
164 			p_x_node_rec.ata_code := null;
165 		END IF;
166 
167 		/*(p_x_node_rec.ata_code IS NOT NULL AND p_x_node_rec.ata_code <> FND_API.G_MISS_CHAR AND NOT (AHL_UTIL_MC_PKG.Validate_Lookup_Code('AHL_ATA_CODE', p_x_node_rec.ata_code)))
168 		THEN
169 			FND_MESSAGE.Set_Name('AHL', 'AHL_MC_ATASEQ_INVALID');
170 			FND_MESSAGE.Set_Token('ATA', p_x_node_rec.ata_meaning);
171 			FND_MESSAGE.Set_Token('CODE', p_x_node_rec.ata_code);
172 			FND_MSG_PUB.ADD;
173 			IF (fnd_log.level_exception >= fnd_log.g_current_runtime_level)
174 			THEN
175 				fnd_log.message
176 				(
177 					fnd_log.level_exception,
178 					'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name,
179 					false
180 				);
181 			END IF; */
182 
183 
184 
185 		-- Validate node position necessity code
186 		-- This field is represented in UI with a dropdown, hence need to check for validity of the code only
187 		IF (p_x_node_rec.position_necessity_code IS NULL)
188 		THEN
189 			-- This is a mandatory field, hence throw error
190 			FND_MESSAGE.Set_Name('AHL','AHL_MC_NECESSITY_NULL');
191 			FND_MSG_PUB.ADD;
192 			IF (fnd_log.level_exception >= fnd_log.g_current_runtime_level)
193 			THEN
194 				fnd_log.message
195 				(
196 					fnd_log.level_exception,
197 					'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name,
198 					false
199 				);
200 			END IF;
201 		ELSIF NOT (AHL_UTIL_MC_PKG.Validate_Lookup_Code('AHL_POSITION_NECESSITY', p_x_node_rec.position_necessity_code))
202 		THEN
203 			FND_MESSAGE.Set_Name('AHL', 'AHL_MC_NECESSITY_INVALID');
204 			FND_MESSAGE.Set_Token('POSREF', p_x_node_rec.position_ref_meaning);
205 			FND_MESSAGE.Set_Token('CODE', p_x_node_rec.position_necessity_code);
206 			FND_MSG_PUB.ADD;
207 			IF (fnd_log.level_exception >= fnd_log.g_current_runtime_level)
208 			THEN
209 				fnd_log.message
210 				(
211 					fnd_log.level_exception,
212 					'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name,
213 					false
214 				);
215 			END IF;
216 		END IF;
217 
218 		-- Validate and Convert node item group name to id
219 		p_x_node_rec.item_group_name := RTRIM(p_x_node_rec.item_group_name);
220 
221 		-- This field is represented in UI with an LOV, hence need to check for validity of the name only
222 		-- This is not a mandatory field
223 		IF (p_x_node_rec.item_group_name IS NOT NULL)
224 		THEN
225 			OPEN get_item_group_id (p_x_node_rec.item_group_name);
226 			FETCH get_item_group_id INTO p_x_node_rec.item_group_id;
227 			IF (get_item_group_id%NOTFOUND)
228 			THEN
229 				FND_MESSAGE.Set_Name('AHL', 'AHL_MC_ITEMGRP_INVALID');
230 				FND_MESSAGE.Set_Token('ITEM_GRP', p_x_node_rec.item_group_name);
231 				FND_MSG_PUB.ADD;
232 				IF (fnd_log.level_exception >= fnd_log.g_current_runtime_level)
233 				THEN
234 					fnd_log.message
235 					(
236 						fnd_log.level_exception,
237 						'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name,
238 						false
239 					);
240 				END IF;
241 			END IF;
242 			CLOSE get_item_group_id;
243 		ELSE
244 			-- Not a mandatory field, hence ensure no ID is passed to PVT if there is no name
245 			p_x_node_rec.item_group_id := null;
246 		END IF;
247 
248 		-- Validate and Covert subconfig header name to id
249 		IF (p_x_subconfig_tbl.COUNT > 0)
250 		THEN
251 			FOR i in p_x_subconfig_tbl.FIRST..p_x_subconfig_tbl.LAST
252 			LOOP
253 				IF (p_x_subconfig_tbl(i).operation_flag <> G_DML_DELETE)
254 				THEN
255 					p_x_subconfig_tbl(i).name := RTRIM(p_x_subconfig_tbl(i).name);
256 
257 					-- This field is represented in UI with an LOV, hence need to check for validity of the name only
258 					IF (p_x_subconfig_tbl(i).name IS NOT NULL)
259 					THEN
260 						OPEN get_subconfig_id (p_x_subconfig_tbl(i).name,
261 						                       p_x_subconfig_tbl(i).version_number);
262 						FETCH get_subconfig_id INTO l_temp_num;
263 						IF (get_subconfig_id%NOTFOUND)
264 						THEN
265 							FND_MESSAGE.Set_Name('AHL', 'AHL_MC_MC_INVALID');
266 							FND_MESSAGE.Set_Token('MC_NAME', p_x_subconfig_tbl(i).name);
267 							FND_MSG_PUB.ADD;
268 							IF (fnd_log.level_exception >= fnd_log.g_current_runtime_level)
269 							THEN
270 								fnd_log.message
271 								(
272 									fnd_log.level_exception,
273 									'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name,
274 									false
275 								);
276 							END IF;
277 						ELSE
278 							p_x_subconfig_tbl(i).mc_header_id := l_temp_num;
279 						END IF;
280 						CLOSE get_subconfig_id;
281 					ELSE
282 						FND_MESSAGE.Set_Name('AHL', 'AHL_MC_SUBMC_NULL');
283 						FND_MSG_PUB.ADD;
284 						IF (fnd_log.level_exception >= fnd_log.g_current_runtime_level)
285 						THEN
286 							fnd_log.message
287 							(
288 								fnd_log.level_exception,
289 								'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name,
290 								false
291 							);
292 						END IF;
293 					END IF;
294 				END IF;
295 			END LOOP;
296 		END IF;
297 
298 		-- Validate counter rule code
299 		IF (p_x_counter_rules_tbl.COUNT > 0)
300 		THEN
301 			FOR i in p_x_counter_rules_tbl.FIRST..p_x_counter_rules_tbl.LAST
302 			LOOP
303 				IF (p_x_counter_rules_tbl(i).operation_flag <> G_DML_DELETE)
304 				THEN
305 					-- This field is represented in UI with a dropdown, hence need to check for validity of the code only
306 					IF (p_x_counter_rules_tbl(i).rule_code IS NULL)
307 					THEN
308 						-- This is a mandatory field, hence throw error
309 						FND_MESSAGE.Set_Name('AHL', 'AHL_MC_RULE_NULL');
310 						FND_MSG_PUB.ADD;
311 						IF (fnd_log.level_exception >= fnd_log.g_current_runtime_level)
312 						THEN
313 							fnd_log.message
314 							(
315 								fnd_log.level_exception,
316 								'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name,
317 								false
318 							);
319 						END IF;
320 					ELSIF NOT (AHL_UTIL_MC_PKG.Validate_Lookup_Code('AHL_COUNTER_RULE_TYPE', p_x_counter_rules_tbl(i).rule_code))
321 					THEN
322 						FND_MESSAGE.Set_Name('AHL', 'AHL_MC_RULE_INVALID');
323 						FND_MESSAGE.Set_Token('RULE', p_x_counter_rules_tbl(i).rule_meaning);
324 						FND_MSG_PUB.ADD;
325 						IF (fnd_log.level_exception >= fnd_log.g_current_runtime_level)
329 								fnd_log.level_exception,
326 						THEN
327 							fnd_log.message
328 							(
330 								'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name,
331 								false
332 							);
333 						END IF;
334 					END IF;
335 				END IF;
336 			END LOOP;
337 		END IF;
338 
339 		-- Check Error Message stack.
340 		x_msg_count := FND_MSG_PUB.count_msg;
341 		IF ( x_msg_count > 0 ) THEN
342 			RAISE FND_API.G_EXC_ERROR;
343 		END IF;
344 	END IF;
345 
346 	-- Call PVT APIs accordingly
347 	IF (p_x_node_rec.operation_flag = G_DML_CREATE)
348 	THEN
349 		AHL_MC_Node_PVT.Create_Node
350 		(
351 			p_api_version		=> 1.0,
352 			p_init_msg_list		=> FND_API.G_FALSE,
353 			p_commit		=> FND_API.G_FALSE,
354 			p_validation_level	=> FND_API.G_VALID_LEVEL_FULL,
355 			x_return_status		=> l_return_status,
356 			x_msg_count		=> l_msg_count,
357 			x_msg_data		=> l_msg_data,
358 			p_x_node_rec		=> p_x_node_rec,
359 			p_x_counter_rules_tbl	=> p_x_counter_rules_tbl,
360 			p_x_subconfig_tbl	=> p_x_subconfig_tbl
361 		);
362 	ELSIF (p_x_node_rec.operation_flag = G_DML_DELETE)
363 	THEN
364 		AHL_MC_Node_PVT.Delete_Node
365 		(
366 			p_api_version 		=> 1.0,
367 			p_init_msg_list 	=> FND_API.G_FALSE,
368 			p_commit 		=> FND_API.G_FALSE,
369 			p_validation_level 	=> FND_API.G_VALID_LEVEL_FULL,
370 			x_return_status 	=> l_return_status,
371 			x_msg_count 		=> l_msg_count,
372 			x_msg_data 		=> l_msg_data,
373 			p_node_id		=> p_x_node_rec.relationship_id,
374 			p_object_ver_num	=> p_x_node_rec.object_version_number
375 		);
376 	ELSE
377 		AHL_MC_Node_PVT.Modify_Node
378 		(
379 			p_api_version		=> 1.0,
380 			p_init_msg_list		=> FND_API.G_FALSE,
381 			p_commit		=> FND_API.G_FALSE,
382 			p_validation_level	=> FND_API.G_VALID_LEVEL_FULL,
383 			x_return_status		=> l_return_status,
384 			x_msg_count		=> l_msg_count,
385 			x_msg_data		=> l_msg_data,
386 			p_x_node_rec		=> p_x_node_rec,
387 			p_x_counter_rules_tbl	=> p_x_counter_rules_tbl,
388 			p_x_subconfig_tbl	=> p_x_subconfig_tbl
389 		);
390   	END IF;
391 
392 	IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level)
393 	THEN
394 		fnd_log.string
395 		(
396 			fnd_log.level_procedure,
397 			'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||'.end',
398 			'At the end of PLSQL procedure'
399 		);
400 	END IF;
401 	-- API body ends here
402 
403 	-- Check Error Message stack.
404 	x_msg_count := FND_MSG_PUB.count_msg;
405 
406 	--priyan MEL_CDL
407 	IF ( x_msg_count > 0  and l_return_status <> FND_API.G_RET_STS_SUCCESS)  THEN
408 		RAISE FND_API.G_EXC_ERROR;
409 	END IF;
410 
411   	-- Standard check for p_commit
412 	IF FND_API.TO_BOOLEAN (p_commit)
413 	THEN
414 		COMMIT WORK;
415 	END IF;
416 
417 	-- Standard call to get message count and if count is 1, get message info
418 	FND_MSG_PUB.count_and_get
419 	(
420 		p_count 	=> x_msg_count,
421 		p_data  	=> x_msg_data,
422 		p_encoded 	=> FND_API.G_FALSE
423 	);
424 
425 EXCEPTION
426 	WHEN FND_API.G_EXC_ERROR THEN
430 		(
427 		x_return_status := FND_API.G_RET_STS_ERROR;
428 		Rollback to Process_Node_SP;
429 		FND_MSG_PUB.count_and_get
431 			p_count 	=> x_msg_count,
432 			p_data  	=> x_msg_data,
433 			p_encoded 	=> FND_API.G_FALSE
434 		);
435 
436 	WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
437 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
438 		Rollback to Process_Node_SP;
439 		FND_MSG_PUB.count_and_get
440 		(
441 			p_count 	=> x_msg_count,
442 			p_data  	=> x_msg_data,
443 			p_encoded 	=> FND_API.G_FALSE
444 		);
445 
446 	WHEN OTHERS THEN
447 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
448 		Rollback to Process_Node_SP;
449 		IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
450 		THEN
451 			FND_MSG_PUB.add_exc_msg
452 			(
453 				p_pkg_name		=> G_PKG_NAME,
454 				p_procedure_name 	=> 'Process_Node',
455 				p_error_text     	=> SUBSTR(SQLERRM,1,240)
456 			);
457 		END IF;
458 		FND_MSG_PUB.count_and_get
459 		(
460 			p_count 	=> x_msg_count,
461 			p_data  	=> x_msg_data,
462 			p_encoded 	=> FND_API.G_FALSE
463 		);
464 
465 END Process_Node;
466 
467 
468 
469 PROCEDURE Delete_Nodes
470 (
471 	p_api_version		IN 		NUMBER,
472 	p_init_msg_list       	IN 		VARCHAR2	:= FND_API.G_FALSE,
473 	p_commit              	IN 		VARCHAR2 	:= FND_API.G_FALSE,
474 	p_validation_level    	IN 		NUMBER 		:= FND_API.G_VALID_LEVEL_FULL,
475 	x_return_status       	OUT 	NOCOPY  VARCHAR2,
476 	x_msg_count           	OUT 	NOCOPY  NUMBER,
477 	x_msg_data            	OUT 	NOCOPY  VARCHAR2,
478 	p_nodes_tbl		IN		AHL_MC_Node_PVT.Node_Tbl_Type
479 )
480 IS
481 
482 	-- 1.	Define local variables
483 	l_api_name	CONSTANT	VARCHAR2(30)	:= 'Delete_Nodes';
484 	l_api_version	CONSTANT	NUMBER		:= 1.0;
485 	l_return_status			VARCHAR2(1);
486 	l_msg_count         		NUMBER;
487 	l_msg_data          		VARCHAR2(2000);
488 
489 BEGIN
490 
491 	-- Standard start of API savepoint
492 	SAVEPOINT Delete_Nodes_SP;
493 
494 	-- Standard call to check for call compatibility
495 	IF NOT FND_API.compatible_api_call(l_api_version, p_api_version, l_api_name, G_PKG_NAME)
496 	THEN
497 		RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
498 	END IF;
499 
500 	-- Initialize message list if p_init_msg_list is set to TRUE
501 	IF FND_API.TO_BOOLEAN(p_init_msg_list)
502 	THEN
503 		FND_MSG_PUB.Initialize;
504 	END IF;
505 
506 	-- Initialize API return status to success
507 	x_return_status := FND_API.G_RET_STS_SUCCESS;
508 
509 	-- API body starts here
510 	IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level)
511 	THEN
512 		fnd_log.string
513 		(
514 			fnd_log.level_procedure,
515 			'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||'.begin',
516 			'At the start of PLSQL procedure'
517 		);
518 	END IF;
519 
520 	IF (p_nodes_tbl.COUNT > 0)
521 	THEN
522 		FOR i IN p_nodes_tbl.FIRST..p_nodes_tbl.LAST
523 		LOOP
524 			AHL_MC_Node_PVT.Delete_Node
525 			(
526 				p_api_version 		=> 1.0,
527 				p_init_msg_list 	=> FND_API.G_FALSE,
528 				p_commit		=> FND_API.G_FALSE,
529 				p_validation_level	=> FND_API.G_VALID_LEVEL_FULL,
530 				x_return_status		=> l_return_status,
531 				x_msg_count		=> l_msg_count,
532 				x_msg_data		=> l_msg_data,
533 				p_node_id		=> p_nodes_tbl(i).relationship_id,
534 				p_object_ver_num	=> p_nodes_tbl(i).object_version_number
535 			);
536 
537 			IF (fnd_log.level_statement >= fnd_log.g_current_runtime_level)
538 			THEN
539 				fnd_log.string
540 				(
541 					fnd_log.level_statement,
542 					'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name,
543 					'Deleted Node ['||p_nodes_tbl(i).relationship_id||']'
544 				);
545 			END IF;
546 
547 			-- Check Error Message stack.
548 			x_msg_count := FND_MSG_PUB.count_msg;
549 			IF x_msg_count > 0 THEN
550 				RAISE FND_API.G_EXC_ERROR;
551 			END IF;
552 		END LOOP;
553 	END IF;
554 
555 	IF (fnd_log.level_procedure >= fnd_log.g_current_runtime_level)
556 	THEN
557 		fnd_log.string
558 		(
559 			fnd_log.level_procedure,
560 			'ahl.plsql.'||G_PKG_NAME||'.'||l_api_name||'.end',
561 			'At the end of PLSQL procedure'
562 		);
563 	END IF;
564 	-- API body ends here
565 
566 	-- Check Error Message stack.
567 	x_msg_count := FND_MSG_PUB.count_msg;
568 	IF x_msg_count > 0 THEN
569 		RAISE FND_API.G_EXC_ERROR;
570 	END IF;
571 
572   	-- Standard check for p_commit
573 	IF FND_API.TO_BOOLEAN (p_commit)
574 	THEN
575 		COMMIT WORK;
576 	END IF;
577 
578 	-- Standard call to get message count and if count is 1, get message info
579 	FND_MSG_PUB.count_and_get
580 	(
581 		p_count 	=> x_msg_count,
582 		p_data  	=> x_msg_data,
583 		p_encoded 	=> FND_API.G_FALSE
584 	);
585 
586 EXCEPTION
587 	WHEN FND_API.G_EXC_ERROR THEN
588 		x_return_status := FND_API.G_RET_STS_ERROR;
589 		Rollback to Delete_Nodes_SP;
590 		FND_MSG_PUB.count_and_get
591 		(
592 			p_count 	=> x_msg_count,
593 			p_data  	=> x_msg_data,
594 			p_encoded 	=> FND_API.G_FALSE
595 		);
596 
597 	WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
598 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
599 		Rollback to Delete_Nodes_SP;
600 		FND_MSG_PUB.count_and_get
601 		(
602 			p_count 	=> x_msg_count,
603 			p_data  	=> x_msg_data,
604 			p_encoded 	=> FND_API.G_FALSE
605 		);
606 
607 	WHEN OTHERS THEN
608 		x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
609 		Rollback to Delete_Nodes_SP;
610 		IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
611 		THEN
612 			FND_MSG_PUB.add_exc_msg
613 			(
614 				p_pkg_name		=> G_PKG_NAME,
615 				p_procedure_name 	=> 'Delete_Nodes',
616 				p_error_text     	=> SUBSTR(SQLERRM,1,240)
617 			);
618 		END IF;
619 		FND_MSG_PUB.count_and_get
620 		(
621 			p_count 	=> x_msg_count,
622 			p_data  	=> x_msg_data,
623 			p_encoded 	=> FND_API.G_FALSE
624 		);
625 
626 END Delete_Nodes;
627 
628 End AHL_MC_Node_PUB;