55: INTO x_plan_id
56: FROM AHL_SIMULATION_PLANS_VL
57: WHERE SIMULATION_PLAN_NAME = p_plan_name;
58: END IF;
59: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
60: EXCEPTION
61: WHEN NO_DATA_FOUND THEN
62: x_return_status:= Fnd_Api.G_RET_STS_ERROR;
63: x_error_msg_code:= 'AHL_LTP_ORG_NOT_EXISTS';
58: END IF;
59: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
60: EXCEPTION
61: WHEN NO_DATA_FOUND THEN
62: x_return_status:= Fnd_Api.G_RET_STS_ERROR;
63: x_error_msg_code:= 'AHL_LTP_ORG_NOT_EXISTS';
64: WHEN TOO_MANY_ROWS THEN
65: x_return_status:= Fnd_Api.G_RET_STS_ERROR;
66: x_error_msg_code:= 'AHL_LTP_ORG_NOT_EXISTS';
61: WHEN NO_DATA_FOUND THEN
62: x_return_status:= Fnd_Api.G_RET_STS_ERROR;
63: x_error_msg_code:= 'AHL_LTP_ORG_NOT_EXISTS';
64: WHEN TOO_MANY_ROWS THEN
65: x_return_status:= Fnd_Api.G_RET_STS_ERROR;
66: x_error_msg_code:= 'AHL_LTP_ORG_NOT_EXISTS';
67: WHEN OTHERS THEN
68: x_return_status:= Fnd_Api.G_RET_STS_UNEXP_ERROR;
69: RAISE;
64: WHEN TOO_MANY_ROWS THEN
65: x_return_status:= Fnd_Api.G_RET_STS_ERROR;
66: x_error_msg_code:= 'AHL_LTP_ORG_NOT_EXISTS';
67: WHEN OTHERS THEN
68: x_return_status:= Fnd_Api.G_RET_STS_UNEXP_ERROR;
69: RAISE;
70: END Check_plan_name_Or_Id;
71:
72: --------------------------------------------------------------------
156: IF c_simulation_rec%NOTFOUND THEN
157: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.g_msg_lvl_error) THEN
158: FND_MESSAGE.set_name('AHL', 'AHL_LTP_RECORD_NOT_FOUND');
159: FND_MSG_PUB.add;
160: RAISE Fnd_Api.G_EXC_ERROR;
161: END IF;
162: END IF;
163: CLOSE c_simulation_rec;
164: --Check for object version number
165: IF (l_simulation_rec.object_version_number <> p_simulation_rec.object_version_number)
166: THEN
167: Fnd_Message.SET_NAME('AHL','AHL_COM_RECORD_CHANGED');
168: Fnd_Msg_Pub.ADD;
169: RAISE Fnd_Api.G_EXC_ERROR;
170: END IF;
171:
172: IF G_DEBUG='Y' THEN
173: AHL_DEBUG_PUB.debug( 'inside complete name 1:'||l_simulation_rec.simulation_plan_name);
173: AHL_DEBUG_PUB.debug( 'inside complete name 1:'||l_simulation_rec.simulation_plan_name);
174: END IF;
175:
176: -- SIMULATION_PLAN_NAME
177: IF p_simulation_rec.simulation_plan_name <> FND_API.g_miss_char THEN
178: x_simulation_rec.simulation_plan_name := p_simulation_rec.simulation_plan_name;
179: ELSE
180: x_simulation_rec.simulation_plan_name := l_simulation_rec.simulation_plan_name;
181: END IF;
179: ELSE
180: x_simulation_rec.simulation_plan_name := l_simulation_rec.simulation_plan_name;
181: END IF;
182: -- DESCRIPTION
183: IF p_simulation_rec.description <> FND_API.g_miss_char THEN
184: x_simulation_rec.description := p_simulation_rec.description;
185: ELSE
186: x_simulation_rec.description := l_simulation_rec.description;
187: END IF;
185: ELSE
186: x_simulation_rec.description := l_simulation_rec.description;
187: END IF;
188: -- ATTRIBUTE CATEGORY
189: IF p_simulation_rec.attribute_category <> FND_API.g_miss_char THEN
190: x_simulation_rec.attribute_category := p_simulation_rec.attribute_category;
191: ELSE
192: x_simulation_rec.attribute_category := l_simulation_rec.attribute_category;
193: END IF;
191: ELSE
192: x_simulation_rec.attribute_category := l_simulation_rec.attribute_category;
193: END IF;
194: -- ATTRIBUTE 1
195: IF p_simulation_rec.attribute1 <> FND_API.g_miss_char THEN
196: x_simulation_rec.attribute1 := p_simulation_rec.attribute1;
197: ELSE
198: x_simulation_rec.attribute1 := l_simulation_rec.attribute1;
199: END IF;
197: ELSE
198: x_simulation_rec.attribute1 := l_simulation_rec.attribute1;
199: END IF;
200: -- ATTRIBUTE 2
201: IF p_simulation_rec.attribute2 <> FND_API.g_miss_char THEN
202: x_simulation_rec.attribute2 := p_simulation_rec.attribute2;
203: ELSE
204: x_simulation_rec.attribute2 := l_simulation_rec.attribute2;
205: END IF;
203: ELSE
204: x_simulation_rec.attribute2 := l_simulation_rec.attribute2;
205: END IF;
206: -- ATTRIBUTE 3
207: IF p_simulation_rec.attribute3 <> FND_API.g_miss_char THEN
208: x_simulation_rec.attribute3 := p_simulation_rec.attribute3;
209: ELSE
210: x_simulation_rec.attribute3 := l_simulation_rec.attribute3;
211: END IF;
209: ELSE
210: x_simulation_rec.attribute3 := l_simulation_rec.attribute3;
211: END IF;
212: -- ATTRIBUTE 4
213: IF p_simulation_rec.attribute4 <> FND_API.g_miss_char THEN
214: x_simulation_rec.attribute4 := p_simulation_rec.attribute4;
215: ELSE
216: x_simulation_rec.attribute4 := l_simulation_rec.attribute4;
217: END IF;
215: ELSE
216: x_simulation_rec.attribute4 := l_simulation_rec.attribute4;
217: END IF;
218: -- ATTRIBUTE 5
219: IF p_simulation_rec.attribute5 <> FND_API.g_miss_char THEN
220: x_simulation_rec.attribute5 := p_simulation_rec.attribute5;
221: ELSE
222: x_simulation_rec.attribute5 := l_simulation_rec.attribute5;
223: END IF;
221: ELSE
222: x_simulation_rec.attribute5 := l_simulation_rec.attribute5;
223: END IF;
224: -- ATTRIBUTE 6
225: IF p_simulation_rec.attribute6 <> FND_API.g_miss_char THEN
226: x_simulation_rec.attribute6 := p_simulation_rec.attribute6;
227: ELSE
228: x_simulation_rec.attribute6 := l_simulation_rec.attribute6;
229: END IF;
227: ELSE
228: x_simulation_rec.attribute6 := l_simulation_rec.attribute6;
229: END IF;
230: -- ATTRIBUTE 7
231: IF p_simulation_rec.attribute7 <> FND_API.g_miss_char THEN
232: x_simulation_rec.attribute7 := p_simulation_rec.attribute7;
233: ELSE
234: x_simulation_rec.attribute7 := l_simulation_rec.attribute7;
235: END IF;
233: ELSE
234: x_simulation_rec.attribute7 := l_simulation_rec.attribute7;
235: END IF;
236: -- ATTRIBUTE 8
237: IF p_simulation_rec.attribute8 <> FND_API.g_miss_char THEN
238: x_simulation_rec.attribute8 := p_simulation_rec.attribute8;
239: ELSE
240: x_simulation_rec.attribute8 := l_simulation_rec.attribute8;
241: END IF;
239: ELSE
240: x_simulation_rec.attribute8 := l_simulation_rec.attribute8;
241: END IF;
242: -- ATTRIBUTE 9
243: IF p_simulation_rec.attribute9 <> FND_API.g_miss_char THEN
244: x_simulation_rec.attribute9 := p_simulation_rec.attribute9;
245: ELSE
246: x_simulation_rec.attribute9 := l_simulation_rec.attribute9;
247: END IF;
245: ELSE
246: x_simulation_rec.attribute9 := l_simulation_rec.attribute9;
247: END IF;
248: -- ATTRIBUTE 10
249: IF p_simulation_rec.attribute10 <> FND_API.g_miss_char THEN
250: x_simulation_rec.attribute10 := p_simulation_rec.attribute10;
251: ELSE
252: x_simulation_rec.attribute10 := l_simulation_rec.attribute10;
253: END IF;
251: ELSE
252: x_simulation_rec.attribute10 := l_simulation_rec.attribute10;
253: END IF;
254: -- ATTRIBUTE 11
255: IF p_simulation_rec.attribute11 <> FND_API.g_miss_char THEN
256: x_simulation_rec.attribute11 := p_simulation_rec.attribute11;
257: ELSE
258: x_simulation_rec.attribute11 := l_simulation_rec.attribute11;
259: END IF;
257: ELSE
258: x_simulation_rec.attribute11 := l_simulation_rec.attribute11;
259: END IF;
260: -- ATTRIBUTE 12
261: IF p_simulation_rec.attribute12 <> FND_API.g_miss_char THEN
262: x_simulation_rec.attribute12 := p_simulation_rec.attribute12;
263: ELSE
264: x_simulation_rec.attribute12 := l_simulation_rec.attribute12;
265: END IF;
263: ELSE
264: x_simulation_rec.attribute12 := l_simulation_rec.attribute12;
265: END IF;
266: -- ATTRIBUTE 13
267: IF p_simulation_rec.attribute13 <> FND_API.g_miss_char THEN
268: x_simulation_rec.attribute13 := p_simulation_rec.attribute13;
269: ELSE
270: x_simulation_rec.attribute13 := l_simulation_rec.attribute13;
271: END IF;
269: ELSE
270: x_simulation_rec.attribute13 := l_simulation_rec.attribute13;
271: END IF;
272: -- ATTRIBUTE 14
273: IF p_simulation_rec.attribute14 <> FND_API.g_miss_char THEN
274: x_simulation_rec.attribute14 := p_simulation_rec.attribute14;
275: ELSE
276: x_simulation_rec.attribute14 := l_simulation_rec.attribute14;
277: END IF;
275: ELSE
276: x_simulation_rec.attribute14 := l_simulation_rec.attribute14;
277: END IF;
278: -- ATTRIBUTE 15
279: IF p_simulation_rec.attribute15 <> FND_API.g_miss_char THEN
280: x_simulation_rec.attribute15 := p_simulation_rec.attribute15;
281: ELSE
282: x_simulation_rec.attribute15 := l_simulation_rec.attribute15;
283: END IF;
349:
350:
351: BEGIN
352: -- Initialize API/Procedure return status to success
353: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
354: -- Check required parameters
355: -- PLAN_NAME
356: IF (p_simulation_plan_rec.SIMULATION_PLAN_NAME IS NULL
357: OR
354: -- Check required parameters
355: -- PLAN_NAME
356: IF (p_simulation_plan_rec.SIMULATION_PLAN_NAME IS NULL
357: OR
358: p_simulation_plan_rec.SIMULATION_PLAN_NAME = FND_API.G_MISS_CHAR)
359: THEN
360:
361: -- missing required fields
362: IF Fnd_Msg_Pub.check_msg_level (Fnd_Msg_Pub.G_MSG_LVL_ERROR)
363: THEN
364: Fnd_Message.set_name('AHL', 'AHL_LTP_PLAN_NAME_NOT_EXIST');
365: Fnd_Msg_Pub.ADD;
366: END IF;
367: x_return_status := Fnd_Api.G_RET_STS_ERROR;
368: END IF;
369: -- Validate uniqueness
370: OPEN check_plan_name_cur(p_simulation_plan_rec.simulation_plan_name);
371: FETCH check_plan_name_cur INTO l_dummy;
372: IF check_plan_name_cur%FOUND THEN
373: Fnd_Message.set_name('AHL', 'AHL_LTP_SIMUL_DUPLE_NAME');
374: Fnd_Msg_Pub.ADD;
375: END IF;
376: x_return_status := Fnd_Api.g_ret_sts_error;
377: CLOSE check_plan_name_cur;
378: --Check for primary plan
379: IF p_simulation_plan_rec.primary_plan_flag = 'Y' THEN
380: Fnd_Message.set_name('AHL', 'AHL_LTP_SIMUL_DUPLE_NAME');
378: --Check for primary plan
379: IF p_simulation_plan_rec.primary_plan_flag = 'Y' THEN
380: Fnd_Message.set_name('AHL', 'AHL_LTP_SIMUL_DUPLE_NAME');
381: Fnd_Msg_Pub.ADD;
382: x_return_status := Fnd_Api.g_ret_sts_error;
383: END IF;
384:
385: END Validate_Simulation_plan_Items;
386: ----------------------------------------------------------------------------
400: -- Status Local Variables
401: l_return_status VARCHAR2(1);
402: BEGIN
403: -- Initialize API return status to success
404: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
405: --
406: NULL;
407: --
408: END Validate_Simulation_plan_Rec;
419: --
420: --------------------------------------------------------------------
421: PROCEDURE Validate_Simulation_plan
422: ( p_api_version IN NUMBER,
423: p_init_msg_list IN VARCHAR2 := Fnd_Api.G_FALSE,
424: p_validation_level IN NUMBER := Fnd_Api.G_VALID_LEVEL_FULL,
425: p_simulation_plan_rec IN simulation_plan_rec,
426: x_return_status OUT NOCOPY VARCHAR2,
427: x_msg_count OUT NOCOPY NUMBER,
420: --------------------------------------------------------------------
421: PROCEDURE Validate_Simulation_plan
422: ( p_api_version IN NUMBER,
423: p_init_msg_list IN VARCHAR2 := Fnd_Api.G_FALSE,
424: p_validation_level IN NUMBER := Fnd_Api.G_VALID_LEVEL_FULL,
425: p_simulation_plan_rec IN simulation_plan_rec,
426: x_return_status OUT NOCOPY VARCHAR2,
427: x_msg_count OUT NOCOPY NUMBER,
428: x_msg_data OUT NOCOPY VARCHAR2
434: l_return_status VARCHAR2(1);
435: l_simulation_plan_rec simulation_plan_rec;
436: BEGIN
437: -- Standard call to check for call compatibility.
438: IF NOT Fnd_Api.Compatible_API_Call ( l_api_version,
439: p_api_version,
440: l_api_name,
441: G_PKG_NAME)
442: THEN
439: p_api_version,
440: l_api_name,
441: G_PKG_NAME)
442: THEN
443: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
444: END IF;
445: -- Initialize message list if p_init_msg_list is set to TRUE.
446: IF Fnd_Api.to_Boolean( p_init_msg_list ) THEN
447: Fnd_Msg_Pub.initialize;
442: THEN
443: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
444: END IF;
445: -- Initialize message list if p_init_msg_list is set to TRUE.
446: IF Fnd_Api.to_Boolean( p_init_msg_list ) THEN
447: Fnd_Msg_Pub.initialize;
448: END IF;
449: -- Initialize API return status to success
450: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
446: IF Fnd_Api.to_Boolean( p_init_msg_list ) THEN
447: Fnd_Msg_Pub.initialize;
448: END IF;
449: -- Initialize API return status to success
450: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
451: --
452: -- API body
453: --
454: IF p_validation_level >= Jtf_Plsql_Api.g_valid_level_item
458: p_validation_mode => Jtf_Plsql_Api.g_create,
459: x_return_status => l_return_status
460: );
461: -- If any errors happen abort API.
462: IF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR
463: THEN
464: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
465: ELSIF l_return_status = Fnd_Api.G_RET_STS_ERROR
466: THEN
460: );
461: -- If any errors happen abort API.
462: IF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR
463: THEN
464: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
465: ELSIF l_return_status = Fnd_Api.G_RET_STS_ERROR
466: THEN
467: RAISE Fnd_Api.G_EXC_ERROR;
468: END IF;
461: -- If any errors happen abort API.
462: IF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR
463: THEN
464: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
465: ELSIF l_return_status = Fnd_Api.G_RET_STS_ERROR
466: THEN
467: RAISE Fnd_Api.G_EXC_ERROR;
468: END IF;
469: END IF;
463: THEN
464: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
465: ELSIF l_return_status = Fnd_Api.G_RET_STS_ERROR
466: THEN
467: RAISE Fnd_Api.G_EXC_ERROR;
468: END IF;
469: END IF;
470: -- Perform cross attribute validation and missing attribute checks. Record
471: -- level validation.
474: Validate_Simulation_plan_Rec(
475: p_simulation_plan_rec => p_simulation_plan_rec,
476: x_return_status => l_return_status
477: );
478: IF l_return_status = Fnd_Api.G_RET_STS_ERROR
479: THEN
480: RAISE Fnd_Api.G_EXC_ERROR;
481: ELSIF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR
482: THEN
476: x_return_status => l_return_status
477: );
478: IF l_return_status = Fnd_Api.G_RET_STS_ERROR
479: THEN
480: RAISE Fnd_Api.G_EXC_ERROR;
481: ELSIF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR
482: THEN
483: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
484: END IF;
477: );
478: IF l_return_status = Fnd_Api.G_RET_STS_ERROR
479: THEN
480: RAISE Fnd_Api.G_EXC_ERROR;
481: ELSIF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR
482: THEN
483: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
484: END IF;
485: END IF;
479: THEN
480: RAISE Fnd_Api.G_EXC_ERROR;
481: ELSIF l_return_status = Fnd_Api.G_RET_STS_UNEXP_ERROR
482: THEN
483: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
484: END IF;
485: END IF;
486: --
487: -- END of API body.
487: -- END of API body.
488: --
489: -------------------- finish --------------------------
490: Fnd_Msg_Pub.count_and_get(
491: p_encoded => Fnd_Api.g_false,
492: p_count => x_msg_count,
493: p_data => x_msg_data);
494: EXCEPTION
495: WHEN Fnd_Api.G_EXC_ERROR THEN
491: p_encoded => Fnd_Api.g_false,
492: p_count => x_msg_count,
493: p_data => x_msg_data);
494: EXCEPTION
495: WHEN Fnd_Api.G_EXC_ERROR THEN
496: x_return_status := Fnd_Api.G_RET_STS_ERROR ;
497: Fnd_Msg_Pub.Count_AND_Get
498: ( p_count => x_msg_count,
499: p_data => x_msg_data,
492: p_count => x_msg_count,
493: p_data => x_msg_data);
494: EXCEPTION
495: WHEN Fnd_Api.G_EXC_ERROR THEN
496: x_return_status := Fnd_Api.G_RET_STS_ERROR ;
497: Fnd_Msg_Pub.Count_AND_Get
498: ( p_count => x_msg_count,
499: p_data => x_msg_data,
500: p_encoded => Fnd_Api.G_FALSE
496: x_return_status := Fnd_Api.G_RET_STS_ERROR ;
497: Fnd_Msg_Pub.Count_AND_Get
498: ( p_count => x_msg_count,
499: p_data => x_msg_data,
500: p_encoded => Fnd_Api.G_FALSE
501: );
502: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
503: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR ;
504: Fnd_Msg_Pub.Count_AND_Get
498: ( p_count => x_msg_count,
499: p_data => x_msg_data,
500: p_encoded => Fnd_Api.G_FALSE
501: );
502: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
503: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR ;
504: Fnd_Msg_Pub.Count_AND_Get
505: ( p_count => x_msg_count,
506: p_data => x_msg_data,
499: p_data => x_msg_data,
500: p_encoded => Fnd_Api.G_FALSE
501: );
502: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
503: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR ;
504: Fnd_Msg_Pub.Count_AND_Get
505: ( p_count => x_msg_count,
506: p_data => x_msg_data,
507: p_encoded => Fnd_Api.G_FALSE
503: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR ;
504: Fnd_Msg_Pub.Count_AND_Get
505: ( p_count => x_msg_count,
506: p_data => x_msg_data,
507: p_encoded => Fnd_Api.G_FALSE
508: );
509: WHEN OTHERS THEN
510: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR ;
511: IF Fnd_Msg_Pub.Check_Msg_Level ( Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR )
506: p_data => x_msg_data,
507: p_encoded => Fnd_Api.G_FALSE
508: );
509: WHEN OTHERS THEN
510: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR ;
511: IF Fnd_Msg_Pub.Check_Msg_Level ( Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR )
512: THEN
513: Fnd_Msg_Pub.Add_Exc_Msg( G_PKG_NAME,l_api_name);
514: END IF;
514: END IF;
515: Fnd_Msg_Pub.Count_AND_Get
516: ( p_count => x_msg_count,
517: p_data => x_msg_data,
518: p_encoded => Fnd_Api.G_FALSE
519: );
520: END Validate_Simulation_plan;
521:
522: --------------------------------------------------------------------
533: --------------------------------------------------------------------
534:
535: PROCEDURE Create_Simulation_plan (
536: p_api_version IN NUMBER,
537: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
538: p_commit IN VARCHAR2 := FND_API.g_false,
539: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
540: p_module_type IN VARCHAR2 := 'JSP',
541: p_x_simulation_plan_rec IN OUT NOCOPY ahl_ltp_simul_plan_pub.Simulation_Plan_Rec,
534:
535: PROCEDURE Create_Simulation_plan (
536: p_api_version IN NUMBER,
537: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
538: p_commit IN VARCHAR2 := FND_API.g_false,
539: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
540: p_module_type IN VARCHAR2 := 'JSP',
541: p_x_simulation_plan_rec IN OUT NOCOPY ahl_ltp_simul_plan_pub.Simulation_Plan_Rec,
542: x_return_status OUT NOCOPY VARCHAR2,
535: PROCEDURE Create_Simulation_plan (
536: p_api_version IN NUMBER,
537: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
538: p_commit IN VARCHAR2 := FND_API.g_false,
539: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
540: p_module_type IN VARCHAR2 := 'JSP',
541: p_x_simulation_plan_rec IN OUT NOCOPY ahl_ltp_simul_plan_pub.Simulation_Plan_Rec,
542: x_return_status OUT NOCOPY VARCHAR2,
543: x_msg_count OUT NOCOPY NUMBER,
577: IF G_DEBUG='Y' THEN
578: AHL_DEBUG_PUB.debug( 'enter ahl_ltp_simul_plan_pvt.Create Simulation plan','+SIMPL+');
579: END IF;
580: -- Standard call to check for call compatibility.
581: IF FND_API.to_boolean(p_init_msg_list)
582: THEN
583: FND_MSG_PUB.initialize;
584: END IF;
585: -- Initialize API return status to success
582: THEN
583: FND_MSG_PUB.initialize;
584: END IF;
585: -- Initialize API return status to success
586: x_return_status := FND_API.G_RET_STS_SUCCESS;
587: -- Initialize message list if p_init_msg_list is set to TRUE.
588: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
589: p_api_version,
590: l_api_name,G_PKG_NAME)
584: END IF;
585: -- Initialize API return status to success
586: x_return_status := FND_API.G_RET_STS_SUCCESS;
587: -- Initialize message list if p_init_msg_list is set to TRUE.
588: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
589: p_api_version,
590: l_api_name,G_PKG_NAME)
591: THEN
592: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
588: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
589: p_api_version,
590: l_api_name,G_PKG_NAME)
591: THEN
592: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
593: END IF;
594: --------------------Value OR ID conversion---------------------------
595: --Assign to local variable
596: Assign_Simulation_Rec (
607: x_msg_count => l_msg_count,
608: x_msg_data => l_msg_data );
609:
610:
611: IF (p_x_simulation_plan_rec.plan_id = Fnd_Api.G_MISS_NUM OR
612: p_x_simulation_plan_rec.plan_id IS NULL)
613: THEN
614: --
615: -- If the ID is not passed into the API, then
630: Fnd_Message.SET_NAME('AHL','AHL_LTP_SEQUENCE_NOT_EXISTS');
631: Fnd_Msg_Pub.ADD;
632: END IF;
633: -- For optional fields
634: IF p_x_simulation_plan_rec.description = FND_API.G_MISS_CHAR THEN
635: l_simulation_plan_rec.description := NULL;
636: ELSE
637: l_simulation_plan_rec.description := p_x_simulation_plan_rec.description;
638: END IF;
636: ELSE
637: l_simulation_plan_rec.description := p_x_simulation_plan_rec.description;
638: END IF;
639: --
640: IF p_x_simulation_plan_rec.attribute_category = FND_API.G_MISS_CHAR THEN
641: l_simulation_plan_rec.attribute_category := NULL;
642: ELSE
643: l_simulation_plan_rec.attribute_category := p_x_simulation_plan_rec.attribute_category;
644: END IF;
642: ELSE
643: l_simulation_plan_rec.attribute_category := p_x_simulation_plan_rec.attribute_category;
644: END IF;
645: --
646: IF p_x_simulation_plan_rec.attribute1 = FND_API.G_MISS_CHAR THEN
647: l_simulation_plan_rec.attribute1 := NULL;
648: ELSE
649: l_simulation_plan_rec.attribute1 := p_x_simulation_plan_rec.attribute1;
650: END IF;
648: ELSE
649: l_simulation_plan_rec.attribute1 := p_x_simulation_plan_rec.attribute1;
650: END IF;
651: --
652: IF p_x_simulation_plan_rec.attribute2 = FND_API.G_MISS_CHAR THEN
653: l_simulation_plan_rec.attribute2 := NULL;
654: ELSE
655: l_simulation_plan_rec.attribute2 := p_x_simulation_plan_rec.attribute2;
656: END IF;
654: ELSE
655: l_simulation_plan_rec.attribute2 := p_x_simulation_plan_rec.attribute2;
656: END IF;
657: --
658: IF p_x_simulation_plan_rec.attribute3 = FND_API.G_MISS_CHAR THEN
659: l_simulation_plan_rec.attribute3 := NULL;
660: ELSE
661: l_simulation_plan_rec.attribute3 := p_x_simulation_plan_rec.attribute3;
662: END IF;
660: ELSE
661: l_simulation_plan_rec.attribute3 := p_x_simulation_plan_rec.attribute3;
662: END IF;
663: --
664: IF p_x_simulation_plan_rec.attribute4 = FND_API.G_MISS_CHAR THEN
665: l_simulation_plan_rec.attribute4 := NULL;
666: ELSE
667: l_simulation_plan_rec.attribute4 := p_x_simulation_plan_rec.attribute4;
668: END IF;
666: ELSE
667: l_simulation_plan_rec.attribute4 := p_x_simulation_plan_rec.attribute4;
668: END IF;
669: --
670: IF p_x_simulation_plan_rec.attribute5 = FND_API.G_MISS_CHAR THEN
671: l_simulation_plan_rec.attribute5 := NULL;
672: ELSE
673: l_simulation_plan_rec.attribute5 := p_x_simulation_plan_rec.attribute5;
674: END IF;
672: ELSE
673: l_simulation_plan_rec.attribute5 := p_x_simulation_plan_rec.attribute5;
674: END IF;
675: --
676: IF p_x_simulation_plan_rec.attribute6 = FND_API.G_MISS_CHAR THEN
677: l_simulation_plan_rec.attribute6 := NULL;
678: ELSE
679: l_simulation_plan_rec.attribute6 := p_x_simulation_plan_rec.attribute6;
680: END IF;
678: ELSE
679: l_simulation_plan_rec.attribute6 := p_x_simulation_plan_rec.attribute6;
680: END IF;
681: --
682: IF p_x_simulation_plan_rec.attribute7 = FND_API.G_MISS_CHAR THEN
683: l_simulation_plan_rec.attribute7 := NULL;
684: ELSE
685: l_simulation_plan_rec.attribute7 := p_x_simulation_plan_rec.attribute7;
686: END IF;
684: ELSE
685: l_simulation_plan_rec.attribute7 := p_x_simulation_plan_rec.attribute7;
686: END IF;
687: --
688: IF p_x_simulation_plan_rec.attribute8 = FND_API.G_MISS_CHAR THEN
689: l_simulation_plan_rec.attribute8 := NULL;
690: ELSE
691: l_simulation_plan_rec.attribute8 := p_x_simulation_plan_rec.attribute8;
692: END IF;
690: ELSE
691: l_simulation_plan_rec.attribute8 := p_x_simulation_plan_rec.attribute8;
692: END IF;
693: --
694: IF p_x_simulation_plan_rec.attribute9 = FND_API.G_MISS_CHAR THEN
695: l_simulation_plan_rec.attribute9 := NULL;
696: ELSE
697: l_simulation_plan_rec.attribute9 := p_x_simulation_plan_rec.attribute9;
698: END IF;
696: ELSE
697: l_simulation_plan_rec.attribute9 := p_x_simulation_plan_rec.attribute9;
698: END IF;
699: --
700: IF p_x_simulation_plan_rec.attribute10 = FND_API.G_MISS_CHAR THEN
701: l_simulation_plan_rec.attribute10 := NULL;
702: ELSE
703: l_simulation_plan_rec.attribute10 := p_x_simulation_plan_rec.attribute10;
704: END IF;
702: ELSE
703: l_simulation_plan_rec.attribute10 := p_x_simulation_plan_rec.attribute10;
704: END IF;
705: --
706: IF p_x_simulation_plan_rec.attribute11 = FND_API.G_MISS_CHAR THEN
707: l_simulation_plan_rec.attribute11 := NULL;
708: ELSE
709: l_simulation_plan_rec.attribute11 := p_x_simulation_plan_rec.attribute11;
710: END IF;
708: ELSE
709: l_simulation_plan_rec.attribute11 := p_x_simulation_plan_rec.attribute11;
710: END IF;
711: --
712: IF p_x_simulation_plan_rec.attribute12 = FND_API.G_MISS_CHAR THEN
713: l_simulation_plan_rec.attribute12 := NULL;
714: ELSE
715: l_simulation_plan_rec.attribute12 := p_x_simulation_plan_rec.attribute12;
716: END IF;
714: ELSE
715: l_simulation_plan_rec.attribute12 := p_x_simulation_plan_rec.attribute12;
716: END IF;
717: --
718: IF p_x_simulation_plan_rec.attribute13 = FND_API.G_MISS_CHAR THEN
719: l_simulation_plan_rec.attribute13 := NULL;
720: ELSE
721: l_simulation_plan_rec.attribute13 := p_x_simulation_plan_rec.attribute13;
722: END IF;
720: ELSE
721: l_simulation_plan_rec.attribute13 := p_x_simulation_plan_rec.attribute13;
722: END IF;
723: --
724: IF p_x_simulation_plan_rec.attribute14 = FND_API.G_MISS_CHAR THEN
725: l_simulation_plan_rec.attribute14 := NULL;
726: ELSE
727: l_simulation_plan_rec.attribute14 := p_x_simulation_plan_rec.attribute14;
728: END IF;
726: ELSE
727: l_simulation_plan_rec.attribute14 := p_x_simulation_plan_rec.attribute14;
728: END IF;
729: --
730: IF p_x_simulation_plan_rec.attribute15 = FND_API.G_MISS_CHAR THEN
731: l_simulation_plan_rec.attribute15 := NULL;
732: ELSE
733: l_simulation_plan_rec.attribute15 := p_x_simulation_plan_rec.attribute15;
734: END IF;
737: l_msg_count := Fnd_Msg_Pub.count_msg;
738:
739: IF l_msg_count > 0 THEN
740: X_msg_count := l_msg_count;
741: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
742: RAISE Fnd_Api.G_EXC_ERROR;
743: END IF;
744:
745: ----------------------------DML Operation---------------------------------
738:
739: IF l_msg_count > 0 THEN
740: X_msg_count := l_msg_count;
741: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
742: RAISE Fnd_Api.G_EXC_ERROR;
743: END IF;
744:
745: ----------------------------DML Operation---------------------------------
746: --Call table handler generated package to insert a record
779: l_msg_count := Fnd_Msg_Pub.count_msg;
780:
781: IF l_msg_count > 0 THEN
782: X_msg_count := l_msg_count;
783: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
784: RAISE Fnd_Api.G_EXC_ERROR;
785: END IF;
786:
787: --Standard check for commit
780:
781: IF l_msg_count > 0 THEN
782: X_msg_count := l_msg_count;
783: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
784: RAISE Fnd_Api.G_EXC_ERROR;
785: END IF;
786:
787: --Standard check for commit
788: IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
784: RAISE Fnd_Api.G_EXC_ERROR;
785: END IF;
786:
787: --Standard check for commit
788: IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
789: COMMIT;
790: END IF;
791: -- Debug info
792: IF G_DEBUG='Y' THEN
796: IF G_DEBUG='Y' THEN
797: Ahl_Debug_Pub.disable_debug;
798: END IF;
799: EXCEPTION
800: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
801: ROLLBACK TO create_simulation_plan;
802: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
803: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
804: p_count => x_msg_count,
798: END IF;
799: EXCEPTION
800: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
801: ROLLBACK TO create_simulation_plan;
802: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
803: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
804: p_count => x_msg_count,
805: p_data => x_msg_data);
806: IF G_DEBUG='Y' THEN
799: EXCEPTION
800: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
801: ROLLBACK TO create_simulation_plan;
802: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
803: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
804: p_count => x_msg_count,
805: p_data => x_msg_data);
806: IF G_DEBUG='Y' THEN
807:
810: AHL_DEBUG_PUB.debug( 'ahl_ltp_simul_plan_pvt.Create Simulation plan','+SMPLN+');
811: -- Check if API is called in debug mode. If yes, disable debug.
812: AHL_DEBUG_PUB.disable_debug;
813: END IF;
814: WHEN FND_API.G_EXC_ERROR THEN
815: ROLLBACK TO create_simulation_plan;
816: X_return_status := FND_API.G_RET_STS_ERROR;
817: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
818: p_count => x_msg_count,
812: AHL_DEBUG_PUB.disable_debug;
813: END IF;
814: WHEN FND_API.G_EXC_ERROR THEN
815: ROLLBACK TO create_simulation_plan;
816: X_return_status := FND_API.G_RET_STS_ERROR;
817: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
818: p_count => x_msg_count,
819: p_data => X_msg_data);
820: IF G_DEBUG='Y' THEN
813: END IF;
814: WHEN FND_API.G_EXC_ERROR THEN
815: ROLLBACK TO create_simulation_plan;
816: X_return_status := FND_API.G_RET_STS_ERROR;
817: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
818: p_count => x_msg_count,
819: p_data => X_msg_data);
820: IF G_DEBUG='Y' THEN
821: -- Debug info.
826: AHL_DEBUG_PUB.disable_debug;
827: END IF;
828: WHEN OTHERS THEN
829: ROLLBACK TO create_simulation_plan;
830: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
831: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
832: THEN
833: fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PVT',
834: p_procedure_name => 'CREATE_SIMULATION_PLAN',
833: fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PVT',
834: p_procedure_name => 'CREATE_SIMULATION_PLAN',
835: p_error_text => SUBSTR(SQLERRM,1,240));
836: END IF;
837: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
838: p_count => x_msg_count,
839: p_data => X_msg_data);
840: IF G_DEBUG='Y' THEN
841:
863: -- NOTES
864: --------------------------------------------------------------------
865: PROCEDURE Update_Simulation_plan (
866: p_api_version IN NUMBER,
867: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
868: p_commit IN VARCHAR2 := FND_API.g_false,
869: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
870: p_module_type IN VARCHAR2 := 'JSP',
871: p_simulation_plan_rec IN ahl_ltp_simul_plan_pub.Simulation_plan_Rec,
864: --------------------------------------------------------------------
865: PROCEDURE Update_Simulation_plan (
866: p_api_version IN NUMBER,
867: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
868: p_commit IN VARCHAR2 := FND_API.g_false,
869: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
870: p_module_type IN VARCHAR2 := 'JSP',
871: p_simulation_plan_rec IN ahl_ltp_simul_plan_pub.Simulation_plan_Rec,
872: x_return_status OUT NOCOPY VARCHAR2,
865: PROCEDURE Update_Simulation_plan (
866: p_api_version IN NUMBER,
867: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
868: p_commit IN VARCHAR2 := FND_API.g_false,
869: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
870: p_module_type IN VARCHAR2 := 'JSP',
871: p_simulation_plan_rec IN ahl_ltp_simul_plan_pub.Simulation_plan_Rec,
872: x_return_status OUT NOCOPY VARCHAR2,
873: x_msg_count OUT NOCOPY NUMBER,
908: IF G_DEBUG='Y' THEN
909: AHL_DEBUG_PUB.debug( 'enter ahl_ltp_simul_plan_pvt.Update Simulation plan','+SMPNL+');
910: END IF;
911: -- Standard call to check for call compatibility.
912: IF FND_API.to_boolean(p_init_msg_list)
913: THEN
914: FND_MSG_PUB.initialize;
915: END IF;
916: -- Initialize API return status to success
913: THEN
914: FND_MSG_PUB.initialize;
915: END IF;
916: -- Initialize API return status to success
917: x_return_status := FND_API.G_RET_STS_SUCCESS;
918: -- Initialize message list if p_init_msg_list is set to TRUE.
919: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
920: p_api_version,
921: l_api_name,G_PKG_NAME)
915: END IF;
916: -- Initialize API return status to success
917: x_return_status := FND_API.G_RET_STS_SUCCESS;
918: -- Initialize message list if p_init_msg_list is set to TRUE.
919: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
920: p_api_version,
921: l_api_name,G_PKG_NAME)
922: THEN
923: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
919: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
920: p_api_version,
921: l_api_name,G_PKG_NAME)
922: THEN
923: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
924: END IF;
925:
926: --------------------Value OR ID conversion---------------------------
927: --Assign to local variable
931: --Start API Body
932:
933: -- Convert org name to organization id
934: IF (p_simulation_plan_rec.plan_name IS NOT NULL AND
935: p_simulation_plan_rec.plan_name <> FND_API.G_MISS_CHAR ) OR
936: (l_simulation_plan_rec.simulation_plan_id IS NOT NULL AND
937: l_simulation_plan_rec.simulation_plan_id <> FND_API.G_MISS_NUM) THEN
938:
939: Check_plan_name_Or_Id
933: -- Convert org name to organization id
934: IF (p_simulation_plan_rec.plan_name IS NOT NULL AND
935: p_simulation_plan_rec.plan_name <> FND_API.G_MISS_CHAR ) OR
936: (l_simulation_plan_rec.simulation_plan_id IS NOT NULL AND
937: l_simulation_plan_rec.simulation_plan_id <> FND_API.G_MISS_NUM) THEN
938:
939: Check_plan_name_Or_Id
940: (p_simulation_plan_id => l_simulation_plan_rec.simulation_plan_id,
941: p_plan_name => p_simulation_plan_rec.plan_name,
982: l_msg_count := Fnd_Msg_Pub.count_msg;
983:
984: IF l_msg_count > 0 THEN
985: X_msg_count := l_msg_count;
986: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
987: RAISE Fnd_Api.G_EXC_ERROR;
988: END IF;
989:
990: ----------------------------DML Operation---------------------------------
983:
984: IF l_msg_count > 0 THEN
985: X_msg_count := l_msg_count;
986: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
987: RAISE Fnd_Api.G_EXC_ERROR;
988: END IF;
989:
990: ----------------------------DML Operation---------------------------------
991: --Call table handler generated package to update a record
1022: l_msg_count := Fnd_Msg_Pub.count_msg;
1023:
1024: IF l_msg_count > 0 THEN
1025: X_msg_count := l_msg_count;
1026: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1027: RAISE Fnd_Api.G_EXC_ERROR;
1028: END IF;
1029:
1030: --Standard check for commit
1023:
1024: IF l_msg_count > 0 THEN
1025: X_msg_count := l_msg_count;
1026: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1027: RAISE Fnd_Api.G_EXC_ERROR;
1028: END IF;
1029:
1030: --Standard check for commit
1031: IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
1027: RAISE Fnd_Api.G_EXC_ERROR;
1028: END IF;
1029:
1030: --Standard check for commit
1031: IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
1032: COMMIT;
1033: END IF;
1034: -- Debug info
1035: IF G_DEBUG='Y' THEN
1037: -- Check if API is called in debug mode. If yes, disable debug.
1038: Ahl_Debug_Pub.disable_debug;
1039: END IF;
1040: EXCEPTION
1041: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1042: ROLLBACK TO update_simulation_plan;
1043: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1044: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
1045: p_count => x_msg_count,
1039: END IF;
1040: EXCEPTION
1041: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1042: ROLLBACK TO update_simulation_plan;
1043: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1044: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
1045: p_count => x_msg_count,
1046: p_data => x_msg_data);
1047: IF G_DEBUG='Y' THEN
1040: EXCEPTION
1041: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1042: ROLLBACK TO update_simulation_plan;
1043: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1044: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
1045: p_count => x_msg_count,
1046: p_data => x_msg_data);
1047: IF G_DEBUG='Y' THEN
1048:
1051: AHL_DEBUG_PUB.debug( 'ahl_ltp_simul_plan_pvt.Update Simulation plan','+SMPLN+');
1052: -- Check if API is called in debug mode. If yes, disable debug.
1053: AHL_DEBUG_PUB.disable_debug;
1054: END IF;
1055: WHEN FND_API.G_EXC_ERROR THEN
1056: ROLLBACK TO update_simulation_plan;
1057: X_return_status := FND_API.G_RET_STS_ERROR;
1058: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
1059: p_count => x_msg_count,
1053: AHL_DEBUG_PUB.disable_debug;
1054: END IF;
1055: WHEN FND_API.G_EXC_ERROR THEN
1056: ROLLBACK TO update_simulation_plan;
1057: X_return_status := FND_API.G_RET_STS_ERROR;
1058: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
1059: p_count => x_msg_count,
1060: p_data => X_msg_data);
1061: IF G_DEBUG='Y' THEN
1054: END IF;
1055: WHEN FND_API.G_EXC_ERROR THEN
1056: ROLLBACK TO update_simulation_plan;
1057: X_return_status := FND_API.G_RET_STS_ERROR;
1058: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
1059: p_count => x_msg_count,
1060: p_data => X_msg_data);
1061: IF G_DEBUG='Y' THEN
1062:
1068: AHL_DEBUG_PUB.disable_debug;
1069: END IF;
1070: WHEN OTHERS THEN
1071: ROLLBACK TO update_simulation_plan;
1072: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1073: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1074: THEN
1075: fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PVT',
1076: p_procedure_name => 'UPDATE_SIMULATION_PLAN',
1075: fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PVT',
1076: p_procedure_name => 'UPDATE_SIMULATION_PLAN',
1077: p_error_text => SUBSTR(SQLERRM,1,240));
1078: END IF;
1079: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
1080: p_count => x_msg_count,
1081: p_data => X_msg_data);
1082: IF G_DEBUG='Y' THEN
1083:
1106: -- 1. Raise exception if the object_version_number doesn't match.
1107: --------------------------------------------------------------------
1108: PROCEDURE Delete_Simulation_plan (
1109: p_api_version IN NUMBER,
1110: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
1111: p_commit IN VARCHAR2 := FND_API.g_false,
1112: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
1113: p_simulation_plan_rec IN ahl_ltp_simul_plan_pub.Simulation_plan_Rec,
1114: x_return_status OUT NOCOPY VARCHAR2,
1107: --------------------------------------------------------------------
1108: PROCEDURE Delete_Simulation_plan (
1109: p_api_version IN NUMBER,
1110: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
1111: p_commit IN VARCHAR2 := FND_API.g_false,
1112: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
1113: p_simulation_plan_rec IN ahl_ltp_simul_plan_pub.Simulation_plan_Rec,
1114: x_return_status OUT NOCOPY VARCHAR2,
1115: x_msg_count OUT NOCOPY NUMBER,
1108: PROCEDURE Delete_Simulation_plan (
1109: p_api_version IN NUMBER,
1110: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
1111: p_commit IN VARCHAR2 := FND_API.g_false,
1112: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
1113: p_simulation_plan_rec IN ahl_ltp_simul_plan_pub.Simulation_plan_Rec,
1114: x_return_status OUT NOCOPY VARCHAR2,
1115: x_msg_count OUT NOCOPY NUMBER,
1116: x_msg_data OUT NOCOPY VARCHAR2
1174: IF G_DEBUG='Y' THEN
1175: AHL_DEBUG_PUB.debug( 'enter ahl_ltp_simul_plan_pvt.Delete Simulation plan','+SMPLN+');
1176: END IF;
1177: -- Standard call to check for call compatibility.
1178: IF FND_API.to_boolean(p_init_msg_list)
1179: THEN
1180: FND_MSG_PUB.initialize;
1181: END IF;
1182: -- Initialize API return status to success
1179: THEN
1180: FND_MSG_PUB.initialize;
1181: END IF;
1182: -- Initialize API return status to success
1183: x_return_status := FND_API.G_RET_STS_SUCCESS;
1184: -- Initialize message list if p_init_msg_list is set to TRUE.
1185: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
1186: p_api_version,
1187: l_api_name,G_PKG_NAME)
1181: END IF;
1182: -- Initialize API return status to success
1183: x_return_status := FND_API.G_RET_STS_SUCCESS;
1184: -- Initialize message list if p_init_msg_list is set to TRUE.
1185: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
1186: p_api_version,
1187: l_api_name,G_PKG_NAME)
1188: THEN
1189: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1185: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
1186: p_api_version,
1187: l_api_name,G_PKG_NAME)
1188: THEN
1189: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1190: END IF;
1191: -----------------------Start of API Body-----------------------------
1192: -- Check for Record exists
1193: OPEN c_simulation_plan_cur(p_simulation_plan_rec.plan_id);
1199: FND_MESSAGE.set_name('AHL', 'AHL_LTP_RECORD_NOT_FOUND');
1200: FND_MSG_PUB.add;
1201: END IF;
1202: CLOSE c_simulation_plan_cur;
1203: RAISE FND_API.g_exc_error;
1204: END IF;
1205: CLOSE c_simulation_plan_cur;
1206: --
1207: --Check for primary plan
1208: IF l_primary_plan_flag = 'Y'
1209: THEN
1210: FND_MESSAGE.set_name('AHL', 'AHL_LTP_PRIMARY_PLAN');
1211: FND_MSG_PUB.add;
1212: RAISE FND_API.g_exc_error;
1213: END IF;
1214:
1215: /* Added by mpothuku on 12/22/04 to delete the associated simulation visits.
1216: */
1221: EXIT WHEN get_simulation_visits_cur%NOTFOUND;
1222: IF l_visit_id IS NOT NULL THEN
1223: Remove_Visits_FR_Plan (
1224: p_api_version => p_api_version,
1225: p_init_msg_list => FND_API.g_false,--p_init_msg_list,
1226: p_commit => FND_API.g_false, --p_commit,
1227: p_validation_level => p_validation_level,
1228: p_module_type => null,
1229: p_visit_id => l_visit_id,
1222: IF l_visit_id IS NOT NULL THEN
1223: Remove_Visits_FR_Plan (
1224: p_api_version => p_api_version,
1225: p_init_msg_list => FND_API.g_false,--p_init_msg_list,
1226: p_commit => FND_API.g_false, --p_commit,
1227: p_validation_level => p_validation_level,
1228: p_module_type => null,
1229: p_visit_id => l_visit_id,
1230: p_plan_id => null,
1233: x_msg_count => l_msg_count,
1234: x_msg_data => l_msg_data);
1235:
1236: -- Check Error Message stack.
1237: IF (l_return_Status <> FND_API.G_RET_STS_SUCCESS) THEN
1238: l_msg_count := FND_MSG_PUB.count_msg;
1239: IF l_msg_count > 0 THEN
1240: RAISE FND_API.G_EXC_ERROR;
1241: END IF;
1236: -- Check Error Message stack.
1237: IF (l_return_Status <> FND_API.G_RET_STS_SUCCESS) THEN
1238: l_msg_count := FND_MSG_PUB.count_msg;
1239: IF l_msg_count > 0 THEN
1240: RAISE FND_API.G_EXC_ERROR;
1241: END IF;
1242: END IF;
1243: END IF; -- If Visit not null
1244: END LOOP;
1248: IF l_object_version_number <> p_simulation_plan_rec.object_version_number
1249: THEN
1250: FND_MESSAGE.set_name('AHL', 'AHL_LTP_RECORD_CHANGED');
1251: FND_MSG_PUB.add;
1252: RAISE FND_API.g_exc_error;
1253: END IF;
1254: -------------------Call Table handler generated procedure------------
1255: AHL_SIMULATION_PLANS_PKG.DELETE_ROW (
1256: X_SIMULATION_PLAN_ID => l_simulation_plan_id
1260: l_msg_count := Fnd_Msg_Pub.count_msg;
1261:
1262: IF l_msg_count > 0 THEN
1263: X_msg_count := l_msg_count;
1264: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1265: RAISE Fnd_Api.G_EXC_ERROR;
1266: END IF;
1267:
1268: --Standard check for commit
1261:
1262: IF l_msg_count > 0 THEN
1263: X_msg_count := l_msg_count;
1264: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1265: RAISE Fnd_Api.G_EXC_ERROR;
1266: END IF;
1267:
1268: --Standard check for commit
1269: IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
1265: RAISE Fnd_Api.G_EXC_ERROR;
1266: END IF;
1267:
1268: --Standard check for commit
1269: IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
1270: COMMIT;
1271: END IF;
1272: -- Debug info
1273: IF G_DEBUG='Y' THEN
1277: IF G_DEBUG='Y' THEN
1278: Ahl_Debug_Pub.disable_debug;
1279: END IF;
1280: EXCEPTION
1281: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1282: ROLLBACK TO delete_simulation_plan;
1283: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1284: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
1285: p_count => x_msg_count,
1279: END IF;
1280: EXCEPTION
1281: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1282: ROLLBACK TO delete_simulation_plan;
1283: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1284: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
1285: p_count => x_msg_count,
1286: p_data => x_msg_data);
1287: IF G_DEBUG='Y' THEN
1280: EXCEPTION
1281: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
1282: ROLLBACK TO delete_simulation_plan;
1283: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1284: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
1285: p_count => x_msg_count,
1286: p_data => x_msg_data);
1287: IF G_DEBUG='Y' THEN
1288:
1291: AHL_DEBUG_PUB.debug( 'ahl_ltp_simul_plan_pvt.Delete Simulation plan','+SMPLN+');
1292: -- Check if API is called in debug mode. If yes, disable debug.
1293: AHL_DEBUG_PUB.disable_debug;
1294: END IF;
1295: WHEN FND_API.G_EXC_ERROR THEN
1296: ROLLBACK TO delete_simulation_plan;
1297: X_return_status := FND_API.G_RET_STS_ERROR;
1298: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
1299: p_count => x_msg_count,
1293: AHL_DEBUG_PUB.disable_debug;
1294: END IF;
1295: WHEN FND_API.G_EXC_ERROR THEN
1296: ROLLBACK TO delete_simulation_plan;
1297: X_return_status := FND_API.G_RET_STS_ERROR;
1298: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
1299: p_count => x_msg_count,
1300: p_data => X_msg_data);
1301: IF G_DEBUG='Y' THEN
1294: END IF;
1295: WHEN FND_API.G_EXC_ERROR THEN
1296: ROLLBACK TO delete_simulation_plan;
1297: X_return_status := FND_API.G_RET_STS_ERROR;
1298: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
1299: p_count => x_msg_count,
1300: p_data => X_msg_data);
1301: IF G_DEBUG='Y' THEN
1302: -- Debug info.
1307: AHL_DEBUG_PUB.disable_debug;
1308: END IF;
1309: WHEN OTHERS THEN
1310: ROLLBACK TO delete_simulation_plan;
1311: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
1312: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
1313: THEN
1314: fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PVT',
1315: p_procedure_name => 'DELETE_SIMULATION_PLAN',
1314: fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PVT',
1315: p_procedure_name => 'DELETE_SIMULATION_PLAN',
1316: p_error_text => SUBSTR(SQLERRM,1,240));
1317: END IF;
1318: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
1319: p_count => x_msg_count,
1320: p_data => X_msg_data);
1321: IF G_DEBUG='Y' THEN
1322:
1345: -- NOTES
1346: --------------------------------------------------------------------
1347: PROCEDURE Copy_Visits_To_Plan (
1348: p_api_version IN NUMBER,
1349: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
1350: p_commit IN VARCHAR2 := FND_API.g_false,
1351: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
1352: p_module_type IN VARCHAR2 := 'JSP',
1353: p_visit_id IN NUMBER ,
1346: --------------------------------------------------------------------
1347: PROCEDURE Copy_Visits_To_Plan (
1348: p_api_version IN NUMBER,
1349: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
1350: p_commit IN VARCHAR2 := FND_API.g_false,
1351: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
1352: p_module_type IN VARCHAR2 := 'JSP',
1353: p_visit_id IN NUMBER ,
1354: p_visit_number IN NUMBER ,
1347: PROCEDURE Copy_Visits_To_Plan (
1348: p_api_version IN NUMBER,
1349: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
1350: p_commit IN VARCHAR2 := FND_API.g_false,
1351: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
1352: p_module_type IN VARCHAR2 := 'JSP',
1353: p_visit_id IN NUMBER ,
1354: p_visit_number IN NUMBER ,
1355: p_plan_id IN NUMBER,
1713: -- Debug info.
1714: AHL_DEBUG_PUB.debug( 'enter ahl_ltp_simul_plan_pvt.Copy Visits to Plan','+SMPNL+');
1715: END IF;
1716: -- Standard call to check for call compatibility.
1717: IF FND_API.to_boolean(p_init_msg_list)
1718: THEN
1719: FND_MSG_PUB.initialize;
1720: END IF;
1721: -- Initialize API return status to success
1718: THEN
1719: FND_MSG_PUB.initialize;
1720: END IF;
1721: -- Initialize API return status to success
1722: x_return_status := FND_API.G_RET_STS_SUCCESS;
1723: -- Initialize message list if p_init_msg_list is set to TRUE.
1724: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
1725: p_api_version,
1726: l_api_name,G_PKG_NAME)
1720: END IF;
1721: -- Initialize API return status to success
1722: x_return_status := FND_API.G_RET_STS_SUCCESS;
1723: -- Initialize message list if p_init_msg_list is set to TRUE.
1724: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
1725: p_api_version,
1726: l_api_name,G_PKG_NAME)
1727: THEN
1728: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1724: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
1725: p_api_version,
1726: l_api_name,G_PKG_NAME)
1727: THEN
1728: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
1729: END IF;
1730: IF G_DEBUG='Y' THEN
1731: AHL_DEBUG_PUB.debug( 'visit_id'||p_visit_id);
1732: AHL_DEBUG_PUB.debug( 'visit_number'||p_visit_number);
1733: END IF;
1734: ---------------------start API Body------------------------------------
1735: --
1736: IF (p_visit_number IS NOT NULL AND
1737: p_visit_number <> FND_API.G_MISS_NUM) THEN
1738: --
1739: OPEN get_visit_id_cur(p_visit_number);
1740: FETCH get_visit_id_cur INTO l_pvisit_id, l_primary_visit_id;
1741: IF get_visit_id_cur%NOTFOUND THEN
1741: IF get_visit_id_cur%NOTFOUND THEN
1742: Fnd_message.SET_NAME('AHL','AHL_LTP_INVALID_VISIT_NUMBER');
1743: Fnd_Msg_Pub.ADD;
1744: CLOSE get_visit_id_cur;
1745: RAISE Fnd_Api.G_EXC_ERROR;
1746: --
1747: END IF;
1748: CLOSE get_visit_id_cur;
1749: END IF;
1753: AHL_DEBUG_PUB.debug( 'visit_number'||l_primary_visit_id);
1754: END IF;
1755: --
1756: IF (p_visit_id IS NOT NULL AND
1757: p_visit_id <> FND_API.G_MISS_NUM) THEN
1758: OPEN get_visit_num_cur(p_visit_id);
1759: FETCH get_visit_num_cur INTO l_pvisit_id, l_primary_visit_id;
1760: IF get_visit_num_cur%NOTFOUND THEN
1761: Fnd_message.SET_NAME('AHL','AHL_LTP_INVALID_VISIT_NUMBER');
1760: IF get_visit_num_cur%NOTFOUND THEN
1761: Fnd_message.SET_NAME('AHL','AHL_LTP_INVALID_VISIT_NUMBER');
1762: Fnd_Msg_Pub.ADD;
1763: CLOSE get_visit_num_cur;
1764: RAISE Fnd_Api.G_EXC_ERROR;
1765: END IF;
1766: CLOSE get_visit_num_cur;
1767: END IF;
1768: --
1767: END IF;
1768: --
1769: --Get simulation plan id
1770: IF (p_plan_id IS NOT NULL AND
1771: p_plan_id <> FND_API.G_MISS_NUM) THEN
1772: SELECT simulation_plan_id,primary_plan_flag
1773: INTO l_simulation_plan_id, l_plan_flag
1774: FROM AHL_SIMULATION_PLANS_VL
1775: WHERE simulation_plan_id = p_plan_id;
1775: WHERE simulation_plan_id = p_plan_id;
1776: ELSE
1777: Fnd_message.SET_NAME('AHL','AHL_LTP_INVALID_SIMUL_NAME');
1778: Fnd_Msg_Pub.ADD;
1779: RAISE Fnd_Api.G_EXC_ERROR;
1780: END IF;
1781: --Check for copying to priamry plan
1782: IF l_plan_flag = 'Y' THEN
1783: Fnd_message.SET_NAME('AHL','AHL_LTP_NO_COPY_PRIM_PLAN');
1781: --Check for copying to priamry plan
1782: IF l_plan_flag = 'Y' THEN
1783: Fnd_message.SET_NAME('AHL','AHL_LTP_NO_COPY_PRIM_PLAN');
1784: Fnd_Msg_Pub.ADD;
1785: RAISE Fnd_Api.G_EXC_ERROR;
1786: END IF;
1787: --
1788: OPEN visit_detail_cur(l_pvisit_id);
1789: FETCH visit_detail_cur INTO l_visit_detail_rec;
1793: IF l_visit_detail_rec.visit_id = l_pvisit_id THEN
1794: IF l_visit_detail_rec.simulation_plan_id = p_plan_id THEN
1795: Fnd_message.SET_NAME('AHL','AHL_LTP_RECORD_EXISTS');
1796: Fnd_Msg_Pub.ADD;
1797: RAISE Fnd_Api.G_EXC_ERROR;
1798: END IF;
1799: END IF;
1800:
1801: --Check for Object version number
1798: END IF;
1799: END IF;
1800:
1801: --Check for Object version number
1802: IF (p_v_ovn IS NOT NULL AND p_v_ovn <> FND_API.G_MISS_NUM )
1803: THEN
1804: IF p_v_ovn <> l_visit_detail_rec.object_version_number THEN
1805: Fnd_message.SET_NAME('AHL','AHL_LTP_INVALID_VISIT_RECORD');
1806: Fnd_Msg_Pub.ADD;
1803: THEN
1804: IF p_v_ovn <> l_visit_detail_rec.object_version_number THEN
1805: Fnd_message.SET_NAME('AHL','AHL_LTP_INVALID_VISIT_RECORD');
1806: Fnd_Msg_Pub.ADD;
1807: RAISE Fnd_Api.G_EXC_ERROR;
1808: END IF;
1809: END IF;
1810: --
1811: SELECT object_version_number INTO l_plan_ovn_number FROM
1810: --
1811: SELECT object_version_number INTO l_plan_ovn_number FROM
1812: AHL_SIMULATION_PLANS_VL WHERE simulation_plan_id = p_plan_id;
1813: --Check for plan object version number
1814: IF (p_p_ovn IS NOT NULL AND p_p_ovn <> FND_API.G_MISS_NUM )
1815: THEN
1816: IF p_p_ovn <> l_plan_ovn_number THEN
1817: Fnd_message.SET_NAME('AHL','AHL_LTP_INVALID_PLAN_RECORD');
1818: Fnd_Msg_Pub.ADD;
1815: THEN
1816: IF p_p_ovn <> l_plan_ovn_number THEN
1817: Fnd_message.SET_NAME('AHL','AHL_LTP_INVALID_PLAN_RECORD');
1818: Fnd_Msg_Pub.ADD;
1819: RAISE Fnd_Api.G_EXC_ERROR;
1820: END IF;
1821: END IF;
1822: --Check for duplicate records
1823: OPEN check_visit_exist_cur(p_plan_id,l_pvisit_id,l_primary_visit_id);
1826: --
1827: IF l_dup_id IS NOT NULL THEN
1828: Fnd_message.SET_NAME('AHL','AHL_LTP_VISIT_NUMBER_EXISTS');
1829: Fnd_Msg_Pub.ADD;
1830: RAISE Fnd_Api.G_EXC_ERROR;
1831: END IF;
1832: IF G_DEBUG='Y' THEN
1833: AHL_DEBUG_PUB.debug( 'plan_id'||p_plan_id);
1834: AHL_DEBUG_PUB.debug( 'visit_id'||l_pvisit_id);
2046: FETCH get_visit_number INTO l_asso_prim_visit_number;
2047: CLOSE get_visit_number;
2048:
2049:
2050: x_return_status := Fnd_Api.g_ret_sts_error;
2051:
2052: /*
2053: Fnd_Message.SET_NAME('AHL','AHL_LTP_SIM_VISIT_UNIT_FOUND');
2054: Fnd_Message.SET_TOKEN('UE_TITLE', l_ue_details_rec.ue_title);
2063:
2064: Fnd_Message.SET_TOKEN('VISIT1', l_primary_visit_number);
2065: Fnd_Message.SET_TOKEN('VISIT2', l_asso_prim_visit_number);
2066: Fnd_Msg_Pub.ADD;
2067: RAISE Fnd_Api.G_EXC_ERROR;
2068: ELSE
2069: CLOSE chk_unit_effectivities;
2070: END IF;
2071: END IF;
2335: l_msg_count := Fnd_Msg_Pub.count_msg;
2336:
2337: IF l_msg_count > 0 THEN
2338: X_msg_count := l_msg_count;
2339: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
2340: RAISE Fnd_Api.G_EXC_ERROR;
2341: END IF;
2342:
2343: --Standard check for commit
2336:
2337: IF l_msg_count > 0 THEN
2338: X_msg_count := l_msg_count;
2339: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
2340: RAISE Fnd_Api.G_EXC_ERROR;
2341: END IF;
2342:
2343: --Standard check for commit
2344: IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
2340: RAISE Fnd_Api.G_EXC_ERROR;
2341: END IF;
2342:
2343: --Standard check for commit
2344: IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
2345: COMMIT;
2346: END IF;
2347: -- Debug info
2348: IF G_DEBUG='Y' THEN
2351: Ahl_Debug_Pub.disable_debug;
2352: END IF;
2353:
2354: EXCEPTION
2355: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2356: ROLLBACK TO copy_visits_to_plan;
2357: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2358: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2359: p_count => x_msg_count,
2353:
2354: EXCEPTION
2355: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2356: ROLLBACK TO copy_visits_to_plan;
2357: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2358: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2359: p_count => x_msg_count,
2360: p_data => x_msg_data);
2361: IF G_DEBUG='Y' THEN
2354: EXCEPTION
2355: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2356: ROLLBACK TO copy_visits_to_plan;
2357: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2358: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2359: p_count => x_msg_count,
2360: p_data => x_msg_data);
2361: IF G_DEBUG='Y' THEN
2362:
2366: -- Check if API is called in debug mode. If yes, disable debug.
2367: AHL_DEBUG_PUB.disable_debug;
2368: END IF;
2369:
2370: WHEN FND_API.G_EXC_ERROR THEN
2371: ROLLBACK TO copy_visits_to_plan;
2372: X_return_status := FND_API.G_RET_STS_ERROR;
2373: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2374: p_count => x_msg_count,
2368: END IF;
2369:
2370: WHEN FND_API.G_EXC_ERROR THEN
2371: ROLLBACK TO copy_visits_to_plan;
2372: X_return_status := FND_API.G_RET_STS_ERROR;
2373: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2374: p_count => x_msg_count,
2375: p_data => X_msg_data);
2376: IF G_DEBUG='Y' THEN
2369:
2370: WHEN FND_API.G_EXC_ERROR THEN
2371: ROLLBACK TO copy_visits_to_plan;
2372: X_return_status := FND_API.G_RET_STS_ERROR;
2373: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2374: p_count => x_msg_count,
2375: p_data => X_msg_data);
2376: IF G_DEBUG='Y' THEN
2377:
2384: END IF;
2385:
2386: WHEN OTHERS THEN
2387: ROLLBACK TO copy_visits_to_plan;
2388: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2389: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
2390: THEN
2391: fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PVT',
2392: p_procedure_name => 'COPY_VISITS_TO_PLAN',
2391: fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PVT',
2392: p_procedure_name => 'COPY_VISITS_TO_PLAN',
2393: p_error_text => SUBSTR(SQLERRM,1,240));
2394: END IF;
2395: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2396: p_count => x_msg_count,
2397: p_data => X_msg_data);
2398: IF G_DEBUG='Y' THEN
2399:
2422: -- NOTES
2423: --------------------------------------------------------------------
2424: PROCEDURE Remove_Visits_FR_Plan (
2425: p_api_version IN NUMBER,
2426: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
2427: p_commit IN VARCHAR2 := FND_API.g_false,
2428: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
2429: p_module_type IN VARCHAR2 := 'JSP',
2430: p_visit_id IN NUMBER,
2423: --------------------------------------------------------------------
2424: PROCEDURE Remove_Visits_FR_Plan (
2425: p_api_version IN NUMBER,
2426: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
2427: p_commit IN VARCHAR2 := FND_API.g_false,
2428: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
2429: p_module_type IN VARCHAR2 := 'JSP',
2430: p_visit_id IN NUMBER,
2431: p_plan_id IN NUMBER,
2424: PROCEDURE Remove_Visits_FR_Plan (
2425: p_api_version IN NUMBER,
2426: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
2427: p_commit IN VARCHAR2 := FND_API.g_false,
2428: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
2429: p_module_type IN VARCHAR2 := 'JSP',
2430: p_visit_id IN NUMBER,
2431: p_plan_id IN NUMBER,
2432: p_v_ovn IN NUMBER,
2494: IF G_DEBUG='Y' THEN
2495: AHL_DEBUG_PUB.debug( 'enter ahl_ltp_simul_plan_pvt.Remove Visits from Plan','+SMPNL+');
2496: END IF;
2497: -- Standard call to check for call compatibility.
2498: IF FND_API.to_boolean(p_init_msg_list)
2499: THEN
2500: FND_MSG_PUB.initialize;
2501: END IF;
2502: -- Initialize API return status to success
2499: THEN
2500: FND_MSG_PUB.initialize;
2501: END IF;
2502: -- Initialize API return status to success
2503: x_return_status := FND_API.G_RET_STS_SUCCESS;
2504: -- Initialize message list if p_init_msg_list is set to TRUE.
2505: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
2506: p_api_version,
2507: l_api_name,G_PKG_NAME)
2501: END IF;
2502: -- Initialize API return status to success
2503: x_return_status := FND_API.G_RET_STS_SUCCESS;
2504: -- Initialize message list if p_init_msg_list is set to TRUE.
2505: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
2506: p_api_version,
2507: l_api_name,G_PKG_NAME)
2508: THEN
2509: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2505: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
2506: p_api_version,
2507: l_api_name,G_PKG_NAME)
2508: THEN
2509: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2510: END IF;
2511:
2512: ---------------------start API Body------------------------------------
2513: --Remove tasks
2567: IF(l_delete_unit_effectivity_tbl(ue_count) is not null) THEN
2568: AHL_UMP_UNPLANNED_PVT.DELETE_UNIT_EFFECTIVITY
2569: (
2570: P_API_VERSION => p_api_version,
2571: p_init_msg_list => FND_API.G_FALSE,
2572: p_commit => FND_API.G_FALSE,
2573:
2574: X_RETURN_STATUS => l_return_status,
2575: X_MSG_COUNT => l_msg_count,
2568: AHL_UMP_UNPLANNED_PVT.DELETE_UNIT_EFFECTIVITY
2569: (
2570: P_API_VERSION => p_api_version,
2571: p_init_msg_list => FND_API.G_FALSE,
2572: p_commit => FND_API.G_FALSE,
2573:
2574: X_RETURN_STATUS => l_return_status,
2575: X_MSG_COUNT => l_msg_count,
2576: X_MSG_DATA => l_msg_data,
2585: 'After Calling ahl Ump Unplanned Pvt status : '|| l_return_status
2586: );
2587: END IF;
2588:
2589: IF (l_msg_count > 0) OR NVL(l_return_status,'x') <> FND_API.G_RET_STS_SUCCESS THEN
2590: x_return_status := FND_API.G_RET_STS_ERROR;
2591: RAISE FND_API.G_EXC_ERROR;
2592: END IF;
2593: END IF;
2586: );
2587: END IF;
2588:
2589: IF (l_msg_count > 0) OR NVL(l_return_status,'x') <> FND_API.G_RET_STS_SUCCESS THEN
2590: x_return_status := FND_API.G_RET_STS_ERROR;
2591: RAISE FND_API.G_EXC_ERROR;
2592: END IF;
2593: END IF;
2594: END LOOP;
2587: END IF;
2588:
2589: IF (l_msg_count > 0) OR NVL(l_return_status,'x') <> FND_API.G_RET_STS_SUCCESS THEN
2590: x_return_status := FND_API.G_RET_STS_ERROR;
2591: RAISE FND_API.G_EXC_ERROR;
2592: END IF;
2593: END IF;
2594: END LOOP;
2595: END IF;
2641: -- Removing planned materials for the visit
2642: AHL_LTP_REQST_MATRL_PVT.Process_Planned_Materials
2643: (
2644: p_api_version => p_api_version,
2645: p_init_msg_list => Fnd_Api.G_FALSE,
2646: p_commit => Fnd_Api.G_FALSE,
2647: p_visit_id => p_visit_id,
2648: p_visit_task_id => NULL,
2649: p_org_id => NULL,
2642: AHL_LTP_REQST_MATRL_PVT.Process_Planned_Materials
2643: (
2644: p_api_version => p_api_version,
2645: p_init_msg_list => Fnd_Api.G_FALSE,
2646: p_commit => Fnd_Api.G_FALSE,
2647: p_visit_id => p_visit_id,
2648: p_visit_task_id => NULL,
2649: p_org_id => NULL,
2650: p_start_date => NULL,
2655: x_msg_count => l_msg_count,
2656: x_msg_data => l_msg_data
2657: );
2658:
2659: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2660: CLOSE c_Material;
2661: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
2662: END IF;
2663:
2657: );
2658:
2659: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
2660: CLOSE c_Material;
2661: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
2662: END IF;
2663:
2664: END IF;
2665: CLOSE c_Material;
2674: l_msg_count := Fnd_Msg_Pub.count_msg;
2675:
2676: IF l_msg_count > 0 THEN
2677: X_msg_count := l_msg_count;
2678: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
2679: RAISE Fnd_Api.G_EXC_ERROR;
2680: END IF;
2681:
2682: --Standard check for commit
2675:
2676: IF l_msg_count > 0 THEN
2677: X_msg_count := l_msg_count;
2678: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
2679: RAISE Fnd_Api.G_EXC_ERROR;
2680: END IF;
2681:
2682: --Standard check for commit
2683: IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
2679: RAISE Fnd_Api.G_EXC_ERROR;
2680: END IF;
2681:
2682: --Standard check for commit
2683: IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
2684: COMMIT;
2685: END IF;
2686: IF G_DEBUG='Y' THEN
2687: -- Debug info
2690: Ahl_Debug_Pub.disable_debug;
2691: END IF;
2692:
2693: EXCEPTION
2694: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2695: ROLLBACK TO remove_visits_fr_plan;
2696: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2697: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2698: p_count => x_msg_count,
2692:
2693: EXCEPTION
2694: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2695: ROLLBACK TO remove_visits_fr_plan;
2696: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2697: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2698: p_count => x_msg_count,
2699: p_data => x_msg_data);
2700: IF G_DEBUG='Y' THEN
2693: EXCEPTION
2694: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2695: ROLLBACK TO remove_visits_fr_plan;
2696: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2697: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2698: p_count => x_msg_count,
2699: p_data => x_msg_data);
2700: IF G_DEBUG='Y' THEN
2701:
2705: -- Check if API is called in debug mode. If yes, disable debug.
2706: AHL_DEBUG_PUB.disable_debug;
2707: END IF;
2708:
2709: WHEN FND_API.G_EXC_ERROR THEN
2710: ROLLBACK TO remove_visits_fr_plan;
2711: X_return_status := FND_API.G_RET_STS_ERROR;
2712: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2713: p_count => x_msg_count,
2707: END IF;
2708:
2709: WHEN FND_API.G_EXC_ERROR THEN
2710: ROLLBACK TO remove_visits_fr_plan;
2711: X_return_status := FND_API.G_RET_STS_ERROR;
2712: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2713: p_count => x_msg_count,
2714: p_data => X_msg_data);
2715: IF G_DEBUG='Y' THEN
2708:
2709: WHEN FND_API.G_EXC_ERROR THEN
2710: ROLLBACK TO remove_visits_fr_plan;
2711: X_return_status := FND_API.G_RET_STS_ERROR;
2712: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2713: p_count => x_msg_count,
2714: p_data => X_msg_data);
2715: IF G_DEBUG='Y' THEN
2716:
2723: END IF;
2724:
2725: WHEN OTHERS THEN
2726: ROLLBACK TO remove_visits_fr_plan;
2727: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2728: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
2729: THEN
2730: fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PVT',
2731: p_procedure_name => 'REMOVE_VISITS_FR_PLAN',
2730: fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PVT',
2731: p_procedure_name => 'REMOVE_VISITS_FR_PLAN',
2732: p_error_text => SUBSTR(SQLERRM,1,240));
2733: END IF;
2734: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2735: p_count => x_msg_count,
2736: p_data => X_msg_data);
2737: IF G_DEBUG='Y' THEN
2738:
2761: -- NOTES
2762: --------------------------------------------------------------------
2763: PROCEDURE Toggle_Simulation_Delete (
2764: p_api_version IN NUMBER,
2765: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
2766: p_commit IN VARCHAR2 := FND_API.g_false,
2767: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
2768: p_module_type IN VARCHAR2 := 'JSP',
2769: p_visit_id IN NUMBER,
2762: --------------------------------------------------------------------
2763: PROCEDURE Toggle_Simulation_Delete (
2764: p_api_version IN NUMBER,
2765: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
2766: p_commit IN VARCHAR2 := FND_API.g_false,
2767: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
2768: p_module_type IN VARCHAR2 := 'JSP',
2769: p_visit_id IN NUMBER,
2770: p_visit_object_version_number IN NUMBER,
2763: PROCEDURE Toggle_Simulation_Delete (
2764: p_api_version IN NUMBER,
2765: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
2766: p_commit IN VARCHAR2 := FND_API.g_false,
2767: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
2768: p_module_type IN VARCHAR2 := 'JSP',
2769: p_visit_id IN NUMBER,
2770: p_visit_object_version_number IN NUMBER,
2771: x_return_status OUT NOCOPY VARCHAR2,
2799: -- Debug info.
2800: AHL_DEBUG_PUB.debug( 'enter ahl_ltp_simul_plan_pvt.toggle simulation delete','+SMPNL+');
2801: END IF;
2802: -- Standard call to check for call compatibility.
2803: IF FND_API.to_boolean(p_init_msg_list)
2804: THEN
2805: FND_MSG_PUB.initialize;
2806: END IF;
2807: -- Initialize API return status to success
2804: THEN
2805: FND_MSG_PUB.initialize;
2806: END IF;
2807: -- Initialize API return status to success
2808: x_return_status := FND_API.G_RET_STS_SUCCESS;
2809: -- Initialize message list if p_init_msg_list is set to TRUE.
2810: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
2811: p_api_version,
2812: l_api_name,G_PKG_NAME)
2806: END IF;
2807: -- Initialize API return status to success
2808: x_return_status := FND_API.G_RET_STS_SUCCESS;
2809: -- Initialize message list if p_init_msg_list is set to TRUE.
2810: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
2811: p_api_version,
2812: l_api_name,G_PKG_NAME)
2813: THEN
2814: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2810: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
2811: p_api_version,
2812: l_api_name,G_PKG_NAME)
2813: THEN
2814: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
2815: END IF;
2816:
2817: ---------------------start API Body----------------------------------------
2818: -- Check for Visit ID
2853: l_msg_count := Fnd_Msg_Pub.count_msg;
2854:
2855: IF l_msg_count > 0 THEN
2856: X_msg_count := l_msg_count;
2857: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
2858: RAISE Fnd_Api.G_EXC_ERROR;
2859: END IF;
2860:
2861: --Standard check for commit
2854:
2855: IF l_msg_count > 0 THEN
2856: X_msg_count := l_msg_count;
2857: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
2858: RAISE Fnd_Api.G_EXC_ERROR;
2859: END IF;
2860:
2861: --Standard check for commit
2862: IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
2858: RAISE Fnd_Api.G_EXC_ERROR;
2859: END IF;
2860:
2861: --Standard check for commit
2862: IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
2863: COMMIT;
2864: END IF;
2865: IF G_DEBUG='Y' THEN
2866: -- Debug info
2869: Ahl_Debug_Pub.disable_debug;
2870: END IF;
2871:
2872: EXCEPTION
2873: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2874: ROLLBACK TO toggle_simulation_delete;
2875: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2876: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2877: p_count => x_msg_count,
2871:
2872: EXCEPTION
2873: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2874: ROLLBACK TO toggle_simulation_delete;
2875: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2876: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2877: p_count => x_msg_count,
2878: p_data => x_msg_data);
2879: IF G_DEBUG='Y' THEN
2872: EXCEPTION
2873: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
2874: ROLLBACK TO toggle_simulation_delete;
2875: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2876: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2877: p_count => x_msg_count,
2878: p_data => x_msg_data);
2879: IF G_DEBUG='Y' THEN
2880:
2886: -- Check if API is called in debug mode. If yes, disable debug.
2887: AHL_DEBUG_PUB.disable_debug;
2888: END IF;
2889:
2890: WHEN FND_API.G_EXC_ERROR THEN
2891: ROLLBACK TO toggle_simulation_delete;
2892: X_return_status := FND_API.G_RET_STS_ERROR;
2893: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2894: p_count => x_msg_count,
2888: END IF;
2889:
2890: WHEN FND_API.G_EXC_ERROR THEN
2891: ROLLBACK TO toggle_simulation_delete;
2892: X_return_status := FND_API.G_RET_STS_ERROR;
2893: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2894: p_count => x_msg_count,
2895: p_data => X_msg_data);
2896: IF G_DEBUG='Y' THEN
2889:
2890: WHEN FND_API.G_EXC_ERROR THEN
2891: ROLLBACK TO toggle_simulation_delete;
2892: X_return_status := FND_API.G_RET_STS_ERROR;
2893: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2894: p_count => x_msg_count,
2895: p_data => X_msg_data);
2896: IF G_DEBUG='Y' THEN
2897:
2906: END IF;
2907:
2908: WHEN OTHERS THEN
2909: ROLLBACK TO toggle_simulation_delete;
2910: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
2911: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
2912: THEN
2913: fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PVT',
2914: p_procedure_name => 'TOGGLE_SIMULATION_DELETE',
2913: fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PVT',
2914: p_procedure_name => 'TOGGLE_SIMULATION_DELETE',
2915: p_error_text => SUBSTR(SQLERRM,1,240));
2916: END IF;
2917: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
2918: p_count => x_msg_count,
2919: p_data => X_msg_data);
2920: IF G_DEBUG='Y' THEN
2921:
2945: -- NOTES
2946: --------------------------------------------------------------------
2947: PROCEDURE Set_Plan_As_Primary (
2948: p_api_version IN NUMBER,
2949: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
2950: p_commit IN VARCHAR2 := FND_API.g_false,
2951: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
2952: p_module_type IN VARCHAR2 := 'JSP',
2953: p_plan_id IN NUMBER,
2946: --------------------------------------------------------------------
2947: PROCEDURE Set_Plan_As_Primary (
2948: p_api_version IN NUMBER,
2949: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
2950: p_commit IN VARCHAR2 := FND_API.g_false,
2951: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
2952: p_module_type IN VARCHAR2 := 'JSP',
2953: p_plan_id IN NUMBER,
2954: p_object_version_number IN NUMBER,
2947: PROCEDURE Set_Plan_As_Primary (
2948: p_api_version IN NUMBER,
2949: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
2950: p_commit IN VARCHAR2 := FND_API.g_false,
2951: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
2952: p_module_type IN VARCHAR2 := 'JSP',
2953: p_plan_id IN NUMBER,
2954: p_object_version_number IN NUMBER,
2955: x_return_status OUT NOCOPY VARCHAR2,
2999: IF G_DEBUG='Y' THEN
3000: AHL_DEBUG_PUB.debug( 'enter ahl_ltp_simul_plan_pvt.set plan as primary','+SMPNL+');
3001: END IF;
3002: -- Standard call to check for call compatibility.
3003: IF FND_API.to_boolean(p_init_msg_list)
3004: THEN
3005: FND_MSG_PUB.initialize;
3006: END IF;
3007: -- Initialize API return status to success
3004: THEN
3005: FND_MSG_PUB.initialize;
3006: END IF;
3007: -- Initialize API return status to success
3008: x_return_status := FND_API.G_RET_STS_SUCCESS;
3009: -- Initialize message list if p_init_msg_list is set to TRUE.
3010: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
3011: p_api_version,
3012: l_api_name,G_PKG_NAME)
3006: END IF;
3007: -- Initialize API return status to success
3008: x_return_status := FND_API.G_RET_STS_SUCCESS;
3009: -- Initialize message list if p_init_msg_list is set to TRUE.
3010: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
3011: p_api_version,
3012: l_api_name,G_PKG_NAME)
3013: THEN
3014: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3010: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
3011: p_api_version,
3012: l_api_name,G_PKG_NAME)
3013: THEN
3014: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3015: END IF;
3016:
3017: ---------------------start API Body----------------------------------------
3018: IF p_plan_id IS NULL AND p_plan_id <> FND_API.G_MISS_NUM THEN
3014: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3015: END IF;
3016:
3017: ---------------------start API Body----------------------------------------
3018: IF p_plan_id IS NULL AND p_plan_id <> FND_API.G_MISS_NUM THEN
3019: OPEN plan_cur(p_plan_id);
3020: FETCH plan_cur INTO l_simulation_plan_id,
3021: l_object_version_number,
3022: l_primary_plan_flag;
3032: IF check_visit_cur%NOTFOUND THEN
3033: Fnd_message.SET_NAME('AHL','AHL_LTP_SIMULATION_NO_VISITS');
3034: Fnd_Msg_Pub.ADD;
3035: CLOSE check_visit_cur;
3036: RAISE Fnd_Api.G_EXC_ERROR;
3037: END IF;
3038: CLOSE check_visit_cur;
3039: --
3040: --Check for Record change
3042: Fnd_message.SET_NAME('AHL','AHL_LTP_INVALID_PLAN_RECORD');
3043: Fnd_Msg_Pub.ADD;
3044: END IF;
3045: --Get all the simulated visits
3046: IF p_plan_id IS NOT NULL AND p_plan_id <> FND_API.G_MISS_NUM
3047: THEN
3048:
3049: OPEN visit_detail_cur(p_plan_id);
3050: LOOP
3053: EXIT WHEN visit_detail_cur%NOTFOUND;
3054: --Call set visit as primary
3055: Set_Visit_As_Primary
3056: ( p_api_version => p_api_version,
3057: p_init_msg_list => FND_API.G_FALSE,--p_init_msg_list,
3058: p_commit => FND_API.G_FALSE, --p_commit,
3059: p_validation_level => p_validation_level,
3060: p_module_type => p_module_type,
3061: p_visit_id => l_visit_id,
3054: --Call set visit as primary
3055: Set_Visit_As_Primary
3056: ( p_api_version => p_api_version,
3057: p_init_msg_list => FND_API.G_FALSE,--p_init_msg_list,
3058: p_commit => FND_API.G_FALSE, --p_commit,
3059: p_validation_level => p_validation_level,
3060: p_module_type => p_module_type,
3061: p_visit_id => l_visit_id,
3062: p_plan_id => p_plan_id,
3079: l_msg_count := Fnd_Msg_Pub.count_msg;
3080:
3081: IF l_msg_count > 0 THEN
3082: X_msg_count := l_msg_count;
3083: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
3084: RAISE Fnd_Api.G_EXC_ERROR;
3085: END IF;
3086:
3087: --Standard check for commit
3080:
3081: IF l_msg_count > 0 THEN
3082: X_msg_count := l_msg_count;
3083: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
3084: RAISE Fnd_Api.G_EXC_ERROR;
3085: END IF;
3086:
3087: --Standard check for commit
3088: IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
3084: RAISE Fnd_Api.G_EXC_ERROR;
3085: END IF;
3086:
3087: --Standard check for commit
3088: IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
3089: COMMIT;
3090: END IF;
3091: -- Debug info
3092: IF G_DEBUG='Y' THEN
3095: Ahl_Debug_Pub.disable_debug;
3096: END IF;
3097:
3098: EXCEPTION
3099: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3100: ROLLBACK TO toggle_simulation_delete;
3101: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3102: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
3103: p_count => x_msg_count,
3097:
3098: EXCEPTION
3099: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3100: ROLLBACK TO toggle_simulation_delete;
3101: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3102: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
3103: p_count => x_msg_count,
3104: p_data => x_msg_data);
3105: IF G_DEBUG='Y' THEN
3098: EXCEPTION
3099: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
3100: ROLLBACK TO toggle_simulation_delete;
3101: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3102: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
3103: p_count => x_msg_count,
3104: p_data => x_msg_data);
3105: IF G_DEBUG='Y' THEN
3106:
3110: -- Check if API is called in debug mode. If yes, disable debug.
3111: AHL_DEBUG_PUB.disable_debug;
3112: END IF;
3113:
3114: WHEN FND_API.G_EXC_ERROR THEN
3115: ROLLBACK TO set_plan_as_primary;
3116: X_return_status := FND_API.G_RET_STS_ERROR;
3117: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
3118: p_count => x_msg_count,
3112: END IF;
3113:
3114: WHEN FND_API.G_EXC_ERROR THEN
3115: ROLLBACK TO set_plan_as_primary;
3116: X_return_status := FND_API.G_RET_STS_ERROR;
3117: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
3118: p_count => x_msg_count,
3119: p_data => X_msg_data);
3120: IF G_DEBUG='Y' THEN
3113:
3114: WHEN FND_API.G_EXC_ERROR THEN
3115: ROLLBACK TO set_plan_as_primary;
3116: X_return_status := FND_API.G_RET_STS_ERROR;
3117: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
3118: p_count => x_msg_count,
3119: p_data => X_msg_data);
3120: IF G_DEBUG='Y' THEN
3121:
3127: AHL_DEBUG_PUB.disable_debug;
3128: END IF;
3129: WHEN OTHERS THEN
3130: ROLLBACK TO set_plan_as_primary;
3131: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
3132: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
3133: THEN
3134: fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PVT',
3135: p_procedure_name => 'SET_PLAN_AS_PRIMARY',
3134: fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PVT',
3135: p_procedure_name => 'SET_PLAN_AS_PRIMARY',
3136: p_error_text => SUBSTR(SQLERRM,1,240));
3137: END IF;
3138: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
3139: p_count => x_msg_count,
3140: p_data => X_msg_data);
3141:
3142: -- Debug info.
3163: -- NOTES
3164: --------------------------------------------------------------------
3165: PROCEDURE Set_Visit_As_Primary (
3166: p_api_version IN NUMBER,
3167: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
3168: p_commit IN VARCHAR2 := FND_API.g_false,
3169: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
3170: p_module_type IN VARCHAR2 := 'JSP',
3171: p_visit_id IN NUMBER,
3164: --------------------------------------------------------------------
3165: PROCEDURE Set_Visit_As_Primary (
3166: p_api_version IN NUMBER,
3167: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
3168: p_commit IN VARCHAR2 := FND_API.g_false,
3169: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
3170: p_module_type IN VARCHAR2 := 'JSP',
3171: p_visit_id IN NUMBER,
3172: p_plan_id IN NUMBER,
3165: PROCEDURE Set_Visit_As_Primary (
3166: p_api_version IN NUMBER,
3167: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
3168: p_commit IN VARCHAR2 := FND_API.g_false,
3169: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
3170: p_module_type IN VARCHAR2 := 'JSP',
3171: p_visit_id IN NUMBER,
3172: p_plan_id IN NUMBER,
3173: p_object_version_number IN NUMBER,
3596: IF G_DEBUG='Y' THEN
3597: AHL_DEBUG_PUB.debug( 'enter ahl_ltp_simul_plan_pvt.set visit as primary','+SMPNL+');
3598: END IF;
3599: -- Standard call to check for call compatibility.
3600: IF FND_API.to_boolean(p_init_msg_list)
3601: THEN
3602: FND_MSG_PUB.initialize;
3603: END IF;
3604: -- Initialize API return status to success
3601: THEN
3602: FND_MSG_PUB.initialize;
3603: END IF;
3604: -- Initialize API return status to success
3605: x_return_status := FND_API.G_RET_STS_SUCCESS;
3606: -- Initialize message list if p_init_msg_list is set to TRUE.
3607: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
3608: p_api_version,
3609: l_api_name,G_PKG_NAME)
3603: END IF;
3604: -- Initialize API return status to success
3605: x_return_status := FND_API.G_RET_STS_SUCCESS;
3606: -- Initialize message list if p_init_msg_list is set to TRUE.
3607: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
3608: p_api_version,
3609: l_api_name,G_PKG_NAME)
3610: THEN
3611: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3607: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
3608: p_api_version,
3609: l_api_name,G_PKG_NAME)
3610: THEN
3611: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
3612: END IF;
3613:
3614: ---------------------start API Body----------------------------------------
3615: --Check for simulation plan is primary
3619: --
3620: IF l_primary_plan_id IS NOT NULL THEN
3621: Fnd_message.SET_NAME('AHL','AHL_LTP_PRIMARY_PLAN');
3622: Fnd_Msg_Pub.ADD;
3623: RAISE Fnd_Api.G_EXC_ERROR;
3624: END IF;
3625: --Check for visit belongs to simulation plan
3626: SELECT simulation_plan_id,
3627: primary_plan_flag,
3633: --
3634: IF l_simulation_plan_id IS NULL THEN
3635: Fnd_message.SET_NAME('AHL','AHL_LTP_PRIMARY_PLAN');
3636: Fnd_Msg_Pub.ADD;
3637: RAISE Fnd_Api.G_EXC_ERROR;
3638: END IF;
3639:
3640: --Check for simulation plan
3641: OPEN simul_visit_cur(p_visit_id,p_plan_id);
3643: IF simul_visit_cur%NOTFOUND THEN
3644: Fnd_message.SET_NAME('AHL','AHL_LTP_INVALID_RECORD');
3645: Fnd_Msg_Pub.ADD;
3646: CLOSE simul_visit_cur;
3647: RAISE Fnd_Api.G_EXC_ERROR;
3648: END IF;
3649: CLOSE simul_visit_cur;
3650:
3651: --Check for object version number
3652: IF p_object_version_number <> l_simul_visit_rec.object_version_number
3653: THEN
3654: Fnd_message.SET_NAME('AHL','AHL_LTP_INVALID_PLAN_RECORD');
3655: Fnd_Msg_Pub.ADD;
3656: RAISE Fnd_Api.G_EXC_ERROR;
3657: END IF;
3658: --Get corresponding primary visit
3659:
3660: SELECT VISIT_ID,VISIT_NUMBER, a.SIMULATION_PLAN_ID INTO
3675: /* Modified by mpothuku on 01/25/05 to delete the primary visit if the Simulation Flag is delete */
3676: /*
3677: Fnd_message.SET_NAME('AHL','AHL_LTP_VISIT_REMOVED');
3678: Fnd_Msg_Pub.ADD;
3679: RAISE Fnd_Api.G_EXC_ERROR;
3680: */
3681: IF l_primary_visit_id IS NOT NULL THEN
3682: l_visit_tbl(l_visit_count).visit_id := l_primary_visit_id;
3683: l_visit_tbl(l_visit_count).operation_flag := 'D';
3691: END IF;
3692: AHL_VWP_VISITS_PVT.Process_Visit
3693: (
3694: p_api_version => p_api_version,
3695: p_init_msg_list => FND_API.g_false,--p_init_msg_list,
3696: p_commit => FND_API.g_false, --p_commit,
3697: p_validation_level => p_validation_level,
3698: p_module_type => p_module_type,
3699: p_x_Visit_tbl => l_visit_tbl,
3692: AHL_VWP_VISITS_PVT.Process_Visit
3693: (
3694: p_api_version => p_api_version,
3695: p_init_msg_list => FND_API.g_false,--p_init_msg_list,
3696: p_commit => FND_API.g_false, --p_commit,
3697: p_validation_level => p_validation_level,
3698: p_module_type => p_module_type,
3699: p_x_Visit_tbl => l_visit_tbl,
3700: x_return_status => l_return_status,
3711: 'After Calling ahl Vwp Visits Pvt status : '|| l_return_status
3712: );
3713: END IF;
3714: -- Check Error Message stack.
3715: IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
3716: l_msg_count := FND_MSG_PUB.count_msg;
3717: IF l_msg_count > 0 THEN
3718: RAISE FND_API.G_EXC_ERROR;
3719: END IF;
3714: -- Check Error Message stack.
3715: IF (l_return_status <> FND_API.G_RET_STS_SUCCESS) THEN
3716: l_msg_count := FND_MSG_PUB.count_msg;
3717: IF l_msg_count > 0 THEN
3718: RAISE FND_API.G_EXC_ERROR;
3719: END IF;
3720: END IF;
3721: END IF;
3722:
3732: FETCH c_Visit INTO c_visit_rec;
3733: CLOSE c_Visit;
3734:
3735: -- To check if visit starttime is not null then store time in HH4 format
3736: IF (l_simul_visit_rec.START_DATE_TIME IS NOT NULL AND l_simul_visit_rec.START_DATE_TIME <> Fnd_Api.G_MISS_DATE) THEN
3737: l_hour := TO_NUMBER(TO_CHAR(l_simul_visit_rec.START_DATE_TIME , 'HH24'));
3738: l_minute := TO_NUMBER(TO_CHAR(l_simul_visit_rec.START_DATE_TIME , 'MI'));
3739: ELSE
3740: l_hour := NULL;
3742: l_simul_visit_rec.START_DATE_TIME := NULL;
3743: END IF;
3744:
3745: -- To check if visit closetime is not null then store time in HH4 format
3746: IF (l_simul_visit_rec.CLOSE_DATE_TIME IS NOT NULL AND l_simul_visit_rec.CLOSE_DATE_TIME <> Fnd_Api.G_MISS_DATE) THEN
3747: l_hour_close := TO_NUMBER(TO_CHAR(l_simul_visit_rec.CLOSE_DATE_TIME , 'HH24'));
3748: l_minute_close := TO_NUMBER(TO_CHAR(l_simul_visit_rec.CLOSE_DATE_TIME , 'MI'));
3749: ELSE
3750: l_hour_close := NULL;
3833:
3834: AHL_VWP_VISITS_PVT.Process_Visit
3835: (
3836: p_api_version => p_api_version,
3837: p_init_msg_list => FND_API.g_false,
3838: p_commit => FND_API.g_false,
3839: p_validation_level => p_validation_level,
3840: p_module_type => NULL, --p_module_type,
3841: p_x_Visit_tbl => l_prim_visit_tbl,
3834: AHL_VWP_VISITS_PVT.Process_Visit
3835: (
3836: p_api_version => p_api_version,
3837: p_init_msg_list => FND_API.g_false,
3838: p_commit => FND_API.g_false,
3839: p_validation_level => p_validation_level,
3840: p_module_type => NULL, --p_module_type,
3841: p_x_Visit_tbl => l_prim_visit_tbl,
3842: x_return_status => l_return_status,
3853: );
3854:
3855: END IF;
3856: -- Check Error Message stack.
3857: IF (l_return_Status <> FND_API.G_RET_STS_SUCCESS) THEN
3858: l_msg_count := FND_MSG_PUB.count_msg;
3859: IF l_msg_count > 0 THEN
3860: RAISE FND_API.G_EXC_ERROR;
3861: END IF;
3856: -- Check Error Message stack.
3857: IF (l_return_Status <> FND_API.G_RET_STS_SUCCESS) THEN
3858: l_msg_count := FND_MSG_PUB.count_msg;
3859: IF l_msg_count > 0 THEN
3860: RAISE FND_API.G_EXC_ERROR;
3861: END IF;
3862: END IF;
3863:
3864: -- Update the Any_task_chg flag to 'Y'
3868: p_flag => 'Y',
3869: x_return_status => l_return_status
3870: );
3871:
3872: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3873: RAISE FND_API.G_EXC_ERROR;
3874: END IF;
3875:
3876: -- Check for tasks exist in primary visit tasks which are not in simulation visit
3869: x_return_status => l_return_status
3870: );
3871:
3872: IF l_return_status <> FND_API.G_RET_STS_SUCCESS THEN
3873: RAISE FND_API.G_EXC_ERROR;
3874: END IF;
3875:
3876: -- Check for tasks exist in primary visit tasks which are not in simulation visit
3877: OPEN get_tasks_delete_csr (l_primary_visit_id);
3890: --This will take care of removing the links as well from the primary tasks.
3891: AHL_VWP_TASKS_PVT.Delete_Task
3892: (
3893: p_api_version => p_api_version,
3894: p_init_msg_list => FND_API.g_false,
3895: p_commit => FND_API.g_false,
3896: p_validation_level => p_validation_level,
3897: p_module_type => NULL,
3898: p_visit_task_id => l_tasks_delete_rec.visit_task_id,
3891: AHL_VWP_TASKS_PVT.Delete_Task
3892: (
3893: p_api_version => p_api_version,
3894: p_init_msg_list => FND_API.g_false,
3895: p_commit => FND_API.g_false,
3896: p_validation_level => p_validation_level,
3897: p_module_type => NULL,
3898: p_visit_task_id => l_tasks_delete_rec.visit_task_id,
3899: x_return_status => l_return_status,
3901: x_msg_data => l_msg_data
3902: );
3903:
3904: -- Check Error Message stack.
3905: IF (l_return_Status <> FND_API.G_RET_STS_SUCCESS) THEN
3906: l_msg_count := FND_MSG_PUB.count_msg;
3907: IF l_msg_count > 0 THEN
3908: CLOSE get_tasks_delete_csr;
3909: RAISE FND_API.G_EXC_ERROR;
3905: IF (l_return_Status <> FND_API.G_RET_STS_SUCCESS) THEN
3906: l_msg_count := FND_MSG_PUB.count_msg;
3907: IF l_msg_count > 0 THEN
3908: CLOSE get_tasks_delete_csr;
3909: RAISE FND_API.G_EXC_ERROR;
3910: END IF;
3911: END IF;
3912: END IF;
3913: END IF;
3954: OPEN c_ue_details (l_simul_visit_task_rec.unit_effectivity_id);
3955: FETCH c_ue_details INTO l_ue_details_rec;
3956: CLOSE c_ue_details;
3957: */
3958: x_return_status := Fnd_Api.g_ret_sts_error;
3959: OPEN c_ue_mr_sr_id(l_simul_visit_task_rec.unit_effectivity_id);
3960: FETCH c_ue_mr_sr_id INTO ue_mr_sr_id_rec;
3961: CLOSE c_ue_mr_sr_id;
3962:
3971: Fnd_Message.SET_TOKEN('MR_TITLE', ue_sr_details_rec.mr_title);
3972: Fnd_Message.SET_TOKEN('VISIT1', l_primary_visit_number);
3973: Fnd_Message.SET_TOKEN('VISIT2', l_visit_number);
3974: Fnd_Msg_Pub.ADD;
3975: RAISE Fnd_Api.G_EXC_ERROR;
3976: ELSE
3977: OPEN c_ue_mr_details(ue_mr_sr_id_rec.mr_header_id,ue_mr_sr_id_rec.csi_item_instance_id);
3978: FETCH c_ue_mr_details INTO ue_mr_details_rec;
3979: CLOSE c_ue_mr_details;
3984: Fnd_Message.SET_TOKEN('MR_TITLE', ue_mr_details_rec.mr_title);
3985: Fnd_Message.SET_TOKEN('VISIT1', l_primary_visit_number);
3986: Fnd_Message.SET_TOKEN('VISIT2', l_visit_number);
3987: Fnd_Msg_Pub.ADD;
3988: RAISE Fnd_Api.G_EXC_ERROR;
3989: END IF;
3990: /*
3991: AnRaj: End of Fix bug#:4919576
3992: */
4050:
4051: AHL_VWP_TASKS_PVT.Update_Task
4052: (
4053: p_api_version => p_api_version,
4054: p_init_msg_list => Fnd_Api.g_false,
4055: p_commit => Fnd_Api.g_false,
4056: p_validation_level => p_validation_level,
4057: --passing null here as we dont want the OrigtaskId,
4058: --to be picked up as the value we are passing at this point.
4051: AHL_VWP_TASKS_PVT.Update_Task
4052: (
4053: p_api_version => p_api_version,
4054: p_init_msg_list => Fnd_Api.g_false,
4055: p_commit => Fnd_Api.g_false,
4056: p_validation_level => p_validation_level,
4057: --passing null here as we dont want the OrigtaskId,
4058: --to be picked up as the value we are passing at this point.
4059: p_module_type => null,
4063: x_msg_data => l_msg_data
4064: );
4065:
4066: -- Check Error Message stack.
4067: IF (l_return_Status <> FND_API.G_RET_STS_SUCCESS) THEN
4068: l_msg_count := FND_MSG_PUB.count_msg;
4069: IF l_msg_count > 0 THEN
4070: RAISE FND_API.G_EXC_ERROR;
4071: END IF;
4066: -- Check Error Message stack.
4067: IF (l_return_Status <> FND_API.G_RET_STS_SUCCESS) THEN
4068: l_msg_count := FND_MSG_PUB.count_msg;
4069: IF l_msg_count > 0 THEN
4070: RAISE FND_API.G_EXC_ERROR;
4071: END IF;
4072: END IF;
4073:
4074: ELSIF((l_simul_visit_task_rec.primary_visit_task_id IS NULL) OR
4253:
4254: AHL_VWP_TASKS_PVT.Update_Task
4255: (
4256: p_api_version => p_api_version,
4257: p_init_msg_list => Fnd_Api.g_false,
4258: p_commit => Fnd_Api.g_false,
4259: p_validation_level => p_validation_level,
4260: --passing LTP here as we want the OrigtaskId,
4261: --to be picked up as the value we are passing.
4254: AHL_VWP_TASKS_PVT.Update_Task
4255: (
4256: p_api_version => p_api_version,
4257: p_init_msg_list => Fnd_Api.g_false,
4258: p_commit => Fnd_Api.g_false,
4259: p_validation_level => p_validation_level,
4260: --passing LTP here as we want the OrigtaskId,
4261: --to be picked up as the value we are passing.
4262: p_module_type => 'LTP',
4266: x_msg_data => l_msg_data
4267: );
4268:
4269: -- Check Error Message stack.
4270: IF (l_return_Status <> FND_API.G_RET_STS_SUCCESS) THEN
4271: l_msg_count := FND_MSG_PUB.count_msg;
4272: IF l_msg_count > 0 THEN
4273: RAISE FND_API.G_EXC_ERROR;
4274: END IF;
4269: -- Check Error Message stack.
4270: IF (l_return_Status <> FND_API.G_RET_STS_SUCCESS) THEN
4271: l_msg_count := FND_MSG_PUB.count_msg;
4272: IF l_msg_count > 0 THEN
4273: RAISE FND_API.G_EXC_ERROR;
4274: END IF;
4275: END IF;
4276: END IF;
4277: END LOOP;
4434: --To adjust the task times for the inserted/updated tasks
4435: AHL_VWP_TIMES_PVT.Calculate_Task_Times
4436: (
4437: p_api_version => p_api_version,
4438: p_init_msg_list => Fnd_Api.G_FALSE,
4439: p_commit => Fnd_Api.G_FALSE,
4440: p_validation_level => p_validation_level,
4441: x_return_status => l_return_status,
4442: x_msg_count => l_msg_count,
4435: AHL_VWP_TIMES_PVT.Calculate_Task_Times
4436: (
4437: p_api_version => p_api_version,
4438: p_init_msg_list => Fnd_Api.G_FALSE,
4439: p_commit => Fnd_Api.G_FALSE,
4440: p_validation_level => p_validation_level,
4441: x_return_status => l_return_status,
4442: x_msg_count => l_msg_count,
4443: x_msg_data => l_msg_data,
4452: 'After calling AHL_VWP_TIMES_PVT.Calculate_Task_Times'
4453: );
4454: END IF;
4455:
4456: IF l_msg_count > 0 OR l_return_status <> Fnd_Api.g_ret_sts_success THEN
4457: x_return_status := FND_API.G_RET_STS_ERROR;
4458: RAISE FND_API.G_EXC_ERROR;
4459: END IF;
4460:
4453: );
4454: END IF;
4455:
4456: IF l_msg_count > 0 OR l_return_status <> Fnd_Api.g_ret_sts_success THEN
4457: x_return_status := FND_API.G_RET_STS_ERROR;
4458: RAISE FND_API.G_EXC_ERROR;
4459: END IF;
4460:
4461: -- anraj for fixing the issue number 207 in the CMRO Forum
4454: END IF;
4455:
4456: IF l_msg_count > 0 OR l_return_status <> Fnd_Api.g_ret_sts_success THEN
4457: x_return_status := FND_API.G_RET_STS_ERROR;
4458: RAISE FND_API.G_EXC_ERROR;
4459: END IF;
4460:
4461: -- anraj for fixing the issue number 207 in the CMRO Forum
4462: -- If none of the Org,dept and start date are null then Process_Planned_Materials is called with 'U'
4472: --Schedule material Reqmts in the Primary Visit for tasks created newly.
4473: AHL_LTP_REQST_MATRL_PVT.Process_Planned_Materials
4474: (
4475: p_api_version => p_api_version,
4476: p_init_msg_list => FND_API.g_false,
4477: p_commit => FND_API.g_false,
4478: p_validation_level => p_validation_level,--FND_API.g_valid_level_full,
4479: p_visit_id => l_primary_visit_id,
4480: p_visit_task_id => NULL,
4473: AHL_LTP_REQST_MATRL_PVT.Process_Planned_Materials
4474: (
4475: p_api_version => p_api_version,
4476: p_init_msg_list => FND_API.g_false,
4477: p_commit => FND_API.g_false,
4478: p_validation_level => p_validation_level,--FND_API.g_valid_level_full,
4479: p_visit_id => l_primary_visit_id,
4480: p_visit_task_id => NULL,
4481: p_org_id => NULL,
4474: (
4475: p_api_version => p_api_version,
4476: p_init_msg_list => FND_API.g_false,
4477: p_commit => FND_API.g_false,
4478: p_validation_level => p_validation_level,--FND_API.g_valid_level_full,
4479: p_visit_id => l_primary_visit_id,
4480: p_visit_task_id => NULL,
4481: p_org_id => NULL,
4482: p_start_date => NULL,
4497: ELSE
4498: AHL_LTP_REQST_MATRL_PVT.Process_Planned_Materials
4499: (
4500: p_api_version => p_api_version,
4501: p_init_msg_list => FND_API.g_false,
4502: p_commit => FND_API.g_false,
4503: p_validation_level => p_validation_level,--FND_API.g_valid_level_full,
4504: p_visit_id => l_primary_visit_id,
4505: p_visit_task_id => NULL,
4498: AHL_LTP_REQST_MATRL_PVT.Process_Planned_Materials
4499: (
4500: p_api_version => p_api_version,
4501: p_init_msg_list => FND_API.g_false,
4502: p_commit => FND_API.g_false,
4503: p_validation_level => p_validation_level,--FND_API.g_valid_level_full,
4504: p_visit_id => l_primary_visit_id,
4505: p_visit_task_id => NULL,
4506: p_org_id => NULL,
4499: (
4500: p_api_version => p_api_version,
4501: p_init_msg_list => FND_API.g_false,
4502: p_commit => FND_API.g_false,
4503: p_validation_level => p_validation_level,--FND_API.g_valid_level_full,
4504: p_visit_id => l_primary_visit_id,
4505: p_visit_task_id => NULL,
4506: p_org_id => NULL,
4507: p_start_date => NULL,
4522: END IF;
4523:
4524: -- modification end
4525:
4526: IF l_msg_count > 0 OR l_return_status <> Fnd_Api.g_ret_sts_success THEN
4527: x_return_status := FND_API.G_RET_STS_ERROR;
4528: RAISE FND_API.G_EXC_ERROR;
4529: END IF;
4530:
4523:
4524: -- modification end
4525:
4526: IF l_msg_count > 0 OR l_return_status <> Fnd_Api.g_ret_sts_success THEN
4527: x_return_status := FND_API.G_RET_STS_ERROR;
4528: RAISE FND_API.G_EXC_ERROR;
4529: END IF;
4530:
4531: /* Only if Simulation Flag is not set we ought to delete the Simulation Visit otherwise it
4524: -- modification end
4525:
4526: IF l_msg_count > 0 OR l_return_status <> Fnd_Api.g_ret_sts_success THEN
4527: x_return_status := FND_API.G_RET_STS_ERROR;
4528: RAISE FND_API.G_EXC_ERROR;
4529: END IF;
4530:
4531: /* Only if Simulation Flag is not set we ought to delete the Simulation Visit otherwise it
4532: anyway be deleted in process Visit
4534:
4535: Remove_Visits_FR_Plan
4536: (
4537: p_api_version => p_api_version,
4538: p_init_msg_list => FND_API.g_false,--p_init_msg_list,
4539: p_commit => FND_API.g_false, --p_commit,
4540: p_validation_level => p_validation_level,
4541: p_module_type => p_module_type,
4542: p_visit_id => p_visit_id,
4535: Remove_Visits_FR_Plan
4536: (
4537: p_api_version => p_api_version,
4538: p_init_msg_list => FND_API.g_false,--p_init_msg_list,
4539: p_commit => FND_API.g_false, --p_commit,
4540: p_validation_level => p_validation_level,
4541: p_module_type => p_module_type,
4542: p_visit_id => p_visit_id,
4543: p_plan_id => null,
4550:
4551: --mpothuku End
4552:
4553: -- Check Error Message stack.
4554: IF (l_return_Status <> FND_API.G_RET_STS_SUCCESS) THEN
4555: l_msg_count := FND_MSG_PUB.count_msg;
4556: IF l_msg_count > 0 THEN
4557: RAISE FND_API.G_EXC_ERROR;
4558: END IF;
4553: -- Check Error Message stack.
4554: IF (l_return_Status <> FND_API.G_RET_STS_SUCCESS) THEN
4555: l_msg_count := FND_MSG_PUB.count_msg;
4556: IF l_msg_count > 0 THEN
4557: RAISE FND_API.G_EXC_ERROR;
4558: END IF;
4559: END IF;
4560: ---------------------------End of Body---------------------------------------
4561: --Standard check to count messages
4562: l_msg_count := Fnd_Msg_Pub.count_msg;
4563:
4564: IF l_msg_count > 0 THEN
4565: X_msg_count := l_msg_count;
4566: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
4567: RAISE Fnd_Api.G_EXC_ERROR;
4568: END IF;
4569:
4570: --Standard check for commit
4563:
4564: IF l_msg_count > 0 THEN
4565: X_msg_count := l_msg_count;
4566: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
4567: RAISE Fnd_Api.G_EXC_ERROR;
4568: END IF;
4569:
4570: --Standard check for commit
4571: IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
4567: RAISE Fnd_Api.G_EXC_ERROR;
4568: END IF;
4569:
4570: --Standard check for commit
4571: IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
4572: COMMIT;
4573: END IF;
4574: -- Debug info
4575: IF G_DEBUG='Y' THEN
4578: Ahl_Debug_Pub.disable_debug;
4579: END IF;
4580: --
4581: EXCEPTION
4582: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4583: ROLLBACK TO set_visit_as_primary;
4584: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4585: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
4586: p_count => x_msg_count,
4580: --
4581: EXCEPTION
4582: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4583: ROLLBACK TO set_visit_as_primary;
4584: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4585: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
4586: p_count => x_msg_count,
4587: p_data => x_msg_data);
4588:
4581: EXCEPTION
4582: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4583: ROLLBACK TO set_visit_as_primary;
4584: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4585: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
4586: p_count => x_msg_count,
4587: p_data => x_msg_data);
4588:
4589: IF G_DEBUG='Y' THEN
4593: END IF;
4594: -- Check if API is called in debug mode. If yes, disable debug.
4595: AHL_DEBUG_PUB.disable_debug;
4596:
4597: WHEN FND_API.G_EXC_ERROR THEN
4598: ROLLBACK TO set_visit_as_primary;
4599: X_return_status := FND_API.G_RET_STS_ERROR;
4600: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
4601: p_count => x_msg_count,
4595: AHL_DEBUG_PUB.disable_debug;
4596:
4597: WHEN FND_API.G_EXC_ERROR THEN
4598: ROLLBACK TO set_visit_as_primary;
4599: X_return_status := FND_API.G_RET_STS_ERROR;
4600: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
4601: p_count => x_msg_count,
4602: p_data => X_msg_data);
4603: -- Debug info.
4596:
4597: WHEN FND_API.G_EXC_ERROR THEN
4598: ROLLBACK TO set_visit_as_primary;
4599: X_return_status := FND_API.G_RET_STS_ERROR;
4600: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
4601: p_count => x_msg_count,
4602: p_data => X_msg_data);
4603: -- Debug info.
4604: IF G_DEBUG='Y' THEN
4610: AHL_DEBUG_PUB.disable_debug;
4611:
4612: WHEN OTHERS THEN
4613: ROLLBACK TO set_visit_as_primary;
4614: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4615: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4616: THEN
4617: fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PVT',
4618: p_procedure_name => 'SET_VISIT_AS_PRIMARY',
4617: fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PVT',
4618: p_procedure_name => 'SET_VISIT_AS_PRIMARY',
4619: p_error_text => SUBSTR(SQLERRM,1,240));
4620: END IF;
4621: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
4622: p_count => x_msg_count,
4623: p_data => X_msg_data);
4624:
4625: -- Debug info.
4647: --------------------------------------------------------------------
4648:
4649: PROCEDURE Delete_Simul_Visits (
4650: p_api_version IN NUMBER,
4651: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
4652: p_commit IN VARCHAR2 := FND_API.g_false,
4653: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
4654: p_visit_id IN NUMBER,
4655: x_return_status OUT NOCOPY VARCHAR2,
4648:
4649: PROCEDURE Delete_Simul_Visits (
4650: p_api_version IN NUMBER,
4651: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
4652: p_commit IN VARCHAR2 := FND_API.g_false,
4653: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
4654: p_visit_id IN NUMBER,
4655: x_return_status OUT NOCOPY VARCHAR2,
4656: x_msg_count OUT NOCOPY NUMBER,
4649: PROCEDURE Delete_Simul_Visits (
4650: p_api_version IN NUMBER,
4651: p_init_msg_list IN VARCHAR2 := FND_API.g_false,
4652: p_commit IN VARCHAR2 := FND_API.g_false,
4653: p_validation_level IN NUMBER := FND_API.g_valid_level_full,
4654: p_visit_id IN NUMBER,
4655: x_return_status OUT NOCOPY VARCHAR2,
4656: x_msg_count OUT NOCOPY NUMBER,
4657: x_msg_data OUT NOCOPY VARCHAR2)
4699: IF G_DEBUG='Y' THEN
4700: AHL_DEBUG_PUB.debug( 'enter ahl_ltp_simul_plan_pvt.Delete Simul Visits','+SMPNL+');
4701: END IF;
4702: -- Standard call to check for call compatibility.
4703: IF FND_API.to_boolean(p_init_msg_list)
4704: THEN
4705: FND_MSG_PUB.initialize;
4706: END IF;
4707: -- Initialize API return status to success
4704: THEN
4705: FND_MSG_PUB.initialize;
4706: END IF;
4707: -- Initialize API return status to success
4708: x_return_status := FND_API.G_RET_STS_SUCCESS;
4709: -- Initialize message list if p_init_msg_list is set to TRUE.
4710: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
4711: p_api_version,
4712: l_api_name,G_PKG_NAME)
4706: END IF;
4707: -- Initialize API return status to success
4708: x_return_status := FND_API.G_RET_STS_SUCCESS;
4709: -- Initialize message list if p_init_msg_list is set to TRUE.
4710: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
4711: p_api_version,
4712: l_api_name,G_PKG_NAME)
4713: THEN
4714: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4710: IF NOT FND_API.COMPATIBLE_API_CALL(l_api_version,
4711: p_api_version,
4712: l_api_name,G_PKG_NAME)
4713: THEN
4714: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
4715: END IF;
4716:
4717: ---------------------start API Body----------------------------------------
4718: /* Changes made by mpothuku on 12/22/04 to call the VWP API instead of
4725: EXIT WHEN Get_simul_visits_cur%NOTFOUND;
4726: IF l_simul_visits_rec.visit_id IS NOT NULL THEN
4727: Remove_Visits_FR_Plan (
4728: p_api_version => p_api_version,
4729: p_init_msg_list => FND_API.g_false,--p_init_msg_list,
4730: p_commit => FND_API.g_false, --p_commit,
4731: p_validation_level => p_validation_level,
4732: p_module_type => NULL,
4733: p_visit_id => l_simul_visits_rec.visit_id,
4726: IF l_simul_visits_rec.visit_id IS NOT NULL THEN
4727: Remove_Visits_FR_Plan (
4728: p_api_version => p_api_version,
4729: p_init_msg_list => FND_API.g_false,--p_init_msg_list,
4730: p_commit => FND_API.g_false, --p_commit,
4731: p_validation_level => p_validation_level,
4732: p_module_type => NULL,
4733: p_visit_id => l_simul_visits_rec.visit_id,
4734: p_plan_id => null,
4737: x_msg_count => l_msg_count,
4738: x_msg_data => l_msg_data);
4739:
4740: -- Check Error Message stack.
4741: IF (l_return_Status <> FND_API.G_RET_STS_SUCCESS) THEN
4742: l_msg_count := FND_MSG_PUB.count_msg;
4743: IF l_msg_count > 0 THEN
4744: RAISE FND_API.G_EXC_ERROR;
4745: END IF;
4740: -- Check Error Message stack.
4741: IF (l_return_Status <> FND_API.G_RET_STS_SUCCESS) THEN
4742: l_msg_count := FND_MSG_PUB.count_msg;
4743: IF l_msg_count > 0 THEN
4744: RAISE FND_API.G_EXC_ERROR;
4745: END IF;
4746: END IF;
4747: END IF; -- Visit not null
4748: END LOOP;
4754: l_msg_count := Fnd_Msg_Pub.count_msg;
4755:
4756: IF l_msg_count > 0 THEN
4757: X_msg_count := l_msg_count;
4758: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
4759: RAISE Fnd_Api.G_EXC_ERROR;
4760: END IF;
4761:
4762: --Standard check for commit
4755:
4756: IF l_msg_count > 0 THEN
4757: X_msg_count := l_msg_count;
4758: X_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
4759: RAISE Fnd_Api.G_EXC_ERROR;
4760: END IF;
4761:
4762: --Standard check for commit
4763: IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
4759: RAISE Fnd_Api.G_EXC_ERROR;
4760: END IF;
4761:
4762: --Standard check for commit
4763: IF Fnd_Api.TO_BOOLEAN(p_commit) THEN
4764: COMMIT;
4765: END IF;
4766: -- Debug info
4767: IF G_DEBUG='Y' THEN
4770: Ahl_Debug_Pub.disable_debug;
4771: END IF;
4772: --
4773: EXCEPTION
4774: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4775: ROLLBACK TO Delete_Simul_Visits;
4776: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4777: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
4778: p_count => x_msg_count,
4772: --
4773: EXCEPTION
4774: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4775: ROLLBACK TO Delete_Simul_Visits;
4776: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4777: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
4778: p_count => x_msg_count,
4779: p_data => x_msg_data);
4780:
4773: EXCEPTION
4774: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
4775: ROLLBACK TO Delete_Simul_Visits;
4776: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4777: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
4778: p_count => x_msg_count,
4779: p_data => x_msg_data);
4780:
4781: IF G_DEBUG='Y' THEN
4785: END IF;
4786: -- Check if API is called in debug mode. If yes, disable debug.
4787: AHL_DEBUG_PUB.disable_debug;
4788:
4789: WHEN FND_API.G_EXC_ERROR THEN
4790: ROLLBACK TO Delete_Simul_Visits;
4791: X_return_status := FND_API.G_RET_STS_ERROR;
4792: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
4793: p_count => x_msg_count,
4787: AHL_DEBUG_PUB.disable_debug;
4788:
4789: WHEN FND_API.G_EXC_ERROR THEN
4790: ROLLBACK TO Delete_Simul_Visits;
4791: X_return_status := FND_API.G_RET_STS_ERROR;
4792: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
4793: p_count => x_msg_count,
4794: p_data => X_msg_data);
4795: -- Debug info.
4788:
4789: WHEN FND_API.G_EXC_ERROR THEN
4790: ROLLBACK TO Delete_Simul_Visits;
4791: X_return_status := FND_API.G_RET_STS_ERROR;
4792: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
4793: p_count => x_msg_count,
4794: p_data => X_msg_data);
4795: -- Debug info.
4796: IF G_DEBUG='Y' THEN
4802: AHL_DEBUG_PUB.disable_debug;
4803:
4804: WHEN OTHERS THEN
4805: ROLLBACK TO Delete_Simul_Visits;
4806: X_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
4807: IF FND_MSG_PUB.check_msg_level(FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR)
4808: THEN
4809: fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PVT',
4810: p_procedure_name => 'DELETE_SIMUL_VISITS',
4809: fnd_msg_pub.add_exc_msg(p_pkg_name => 'AHL_LTP_SIMUL_PLAN_PVT',
4810: p_procedure_name => 'DELETE_SIMUL_VISITS',
4811: p_error_text => SUBSTR(SQLERRM,1,240));
4812: END IF;
4813: FND_MSG_PUB.count_and_get( p_encoded => FND_API.G_FALSE,
4814: p_count => x_msg_count,
4815: p_data => X_msg_data);
4816: -- Debug info.
4817: IF G_DEBUG='Y' THEN