[Home] [Help]
PACKAGE BODY: APPS.AHL_LTP_SIMUL_PLAN_PUB
Source
1 PACKAGE BODY AHL_LTP_SIMUL_PLAN_PUB AS
2 /* $Header: AHLPSPNB.pls 115.7 2003/09/09 06:05:47 rroy noship $ */
3 --
4
5 G_PKG_NAME VARCHAR2(30) := 'AHL_LTP_SIMUL_PLAN_PUB';
6 G_DEBUG VARCHAR2(1) := AHL_DEBUG_PUB.is_log_enabled;
7 --
8 -----------------------------------------------------------
9 -- PACKAGE
10 -- AHL_LTP_SIMUL_PLAN_PUB
11 --
12 -- PURPOSE
13 -- This package is a Public API for managing Simulation plan information in
14 -- Advanced Services Online. It contains specification for pl/sql records and tables
15 --
16 -- AHL_SIMULATION_PLANS_VL:
17 -- Process_Simulation_plan (see below for specification)
18 --
19 --
20 -- NOTES
21 --
22 --
23 -- HISTORY
24 -- 17-Apr-2002 ssurapan Created.
25
26 --------------------------------------------------------------------
27 -- PROCEDURE
28 -- Process_Simulation_Plan
29 --
30 -- PURPOSE
31 -- Process Simulation Plan
32 --
33 -- PARAMETERS
34 -- p_x_simulation_plan_tbl: the table representing simulation_plan_tbl
35 --
36 -- NOTES
37 --------------------------------------------------------------------
38
39 PROCEDURE Process_Simulation_plan (
40 p_api_version IN NUMBER,
41 p_init_msg_list IN VARCHAR2 := FND_API.g_false,
42 p_commit IN VARCHAR2 := FND_API.g_false,
43 p_validation_level IN NUMBER := FND_API.g_valid_level_full,
44 p_module_type IN VARCHAR2 := 'JSP',
45 p_x_simulation_plan_tbl IN OUT NOCOPY Simulation_Plan_Tbl,
46 x_return_status OUT NOCOPY VARCHAR2,
47 x_msg_count OUT NOCOPY NUMBER,
48 x_msg_data OUT NOCOPY VARCHAR2
49 )
50 IS
51 l_api_name CONSTANT VARCHAR2(30) := 'PROCESS_SIMULATION_PLAN';
52 l_api_version CONSTANT NUMBER := 1.0;
53 l_msg_count NUMBER;
54 l_return_status VARCHAR2(1);
55 l_msg_data VARCHAR2(2000);
56 --
57 BEGIN
58 --------------------Initialize ----------------------------------
59 -- Standard Start of API savepoint
60 SAVEPOINT process_simulation_plan;
61 -- Check if API is called in debug mode. If yes, enable debug.
62 IF G_DEBUG='Y' THEN
63 AHL_DEBUG_PUB.enable_debug;
64 END IF;
65 -- Debug info.
66 IF G_DEBUG='Y' THEN
67 AHL_DEBUG_PUB.debug( 'enter ahl_ltp_simul_plan_pub.Process Simulation Plan','+SMPLN+');
68 END IF;
69 -- Standard call to check for call compatibility.
70 IF FND_API.to_boolean(p_init_msg_list)
71 THEN
72 FND_MSG_PUB.initialize;
73 END IF;
74 -- Initialize API return status to success
75 x_return_status := FND_API.G_RET_STS_SUCCESS;
76 -- Initialize message list if p_init_msg_list is set to TRUE.
77 IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
78 p_api_version,
79 l_api_name,G_PKG_NAME)
80 THEN
81 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
82 END IF;
83 --------------------Start of API Body-----------------------------------
84 IF p_x_simulation_plan_tbl.COUNT > 0
85 THEN
86 FOR i IN p_x_simulation_plan_tbl.FIRST..p_x_simulation_plan_tbl.LAST
87 LOOP
88 IF p_x_simulation_plan_tbl(i).operation_flag = 'C' THEN
89 AHL_LTP_SIMUL_PLAN_PVT.CREATE_SIMULATION_PLAN
90 (
91 p_api_version => l_api_version,
92 p_init_msg_list => p_init_msg_list,
93 p_commit => p_commit,
94 p_validation_level => p_validation_level,
95 p_module_type => p_module_type,
96 p_x_simulation_plan_rec => p_x_simulation_plan_tbl(i),
97 x_return_status => l_return_status,
98 x_msg_count => l_msg_count,
99 x_msg_data => l_msg_data
100 );
101 --Standard check to count messages
102 l_msg_count := Fnd_Msg_Pub.count_msg;
103
104 IF l_msg_count > 0 THEN
105 X_msg_count := l_msg_count;
106 X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
107 RAISE Fnd_Api.G_EXC_ERROR;
108 END IF;
109
110 ELSIF p_x_simulation_plan_tbl(i).operation_flag = 'U' THEN
111
112 AHL_LTP_SIMUL_PLAN_PVT.UPDATE_SIMULATION_PLAN
113 (
114 p_api_version => l_api_version,
115 p_init_msg_list => p_init_msg_list,
116 p_commit => p_commit,
117 p_validation_level => p_validation_level,
118 p_module_type => p_module_type,
119 p_simulation_plan_rec => p_x_simulation_plan_tbl(i),
120 x_return_status => l_return_status,
121 x_msg_count => l_msg_count,
122 x_msg_data => l_msg_data
123 );
124 --Standard check to count messages
125 l_msg_count := Fnd_Msg_Pub.count_msg;
126
127 IF l_msg_count > 0 THEN
128 X_msg_count := l_msg_count;
129 X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
130 RAISE Fnd_Api.G_EXC_ERROR;
131 END IF;
132
133 ELSIF p_x_simulation_plan_tbl(i).operation_flag = 'D' THEN
134 AHL_LTP_SIMUL_PLAN_PVT.DELETE_SIMULATION_PLAN
135 (
136 p_api_version => l_api_version,
137 p_init_msg_list => p_init_msg_list,
138 p_commit => p_commit,
139 p_validation_level => p_validation_level,
140 p_simulation_plan_rec => p_x_simulation_plan_tbl(i),
141 x_return_status => l_return_status,
142 x_msg_count => l_msg_count,
143 x_msg_data => l_msg_data
144 );
145 END IF;
146 --Standard check to count messages
147 l_msg_count := Fnd_Msg_Pub.count_msg;
148
149 IF l_msg_count > 0 THEN
150 X_msg_count := l_msg_count;
151 X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
152 RAISE Fnd_Api.G_EXC_ERROR;
153 END IF;
154
155 END LOOP;
156 END IF;
157
158 ------------------------End of Body---------------------------------------
159 --Standard check to count messages
160 l_msg_count := Fnd_Msg_Pub.count_msg;
161
162 IF l_msg_count > 0 THEN
163 X_msg_count := l_msg_count;
164 X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
165 RAISE Fnd_Api.G_EXC_ERROR;
166 END IF;
167
168 --Standard check for commit
169 IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
170 COMMIT;
171 END IF;
172 -- Debug info
173 IF G_DEBUG='Y' THEN
174 Ahl_Debug_Pub.debug( 'End of public api Process Simulation plan','+SMPLN+');
175 END IF;
176 -- Check if API is called in debug mode. If yes, disable debug.
177 IF G_DEBUG='Y' THEN
178 Ahl_Debug_Pub.disable_debug;
179 END IF;
180
181 EXCEPTION
182 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
183 ROLLBACK TO process_simulation_plan;
184 X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
185 FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
186 p_count => x_msg_count,
187 p_data => x_msg_data);
188
189 IF G_DEBUG='Y' THEN
190 AHL_DEBUG_PUB.log_app_messages (
191 x_msg_count, x_msg_data, 'ERROR' );
192 AHL_DEBUG_PUB.debug( 'ahl_ltp_simul_plan_pub.Process Simulation plan','+SMPLN+');
193 END IF;
194 -- Check if API is called in debug mode. If yes, disable debug.
195 AHL_DEBUG_PUB.disable_debug;
196
197 WHEN FND_API.G_EXC_ERROR THEN
198 ROLLBACK TO process_simulation_plan;
199 X_return_status := FND_API.G_RET_STS_ERROR;
200 FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
201 p_count => x_msg_count,
202 p_data => X_msg_data);
203 -- Debug info.
204 IF G_DEBUG='Y' THEN
205 AHL_DEBUG_PUB.log_app_messages (
206 x_msg_count, x_msg_data, 'UNEXPECTED ERROR' );
207 AHL_DEBUG_PUB.debug( 'ahl_ltp_simul_plan_pub.Process Simulation plan','+SMPLN+');
208 END IF;
209 -- Check if API is called in debug mode. If yes, disable debug.
210 AHL_DEBUG_PUB.disable_debug;
211
212 WHEN OTHERS THEN
213 ROLLBACK TO process_simulation_plan;
214 X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
215 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
216 THEN
217 fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PUB',
218 p_procedure_name => 'PROCESS_SIMULATION_PLAN',
219 p_error_text => SUBSTR(SQLERRM,1,240));
220 END IF;
221 FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
222 p_count => x_msg_count,
223 p_data => X_msg_data);
224
225 -- Debug info.
226 IF G_DEBUG='Y' THEN
227 AHL_DEBUG_PUB.log_app_messages (
228 x_msg_count, x_msg_data, 'SQL ERROR' );
229 AHL_DEBUG_PUB.debug( 'ahl_ltp_simul_plan_pub.Process Simulation Plan','+SMPLN+');
230 END IF;
231 -- Check if API is called in debug mode. If yes, disable debug.
232 AHL_DEBUG_PUB.disable_debug;
233
234 END Process_Simulation_Plan;
235
236
237
238 --------------------------------------------------------------------
239 -- PROCEDURE
240 -- Process_Simulation_Visit
241 --
242 -- PURPOSE
243 -- Process Simulation Visit
244 --
245 -- PARAMETERS
246 -- p_x_simulation_visit_tbl : Table Representing Simulation_Visit_Tbl
247 --
248 -- NOTES
249 --------------------------------------------------------------------
250 PROCEDURE Process_Simulation_Visit (
251 p_api_version IN NUMBER,
252 p_init_msg_list IN VARCHAR2 := FND_API.g_false,
253 p_commit IN VARCHAR2 := FND_API.g_false,
254 p_validation_level IN NUMBER := FND_API.g_valid_level_full,
255 p_module_type IN VARCHAR2 := 'JSP',
256 p_simulation_visit_tbl IN OUT NOCOPY Simulation_Visit_Tbl,
257 x_return_status OUT NOCOPY VARCHAR2,
258 x_msg_count OUT NOCOPY NUMBER,
259 x_msg_data OUT NOCOPY VARCHAR2
260 )
261
262 IS
263
264 l_api_name CONSTANT VARCHAR2(30) := 'PROCESS_SIMULATION_VISIT';
265 l_api_version CONSTANT NUMBER := 1.0;
266 l_msg_count NUMBER;
267 l_return_status VARCHAR2(1);
268 l_msg_data VARCHAR2(2000);
269 l_visit_id NUMBER;
270 --
271 BEGIN
272 --------------------Initialize ----------------------------------
273 -- Standard Start of API savepoint
274 SAVEPOINT process_simulation_visit;
275 -- Check if API is called in debug mode. If yes, enable debug.
276 IF G_DEBUG='Y' THEN
277 AHL_DEBUG_PUB.enable_debug;
278 END IF;
279 -- Debug info.
280 IF G_DEBUG='Y' THEN
281 AHL_DEBUG_PUB.debug( 'enter ahl_ltp_simul_plan_pub.Process Visits to Plan','+SMPLN+');
282 END IF;
283 -- Standard call to check for call compatibility.
284 IF FND_API.to_boolean(p_init_msg_list)
285 THEN
286 FND_MSG_PUB.initialize;
287 END IF;
288 -- Initialize API return status to success
289 x_return_status := FND_API.G_RET_STS_SUCCESS;
290 -- Initialize message list if p_init_msg_list is set to TRUE.
291 IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
292 p_api_version,
293 l_api_name,G_PKG_NAME)
294 THEN
295 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
296 END IF;
297 --------------------Start of API Body-----------------------------------
298 IF p_simulation_visit_tbl.COUNT > 0
299 THEN
300 FOR i IN p_simulation_visit_tbl.FIRST..p_simulation_visit_tbl.LAST
301 LOOP
302 IF p_simulation_visit_tbl(i).operation_flag = 'X' THEN
303
304 IF G_DEBUG='Y' THEN
305 AHL_DEBUG_PUB.debug( 'visit_id'||p_simulation_visit_tbl(i).visit_id);
306 AHL_DEBUG_PUB.debug( 'plan_id'||p_simulation_visit_tbl(i).plan_id);
307 END IF;
308
309 AHL_LTP_SIMUL_PLAN_PVT.Copy_Visits_To_Plan (
310 p_api_version => p_api_version,
311 p_init_msg_list => p_init_msg_list,
312 p_commit => p_commit,
313 p_validation_level => p_validation_level,
314 p_module_type => p_module_type,
315 p_visit_id => p_simulation_visit_tbl(i).visit_id,
316 p_visit_number => p_simulation_visit_tbl(i).primary_visit_number,
317 p_plan_id => p_simulation_visit_tbl(i).plan_id,
318 p_v_ovn => p_simulation_visit_tbl(i).visit_ovn,
319 p_p_ovn => p_simulation_visit_tbl(i).plan_ovn,
320 x_visit_id => l_visit_id,
321 x_return_status => l_return_status,
322 x_msg_count => l_msg_count,
323 x_msg_data => l_msg_data);
324 --Assign returned value
325 p_simulation_visit_tbl(i).visit_id := l_visit_id;
326 IF G_DEBUG='Y' THEN
327 AHL_DEBUG_PUB.debug( 'pvisit_id'||p_simulation_visit_tbl(i).visit_id);
328 AHL_DEBUG_PUB.debug( 'plan_id'||p_simulation_visit_tbl(i).plan_id);
329 AHL_DEBUG_PUB.debug( 'flag'||p_simulation_visit_tbl(i).operation_flag);
330 END IF;
331 --Standard check to count messages
332 l_msg_count := Fnd_Msg_Pub.count_msg;
333
334 IF l_msg_count > 0 THEN
335 X_msg_count := l_msg_count;
336 X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
337 RAISE Fnd_Api.G_EXC_ERROR;
338 END IF;
339
340 /*
341 ELSIF p_simulation_visit_tbl(i).operation_flag = 'D' THEN
342 AHL_LTP_SIMUL_PLAN_PVT.Remove_Visits_FR_Plan (
343 p_api_version => p_api_version,
344 p_init_msg_list => p_init_msg_list,
345 p_commit => p_commit,
346 p_validation_level => p_validation_level,
347 p_module_type => p_module_type,
348 p_visit_id => p_simulation_visit_tbl(i).visit_id,
349 p_plan_id => p_simulation_visit_tbl(i).plan_id,
350 p_v_ovn => p_simulation_visit_tbl(i).visit_ovn,
351 x_return_status => l_return_status,
352 x_msg_count => l_msg_count,
353 x_msg_data => l_msg_data);
354 --
355 */
356 IF G_DEBUG='Y' THEN
357 AHL_DEBUG_PUB.debug( 'Pvisit_id'||p_simulation_visit_tbl(i).primary_visit_id);
358 AHL_DEBUG_PUB.debug( 'plan_id'||p_simulation_visit_tbl(i).plan_id);
359 END IF;
360
361
362 ELSIF p_simulation_visit_tbl(i).operation_flag = 'C' THEN
363 AHL_LTP_SIMUL_PLAN_PVT.Copy_Visits_To_Plan (
364 p_api_version => p_api_version,
365 p_init_msg_list => p_init_msg_list,
366 p_commit => p_commit,
367 p_validation_level => p_validation_level,
368 p_module_type => p_module_type,
369 p_visit_id => p_simulation_visit_tbl(i).primary_visit_id,
370 p_visit_number => p_simulation_visit_tbl(i).primary_visit_number,
371 p_plan_id => p_simulation_visit_tbl(i).plan_id,
372 p_v_ovn => p_simulation_visit_tbl(i).visit_ovn,
373 p_p_ovn => p_simulation_visit_tbl(i).plan_ovn,
374 x_visit_id => l_visit_id,
375 x_return_status => l_return_status,
376 x_msg_count => l_msg_count,
377 x_msg_data => l_msg_data);
378 END IF;
379
380 IF G_DEBUG='Y' THEN
381 AHL_DEBUG_PUB.debug( 'pvisit_id'||p_simulation_visit_tbl(i).visit_id);
382 AHL_DEBUG_PUB.debug( 'plan_id'||p_simulation_visit_tbl(i).plan_id);
383 AHL_DEBUG_PUB.debug( 'flag'||p_simulation_visit_tbl(i).operation_flag);
384 END IF;
385 --Standard check to count messages
386 l_msg_count := Fnd_Msg_Pub.count_msg;
387
388 IF l_msg_count > 0 THEN
389 X_msg_count := l_msg_count;
390 X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
391 RAISE Fnd_Api.G_EXC_ERROR;
392 END IF;
393
394 IF p_simulation_visit_tbl(i).operation_flag = 'D' THEN
395 AHL_LTP_SIMUL_PLAN_PVT.Remove_Visits_FR_Plan (
396 p_api_version => p_api_version,
397 p_init_msg_list => p_init_msg_list,
398 p_commit => p_commit,
399 p_validation_level => p_validation_level,
400 p_module_type => p_module_type,
401 p_visit_id => p_simulation_visit_tbl(i).visit_id,
402 p_plan_id => p_simulation_visit_tbl(i).plan_id,
403 p_v_ovn => p_simulation_visit_tbl(i).visit_ovn,
404 x_return_status => l_return_status,
405 x_msg_count => l_msg_count,
406 x_msg_data => l_msg_data);
407 END IF;
408 --Standard check to count messages
409 l_msg_count := Fnd_Msg_Pub.count_msg;
410
411 IF l_msg_count > 0 THEN
412 X_msg_count := l_msg_count;
413 X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
414 RAISE Fnd_Api.G_EXC_ERROR;
415 END IF;
416
417 END LOOP;
418 END IF;
419 ------------------------End of Body---------------------------------------
420 --Standard check to count messages
421 l_msg_count := Fnd_Msg_Pub.count_msg;
422
423 IF l_msg_count > 0 THEN
424 X_msg_count := l_msg_count;
425 X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
426 RAISE Fnd_Api.G_EXC_ERROR;
427 END IF;
428
429 --Standard check for commit
430 IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
431 COMMIT;
432 END IF;
433 -- Debug info
434 IF G_DEBUG='Y' THEN
435 Ahl_Debug_Pub.debug( 'End of public api Process Simulation Visit','+SMPLN+');
436 END IF;
437 -- Check if API is called in debug mode. If yes, disable debug.
438 IF G_DEBUG='Y' THEN
439 Ahl_Debug_Pub.disable_debug;
440 END IF;
441
442 EXCEPTION
443 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
444 ROLLBACK TO process_simulation_visit;
445 X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
446 FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
447 p_count => x_msg_count,
448 p_data => x_msg_data);
449
450 IF G_DEBUG='Y' THEN
451 AHL_DEBUG_PUB.log_app_messages (
452 x_msg_count, x_msg_data, 'ERROR' );
453 AHL_DEBUG_PUB.debug( 'ahl_ltp_simul_plan_pub.Process Simulation Visit','+SMPLN+');
454 END IF;
455 -- Check if API is called in debug mode. If yes, disable debug.
456 AHL_DEBUG_PUB.disable_debug;
457
458 WHEN FND_API.G_EXC_ERROR THEN
459 ROLLBACK TO process_simulation_visit;
460 X_return_status := FND_API.G_RET_STS_ERROR;
461 FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
462 p_count => x_msg_count,
463 p_data => X_msg_data);
464 -- Debug info.
465 IF G_DEBUG='Y' THEN
466 AHL_DEBUG_PUB.log_app_messages (
467 x_msg_count, x_msg_data, 'UNEXPECTED ERROR' );
468 AHL_DEBUG_PUB.debug( 'ahl_ltp_simul_plan_pub.Process Simulation Visit','+SMPLN+');
469 END IF;
470 -- Check if API is called in debug mode. If yes, disable debug.
471 AHL_DEBUG_PUB.disable_debug;
472
473 WHEN OTHERS THEN
474 ROLLBACK TO process_simulation_visit;
475 X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
476 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
477 THEN
478 fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PUB',
479 p_procedure_name => 'PROCESS_SIMULATION_VISIT',
480 p_error_text => SUBSTR(SQLERRM,1,240));
481 END IF;
482 FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
483 p_count => x_msg_count,
484 p_data => X_msg_data);
485
486 -- Debug info.
487 IF G_DEBUG='Y' THEN
488 AHL_DEBUG_PUB.log_app_messages (
489 x_msg_count, x_msg_data, 'SQL ERROR' );
490 AHL_DEBUG_PUB.debug( 'ahl_ltp_simul_plan_pub.Process Simulation visit','+SMPLN+');
491 END IF;
492 -- Check if API is called in debug mode. If yes, disable debug.
493 AHL_DEBUG_PUB.disable_debug;
494
495 END Process_Simulation_Visit;
496
497
498
499 --------------------------------------------------------------------
500 -- PROCEDURE
501 -- Toggle_Simulation_Delete
502 --
503 -- PURPOSE
504 -- Toggle Simulation Delete/Undelete
505 --
506 -- PARAMETERS
507 -- p_visit_id : Visit Id
508 -- p_visit_object_version_number : Visit Object Version Number
509 --
510 -- NOTES
511 --------------------------------------------------------------------
512 PROCEDURE Toggle_Simulation_Delete (
513 p_api_version IN NUMBER,
514 p_init_msg_list IN VARCHAR2 := FND_API.g_false,
515 p_commit IN VARCHAR2 := FND_API.g_false,
516 p_validation_level IN NUMBER := FND_API.g_valid_level_full,
517 p_module_type IN VARCHAR2 := 'JSP',
518 p_visit_id IN NUMBER,
519 p_visit_object_version_number IN NUMBER,
520 x_return_status OUT NOCOPY VARCHAR2,
521 x_msg_count OUT NOCOPY NUMBER,
522 x_msg_data OUT NOCOPY VARCHAR2
523 )
524 IS
525 l_api_name CONSTANT VARCHAR2(30) := 'TOGGLE_SIMULATION_DELETE';
526 l_api_version CONSTANT NUMBER := 1.0;
527 l_msg_count NUMBER;
528 l_return_status VARCHAR2(1);
529 l_msg_data VARCHAR2(2000);
530 --
531
532 BEGIN
533 --------------------Initialize ----------------------------------
534 -- Standard Start of API savepoint
535 SAVEPOINT toggle_simulation_delete;
536 -- Check if API is called in debug mode. If yes, enable debug.
537 IF G_DEBUG='Y' THEN
538 AHL_DEBUG_PUB.enable_debug;
539 END IF;
540 -- Debug info.
541 IF G_DEBUG='Y' THEN
542 AHL_DEBUG_PUB.debug( 'enter ahl_ltp_simul_plan_pub.Toggle Simulation Delete','+SMPLN+');
543 END IF;
544 -- Standard call to check for call compatibility.
545 IF FND_API.to_boolean(p_init_msg_list)
546 THEN
547 FND_MSG_PUB.initialize;
548 END IF;
549 -- Initialize API return status to success
550 x_return_status := FND_API.G_RET_STS_SUCCESS;
551 -- Initialize message list if p_init_msg_list is set to TRUE.
552 IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
553 p_api_version,
554 l_api_name,G_PKG_NAME)
555 THEN
556 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
557 END IF;
558 --------------------Start of API Body-----------------------------------
559 --Call Private APT
560 AHL_LTP_SIMUL_PLAN_PVT.Toggle_Simulation_Delete (
561 p_api_version => p_api_version,
562 p_init_msg_list => p_init_msg_list,
563 p_commit => p_commit,
564 p_validation_level => p_validation_level,
565 p_module_type => p_module_type,
566 p_visit_id => p_visit_id,
567 p_visit_object_version_number => p_visit_object_version_number,
568 x_return_status => l_return_status,
569 x_msg_count => l_msg_count,
570 x_msg_data => l_msg_data);
571
572
573 ------------------------End of Body---------------------------------------
574 --Standard check to count messages
575 l_msg_count := Fnd_Msg_Pub.count_msg;
576
577 IF l_msg_count > 0 THEN
578 X_msg_count := l_msg_count;
579 X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
580 RAISE Fnd_Api.G_EXC_ERROR;
581 END IF;
582
583 --Standard check for commit
584 IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
585 COMMIT;
586 END IF;
587 -- Debug info
588 IF G_DEBUG='Y' THEN
589 Ahl_Debug_Pub.debug( 'End of public api Toggle Simulation Delete','+SMPLN+');
590 -- Check if API is called in debug mode. If yes, disable debug.
591 Ahl_Debug_Pub.disable_debug;
592 END IF;
593
594 EXCEPTION
595 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
596 ROLLBACK TO toggle_simulation_delete;
597 X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
598 FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
599 p_count => x_msg_count,
600 p_data => x_msg_data);
601
602 IF G_DEBUG='Y' THEN
603 AHL_DEBUG_PUB.log_app_messages (
604 x_msg_count, x_msg_data, 'ERROR' );
605 AHL_DEBUG_PUB.debug( 'ahl_ltp_simul_plan_pub.Toggle Simulation Delete','+SMPLN+');
606 END IF;
607 -- Check if API is called in debug mode. If yes, disable debug.
608 AHL_DEBUG_PUB.disable_debug;
609
610 WHEN FND_API.G_EXC_ERROR THEN
611 ROLLBACK TO toggle_simulation_delete;
612 X_return_status := FND_API.G_RET_STS_ERROR;
613 FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
614 p_count => x_msg_count,
615 p_data => X_msg_data);
616 -- Debug info.
617 IF G_DEBUG='Y' THEN
618 AHL_DEBUG_PUB.log_app_messages (
619 x_msg_count, x_msg_data, 'UNEXPECTED ERROR' );
620 AHL_DEBUG_PUB.debug( 'ahl_ltp_simul_plan_pub.Toggle Simulation Delete','+SMPLN+');
621 END IF;
622 -- Check if API is called in debug mode. If yes, disable debug.
623 AHL_DEBUG_PUB.disable_debug;
624
625 WHEN OTHERS THEN
626 ROLLBACK TO toggle_simulation_delete;
627 X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
628 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
629 THEN
630 fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PUB',
631 p_procedure_name => 'TOGGLE_SIMULATION_DELETE',
632 p_error_text => SUBSTR(SQLERRM,1,240));
633 END IF;
634 FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
635 p_count => x_msg_count,
636 p_data => X_msg_data);
637
638 -- Debug info.
639 IF G_DEBUG='Y' THEN
640 AHL_DEBUG_PUB.log_app_messages (
641 x_msg_count, x_msg_data, 'SQL ERROR' );
642 AHL_DEBUG_PUB.debug( 'ahl_ltp_simul_plan_pub.Toggle Simulation Delete','+SMPLN+');
643 END IF;
644 -- Check if API is called in debug mode. If yes, disable debug.
645 AHL_DEBUG_PUB.disable_debug;
646
647 END Toggle_Simulation_Delete;
648
649
650 --------------------------------------------------------------------
651 -- PROCEDURE
652 -- Set_Plan_As_Primary
653 --
654 -- PURPOSE
655 -- Set Plan As Primary
656 --
657 -- PARAMETERS
658 -- p_plan_id : Simulation Plan Id
659 -- p_object_version_number : Plan Object Version Number
660 --
661 -- NOTES
662 --------------------------------------------------------------------
663 PROCEDURE Set_Plan_As_Primary (
664 p_api_version IN NUMBER,
665 p_init_msg_list IN VARCHAR2 := FND_API.g_false,
666 p_commit IN VARCHAR2 := FND_API.g_false,
667 p_validation_level IN NUMBER := FND_API.g_valid_level_full,
668 p_module_type IN VARCHAR2 := 'JSP',
669 p_plan_id IN NUMBER,
670 p_object_version_number IN NUMBER,
671 x_return_status OUT NOCOPY VARCHAR2,
672 x_msg_count OUT NOCOPY NUMBER,
673 x_msg_data OUT NOCOPY VARCHAR2
674 )
675 IS
676
677 l_api_name CONSTANT VARCHAR2(30) := 'SET_PLAN_AS_PRIMARY';
678 l_api_version CONSTANT NUMBER := 1.0;
679 l_msg_count NUMBER;
680 l_return_status VARCHAR2(1);
681 l_msg_data VARCHAR2(2000);
682 --
683
684 BEGIN
685 --------------------Initialize ----------------------------------
686 -- Standard Start of API savepoint
687 SAVEPOINT set_plan_as_primary;
688 -- Check if API is called in debug mode. If yes, enable debug.
689 IF G_DEBUG='Y' THEN
690 AHL_DEBUG_PUB.enable_debug;
691 END IF;
692 -- Debug info.
693 IF G_DEBUG='Y' THEN
694 AHL_DEBUG_PUB.debug( 'enter ahl_ltp_simul_plan_pub. Set Plan as Primary','+SMPLN+');
695 END IF;
696 -- Standard call to check for call compatibility.
697 IF FND_API.to_boolean(p_init_msg_list)
698 THEN
699 FND_MSG_PUB.initialize;
700 END IF;
701 -- Initialize API return status to success
702 x_return_status := FND_API.G_RET_STS_SUCCESS;
703 -- Initialize message list if p_init_msg_list is set to TRUE.
704 IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
705 p_api_version,
706 l_api_name,G_PKG_NAME)
707 THEN
708 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
709 END IF;
710 --------------------Start of API Body-----------------------------------
711 --Call Private APT
712 AHL_LTP_SIMUL_PLAN_PVT.Set_Plan_As_Primary (
713 p_api_version => p_api_version,
714 p_init_msg_list => p_init_msg_list,
715 p_commit => p_commit,
716 p_validation_level => p_validation_level,
717 p_module_type => p_module_type,
718 p_plan_id => p_plan_id,
719 p_object_version_number => p_object_version_number,
720 x_return_status => l_return_status,
721 x_msg_count => l_msg_count,
722 x_msg_data => l_msg_data);
723
724
725 ------------------------End of Body---------------------------------------
726 --Standard check to count messages
727 l_msg_count := Fnd_Msg_Pub.count_msg;
728
729 IF l_msg_count > 0 THEN
730 X_msg_count := l_msg_count;
731 X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
732 RAISE Fnd_Api.G_EXC_ERROR;
733 END IF;
734
735 --Standard check for commit
736 IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
737 COMMIT;
738 END IF;
739 -- Debug info
740 IF G_DEBUG='Y' THEN
741 Ahl_Debug_Pub.debug( 'End of public api Set Plan as primary','+SMPLN+');
742 -- Check if API is called in debug mode. If yes, disable debug.
743 Ahl_Debug_Pub.disable_debug;
744 END IF;
745
746 EXCEPTION
747 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
748 ROLLBACK TO set_plan_as_primary;
749 X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
750 FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
751 p_count => x_msg_count,
752 p_data => x_msg_data);
753
754 IF G_DEBUG='Y' THEN
755 AHL_DEBUG_PUB.log_app_messages (
756 x_msg_count, x_msg_data, 'ERROR' );
757 AHL_DEBUG_PUB.debug( 'ahl_ltp_simul_plan_pub.Set plan as primary','+SMPLN+');
758 END IF;
759 -- Check if API is called in debug mode. If yes, disable debug.
760 AHL_DEBUG_PUB.disable_debug;
761
762 WHEN FND_API.G_EXC_ERROR THEN
763 ROLLBACK TO set_plan_as_primary;
764 X_return_status := FND_API.G_RET_STS_ERROR;
765 FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
766 p_count => x_msg_count,
767 p_data => X_msg_data);
768 -- Debug info.
769 IF G_DEBUG='Y' THEN
770 AHL_DEBUG_PUB.log_app_messages (
771 x_msg_count, x_msg_data, 'UNEXPECTED ERROR' );
772 AHL_DEBUG_PUB.debug( 'ahl_ltp_simul_plan_pub.Set Plan as primary','+SMPLN+');
773 END IF;
774 -- Check if API is called in debug mode. If yes, disable debug.
775 AHL_DEBUG_PUB.disable_debug;
776
777 WHEN OTHERS THEN
778 ROLLBACK TO set_plan_as_primary;
779 X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
780 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
781 THEN
782 fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PUB',
783 p_procedure_name => 'SET_PLAN_AS_PRIMARY',
784 p_error_text => SUBSTR(SQLERRM,1,240));
785 END IF;
786 FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
787 p_count => x_msg_count,
788 p_data => X_msg_data);
789
790 -- Debug info.
791 IF G_DEBUG='Y' THEN
792 AHL_DEBUG_PUB.log_app_messages (
793 x_msg_count, x_msg_data, 'SQL ERROR' );
794 AHL_DEBUG_PUB.debug( 'ahl_ltp_simul_plan_pub.Set plan as primary','+SMPLN+');
795 END IF;
796 -- Check if API is called in debug mode. If yes, disable debug.
797 AHL_DEBUG_PUB.disable_debug;
798
799 END Set_Plan_As_Primary;
800
801
802 --------------------------------------------------------------------
803 -- PROCEDURE
804 -- Set_Visit_As_Primary
805 --
806 -- PURPOSE
807 -- Set Visit As Primary
808 --
809 -- PARAMETERS
810 -- p_visit_id : Simulation Visit Id
811 -- p_object_version_number : Visit Object Version Number
812 --
813 -- NOTES
814 --------------------------------------------------------------------
815 PROCEDURE Set_Visit_As_Primary (
816 p_api_version IN NUMBER,
817 p_init_msg_list IN VARCHAR2 := FND_API.g_false,
818 p_commit IN VARCHAR2 := FND_API.g_false,
819 p_validation_level IN NUMBER := FND_API.g_valid_level_full,
820 p_module_type IN VARCHAR2 := 'JSP',
821 p_visit_id IN NUMBER,
822 p_plan_id IN NUMBER,
823 p_object_version_number IN NUMBER,
824 x_return_status OUT NOCOPY VARCHAR2,
825 x_msg_count OUT NOCOPY NUMBER,
826 x_msg_data OUT NOCOPY VARCHAR2
827 )
828 IS
829
830 l_api_name CONSTANT VARCHAR2(30) := 'SET_VISIT_AS_PRIMARY';
831 l_api_version CONSTANT NUMBER := 1.0;
832 l_msg_count NUMBER;
833 l_return_status VARCHAR2(1);
834 l_msg_data VARCHAR2(2000);
835 --
836
837 BEGIN
838 --------------------Initialize ----------------------------------
839 -- Standard Start of API savepoint
840 SAVEPOINT set_visit_as_primary;
841 -- Check if API is called in debug mode. If yes, enable debug.
842 IF G_DEBUG='Y' THEN
843 AHL_DEBUG_PUB.enable_debug;
844 END IF;
845 -- Debug info.
846 IF G_DEBUG='Y' THEN
847 AHL_DEBUG_PUB.debug( 'enter ahl_ltp_simul_plan_pub. Set Visit as Primary','+SMPLN+');
848 END IF;
849 -- Standard call to check for call compatibility.
850 IF FND_API.to_boolean(p_init_msg_list)
851 THEN
852 FND_MSG_PUB.initialize;
853 END IF;
854 -- Initialize API return status to success
855 x_return_status := FND_API.G_RET_STS_SUCCESS;
856 -- Initialize message list if p_init_msg_list is set to TRUE.
857 IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
858 p_api_version,
859 l_api_name,G_PKG_NAME)
860 THEN
861 RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
862 END IF;
863 --------------------Start of API Body-----------------------------------
864 --Call Private APT
865 AHL_LTP_SIMUL_PLAN_PVT.Set_Visit_As_Primary (
866 p_api_version => p_api_version,
867 p_init_msg_list => p_init_msg_list,
868 p_commit => p_commit,
869 p_validation_level => p_validation_level,
870 p_module_type => p_module_type,
871 p_visit_id => p_visit_id,
872 p_plan_id => p_plan_id,
873 p_object_version_number => p_object_version_number,
874 x_return_status => l_return_status,
875 x_msg_count => l_msg_count,
876 x_msg_data => l_msg_data);
877
878
879 ------------------------End of Body---------------------------------------
880 --Standard check to count messages
881 l_msg_count := Fnd_Msg_Pub.count_msg;
882
883 IF l_msg_count > 0 THEN
884 X_msg_count := l_msg_count;
885 X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
886 RAISE Fnd_Api.G_EXC_ERROR;
887 END IF;
888
889 --Standard check for commit
890 IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
891 COMMIT;
892 END IF;
893 -- Debug info
894 IF G_DEBUG='Y' THEN
895 Ahl_Debug_Pub.debug( 'End of public api Set Visit as primary','+SMPLN+');
896 -- Check if API is called in debug mode. If yes, disable debug.
897 Ahl_Debug_Pub.disable_debug;
898 END IF;
899
900 EXCEPTION
901 WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
902 ROLLBACK TO set_visit_as_primary;
903 X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
904 FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
905 p_count => x_msg_count,
906 p_data => x_msg_data);
907
908 IF G_DEBUG='Y' THEN
909 AHL_DEBUG_PUB.log_app_messages (
910 x_msg_count, x_msg_data, 'ERROR' );
911 AHL_DEBUG_PUB.debug( 'ahl_ltp_simul_plan_pub.Set visit as primary','+SMPLN+');
912 END IF;
913 -- Check if API is called in debug mode. If yes, disable debug.
914 AHL_DEBUG_PUB.disable_debug;
915
916 WHEN FND_API.G_EXC_ERROR THEN
917 ROLLBACK TO set_visit_as_primary;
918 X_return_status := FND_API.G_RET_STS_ERROR;
919 FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
920 p_count => x_msg_count,
921 p_data => X_msg_data);
922 -- Debug info.
923 IF G_DEBUG='Y' THEN
924 AHL_DEBUG_PUB.log_app_messages (
925 x_msg_count, x_msg_data, 'UNEXPECTED ERROR' );
926 AHL_DEBUG_PUB.debug( 'ahl_ltp_simul_plan_pub.Set Visit as primary','+SMPLN+');
927 END IF;
928 -- Check if API is called in debug mode. If yes, disable debug.
929 AHL_DEBUG_PUB.disable_debug;
930
931 WHEN OTHERS THEN
932 ROLLBACK TO set_visit_as_primary;
933 X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
934 IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
935 THEN
936 fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PUB',
937 p_procedure_name => 'SET_VISIT_AS_PRIMARY',
938 p_error_text => SUBSTR(SQLERRM,1,240));
939 END IF;
940 FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
941 p_count => x_msg_count,
942 p_data => X_msg_data);
943
944 -- Debug info.
945 IF G_DEBUG='Y' THEN
946 AHL_DEBUG_PUB.log_app_messages (
947 x_msg_count, x_msg_data, 'SQL ERROR' );
948 AHL_DEBUG_PUB.debug( 'ahl_ltp_simul_plan_pub.Set visit as primary','+SMPLN+');
949 END IF;
950 -- Check if API is called in debug mode. If yes, disable debug.
951 AHL_DEBUG_PUB.disable_debug;
952 END Set_Visit_As_Primary;
953 --
954 END AHL_LTP_SIMUL_PLAN_PUB;