42: /* API for 12.1 release */
43: /*--------------------------------------------------*/
44:
45: PROCEDURE PROCESS_ESTIMATE_LINES(p_api_version IN NUMBER,
46: p_commit IN VARCHAR2 := Fnd_Api.g_false,
47: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
48: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
49: p_action IN VARCHAR2,
50: p_cs_cost_flag IN VARCHAR2 := 'Y',
43: /*--------------------------------------------------*/
44:
45: PROCEDURE PROCESS_ESTIMATE_LINES(p_api_version IN NUMBER,
46: p_commit IN VARCHAR2 := Fnd_Api.g_false,
47: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
48: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
49: p_action IN VARCHAR2,
50: p_cs_cost_flag IN VARCHAR2 := 'Y',
51: x_Charges_Rec IN OUT NOCOPY Cs_Charge_Details_Pub.Charges_Rec_Type,
44:
45: PROCEDURE PROCESS_ESTIMATE_LINES(p_api_version IN NUMBER,
46: p_commit IN VARCHAR2 := Fnd_Api.g_false,
47: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
48: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
49: p_action IN VARCHAR2,
50: p_cs_cost_flag IN VARCHAR2 := 'Y',
51: x_Charges_Rec IN OUT NOCOPY Cs_Charge_Details_Pub.Charges_Rec_Type,
52: x_return_status OUT NOCOPY VARCHAR2,
66: -- Standard Start of API savepoint
67: SAVEPOINT process_estimate_lines;
68:
69: -- Standard call to check for call compatibility.
70: IF NOT Fnd_Api.Compatible_API_Call(l_api_version,
71: p_api_version,
72: l_api_name,
73: G_PKG_NAME)
74: THEN
71: p_api_version,
72: l_api_name,
73: G_PKG_NAME)
74: THEN
75: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
76: END IF;
77:
78: -- Initialize message list if p_init_msg_list is set to TRUE.
79: IF Fnd_Api.to_Boolean(p_init_msg_list)
75: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
76: END IF;
77:
78: -- Initialize message list if p_init_msg_list is set to TRUE.
79: IF Fnd_Api.to_Boolean(p_init_msg_list)
80: THEN
81: Fnd_Msg_Pub.initialize;
82: END IF;
83:
81: Fnd_Msg_Pub.initialize;
82: END IF;
83:
84: -- Initialize API return status to success
85: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
86:
87: -- Api body starts
88: IF (g_debug > 0)
89: THEN
108: Cs_Charge_Details_Pub.Create_Charge_Details(p_api_version => p_api_version,
109: p_init_msg_list => p_init_msg_list,
110: p_commit => p_commit,
111: p_validation_level => p_validation_level,
112: p_transaction_control => Fnd_Api.G_TRUE,
113: p_Charges_Rec => x_charges_rec,
114: p_create_cost_detail => p_cs_cost_flag, -- swai: 12.1 service costing uptake bug 6960295
115: x_object_version_number => x_object_version_number,
116: x_estimate_detail_id => l_estimate_detail_id,
119: x_msg_count => x_msg_count,
120: x_msg_data => x_msg_data,
121: x_cost_id => x_cost_id); -- swai: 12.1 service costing uptake bug 6960295
122:
123: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
124: THEN
125: IF (g_debug > 0)
126: THEN
127: Csd_Gen_Utility_Pvt.ADD('Create_Charge_Details failed ');
126: THEN
127: Csd_Gen_Utility_Pvt.ADD('Create_Charge_Details failed ');
128: END IF;
129:
130: RAISE Fnd_Api.G_EXC_ERROR;
131: END IF;
132:
133: x_charges_rec.estimate_detail_id := l_estimate_detail_id;
134:
153: Csd_Gen_Utility_Pvt.ADD('x_Charges_Rec.business_process_id=' ||
154: x_Charges_Rec.business_process_id);
155: END IF;
156:
157: IF ((NVL(x_Charges_Rec.business_process_id, Fnd_Api.G_MISS_NUM) =
158: Fnd_Api.G_MISS_NUM) AND
159: x_Charges_Rec.estimate_detail_id IS NOT NULL)
160: THEN
161: BEGIN
154: x_Charges_Rec.business_process_id);
155: END IF;
156:
157: IF ((NVL(x_Charges_Rec.business_process_id, Fnd_Api.G_MISS_NUM) =
158: Fnd_Api.G_MISS_NUM) AND
159: x_Charges_Rec.estimate_detail_id IS NOT NULL)
160: THEN
161: BEGIN
162: SELECT business_process_id
169: IF (g_debug > 0)
170: THEN
171: Csd_Gen_Utility_Pvt.ADD('No Business business_process_id');
172: END IF;
173: RAISE Fnd_Api.G_EXC_ERROR;
174: WHEN TOO_MANY_ROWS THEN
175: IF (g_debug > 0)
176: THEN
177: Csd_Gen_Utility_Pvt.ADD('Too many business_process_id');
175: IF (g_debug > 0)
176: THEN
177: Csd_Gen_Utility_Pvt.ADD('Too many business_process_id');
178: END IF;
179: RAISE Fnd_Api.G_EXC_ERROR;
180: END;
181: END IF;
182:
183: IF (g_debug > 0)
189: Cs_Charge_Details_Pub.Update_Charge_Details(p_api_version => p_api_version,
190: p_init_msg_list => p_init_msg_list,
191: p_commit => p_commit,
192: p_validation_level => p_validation_level,
193: p_transaction_control => Fnd_Api.G_TRUE,
194: p_Charges_Rec => x_Charges_Rec,
195: p_update_cost_detail => p_cs_cost_flag, -- swai: 12.1 service costing uptake bug 6960295
196: x_object_version_number => x_object_version_number,
197: x_return_status => x_return_status,
197: x_return_status => x_return_status,
198: x_msg_count => x_msg_count,
199: x_msg_data => x_msg_data);
200:
201: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
202: THEN
203: IF (g_debug > 0)
204: THEN
205: Csd_Gen_Utility_Pvt.ADD('update_charge_details failed');
204: THEN
205: Csd_Gen_Utility_Pvt.ADD('update_charge_details failed');
206: END IF;
207:
208: RAISE Fnd_Api.G_EXC_ERROR;
209: END IF;
210:
211: ELSIF p_action = 'DELETE'
212: THEN
227: Cs_Charge_Details_Pub.Delete_Charge_Details(p_api_version => p_api_version,
228: p_init_msg_list => p_init_msg_list,
229: p_commit => p_commit,
230: p_validation_level => p_validation_level,
231: p_transaction_control => Fnd_Api.G_TRUE,
232: p_estimate_detail_id => l_estimate_detail_id,
233: p_delete_cost_detail => p_cs_cost_flag, -- swai: 12.1 service costing uptake bug 6960295
234: x_return_status => x_return_status,
235: x_msg_count => x_msg_count,
234: x_return_status => x_return_status,
235: x_msg_count => x_msg_count,
236: x_msg_data => x_msg_data);
237:
238: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
239: THEN
240: IF (g_debug > 0)
241: THEN
242: Csd_Gen_Utility_Pvt.ADD('Delete_Charge_Details failed ');
241: THEN
242: Csd_Gen_Utility_Pvt.ADD('Delete_Charge_Details failed ');
243: END IF;
244:
245: RAISE Fnd_Api.G_EXC_ERROR;
246: END IF;
247:
248: ELSE
249: IF (g_debug > 0)
253:
254: Fnd_Message.SET_NAME('CSD', 'CSD_INVALID_ACTION');
255: Fnd_Message.SET_TOKEN('ACTION', p_action);
256: Fnd_Msg_Pub.ADD;
257: RAISE Fnd_Api.G_EXC_ERROR;
258:
259: END IF;
260:
261: -- Api body ends here
259: END IF;
260:
261: -- Api body ends here
262: -- Standard check of p_commit.
263: IF Fnd_Api.To_Boolean(p_commit)
264: THEN
265: COMMIT WORK;
266: END IF;
267:
268: -- Standard call to get message count and IF count is get message info.
269: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
270: p_data => x_msg_data);
271: EXCEPTION
272: WHEN Fnd_Api.G_EXC_ERROR THEN
273: ROLLBACK TO process_estimate_lines;
274: x_return_status := Fnd_Api.G_RET_STS_ERROR;
275: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
276: p_data => x_msg_data);
270: p_data => x_msg_data);
271: EXCEPTION
272: WHEN Fnd_Api.G_EXC_ERROR THEN
273: ROLLBACK TO process_estimate_lines;
274: x_return_status := Fnd_Api.G_RET_STS_ERROR;
275: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
276: p_data => x_msg_data);
277: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
278: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
273: ROLLBACK TO process_estimate_lines;
274: x_return_status := Fnd_Api.G_RET_STS_ERROR;
275: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
276: p_data => x_msg_data);
277: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
278: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
279: ROLLBACK TO process_estimate_lines;
280: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
281: p_data => x_msg_data);
274: x_return_status := Fnd_Api.G_RET_STS_ERROR;
275: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
276: p_data => x_msg_data);
277: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
278: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
279: ROLLBACK TO process_estimate_lines;
280: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
281: p_data => x_msg_data);
282: WHEN OTHERS THEN
279: ROLLBACK TO process_estimate_lines;
280: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
281: p_data => x_msg_data);
282: WHEN OTHERS THEN
283: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
284: ROLLBACK TO process_estimate_lines;
285: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
286: THEN
287: Fnd_Msg_Pub.Add_Exc_Msg(G_PKG_NAME, l_api_name);
295: /* description : procedure used to update */
296: /* repair group for estimate changes*/
297: /*--------------------------------------------------*/
298: PROCEDURE UPDATE_RO_GROUP_ESTIMATE(p_api_version IN NUMBER,
299: p_commit IN VARCHAR2 := Fnd_Api.g_false,
300: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
301: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
302: p_repair_line_id IN NUMBER,
303: x_object_version_number OUT NOCOPY NUMBER,
296: /* repair group for estimate changes*/
297: /*--------------------------------------------------*/
298: PROCEDURE UPDATE_RO_GROUP_ESTIMATE(p_api_version IN NUMBER,
299: p_commit IN VARCHAR2 := Fnd_Api.g_false,
300: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
301: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
302: p_repair_line_id IN NUMBER,
303: x_object_version_number OUT NOCOPY NUMBER,
304: x_return_status OUT NOCOPY VARCHAR2,
297: /*--------------------------------------------------*/
298: PROCEDURE UPDATE_RO_GROUP_ESTIMATE(p_api_version IN NUMBER,
299: p_commit IN VARCHAR2 := Fnd_Api.g_false,
300: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
301: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
302: p_repair_line_id IN NUMBER,
303: x_object_version_number OUT NOCOPY NUMBER,
304: x_return_status OUT NOCOPY VARCHAR2,
305: x_msg_count OUT NOCOPY NUMBER,
330: -- Standard Start of API savepoint
331: SAVEPOINT UPDATE_RO_GROUP_ESTIMATE;
332:
333: -- Standard call to check for call compatibility.
334: IF NOT Fnd_Api.Compatible_API_Call(l_api_version,
335: p_api_version,
336: l_api_name,
337: G_PKG_NAME)
338: THEN
335: p_api_version,
336: l_api_name,
337: G_PKG_NAME)
338: THEN
339: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
340: END IF;
341:
342: -- Initialize message list if p_init_msg_list is set to TRUE.
343: IF Fnd_Api.to_Boolean(p_init_msg_list)
339: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
340: END IF;
341:
342: -- Initialize message list if p_init_msg_list is set to TRUE.
343: IF Fnd_Api.to_Boolean(p_init_msg_list)
344: THEN
345: Fnd_Msg_Pub.initialize;
346: END IF;
347:
345: Fnd_Msg_Pub.initialize;
346: END IF;
347:
348: -- Initialize API return status to success
349: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
350:
351: -- Api body starts
352: IF (g_debug > 0)
353: THEN
367: -- Validate the repair line ID
368: IF NOT
369: (Csd_Process_Util.Validate_rep_line_id(p_repair_line_id => p_repair_line_id))
370: THEN
371: RAISE Fnd_Api.G_EXC_ERROR;
372: END IF;
373:
374: BEGIN
375: SELECT grp.repair_group_id,
388: NULL;
389: -- FND_MESSAGE.SET_NAME('CSD','CSD_API_RO_GRP_UPD_NO_DATA');
390: -- FND_MESSAGE.SET_TOKEN('REPAIR_LINE_ID',p_repair_line_id);
391: -- FND_MSG_PUB.ADD;
392: -- RAISE FND_API.G_EXC_ERROR;
393: WHEN OTHERS THEN
394: NULL;
395: -- FND_MESSAGE.SET_NAME('CSD','CSD_API_RO_GRP_UPD_OTHERS');
396: -- FND_MESSAGE.SET_TOKEN('REPAIR_LINE_ID',p_repair_line_id);
394: NULL;
395: -- FND_MESSAGE.SET_NAME('CSD','CSD_API_RO_GRP_UPD_OTHERS');
396: -- FND_MESSAGE.SET_TOKEN('REPAIR_LINE_ID',p_repair_line_id);
397: -- FND_MSG_PUB.ADD;
398: -- RAISE FND_API.G_EXC_ERROR;
399: END;
400:
401: IF (l_repair_group_id IS NOT NULL)
402: THEN
537:
538: Csd_Repair_Groups_Pvt.UPDATE_REPAIR_GROUPS(p_api_version => 1.0,
539: p_commit => 'F',
540: p_init_msg_list => 'T',
541: p_validation_level => Fnd_Api.g_valid_level_full,
542: x_repair_order_group_rec => l_rep_group_rec,
543: x_return_status => l_return_status,
544: x_msg_count => l_msg_count,
545: x_msg_data => l_msg_data);
551: END IF;
552:
553: IF l_return_status <> 'S'
554: THEN
555: x_return_status := Fnd_Api.G_RET_STS_ERROR;
556: Fnd_Message.SET_NAME('CSD', 'CSD_API_RO_GROUP_EST_FAIL');
557: Fnd_Msg_Pub.ADD;
558: RAISE Fnd_Api.G_EXC_ERROR;
559: ELSIF l_return_status = 'S'
554: THEN
555: x_return_status := Fnd_Api.G_RET_STS_ERROR;
556: Fnd_Message.SET_NAME('CSD', 'CSD_API_RO_GROUP_EST_FAIL');
557: Fnd_Msg_Pub.ADD;
558: RAISE Fnd_Api.G_EXC_ERROR;
559: ELSIF l_return_status = 'S'
560: THEN
561: x_object_version_number := l_rep_group_rec.object_version_number;
562: END IF;
563:
564: -- Api body ends here
565:
566: -- Standard check of p_commit.
567: IF Fnd_Api.To_Boolean(p_commit)
568: THEN
569: COMMIT WORK;
570: END IF;
571:
575:
576: END IF;
577:
578: EXCEPTION
579: WHEN Fnd_Api.G_EXC_ERROR THEN
580: ROLLBACK TO UPDATE_RO_GROUP_ESTIMATE;
581: x_return_status := Fnd_Api.G_RET_STS_ERROR;
582: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
583: p_data => x_msg_data);
577:
578: EXCEPTION
579: WHEN Fnd_Api.G_EXC_ERROR THEN
580: ROLLBACK TO UPDATE_RO_GROUP_ESTIMATE;
581: x_return_status := Fnd_Api.G_RET_STS_ERROR;
582: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
583: p_data => x_msg_data);
584: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
585: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
580: ROLLBACK TO UPDATE_RO_GROUP_ESTIMATE;
581: x_return_status := Fnd_Api.G_RET_STS_ERROR;
582: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
583: p_data => x_msg_data);
584: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
585: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
586: ROLLBACK TO UPDATE_RO_GROUP_ESTIMATE;
587: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
588: p_data => x_msg_data);
581: x_return_status := Fnd_Api.G_RET_STS_ERROR;
582: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
583: p_data => x_msg_data);
584: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
585: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
586: ROLLBACK TO UPDATE_RO_GROUP_ESTIMATE;
587: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
588: p_data => x_msg_data);
589: WHEN OTHERS THEN
586: ROLLBACK TO UPDATE_RO_GROUP_ESTIMATE;
587: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
588: p_data => x_msg_data);
589: WHEN OTHERS THEN
590: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
591: ROLLBACK TO UPDATE_RO_GROUP_ESTIMATE;
592: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
593: THEN
594: Fnd_Msg_Pub.Add_Exc_Msg(G_PKG_NAME, l_api_name);
604: /* repair estimate headers */
605: /*--------------------------------------------------*/
606:
607: PROCEDURE CREATE_REPAIR_ESTIMATE(p_api_version IN NUMBER,
608: p_commit IN VARCHAR2 := Fnd_Api.g_false,
609: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
610: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
611: x_estimate_rec IN OUT NOCOPY REPAIR_ESTIMATE_REC,
612: x_estimate_id OUT NOCOPY NUMBER,
605: /*--------------------------------------------------*/
606:
607: PROCEDURE CREATE_REPAIR_ESTIMATE(p_api_version IN NUMBER,
608: p_commit IN VARCHAR2 := Fnd_Api.g_false,
609: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
610: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
611: x_estimate_rec IN OUT NOCOPY REPAIR_ESTIMATE_REC,
612: x_estimate_id OUT NOCOPY NUMBER,
613: x_return_status OUT NOCOPY VARCHAR2,
606:
607: PROCEDURE CREATE_REPAIR_ESTIMATE(p_api_version IN NUMBER,
608: p_commit IN VARCHAR2 := Fnd_Api.g_false,
609: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
610: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
611: x_estimate_rec IN OUT NOCOPY REPAIR_ESTIMATE_REC,
612: x_estimate_id OUT NOCOPY NUMBER,
613: x_return_status OUT NOCOPY VARCHAR2,
614: x_msg_count OUT NOCOPY NUMBER,
630: -- Standard Start of API savepoint
631: SAVEPOINT create_repair_estimate;
632:
633: -- Standard call to check for call compatibility.
634: IF NOT Fnd_Api.Compatible_API_Call(l_api_version,
635: p_api_version,
636: l_api_name,
637: G_PKG_NAME)
638: THEN
635: p_api_version,
636: l_api_name,
637: G_PKG_NAME)
638: THEN
639: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
640: END IF;
641:
642: -- Initialize message list if p_init_msg_list is set to TRUE.
643: IF Fnd_Api.to_Boolean(p_init_msg_list)
639: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
640: END IF;
641:
642: -- Initialize message list if p_init_msg_list is set to TRUE.
643: IF Fnd_Api.to_Boolean(p_init_msg_list)
644: THEN
645: Fnd_Msg_Pub.initialize;
646: END IF;
647:
645: Fnd_Msg_Pub.initialize;
646: END IF;
647:
648: -- Initialize API return status to success
649: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
650:
651: -- Api body starts
652: IF (g_debug > 0)
653: THEN
707: -- Validate the repair line ID
708: IF NOT
709: (Csd_Process_Util.Validate_rep_line_id(p_repair_line_id => x_estimate_rec.repair_line_id))
710: THEN
711: RAISE Fnd_Api.G_EXC_ERROR;
712: END IF;
713:
714: IF (g_debug > 0)
715: THEN
737: Fnd_Message.SET_NAME('CSD', 'CSD_API_ESTIMATE_EXISTS');
738: Fnd_Message.SET_TOKEN('REPAIR_LINE_ID',
739: x_estimate_rec.repair_line_id);
740: Fnd_Msg_Pub.ADD;
741: RAISE Fnd_Api.G_EXC_ERROR;
742: END IF;
743:
744: IF (g_debug > 0)
745: THEN
757: Fnd_Message.SET_NAME('CSD', 'CSD_EST_STATUS_MISSING');
758: Fnd_Message.SET_TOKEN('ESTIMATE_STATUS',
759: x_estimate_rec.estimate_status);
760: Fnd_Msg_Pub.ADD;
761: RAISE Fnd_Api.G_EXC_ERROR;
762: END;
763: /*
764: IF l_est_status_code in ('ACCEPTED','REJECTED') then
765:
767:
768: FND_MESSAGE.SET_NAME('CSD','CSD_EST_REASON_CODE__MISSING');
769: FND_MESSAGE.SET_TOKEN('REPAIR_ESTIMATE_ID',x_estimate_rec.repair_estimate_id);
770: FND_MSG_PUB.ADD;
771: RAISE FND_API.G_EXC_ERROR;
772:
773: END IF;
774:
775: END IF;
819: IF (x_estimate_rec.estimate_status IN ('ACCEPTED', 'REJECTED'))
820: THEN
821:
822: UPDATE_RO_GROUP_ESTIMATE(p_api_version => 1.0,
823: p_commit => Fnd_Api.g_false,
824: p_init_msg_list => Fnd_Api.g_true,
825: p_validation_level => Fnd_Api.g_valid_level_full,
826: p_repair_line_id => x_estimate_rec.repair_line_id,
827: x_object_version_number => l_group_obj_ver_num,
820: THEN
821:
822: UPDATE_RO_GROUP_ESTIMATE(p_api_version => 1.0,
823: p_commit => Fnd_Api.g_false,
824: p_init_msg_list => Fnd_Api.g_true,
825: p_validation_level => Fnd_Api.g_valid_level_full,
826: p_repair_line_id => x_estimate_rec.repair_line_id,
827: x_object_version_number => l_group_obj_ver_num,
828: x_return_status => l_api_return_status,
821:
822: UPDATE_RO_GROUP_ESTIMATE(p_api_version => 1.0,
823: p_commit => Fnd_Api.g_false,
824: p_init_msg_list => Fnd_Api.g_true,
825: p_validation_level => Fnd_Api.g_valid_level_full,
826: p_repair_line_id => x_estimate_rec.repair_line_id,
827: x_object_version_number => l_group_obj_ver_num,
828: x_return_status => l_api_return_status,
829: x_msg_count => x_msg_count,
830: x_msg_data => x_msg_data);
831:
832: IF (l_api_return_status <> 'S')
833: THEN
834: RAISE Fnd_Api.G_EXC_ERROR;
835: END IF;
836:
837: END IF;
838:
836:
837: END IF;
838:
839: -- Standard check of p_commit.
840: IF Fnd_Api.To_Boolean(p_commit)
841: THEN
842: COMMIT WORK;
843: END IF;
844:
845: -- Standard call to get message count and IF count is get message info.
846: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
847: p_data => x_msg_data);
848: EXCEPTION
849: WHEN Fnd_Api.G_EXC_ERROR THEN
850: x_return_status := Fnd_Api.G_RET_STS_ERROR;
851: ROLLBACK TO create_repair_estimate;
852: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
853: p_data => x_msg_data);
846: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
847: p_data => x_msg_data);
848: EXCEPTION
849: WHEN Fnd_Api.G_EXC_ERROR THEN
850: x_return_status := Fnd_Api.G_RET_STS_ERROR;
851: ROLLBACK TO create_repair_estimate;
852: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
853: p_data => x_msg_data);
854: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
850: x_return_status := Fnd_Api.G_RET_STS_ERROR;
851: ROLLBACK TO create_repair_estimate;
852: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
853: p_data => x_msg_data);
854: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
855: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
856: ROLLBACK TO create_repair_estimate;
857: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
858: p_data => x_msg_data);
851: ROLLBACK TO create_repair_estimate;
852: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
853: p_data => x_msg_data);
854: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
855: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
856: ROLLBACK TO create_repair_estimate;
857: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
858: p_data => x_msg_data);
859: WHEN OTHERS THEN
856: ROLLBACK TO create_repair_estimate;
857: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
858: p_data => x_msg_data);
859: WHEN OTHERS THEN
860: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
861: ROLLBACK TO create_repair_estimate;
862: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
863: THEN
864: Fnd_Msg_Pub.Add_Exc_Msg(G_PKG_NAME, l_api_name);
874: /* */
875: /*--------------------------------------------------*/
876:
877: PROCEDURE UPDATE_REPAIR_ESTIMATE(p_api_version IN NUMBER,
878: p_commit IN VARCHAR2 := Fnd_Api.g_false,
879: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
880: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
881: x_estimate_rec IN OUT NOCOPY REPAIR_ESTIMATE_REC,
882: x_return_status OUT NOCOPY VARCHAR2,
875: /*--------------------------------------------------*/
876:
877: PROCEDURE UPDATE_REPAIR_ESTIMATE(p_api_version IN NUMBER,
878: p_commit IN VARCHAR2 := Fnd_Api.g_false,
879: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
880: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
881: x_estimate_rec IN OUT NOCOPY REPAIR_ESTIMATE_REC,
882: x_return_status OUT NOCOPY VARCHAR2,
883: x_msg_count OUT NOCOPY NUMBER,
876:
877: PROCEDURE UPDATE_REPAIR_ESTIMATE(p_api_version IN NUMBER,
878: p_commit IN VARCHAR2 := Fnd_Api.g_false,
879: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
880: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
881: x_estimate_rec IN OUT NOCOPY REPAIR_ESTIMATE_REC,
882: x_return_status OUT NOCOPY VARCHAR2,
883: x_msg_count OUT NOCOPY NUMBER,
884: x_msg_data OUT NOCOPY VARCHAR2) IS
908: -- Standard Start of API savepoint
909: SAVEPOINT update_repair_estimate;
910:
911: -- Standard call to check for call compatibility.
912: IF NOT Fnd_Api.Compatible_API_Call(l_api_version,
913: p_api_version,
914: l_api_name,
915: G_PKG_NAME)
916: THEN
913: p_api_version,
914: l_api_name,
915: G_PKG_NAME)
916: THEN
917: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
918: END IF;
919:
920: -- Initialize message list if p_init_msg_list is set to TRUE.
921: IF Fnd_Api.to_Boolean(p_init_msg_list)
917: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
918: END IF;
919:
920: -- Initialize message list if p_init_msg_list is set to TRUE.
921: IF Fnd_Api.to_Boolean(p_init_msg_list)
922: THEN
923: Fnd_Msg_Pub.initialize;
924: END IF;
925:
923: Fnd_Msg_Pub.initialize;
924: END IF;
925:
926: -- Initialize API return status to success
927: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
928:
929: -- Api body starts
930: IF (g_debug > 0)
931: THEN
955: Csd_Process_Util.Check_Reqd_Param(p_param_value => x_estimate_rec.repair_estimate_id,
956: p_param_name => 'REPAIR_ESTIMATE_ID',
957: p_api_name => l_api_name);
958:
959: IF NVL(x_estimate_rec.repair_estimate_id, Fnd_Api.G_MISS_NUM) <>
960: Fnd_Api.G_MISS_NUM
961: THEN
962:
963: OPEN repair_estimate(x_estimate_rec.repair_estimate_id);
956: p_param_name => 'REPAIR_ESTIMATE_ID',
957: p_api_name => l_api_name);
958:
959: IF NVL(x_estimate_rec.repair_estimate_id, Fnd_Api.G_MISS_NUM) <>
960: Fnd_Api.G_MISS_NUM
961: THEN
962:
963: OPEN repair_estimate(x_estimate_rec.repair_estimate_id);
964: FETCH repair_estimate
968: THEN
969: Fnd_Message.SET_NAME('CSD', 'CSD_API_ESTIMATE_MISSING');
970: Fnd_Message.SET_TOKEN('REPAIR_ESTIMATE_ID', l_estimate_id);
971: Fnd_Msg_Pub.ADD;
972: RAISE Fnd_Api.G_EXC_ERROR;
973: END IF;
974:
975: IF repair_estimate%ISOPEN
976: THEN
978: END IF;
979:
980: END IF;
981:
982: IF NVL(x_estimate_rec.object_version_number, Fnd_Api.G_MISS_NUM) <>
983: l_obj_ver_num
984: THEN
985: IF (g_debug > 0)
986: THEN
989:
990: Fnd_Message.SET_NAME('CSD', 'CSD_OBJ_VER_MISMATCH');
991: Fnd_Message.SET_TOKEN('REPAIR_ESTIMATE_ID', l_estimate_id);
992: Fnd_Msg_Pub.ADD;
993: RAISE Fnd_Api.G_EXC_ERROR;
994: END IF;
995:
996: IF (g_debug > 0)
997: THEN
1009: Fnd_Message.SET_NAME('CSD', 'CSD_EST_STATUS_MISSING');
1010: Fnd_Message.SET_TOKEN('ESTIMATE_STATUS',
1011: x_estimate_rec.estimate_status);
1012: Fnd_Msg_Pub.ADD;
1013: RAISE Fnd_Api.G_EXC_ERROR;
1014: END;
1015: /*
1016: IF l_est_status_code in ('ACCEPTED','REJECTED') then
1017:
1019:
1020: FND_MESSAGE.SET_NAME('CSD','CSD_EST_REASON_CODE__MISSING');
1021: FND_MESSAGE.SET_TOKEN('REPAIR_ESTIMATE_ID',x_estimate_rec.repair_estimate_id);
1022: FND_MSG_PUB.ADD;
1023: RAISE FND_API.G_EXC_ERROR;
1024:
1025: END IF;
1026: END IF;
1027: */
1086: IF (x_estimate_rec.estimate_status IN ('ACCEPTED', 'REJECTED'))
1087: THEN
1088:
1089: UPDATE_RO_GROUP_ESTIMATE(p_api_version => 1.0,
1090: p_commit => Fnd_Api.g_false,
1091: p_init_msg_list => Fnd_Api.g_true,
1092: p_validation_level => Fnd_Api.g_valid_level_full,
1093: p_repair_line_id => x_estimate_rec.repair_line_id,
1094: x_object_version_number => l_group_obj_ver_num,
1087: THEN
1088:
1089: UPDATE_RO_GROUP_ESTIMATE(p_api_version => 1.0,
1090: p_commit => Fnd_Api.g_false,
1091: p_init_msg_list => Fnd_Api.g_true,
1092: p_validation_level => Fnd_Api.g_valid_level_full,
1093: p_repair_line_id => x_estimate_rec.repair_line_id,
1094: x_object_version_number => l_group_obj_ver_num,
1095: x_return_status => l_api_return_status,
1088:
1089: UPDATE_RO_GROUP_ESTIMATE(p_api_version => 1.0,
1090: p_commit => Fnd_Api.g_false,
1091: p_init_msg_list => Fnd_Api.g_true,
1092: p_validation_level => Fnd_Api.g_valid_level_full,
1093: p_repair_line_id => x_estimate_rec.repair_line_id,
1094: x_object_version_number => l_group_obj_ver_num,
1095: x_return_status => l_api_return_status,
1096: x_msg_count => x_msg_count,
1097: x_msg_data => x_msg_data);
1098:
1099: IF (l_api_return_status <> 'S')
1100: THEN
1101: RAISE Fnd_Api.G_EXC_ERROR;
1102: END IF;
1103:
1104: END IF;
1105:
1103:
1104: END IF;
1105:
1106: -- Standard check of p_commit.
1107: IF Fnd_Api.To_Boolean(p_commit)
1108: THEN
1109: COMMIT WORK;
1110: END IF;
1111:
1112: -- Standard call to get message count and IF count is get message info.
1113: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1114: p_data => x_msg_data);
1115: EXCEPTION
1116: WHEN Fnd_Api.G_EXC_ERROR THEN
1117: x_return_status := Fnd_Api.G_RET_STS_ERROR;
1118: ROLLBACK TO update_repair_estimate;
1119: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1120: p_data => x_msg_data);
1113: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1114: p_data => x_msg_data);
1115: EXCEPTION
1116: WHEN Fnd_Api.G_EXC_ERROR THEN
1117: x_return_status := Fnd_Api.G_RET_STS_ERROR;
1118: ROLLBACK TO update_repair_estimate;
1119: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1120: p_data => x_msg_data);
1121: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
1117: x_return_status := Fnd_Api.G_RET_STS_ERROR;
1118: ROLLBACK TO update_repair_estimate;
1119: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1120: p_data => x_msg_data);
1121: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
1122: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1123: ROLLBACK TO update_repair_estimate;
1124: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1125: p_data => x_msg_data);
1118: ROLLBACK TO update_repair_estimate;
1119: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1120: p_data => x_msg_data);
1121: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
1122: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1123: ROLLBACK TO update_repair_estimate;
1124: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1125: p_data => x_msg_data);
1126: WHEN OTHERS THEN
1123: ROLLBACK TO update_repair_estimate;
1124: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1125: p_data => x_msg_data);
1126: WHEN OTHERS THEN
1127: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1128: ROLLBACK TO update_repair_estimate;
1129: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
1130: THEN
1131: Fnd_Msg_Pub.Add_Exc_Msg(G_PKG_NAME, l_api_name);
1141: /* */
1142: /*--------------------------------------------------*/
1143:
1144: PROCEDURE DELETE_REPAIR_ESTIMATE(p_api_version IN NUMBER,
1145: p_commit IN VARCHAR2 := Fnd_Api.g_false,
1146: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
1147: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
1148: p_estimate_id IN NUMBER,
1149: x_return_status OUT NOCOPY VARCHAR2,
1142: /*--------------------------------------------------*/
1143:
1144: PROCEDURE DELETE_REPAIR_ESTIMATE(p_api_version IN NUMBER,
1145: p_commit IN VARCHAR2 := Fnd_Api.g_false,
1146: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
1147: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
1148: p_estimate_id IN NUMBER,
1149: x_return_status OUT NOCOPY VARCHAR2,
1150: x_msg_count OUT NOCOPY NUMBER,
1143:
1144: PROCEDURE DELETE_REPAIR_ESTIMATE(p_api_version IN NUMBER,
1145: p_commit IN VARCHAR2 := Fnd_Api.g_false,
1146: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
1147: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
1148: p_estimate_id IN NUMBER,
1149: x_return_status OUT NOCOPY VARCHAR2,
1150: x_msg_count OUT NOCOPY NUMBER,
1151: x_msg_data OUT NOCOPY VARCHAR2) IS
1165: -- Standard Start of API savepoint
1166: SAVEPOINT delete_repair_estimate;
1167:
1168: -- Standard call to check for call compatibility.
1169: IF NOT Fnd_Api.Compatible_API_Call(l_api_version,
1170: p_api_version,
1171: l_api_name,
1172: G_PKG_NAME)
1173: THEN
1170: p_api_version,
1171: l_api_name,
1172: G_PKG_NAME)
1173: THEN
1174: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
1175: END IF;
1176:
1177: -- Initialize message list if p_init_msg_list is set to TRUE.
1178: IF Fnd_Api.to_Boolean(p_init_msg_list)
1174: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
1175: END IF;
1176:
1177: -- Initialize message list if p_init_msg_list is set to TRUE.
1178: IF Fnd_Api.to_Boolean(p_init_msg_list)
1179: THEN
1180: Fnd_Msg_Pub.initialize;
1181: END IF;
1182:
1180: Fnd_Msg_Pub.initialize;
1181: END IF;
1182:
1183: -- Initialize API return status to success
1184: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
1185:
1186: -- Api body starts
1187: IF (g_debug > 0)
1188: THEN
1213: -- Validate the repair line ID
1214: IF NOT
1215: (Csd_Process_Util.Validate_estimate_id(p_estimate_id => p_estimate_id))
1216: THEN
1217: RAISE Fnd_Api.G_EXC_ERROR;
1218: END IF;
1219:
1220: BEGIN
1221: SELECT b.approval_status
1232:
1233: Fnd_Message.SET_NAME('CSD', 'CSD_API_ESTIMATE_MISSING');
1234: Fnd_Message.SET_TOKEN('REPAIR_ESTIMATE_ID', p_estimate_id);
1235: Fnd_Msg_Pub.ADD;
1236: RAISE Fnd_Api.G_EXC_ERROR;
1237: END;
1238:
1239: BEGIN
1240: SELECT COUNT(*)
1255:
1256: Fnd_Message.SET_NAME('CSD', 'CSD_ESTIMATE_LINE_EXISTS');
1257: Fnd_Message.SET_TOKEN('REPAIR_ESTIMATE_ID', p_estimate_id);
1258: Fnd_Msg_Pub.ADD;
1259: RAISE Fnd_Api.G_EXC_ERROR;
1260: END IF;
1261:
1262: IF NVL(l_approval_status, 'Z') <> 'A'
1263: THEN
1270: ELSE
1271: Fnd_Message.SET_NAME('CSD', 'CSD_EST_DELETE_NOT_ALLOWED');
1272: Fnd_Message.SET_TOKEN('REPAIR_ESTIMATE_ID', p_estimate_id);
1273: Fnd_Msg_Pub.ADD;
1274: RAISE Fnd_Api.G_EXC_ERROR;
1275: END IF;
1276:
1277: -- Api body ends here
1278: -- Standard check of p_commit.
1275: END IF;
1276:
1277: -- Api body ends here
1278: -- Standard check of p_commit.
1279: IF Fnd_Api.To_Boolean(p_commit)
1280: THEN
1281: COMMIT WORK;
1282: END IF;
1283:
1284: -- Standard call to get message count and IF count is get message info.
1285: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1286: p_data => x_msg_data);
1287: EXCEPTION
1288: WHEN Fnd_Api.G_EXC_ERROR THEN
1289: x_return_status := Fnd_Api.G_RET_STS_ERROR;
1290: ROLLBACK TO delete_repair_estimate;
1291: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1292: p_data => x_msg_data);
1285: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1286: p_data => x_msg_data);
1287: EXCEPTION
1288: WHEN Fnd_Api.G_EXC_ERROR THEN
1289: x_return_status := Fnd_Api.G_RET_STS_ERROR;
1290: ROLLBACK TO delete_repair_estimate;
1291: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1292: p_data => x_msg_data);
1293: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
1289: x_return_status := Fnd_Api.G_RET_STS_ERROR;
1290: ROLLBACK TO delete_repair_estimate;
1291: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1292: p_data => x_msg_data);
1293: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
1294: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1295: ROLLBACK TO delete_repair_estimate;
1296: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1297: p_data => x_msg_data);
1290: ROLLBACK TO delete_repair_estimate;
1291: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1292: p_data => x_msg_data);
1293: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
1294: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1295: ROLLBACK TO delete_repair_estimate;
1296: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1297: p_data => x_msg_data);
1298: WHEN OTHERS THEN
1295: ROLLBACK TO delete_repair_estimate;
1296: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1297: p_data => x_msg_data);
1298: WHEN OTHERS THEN
1299: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1300: ROLLBACK TO delete_repair_estimate;
1301: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
1302: THEN
1303: Fnd_Msg_Pub.Add_Exc_Msg(G_PKG_NAME, l_api_name);
1312: /* repair estimate headers */
1313: /*--------------------------------------------------*/
1314:
1315: PROCEDURE lock_repair_estimate(p_api_version IN NUMBER,
1316: p_commit IN VARCHAR2 := Fnd_Api.g_false,
1317: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
1318: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
1319: p_estimate_rec IN REPAIR_ESTIMATE_REC,
1320: x_return_status OUT NOCOPY VARCHAR2,
1313: /*--------------------------------------------------*/
1314:
1315: PROCEDURE lock_repair_estimate(p_api_version IN NUMBER,
1316: p_commit IN VARCHAR2 := Fnd_Api.g_false,
1317: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
1318: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
1319: p_estimate_rec IN REPAIR_ESTIMATE_REC,
1320: x_return_status OUT NOCOPY VARCHAR2,
1321: x_msg_count OUT NOCOPY NUMBER,
1314:
1315: PROCEDURE lock_repair_estimate(p_api_version IN NUMBER,
1316: p_commit IN VARCHAR2 := Fnd_Api.g_false,
1317: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
1318: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
1319: p_estimate_rec IN REPAIR_ESTIMATE_REC,
1320: x_return_status OUT NOCOPY VARCHAR2,
1321: x_msg_count OUT NOCOPY NUMBER,
1322: x_msg_data OUT NOCOPY VARCHAR2) IS
1331: -- Standard Start of API savepoint
1332: SAVEPOINT lock_repair_estimate;
1333:
1334: -- Standard call to check for call compatibility.
1335: IF NOT Fnd_Api.Compatible_API_Call(l_api_version,
1336: p_api_version,
1337: l_api_name,
1338: G_PKG_NAME)
1339: THEN
1336: p_api_version,
1337: l_api_name,
1338: G_PKG_NAME)
1339: THEN
1340: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
1341: END IF;
1342:
1343: -- Initialize message list if p_init_msg_list is set to TRUE.
1344: IF Fnd_Api.to_Boolean(p_init_msg_list)
1340: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
1341: END IF;
1342:
1343: -- Initialize message list if p_init_msg_list is set to TRUE.
1344: IF Fnd_Api.to_Boolean(p_init_msg_list)
1345: THEN
1346: Fnd_Msg_Pub.initialize;
1347: END IF;
1348:
1346: Fnd_Msg_Pub.initialize;
1347: END IF;
1348:
1349: -- Initialize API return status to success
1350: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
1351:
1352: Csd_Repair_Estimate_Pkg.Lock_Row(p_REPAIR_ESTIMATE_ID => p_estimate_rec.repair_estimate_id,
1353: p_OBJECT_VERSION_NUMBER => p_estimate_rec.OBJECT_VERSION_NUMBER);
1354:
1352: Csd_Repair_Estimate_Pkg.Lock_Row(p_REPAIR_ESTIMATE_ID => p_estimate_rec.repair_estimate_id,
1353: p_OBJECT_VERSION_NUMBER => p_estimate_rec.OBJECT_VERSION_NUMBER);
1354:
1355: -- Standard check of p_commit.
1356: IF Fnd_Api.To_Boolean(p_commit)
1357: THEN
1358: COMMIT WORK;
1359: END IF;
1360:
1361: -- Standard call to get message count and IF count is get message info.
1362: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1363: p_data => x_msg_data);
1364: EXCEPTION
1365: WHEN Fnd_Api.G_EXC_ERROR THEN
1366: x_return_status := Fnd_Api.G_RET_STS_ERROR;
1367: ROLLBACK TO lock_repair_estimate;
1368: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1369: p_data => x_msg_data);
1362: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1363: p_data => x_msg_data);
1364: EXCEPTION
1365: WHEN Fnd_Api.G_EXC_ERROR THEN
1366: x_return_status := Fnd_Api.G_RET_STS_ERROR;
1367: ROLLBACK TO lock_repair_estimate;
1368: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1369: p_data => x_msg_data);
1370: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
1366: x_return_status := Fnd_Api.G_RET_STS_ERROR;
1367: ROLLBACK TO lock_repair_estimate;
1368: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1369: p_data => x_msg_data);
1370: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
1371: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1372: ROLLBACK TO lock_repair_estimate;
1373: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1374: p_data => x_msg_data);
1367: ROLLBACK TO lock_repair_estimate;
1368: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1369: p_data => x_msg_data);
1370: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
1371: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1372: ROLLBACK TO lock_repair_estimate;
1373: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1374: p_data => x_msg_data);
1375: WHEN OTHERS THEN
1372: ROLLBACK TO lock_repair_estimate;
1373: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1374: p_data => x_msg_data);
1375: WHEN OTHERS THEN
1376: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1377: ROLLBACK TO lock_repair_estimate;
1378: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
1379: THEN
1380: Fnd_Msg_Pub.Add_Exc_Msg(G_PKG_NAME, l_api_name);
1389: /* repair estimate lines */
1390: /*--------------------------------------------------*/
1391:
1392: PROCEDURE CREATE_REPAIR_ESTIMATE_LINES(p_api_version IN NUMBER,
1393: p_commit IN VARCHAR2 := Fnd_Api.g_false,
1394: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
1395: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
1396: x_estimate_line_rec IN OUT NOCOPY CSD_REPAIR_ESTIMATE_PVT.REPAIR_ESTIMATE_LINE_REC,
1397: x_estimate_line_id OUT NOCOPY NUMBER,
1390: /*--------------------------------------------------*/
1391:
1392: PROCEDURE CREATE_REPAIR_ESTIMATE_LINES(p_api_version IN NUMBER,
1393: p_commit IN VARCHAR2 := Fnd_Api.g_false,
1394: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
1395: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
1396: x_estimate_line_rec IN OUT NOCOPY CSD_REPAIR_ESTIMATE_PVT.REPAIR_ESTIMATE_LINE_REC,
1397: x_estimate_line_id OUT NOCOPY NUMBER,
1398: x_return_status OUT NOCOPY VARCHAR2,
1391:
1392: PROCEDURE CREATE_REPAIR_ESTIMATE_LINES(p_api_version IN NUMBER,
1393: p_commit IN VARCHAR2 := Fnd_Api.g_false,
1394: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
1395: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
1396: x_estimate_line_rec IN OUT NOCOPY CSD_REPAIR_ESTIMATE_PVT.REPAIR_ESTIMATE_LINE_REC,
1397: x_estimate_line_id OUT NOCOPY NUMBER,
1398: x_return_status OUT NOCOPY VARCHAR2,
1399: x_msg_count OUT NOCOPY NUMBER,
1440: -- Standard Start of API savepoint
1441: SAVEPOINT create_repair_estimate_lines;
1442:
1443: -- Standard call to check for call compatibility.
1444: IF NOT Fnd_Api.Compatible_API_Call(l_api_version,
1445: p_api_version,
1446: l_api_name,
1447: G_PKG_NAME)
1448: THEN
1445: p_api_version,
1446: l_api_name,
1447: G_PKG_NAME)
1448: THEN
1449: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
1450: END IF;
1451:
1452: -- Initialize message list if p_init_msg_list is set to TRUE.
1453: IF Fnd_Api.to_Boolean(p_init_msg_list)
1449: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
1450: END IF;
1451:
1452: -- Initialize message list if p_init_msg_list is set to TRUE.
1453: IF Fnd_Api.to_Boolean(p_init_msg_list)
1454: THEN
1455: Fnd_Msg_Pub.initialize;
1456: END IF;
1457:
1455: Fnd_Msg_Pub.initialize;
1456: END IF;
1457:
1458: -- Initialize API return status to success
1459: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
1460:
1461: -- Api body starts
1462: IF (g_debug > 0)
1463: THEN
1527: -- Validate the repair line ID
1528: IF NOT
1529: (Csd_Process_Util.Validate_estimate_id(p_estimate_id => x_estimate_line_rec.repair_estimate_id))
1530: THEN
1531: RAISE Fnd_Api.G_EXC_ERROR;
1532: END IF;
1533:
1534: IF (g_debug > 0)
1535: THEN
1539: -- Validate the repair line ID
1540: IF NOT
1541: (Csd_Process_Util.Validate_rep_line_id(p_repair_line_id => x_estimate_line_rec.repair_line_id))
1542: THEN
1543: RAISE Fnd_Api.G_EXC_ERROR;
1544: END IF;
1545:
1546: -- Get the service request
1547: BEGIN
1554: Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_REP_LINE_ID');
1555: Fnd_Message.SET_TOKEN('REPAIR_LINE_ID',
1556: x_estimate_line_rec.repair_line_id);
1557: Fnd_Msg_Pub.ADD;
1558: RAISE Fnd_Api.G_EXC_ERROR;
1559: END;
1560:
1561: IF (g_debug > 0)
1562: THEN
1577:
1578: IF l_bus_process_id < 0
1579: THEN
1580: IF NVL(x_estimate_line_rec.business_process_id,
1581: Fnd_Api.G_MISS_NUM) <> Fnd_Api.G_MISS_NUM
1582: THEN
1583: l_bus_process_id := x_estimate_line_rec.business_process_id;
1584: ELSE
1585: IF (g_debug > 0)
1586: THEN
1587: Csd_Gen_Utility_Pvt.ADD('Business process does not exist ');
1588: END IF;
1589:
1590: RAISE Fnd_Api.G_EXC_ERROR;
1591: END IF;
1592: END IF;
1593:
1594: /* contract information passed from form
1600: csd_gen_utility_pvt.ADD('contract_line_id ='||x_estimate_line_rec.contract_id);
1601: END IF;
1602:
1603:
1604: IF NVL(x_estimate_line_rec.contract_id,FND_API.G_MISS_NUM) <> FND_API.G_MISS_NUM THEN
1605:
1606: Begin
1607: SELECT cov.actual_coverage_id ,
1608: cov.coverage_name,
1627: IF (g_debug > 0 ) THEN
1628: csd_gen_utility_pvt.ADD('Contract Line Id missing');
1629: END IF;
1630:
1631: RAISE FND_API.G_EXC_ERROR;
1632: End;
1633:
1634: x_estimate_line_rec.coverage_id := l_coverage_id;
1635: x_estimate_line_rec.coverage_txn_group_id := l_txn_group_id;
1656: THEN
1657: Fnd_Message.SET_NAME('CSD', 'CSD_API_PARTY_MISSING');
1658: Fnd_Message.SET_TOKEN('INCIDENT_ID', l_incident_id);
1659: Fnd_Msg_Pub.ADD;
1660: RAISE Fnd_Api.G_EXC_ERROR;
1661: END IF;
1662:
1663: IF order_rec%ISOPEN
1664: THEN
1701: x_line_type_id => l_line_type_id,
1702: x_line_category_code => l_line_category_code,
1703: x_return_status => x_return_status);
1704:
1705: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
1706: THEN
1707: RAISE Fnd_Api.G_EXC_ERROR;
1708: END IF;
1709:
1703: x_return_status => x_return_status);
1704:
1705: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
1706: THEN
1707: RAISE Fnd_Api.G_EXC_ERROR;
1708: END IF;
1709:
1710: IF (g_debug > 0)
1711: THEN
1732: Fnd_Message.SET_NAME('CSD', 'CSD_API_LINE_TYPE_MISSING');
1733: Fnd_Message.SET_TOKEN('TXN_BILLING_TYPE_ID',
1734: x_estimate_line_rec.txn_billing_type_id);
1735: Fnd_Msg_Pub.ADD;
1736: RAISE Fnd_Api.G_EXC_ERROR;
1737: END IF;
1738:
1739: -- Get the currency code
1740: IF NVL(x_estimate_line_rec.price_list_id, Fnd_Api.G_MISS_NUM) <>
1736: RAISE Fnd_Api.G_EXC_ERROR;
1737: END IF;
1738:
1739: -- Get the currency code
1740: IF NVL(x_estimate_line_rec.price_list_id, Fnd_Api.G_MISS_NUM) <>
1741: Fnd_Api.G_MISS_NUM
1742: THEN
1743: BEGIN
1744: SELECT currency_code
1737: END IF;
1738:
1739: -- Get the currency code
1740: IF NVL(x_estimate_line_rec.price_list_id, Fnd_Api.G_MISS_NUM) <>
1741: Fnd_Api.G_MISS_NUM
1742: THEN
1743: BEGIN
1744: SELECT currency_code
1745: INTO l_curr_code
1751: 'CSD_API_INV_PRICE_LIST_ID');
1752: Fnd_Message.SET_TOKEN('PRICE_LIST_ID',
1753: x_estimate_line_rec.price_list_id);
1754: Fnd_Msg_Pub.ADD;
1755: RAISE Fnd_Api.G_EXC_ERROR;
1756: END;
1757: END IF;
1758:
1759: IF (g_debug > 0)
1767: Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_CURR_CODE');
1768: Fnd_Message.SET_TOKEN('PRICE_LIST_ID',
1769: x_estimate_line_rec.price_list_id);
1770: Fnd_Msg_Pub.ADD;
1771: RAISE Fnd_Api.G_EXC_ERROR;
1772: END IF;
1773:
1774: --
1775: -- Commented for bug# 2857134 (forward port bugfix from 11.5.8)
1773:
1774: --
1775: -- Commented for bug# 2857134 (forward port bugfix from 11.5.8)
1776: --
1777: -- IF NVL(x_estimate_line_rec.item_cost,FND_API.G_MISS_NUM)= FND_API.G_MISS_NUM THEN
1778: --IF (g_debug > 0 ) THEN
1779: -- csd_gen_utility_pvt.ADD('Get item cost' );
1780: --END IF;
1781: --
1797: --END IF;
1798: --
1799: -- FND_MESSAGE.SET_NAME('CSD','CSD_ITEM_COST_MISSING');
1800: -- FND_MSG_PUB.ADD;
1801: -- RAISE FND_API.G_EXC_ERROR;
1802: -- END;
1803: -- END IF;
1804: --
1805: --
1828: Csd_Process_Util.CONVERT_EST_TO_CHG_REC(p_estimate_line_rec => x_estimate_line_rec,
1829: x_charges_rec => l_Charges_Rec,
1830: x_return_status => x_return_status);
1831:
1832: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
1833: THEN
1834: RAISE Fnd_Api.G_EXC_ERROR;
1835: END IF;
1836:
1830: x_return_status => x_return_status);
1831:
1832: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
1833: THEN
1834: RAISE Fnd_Api.G_EXC_ERROR;
1835: END IF;
1836:
1837: IF (g_debug > 0)
1838: THEN
1839: Csd_Gen_Utility_Pvt.ADD('Call process_estimate_lines to create charge lines ');
1840: END IF;
1841:
1842: process_estimate_lines(p_api_version => 1.0,
1843: p_commit => Fnd_Api.g_false,
1844: p_init_msg_list => Fnd_Api.g_false, -- swai 11.5.10, set to g_false
1845: p_validation_level => Fnd_Api.g_valid_level_full,
1846: p_action => 'CREATE',
1847: x_Charges_Rec => l_Charges_Rec,
1840: END IF;
1841:
1842: process_estimate_lines(p_api_version => 1.0,
1843: p_commit => Fnd_Api.g_false,
1844: p_init_msg_list => Fnd_Api.g_false, -- swai 11.5.10, set to g_false
1845: p_validation_level => Fnd_Api.g_valid_level_full,
1846: p_action => 'CREATE',
1847: x_Charges_Rec => l_Charges_Rec,
1848: x_return_status => x_return_status,
1841:
1842: process_estimate_lines(p_api_version => 1.0,
1843: p_commit => Fnd_Api.g_false,
1844: p_init_msg_list => Fnd_Api.g_false, -- swai 11.5.10, set to g_false
1845: p_validation_level => Fnd_Api.g_valid_level_full,
1846: p_action => 'CREATE',
1847: x_Charges_Rec => l_Charges_Rec,
1848: x_return_status => x_return_status,
1849: x_msg_count => x_msg_count,
1848: x_return_status => x_return_status,
1849: x_msg_count => x_msg_count,
1850: x_msg_data => x_msg_data);
1851:
1852: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
1853: THEN
1854: RAISE Fnd_Api.G_EXC_ERROR;
1855: END IF;
1856:
1850: x_msg_data => x_msg_data);
1851:
1852: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
1853: THEN
1854: RAISE Fnd_Api.G_EXC_ERROR;
1855: END IF;
1856:
1857: IF (g_debug > 0)
1858: THEN
1904:
1905: -- Api body ends here
1906:
1907: -- Standard check of p_commit.
1908: IF Fnd_Api.To_Boolean(p_commit)
1909: THEN
1910: COMMIT WORK;
1911: END IF;
1912:
1913: -- Standard call to get message count and IF count is get message info.
1914: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1915: p_data => x_msg_data);
1916: EXCEPTION
1917: WHEN Fnd_Api.G_EXC_ERROR THEN
1918: x_return_status := Fnd_Api.G_RET_STS_ERROR;
1919: ROLLBACK TO create_repair_estimate_lines;
1920: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1921: p_data => x_msg_data);
1914: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1915: p_data => x_msg_data);
1916: EXCEPTION
1917: WHEN Fnd_Api.G_EXC_ERROR THEN
1918: x_return_status := Fnd_Api.G_RET_STS_ERROR;
1919: ROLLBACK TO create_repair_estimate_lines;
1920: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1921: p_data => x_msg_data);
1922: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
1918: x_return_status := Fnd_Api.G_RET_STS_ERROR;
1919: ROLLBACK TO create_repair_estimate_lines;
1920: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1921: p_data => x_msg_data);
1922: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
1923: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1924: ROLLBACK TO create_repair_estimate_lines;
1925: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1926: p_data => x_msg_data);
1919: ROLLBACK TO create_repair_estimate_lines;
1920: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1921: p_data => x_msg_data);
1922: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
1923: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1924: ROLLBACK TO create_repair_estimate_lines;
1925: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1926: p_data => x_msg_data);
1927: WHEN OTHERS THEN
1924: ROLLBACK TO create_repair_estimate_lines;
1925: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
1926: p_data => x_msg_data);
1927: WHEN OTHERS THEN
1928: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
1929: ROLLBACK TO create_repair_estimate_lines;
1930: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
1931: THEN
1932: Fnd_Msg_Pub.Add_Exc_Msg(G_PKG_NAME, l_api_name);
1942: /* */
1943: /*--------------------------------------------------*/
1944:
1945: PROCEDURE UPDATE_REPAIR_ESTIMATE_LINES(p_api_version IN NUMBER,
1946: p_commit IN VARCHAR2 := Fnd_Api.g_false,
1947: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
1948: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
1949: x_estimate_line_rec IN OUT NOCOPY CSD_REPAIR_ESTIMATE_PVT.REPAIR_ESTIMATE_LINE_REC,
1950: x_return_status OUT NOCOPY VARCHAR2,
1943: /*--------------------------------------------------*/
1944:
1945: PROCEDURE UPDATE_REPAIR_ESTIMATE_LINES(p_api_version IN NUMBER,
1946: p_commit IN VARCHAR2 := Fnd_Api.g_false,
1947: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
1948: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
1949: x_estimate_line_rec IN OUT NOCOPY CSD_REPAIR_ESTIMATE_PVT.REPAIR_ESTIMATE_LINE_REC,
1950: x_return_status OUT NOCOPY VARCHAR2,
1951: x_msg_count OUT NOCOPY NUMBER,
1944:
1945: PROCEDURE UPDATE_REPAIR_ESTIMATE_LINES(p_api_version IN NUMBER,
1946: p_commit IN VARCHAR2 := Fnd_Api.g_false,
1947: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
1948: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
1949: x_estimate_line_rec IN OUT NOCOPY CSD_REPAIR_ESTIMATE_PVT.REPAIR_ESTIMATE_LINE_REC,
1950: x_return_status OUT NOCOPY VARCHAR2,
1951: x_msg_count OUT NOCOPY NUMBER,
1952: x_msg_data OUT NOCOPY VARCHAR2) IS
1991: -- Standard Start of API savepoint
1992: SAVEPOINT update_repair_estimate_lines;
1993:
1994: -- Standard call to check for call compatibility.
1995: IF NOT Fnd_Api.Compatible_API_Call(l_api_version,
1996: p_api_version,
1997: l_api_name,
1998: G_PKG_NAME)
1999: THEN
1996: p_api_version,
1997: l_api_name,
1998: G_PKG_NAME)
1999: THEN
2000: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
2001: END IF;
2002:
2003: -- Initialize message list if p_init_msg_list is set to TRUE.
2004: IF Fnd_Api.to_Boolean(p_init_msg_list)
2000: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
2001: END IF;
2002:
2003: -- Initialize message list if p_init_msg_list is set to TRUE.
2004: IF Fnd_Api.to_Boolean(p_init_msg_list)
2005: THEN
2006: Fnd_Msg_Pub.initialize;
2007: END IF;
2008:
2006: Fnd_Msg_Pub.initialize;
2007: END IF;
2008:
2009: -- Initialize API return status to success
2010: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
2011:
2012: -- Api body starts
2013: IF (g_debug > 0)
2014: THEN
2047: -- Validate the repair line ID
2048: IF NOT
2049: (Csd_Process_Util.Validate_estimate_line_id(p_estimate_line_id => x_estimate_line_rec.repair_estimate_line_id))
2050: THEN
2051: RAISE Fnd_Api.G_EXC_ERROR;
2052: END IF;
2053:
2054: IF NVL(x_estimate_line_rec.repair_estimate_line_id,
2055: Fnd_Api.G_MISS_NUM) <> Fnd_Api.G_MISS_NUM
2051: RAISE Fnd_Api.G_EXC_ERROR;
2052: END IF;
2053:
2054: IF NVL(x_estimate_line_rec.repair_estimate_line_id,
2055: Fnd_Api.G_MISS_NUM) <> Fnd_Api.G_MISS_NUM
2056: THEN
2057:
2058: OPEN estimate_line(x_estimate_line_rec.repair_estimate_line_id);
2059: FETCH estimate_line
2061: CLOSE estimate_line;
2062: END IF;
2063:
2064: IF NVL(x_estimate_line_rec.object_version_number,
2065: Fnd_Api.G_MISS_NUM) <> l_obj_ver_num
2066: THEN
2067: IF (g_debug > 0)
2068: THEN
2069: Csd_Gen_Utility_Pvt.ADD('object version number does not match');
2072: Fnd_Message.SET_NAME('CSD', 'CSD_OBJ_VER_MISMATCH');
2073: Fnd_Message.SET_TOKEN('REPAIR_ESTIMATE_LINE_ID',
2074: x_estimate_line_rec.repair_estimate_line_id);
2075: Fnd_Msg_Pub.ADD;
2076: RAISE Fnd_Api.G_EXC_ERROR;
2077: END IF;
2078:
2079: IF NVL(x_estimate_line_rec.estimate_detail_id, Fnd_Api.G_MISS_NUM) <>
2080: Fnd_Api.G_MISS_NUM
2075: Fnd_Msg_Pub.ADD;
2076: RAISE Fnd_Api.G_EXC_ERROR;
2077: END IF;
2078:
2079: IF NVL(x_estimate_line_rec.estimate_detail_id, Fnd_Api.G_MISS_NUM) <>
2080: Fnd_Api.G_MISS_NUM
2081: THEN
2082: IF x_estimate_line_rec.estimate_detail_id <> l_est_detail_id
2083: THEN
2076: RAISE Fnd_Api.G_EXC_ERROR;
2077: END IF;
2078:
2079: IF NVL(x_estimate_line_rec.estimate_detail_id, Fnd_Api.G_MISS_NUM) <>
2080: Fnd_Api.G_MISS_NUM
2081: THEN
2082: IF x_estimate_line_rec.estimate_detail_id <> l_est_detail_id
2083: THEN
2084: IF (g_debug > 0)
2085: THEN
2086: Csd_Gen_Utility_Pvt.ADD('The estimate detail id cannot to changed');
2087: END IF;
2088:
2089: RAISE Fnd_Api.G_EXC_ERROR;
2090: END IF;
2091: ELSE
2092: x_estimate_line_rec.estimate_detail_id := l_est_detail_id;
2093: END IF;
2091: ELSE
2092: x_estimate_line_rec.estimate_detail_id := l_est_detail_id;
2093: END IF;
2094:
2095: IF NVL(x_estimate_line_rec.repair_line_id, Fnd_Api.G_MISS_NUM) <>
2096: Fnd_Api.G_MISS_NUM
2097: THEN
2098: IF x_estimate_line_rec.repair_line_id <> l_repair_line_id
2099: THEN
2092: x_estimate_line_rec.estimate_detail_id := l_est_detail_id;
2093: END IF;
2094:
2095: IF NVL(x_estimate_line_rec.repair_line_id, Fnd_Api.G_MISS_NUM) <>
2096: Fnd_Api.G_MISS_NUM
2097: THEN
2098: IF x_estimate_line_rec.repair_line_id <> l_repair_line_id
2099: THEN
2100: IF (g_debug > 0)
2101: THEN
2102: Csd_Gen_Utility_Pvt.ADD('The repair line id cannot to changed');
2103: END IF;
2104:
2105: RAISE Fnd_Api.G_EXC_ERROR;
2106: END IF;
2107: ELSE
2108: x_estimate_line_rec.repair_line_id := l_repair_line_id;
2109: END IF;
2120: l_upd_charge_flag := 'N';
2121: END;
2122:
2123: /* contract information passed from form
2124: IF NVL(x_estimate_line_rec.contract_id,FND_API.G_MISS_NUM) <> FND_API.G_MISS_NUM THEN
2125:
2126: IF (g_debug > 0 ) THEN
2127: csd_gen_utility_pvt.ADD('Getting the Coverage and txn Group Id');
2128: END IF;
2157: IF (g_debug > 0 ) THEN
2158: csd_gen_utility_pvt.ADD('Contract Line Id missing');
2159: END IF;
2160:
2161: RAISE FND_API.G_EXC_ERROR;
2162: End;
2163:
2164: x_estimate_line_rec.coverage_id := l_coverage_id;
2165: x_estimate_line_rec.coverage_txn_group_id := l_txn_group_id;
2205: Csd_Process_Util.CONVERT_EST_TO_CHG_REC(p_estimate_line_rec => x_estimate_line_rec,
2206: x_charges_rec => l_Charges_Rec,
2207: x_return_status => x_return_status);
2208:
2209: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
2210: THEN
2211: IF (g_debug > 0)
2212: THEN
2213: Csd_Gen_Utility_Pvt.ADD('csd_process_util.convert_to_chg_rec failed');
2212: THEN
2213: Csd_Gen_Utility_Pvt.ADD('csd_process_util.convert_to_chg_rec failed');
2214: END IF;
2215:
2216: RAISE Fnd_Api.G_EXC_ERROR;
2217: END IF;
2218:
2219: l_Charges_Rec.estimate_detail_id := l_est_detail_id;
2220:
2229: l_Charges_Rec.estimate_detail_id);
2230: END IF;
2231:
2232: process_estimate_lines(p_api_version => 1.0,
2233: p_commit => Fnd_Api.g_false,
2234: p_init_msg_list => Fnd_Api.g_true,
2235: p_validation_level => Fnd_Api.g_valid_level_full,
2236: p_action => 'UPDATE',
2237: x_Charges_Rec => l_Charges_Rec,
2230: END IF;
2231:
2232: process_estimate_lines(p_api_version => 1.0,
2233: p_commit => Fnd_Api.g_false,
2234: p_init_msg_list => Fnd_Api.g_true,
2235: p_validation_level => Fnd_Api.g_valid_level_full,
2236: p_action => 'UPDATE',
2237: x_Charges_Rec => l_Charges_Rec,
2238: x_return_status => x_return_status,
2231:
2232: process_estimate_lines(p_api_version => 1.0,
2233: p_commit => Fnd_Api.g_false,
2234: p_init_msg_list => Fnd_Api.g_true,
2235: p_validation_level => Fnd_Api.g_valid_level_full,
2236: p_action => 'UPDATE',
2237: x_Charges_Rec => l_Charges_Rec,
2238: x_return_status => x_return_status,
2239: x_msg_count => x_msg_count,
2238: x_return_status => x_return_status,
2239: x_msg_count => x_msg_count,
2240: x_msg_data => x_msg_data);
2241:
2242: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
2243: THEN
2244: IF (g_debug > 0)
2245: THEN
2246: Csd_Gen_Utility_Pvt.ADD('process_estimate_lines failed ');
2245: THEN
2246: Csd_Gen_Utility_Pvt.ADD('process_estimate_lines failed ');
2247: END IF;
2248:
2249: RAISE Fnd_Api.G_EXC_ERROR;
2250: END IF;
2251:
2252: END IF; -- end of update charge line
2253:
2301:
2302: -- Api body ends here
2303:
2304: -- Standard check of p_commit.
2305: IF Fnd_Api.To_Boolean(p_commit)
2306: THEN
2307: COMMIT WORK;
2308: END IF;
2309:
2310: -- Standard call to get message count and IF count is get message info.
2311: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2312: p_data => x_msg_data);
2313: EXCEPTION
2314: WHEN Fnd_Api.G_EXC_ERROR THEN
2315: x_return_status := Fnd_Api.G_RET_STS_ERROR;
2316: ROLLBACK TO update_repair_estimate_lines;
2317: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2318: p_data => x_msg_data);
2311: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2312: p_data => x_msg_data);
2313: EXCEPTION
2314: WHEN Fnd_Api.G_EXC_ERROR THEN
2315: x_return_status := Fnd_Api.G_RET_STS_ERROR;
2316: ROLLBACK TO update_repair_estimate_lines;
2317: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2318: p_data => x_msg_data);
2319: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
2315: x_return_status := Fnd_Api.G_RET_STS_ERROR;
2316: ROLLBACK TO update_repair_estimate_lines;
2317: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2318: p_data => x_msg_data);
2319: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
2320: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
2321: ROLLBACK TO update_repair_estimate_lines;
2322: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2323: p_data => x_msg_data);
2316: ROLLBACK TO update_repair_estimate_lines;
2317: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2318: p_data => x_msg_data);
2319: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
2320: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
2321: ROLLBACK TO update_repair_estimate_lines;
2322: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2323: p_data => x_msg_data);
2324: WHEN OTHERS THEN
2321: ROLLBACK TO update_repair_estimate_lines;
2322: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2323: p_data => x_msg_data);
2324: WHEN OTHERS THEN
2325: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
2326: ROLLBACK TO update_repair_estimate_lines;
2327: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
2328: THEN
2329: Fnd_Msg_Pub.Add_Exc_Msg(G_PKG_NAME, l_api_name);
2339: /* */
2340: /*--------------------------------------------------*/
2341:
2342: PROCEDURE DELETE_REPAIR_ESTIMATE_LINES(p_api_version IN NUMBER,
2343: p_commit IN VARCHAR2 := Fnd_Api.g_false,
2344: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
2345: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
2346: p_estimate_line_id IN NUMBER,
2347: x_return_status OUT NOCOPY VARCHAR2,
2340: /*--------------------------------------------------*/
2341:
2342: PROCEDURE DELETE_REPAIR_ESTIMATE_LINES(p_api_version IN NUMBER,
2343: p_commit IN VARCHAR2 := Fnd_Api.g_false,
2344: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
2345: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
2346: p_estimate_line_id IN NUMBER,
2347: x_return_status OUT NOCOPY VARCHAR2,
2348: x_msg_count OUT NOCOPY NUMBER,
2341:
2342: PROCEDURE DELETE_REPAIR_ESTIMATE_LINES(p_api_version IN NUMBER,
2343: p_commit IN VARCHAR2 := Fnd_Api.g_false,
2344: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
2345: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
2346: p_estimate_line_id IN NUMBER,
2347: x_return_status OUT NOCOPY VARCHAR2,
2348: x_msg_count OUT NOCOPY NUMBER,
2349: x_msg_data OUT NOCOPY VARCHAR2) IS
2361: -- Standard Start of API savepoint
2362: SAVEPOINT delete_repair_estimate_lines;
2363:
2364: -- Standard call to check for call compatibility.
2365: IF NOT Fnd_Api.Compatible_API_Call(l_api_version,
2366: p_api_version,
2367: l_api_name,
2368: G_PKG_NAME)
2369: THEN
2366: p_api_version,
2367: l_api_name,
2368: G_PKG_NAME)
2369: THEN
2370: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
2371: END IF;
2372:
2373: -- Initialize message list if p_init_msg_list is set to TRUE.
2374: IF Fnd_Api.to_Boolean(p_init_msg_list)
2370: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
2371: END IF;
2372:
2373: -- Initialize message list if p_init_msg_list is set to TRUE.
2374: IF Fnd_Api.to_Boolean(p_init_msg_list)
2375: THEN
2376: Fnd_Msg_Pub.initialize;
2377: END IF;
2378:
2376: Fnd_Msg_Pub.initialize;
2377: END IF;
2378:
2379: -- Initialize API return status to success
2380: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
2381:
2382: -- Api body starts
2383: IF (g_debug > 0)
2384: THEN
2409: -- Validate the repair line ID
2410: IF NOT
2411: (Csd_Process_Util.Validate_estimate_line_id(p_estimate_line_id => p_estimate_line_id))
2412: THEN
2413: RAISE Fnd_Api.G_EXC_ERROR;
2414: END IF;
2415:
2416: IF (g_debug > 0)
2417: THEN
2439: Fnd_Message.SET_NAME('CSD', 'CSD_API_DELETE_NOT_ALLOWED');
2440: Fnd_Message.SET_TOKEN('REPAIR_ESTIMATE_LINE_ID',
2441: p_estimate_line_id);
2442: Fnd_Msg_Pub.ADD;
2443: RAISE Fnd_Api.G_EXC_ERROR;
2444: END;
2445:
2446: IF (g_debug > 0)
2447: THEN
2465: Csd_Gen_Utility_Pvt.ADD('Call process_estimate_lines to delete');
2466: END IF;
2467:
2468: process_estimate_lines(p_api_version => 1.0,
2469: p_commit => Fnd_Api.g_false,
2470: p_init_msg_list => Fnd_Api.g_true,
2471: p_validation_level => Fnd_Api.g_valid_level_full,
2472: p_action => 'DELETE',
2473: x_Charges_Rec => l_Charges_Rec,
2466: END IF;
2467:
2468: process_estimate_lines(p_api_version => 1.0,
2469: p_commit => Fnd_Api.g_false,
2470: p_init_msg_list => Fnd_Api.g_true,
2471: p_validation_level => Fnd_Api.g_valid_level_full,
2472: p_action => 'DELETE',
2473: x_Charges_Rec => l_Charges_Rec,
2474: x_return_status => x_return_status,
2467:
2468: process_estimate_lines(p_api_version => 1.0,
2469: p_commit => Fnd_Api.g_false,
2470: p_init_msg_list => Fnd_Api.g_true,
2471: p_validation_level => Fnd_Api.g_valid_level_full,
2472: p_action => 'DELETE',
2473: x_Charges_Rec => l_Charges_Rec,
2474: x_return_status => x_return_status,
2475: x_msg_count => x_msg_count,
2474: x_return_status => x_return_status,
2475: x_msg_count => x_msg_count,
2476: x_msg_data => x_msg_data);
2477:
2478: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
2479: THEN
2480: RAISE Fnd_Api.G_EXC_ERROR;
2481: END IF;
2482:
2476: x_msg_data => x_msg_data);
2477:
2478: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
2479: THEN
2480: RAISE Fnd_Api.G_EXC_ERROR;
2481: END IF;
2482:
2483: IF (g_debug > 0)
2484: THEN
2491:
2492: -- Api body ends here
2493:
2494: -- Standard check of p_commit.
2495: IF Fnd_Api.To_Boolean(p_commit)
2496: THEN
2497: COMMIT WORK;
2498: END IF;
2499:
2500: -- Standard call to get message count and IF count is get message info.
2501: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2502: p_data => x_msg_data);
2503: EXCEPTION
2504: WHEN Fnd_Api.G_EXC_ERROR THEN
2505: x_return_status := Fnd_Api.G_RET_STS_ERROR;
2506: ROLLBACK TO delete_repair_estimate_lines;
2507: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2508: p_data => x_msg_data);
2501: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2502: p_data => x_msg_data);
2503: EXCEPTION
2504: WHEN Fnd_Api.G_EXC_ERROR THEN
2505: x_return_status := Fnd_Api.G_RET_STS_ERROR;
2506: ROLLBACK TO delete_repair_estimate_lines;
2507: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2508: p_data => x_msg_data);
2509: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
2505: x_return_status := Fnd_Api.G_RET_STS_ERROR;
2506: ROLLBACK TO delete_repair_estimate_lines;
2507: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2508: p_data => x_msg_data);
2509: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
2510: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
2511: ROLLBACK TO delete_repair_estimate_lines;
2512: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2513: p_data => x_msg_data);
2506: ROLLBACK TO delete_repair_estimate_lines;
2507: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2508: p_data => x_msg_data);
2509: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
2510: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
2511: ROLLBACK TO delete_repair_estimate_lines;
2512: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2513: p_data => x_msg_data);
2514: WHEN OTHERS THEN
2511: ROLLBACK TO delete_repair_estimate_lines;
2512: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2513: p_data => x_msg_data);
2514: WHEN OTHERS THEN
2515: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
2516: ROLLBACK TO delete_repair_estimate_lines;
2517: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
2518: THEN
2519: Fnd_Msg_Pub.Add_Exc_Msg(G_PKG_NAME, l_api_name);
2528: /* repair estimate lines */
2529: /*--------------------------------------------------*/
2530:
2531: PROCEDURE LOCK_REPAIR_ESTIMATE_LINES(p_api_version IN NUMBER,
2532: p_commit IN VARCHAR2 := Fnd_Api.g_false,
2533: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
2534: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
2535: p_estimate_line_rec IN REPAIR_ESTIMATE_LINE_REC,
2536: x_return_status OUT NOCOPY VARCHAR2,
2529: /*--------------------------------------------------*/
2530:
2531: PROCEDURE LOCK_REPAIR_ESTIMATE_LINES(p_api_version IN NUMBER,
2532: p_commit IN VARCHAR2 := Fnd_Api.g_false,
2533: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
2534: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
2535: p_estimate_line_rec IN REPAIR_ESTIMATE_LINE_REC,
2536: x_return_status OUT NOCOPY VARCHAR2,
2537: x_msg_count OUT NOCOPY NUMBER,
2530:
2531: PROCEDURE LOCK_REPAIR_ESTIMATE_LINES(p_api_version IN NUMBER,
2532: p_commit IN VARCHAR2 := Fnd_Api.g_false,
2533: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
2534: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
2535: p_estimate_line_rec IN REPAIR_ESTIMATE_LINE_REC,
2536: x_return_status OUT NOCOPY VARCHAR2,
2537: x_msg_count OUT NOCOPY NUMBER,
2538: x_msg_data OUT NOCOPY VARCHAR2) IS
2547: -- Standard Start of API savepoint
2548: SAVEPOINT lock_repair_estimate_lines;
2549:
2550: -- Standard call to check for call compatibility.
2551: IF NOT Fnd_Api.Compatible_API_Call(l_api_version,
2552: p_api_version,
2553: l_api_name,
2554: G_PKG_NAME)
2555: THEN
2552: p_api_version,
2553: l_api_name,
2554: G_PKG_NAME)
2555: THEN
2556: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
2557: END IF;
2558:
2559: -- Initialize message list if p_init_msg_list is set to TRUE.
2560: IF Fnd_Api.to_Boolean(p_init_msg_list)
2556: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
2557: END IF;
2558:
2559: -- Initialize message list if p_init_msg_list is set to TRUE.
2560: IF Fnd_Api.to_Boolean(p_init_msg_list)
2561: THEN
2562: Fnd_Msg_Pub.initialize;
2563: END IF;
2564:
2562: Fnd_Msg_Pub.initialize;
2563: END IF;
2564:
2565: -- Initialize API return status to success
2566: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
2567:
2568: Csd_Repair_Estimate_Lines_Pkg.Lock_Row(p_REPAIR_ESTIMATE_LINE_ID => p_estimate_line_rec.repair_estimate_line_id,
2569: p_OBJECT_VERSION_NUMBER => p_estimate_line_rec.object_version_number);
2570:
2568: Csd_Repair_Estimate_Lines_Pkg.Lock_Row(p_REPAIR_ESTIMATE_LINE_ID => p_estimate_line_rec.repair_estimate_line_id,
2569: p_OBJECT_VERSION_NUMBER => p_estimate_line_rec.object_version_number);
2570:
2571: -- Standard check of p_commit.
2572: IF Fnd_Api.To_Boolean(p_commit)
2573: THEN
2574: COMMIT WORK;
2575: END IF;
2576:
2577: -- Standard call to get message count and IF count is get message info.
2578: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2579: p_data => x_msg_data);
2580: EXCEPTION
2581: WHEN Fnd_Api.G_EXC_ERROR THEN
2582: x_return_status := Fnd_Api.G_RET_STS_ERROR;
2583: ROLLBACK TO lock_repair_estimate_lines;
2584: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2585: p_data => x_msg_data);
2578: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2579: p_data => x_msg_data);
2580: EXCEPTION
2581: WHEN Fnd_Api.G_EXC_ERROR THEN
2582: x_return_status := Fnd_Api.G_RET_STS_ERROR;
2583: ROLLBACK TO lock_repair_estimate_lines;
2584: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2585: p_data => x_msg_data);
2586: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
2582: x_return_status := Fnd_Api.G_RET_STS_ERROR;
2583: ROLLBACK TO lock_repair_estimate_lines;
2584: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2585: p_data => x_msg_data);
2586: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
2587: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
2588: ROLLBACK TO lock_repair_estimate_lines;
2589: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2590: p_data => x_msg_data);
2583: ROLLBACK TO lock_repair_estimate_lines;
2584: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2585: p_data => x_msg_data);
2586: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
2587: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
2588: ROLLBACK TO lock_repair_estimate_lines;
2589: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2590: p_data => x_msg_data);
2591: WHEN OTHERS THEN
2588: ROLLBACK TO lock_repair_estimate_lines;
2589: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2590: p_data => x_msg_data);
2591: WHEN OTHERS THEN
2592: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
2593: ROLLBACK TO lock_repair_estimate_lines;
2594: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
2595: THEN
2596: Fnd_Msg_Pub.Add_Exc_Msg(G_PKG_NAME, l_api_name);
2599: p_data => x_msg_data);
2600: END lock_repair_estimate_lines;
2601:
2602: PROCEDURE REPAIR_ESTIMATE_PRINT(p_api_version IN NUMBER,
2603: p_commit IN VARCHAR2 := Fnd_Api.g_false,
2604: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
2605: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
2606: p_repair_line_id IN NUMBER,
2607: x_request_id OUT NOCOPY NUMBER,
2600: END lock_repair_estimate_lines;
2601:
2602: PROCEDURE REPAIR_ESTIMATE_PRINT(p_api_version IN NUMBER,
2603: p_commit IN VARCHAR2 := Fnd_Api.g_false,
2604: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
2605: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
2606: p_repair_line_id IN NUMBER,
2607: x_request_id OUT NOCOPY NUMBER,
2608: x_return_status OUT NOCOPY VARCHAR2,
2601:
2602: PROCEDURE REPAIR_ESTIMATE_PRINT(p_api_version IN NUMBER,
2603: p_commit IN VARCHAR2 := Fnd_Api.g_false,
2604: p_init_msg_list IN VARCHAR2 := Fnd_Api.g_false,
2605: p_validation_level IN NUMBER := Fnd_Api.g_valid_level_full,
2606: p_repair_line_id IN NUMBER,
2607: x_request_id OUT NOCOPY NUMBER,
2608: x_return_status OUT NOCOPY VARCHAR2,
2609: x_msg_count OUT NOCOPY NUMBER,
2638: BEGIN
2639: -- Standard Start of API savepoint
2640: SAVEPOINT estimate_print;
2641: -- Standard call to check for call compatibility.
2642: IF NOT Fnd_Api.Compatible_API_Call(l_api_version,
2643: p_api_version,
2644: l_api_name,
2645: G_PKG_NAME)
2646: THEN
2643: p_api_version,
2644: l_api_name,
2645: G_PKG_NAME)
2646: THEN
2647: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
2648: END IF;
2649: -- Initialize message list if p_init_msg_list is set to TRUE.
2650: IF Fnd_Api.to_Boolean(p_init_msg_list)
2651: THEN
2646: THEN
2647: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
2648: END IF;
2649: -- Initialize message list if p_init_msg_list is set to TRUE.
2650: IF Fnd_Api.to_Boolean(p_init_msg_list)
2651: THEN
2652: Fnd_Msg_Pub.initialize;
2653: END IF;
2654: -- Initialize API return status to success
2651: THEN
2652: Fnd_Msg_Pub.initialize;
2653: END IF;
2654: -- Initialize API return status to success
2655: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
2656: -- start of the concurrent submission
2657: l_printer_name := Fnd_Profile.value('CSD_PRINTER_NAME');
2658: IF (g_debug > 0)
2659: THEN
2718: Fnd_Message.SET_NAME('CSD', 'CSD_XDO_ESTRT_NO_TEMPLATE');
2719: Fnd_Message.SET_TOKEN('PROF_NAME', csd_repairs_util.get_user_profile_option_name('CSD_CUST_ESTRT_CON_NAME'));
2720: x_request_id := l_request_id;
2721: Fnd_Msg_Pub.ADD;
2722: RAISE Fnd_Api.G_EXC_ERROR;
2723: END IF;
2724: -- get current session language and territory
2725: OPEN get_lang_terr;
2726: FETCH get_lang_terr
2763: COMMIT;
2764: END IF;
2765: x_request_id := l_request_id;
2766: -- Standard check of p_commit.
2767: IF Fnd_Api.To_Boolean(p_commit)
2768: THEN
2769: COMMIT WORK;
2770: END IF;
2771: -- Standard call to get message count and IF count is get message info.
2771: -- Standard call to get message count and IF count is get message info.
2772: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2773: p_data => x_msg_data);
2774: EXCEPTION
2775: WHEN Fnd_Api.G_EXC_ERROR THEN
2776: x_return_status := Fnd_Api.G_RET_STS_ERROR;
2777: ROLLBACK TO estimate_print;
2778: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2779: p_data => x_msg_data);
2772: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2773: p_data => x_msg_data);
2774: EXCEPTION
2775: WHEN Fnd_Api.G_EXC_ERROR THEN
2776: x_return_status := Fnd_Api.G_RET_STS_ERROR;
2777: ROLLBACK TO estimate_print;
2778: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2779: p_data => x_msg_data);
2780: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
2776: x_return_status := Fnd_Api.G_RET_STS_ERROR;
2777: ROLLBACK TO estimate_print;
2778: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2779: p_data => x_msg_data);
2780: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
2781: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
2782: ROLLBACK TO estimate_print;
2783: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2784: p_data => x_msg_data);
2777: ROLLBACK TO estimate_print;
2778: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2779: p_data => x_msg_data);
2780: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
2781: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
2782: ROLLBACK TO estimate_print;
2783: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2784: p_data => x_msg_data);
2785: WHEN OTHERS THEN
2782: ROLLBACK TO estimate_print;
2783: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
2784: p_data => x_msg_data);
2785: WHEN OTHERS THEN
2786: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
2787: ROLLBACK TO estimate_print;
2788: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
2789: THEN
2790: Fnd_Msg_Pub.Add_Exc_Msg(G_PKG_NAME, l_api_name);
2838: -- Standard Start of API savepoint
2839: SAVEPOINT submit_estimate_lines;
2840:
2841: -- Standard call to check for call compatibility.
2842: IF NOT Fnd_Api.Compatible_API_Call(l_api_version,
2843: p_api_version,
2844: l_api_name,
2845: G_PKG_NAME)
2846: THEN
2843: p_api_version,
2844: l_api_name,
2845: G_PKG_NAME)
2846: THEN
2847: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
2848: END IF;
2849:
2850: -- Initialize message list if p_init_msg_list is set to TRUE.
2851: IF Fnd_Api.to_Boolean(p_init_msg_list)
2847: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
2848: END IF;
2849:
2850: -- Initialize message list if p_init_msg_list is set to TRUE.
2851: IF Fnd_Api.to_Boolean(p_init_msg_list)
2852: THEN
2853: Fnd_Msg_Pub.initialize;
2854: END IF;
2855:
2853: Fnd_Msg_Pub.initialize;
2854: END IF;
2855:
2856: -- Initialize API return status to success
2857: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
2858:
2859: BEGIN
2860: SELECT original_source_header_id, original_source_reference
2861: INTO l_org_src_header_id, l_org_src_ref
2865: WHEN NO_DATA_FOUND THEN
2866: Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_REP_LINE_ID');
2867: Fnd_Message.SET_TOKEN('REPAIR_LINE_ID', p_repair_line_id);
2868: Fnd_Msg_Pub.ADD;
2869: RAISE Fnd_Api.G_EXC_ERROR;
2870: END;
2871:
2872: IF l_org_src_ref = 'RMA'
2873: THEN
2960: est.purchase_order_num;
2961: EXCEPTION
2962: WHEN NO_DATA_FOUND THEN
2963: l_est_line_rec.add_to_order_flag := 'F';
2964: l_est_line_rec.order_header_id := Fnd_Api.G_MISS_NUM;
2965: WHEN TOO_MANY_ROWS THEN
2966: NULL;
2967: END;
2968: END IF;
2967: END;
2968: END IF;
2969: ELSE
2970: l_est_line_rec.add_to_order_flag := 'F';
2971: l_est_line_rec.order_header_id := Fnd_Api.G_MISS_NUM;
2972: END IF;
2973: IF (g_debug > 0)
2974: THEN
2975: Csd_Gen_Utility_Pvt.ADD('Updating estimate lines with add to order flag for estimate_detail_id = ' ||
2976: est.estimate_detail_id);
2977: END IF;
2978:
2979: Csd_Process_Pvt.PROCESS_CHARGE_LINES(p_api_version => 1.0,
2980: p_commit => Fnd_Api.g_false,
2981: p_init_msg_list => Fnd_Api.g_true,
2982: p_validation_level => Fnd_Api.g_valid_level_full,
2983: p_action => 'UPDATE',
2984: p_Charges_Rec => l_est_line_rec,
2977: END IF;
2978:
2979: Csd_Process_Pvt.PROCESS_CHARGE_LINES(p_api_version => 1.0,
2980: p_commit => Fnd_Api.g_false,
2981: p_init_msg_list => Fnd_Api.g_true,
2982: p_validation_level => Fnd_Api.g_valid_level_full,
2983: p_action => 'UPDATE',
2984: p_Charges_Rec => l_est_line_rec,
2985: x_estimate_detail_id => l_estimate_detail_id,
2978:
2979: Csd_Process_Pvt.PROCESS_CHARGE_LINES(p_api_version => 1.0,
2980: p_commit => Fnd_Api.g_false,
2981: p_init_msg_list => Fnd_Api.g_true,
2982: p_validation_level => Fnd_Api.g_valid_level_full,
2983: p_action => 'UPDATE',
2984: p_Charges_Rec => l_est_line_rec,
2985: x_estimate_detail_id => l_estimate_detail_id,
2986: x_return_status => x_return_status,
2986: x_return_status => x_return_status,
2987: x_msg_count => x_msg_count,
2988: x_msg_data => x_msg_data);
2989:
2990: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
2991: THEN
2992: RAISE Fnd_Api.G_EXC_ERROR;
2993: END IF;
2994:
2988: x_msg_data => x_msg_data);
2989:
2990: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
2991: THEN
2992: RAISE Fnd_Api.G_EXC_ERROR;
2993: END IF;
2994:
2995: END LOOP;
2996:
3004: WHEN NO_DATA_FOUND THEN
3005: Fnd_Message.SET_NAME('CSD', 'CSD_API_INV_REP_LINE_ID');
3006: Fnd_Message.SET_TOKEN('REPAIR_LINE_ID', p_repair_line_id);
3007: Fnd_Msg_Pub.ADD;
3008: RAISE Fnd_Api.G_EXC_ERROR;
3009: END;
3010:
3011: IF (g_debug > 0)
3012: THEN
3018:
3019: Cs_Charge_Create_Order_Pub.Submit_Order(p_api_version => 1.0,
3020: p_init_msg_list => 'T',
3021: p_commit => 'F',
3022: p_validation_level => Fnd_Api.g_valid_level_full,
3023: p_incident_id => l_incident_id,
3024: p_party_id => l_party_id,
3025: p_account_id => l_account_id,
3026: p_book_order_flag => 'N',
3027: x_return_status => x_return_status,
3028: x_msg_count => x_msg_count,
3029: x_msg_data => x_msg_data);
3030:
3031: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
3032: THEN
3033: RAISE Fnd_Api.G_EXC_ERROR;
3034: END IF;
3035:
3029: x_msg_data => x_msg_data);
3030:
3031: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
3032: THEN
3033: RAISE Fnd_Api.G_EXC_ERROR;
3034: END IF;
3035:
3036: BEGIN
3037: SELECT oe.order_number
3052: END IF;
3053: END;
3054:
3055: -- Standard check of p_commit.
3056: IF Fnd_Api.To_Boolean(p_commit)
3057: THEN
3058: COMMIT WORK;
3059: END IF;
3060:
3061: -- Standard call to get message count and IF count is get message info.
3062: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
3063: p_data => x_msg_data);
3064: EXCEPTION
3065: WHEN Fnd_Api.G_EXC_ERROR THEN
3066: x_return_status := Fnd_Api.G_RET_STS_ERROR;
3067: ROLLBACK TO submit_estimate_lines;
3068: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
3069: p_data => x_msg_data);
3062: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
3063: p_data => x_msg_data);
3064: EXCEPTION
3065: WHEN Fnd_Api.G_EXC_ERROR THEN
3066: x_return_status := Fnd_Api.G_RET_STS_ERROR;
3067: ROLLBACK TO submit_estimate_lines;
3068: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
3069: p_data => x_msg_data);
3070: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
3066: x_return_status := Fnd_Api.G_RET_STS_ERROR;
3067: ROLLBACK TO submit_estimate_lines;
3068: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
3069: p_data => x_msg_data);
3070: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
3071: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
3072: ROLLBACK TO submit_estimate_lines;
3073: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
3074: p_data => x_msg_data);
3067: ROLLBACK TO submit_estimate_lines;
3068: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
3069: p_data => x_msg_data);
3070: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
3071: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
3072: ROLLBACK TO submit_estimate_lines;
3073: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
3074: p_data => x_msg_data);
3075: WHEN OTHERS THEN
3072: ROLLBACK TO submit_estimate_lines;
3073: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
3074: p_data => x_msg_data);
3075: WHEN OTHERS THEN
3076: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
3077: ROLLBACK TO submit_estimate_lines;
3078: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
3079: THEN
3080: Fnd_Msg_Pub.Add_Exc_Msg(G_PKG_NAME, l_api_name);
3115: lc_mod_name || '.BEGIN',
3116: 'Entered get_total_estimated_charge');
3117: END IF;
3118:
3119: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
3120:
3121: SELECT SUM(NVL(charge, 0))
3122: INTO x_estimated_charge
3123: FROM csd_repair_estimate_lines_v
3137: 'Leaving get_total_estimated_charge');
3138: END IF;
3139: EXCEPTION
3140: WHEN NO_DATA_FOUND THEN
3141: x_return_status := Fnd_Api.G_RET_STS_ERROR;
3142: x_estimated_charge := NULL;
3143: WHEN OTHERS THEN
3144: x_return_status := Fnd_Api.G_RET_STS_ERROR;
3145: x_estimated_charge := NULL;
3140: WHEN NO_DATA_FOUND THEN
3141: x_return_status := Fnd_Api.G_RET_STS_ERROR;
3142: x_estimated_charge := NULL;
3143: WHEN OTHERS THEN
3144: x_return_status := Fnd_Api.G_RET_STS_ERROR;
3145: x_estimated_charge := NULL;
3146: END; -- PROCEDURE get_total_estimated_charge
3147:
3148: /*--------------------------------------------------*/
3152: /* button on the `Estimates' tab. */
3153: /* Creates all the estimate lines */
3154: /* for TASK or BOM. */
3155: /* */
3156: /* x_warning_flag : FND_API.G_TRUE if any non-fatal */
3157: /* errors occured. FND_API.G_FALSE */
3158: /* if everything was successful. */
3159: /* Note that this value could be */
3160: /* G_TRUE even if x_return_status */
3153: /* Creates all the estimate lines */
3154: /* for TASK or BOM. */
3155: /* */
3156: /* x_warning_flag : FND_API.G_TRUE if any non-fatal */
3157: /* errors occured. FND_API.G_FALSE */
3158: /* if everything was successful. */
3159: /* Note that this value could be */
3160: /* G_TRUE even if x_return_status */
3161: /* is G_RET_STS_SUCCESS */
3204: l_ro_sc_rec_type Csd_Ro_Service_Codes_Pvt.RO_SERVICE_CODE_REC_TYPE;
3205: l_obj_ver_number NUMBER;
3206: l_prev_ro_sc_id NUMBER;
3207: l_item_name VARCHAR2(40);
3208: l_warning_flag VARCHAR2(1) := Fnd_Api.G_FALSE;
3209:
3210: --bug#11902612
3211: l_default_po VARCHAR2(80);
3212: --bug#11902612
3233: -- Standard Start of API savepoint
3234: SAVEPOINT Autocreate_Estimate_Lines;
3235:
3236: -- Standard call to check for call compatibility.
3237: IF NOT Fnd_Api.Compatible_API_Call(lc_api_version,
3238: p_api_version,
3239: lc_api_name,
3240: G_PKG_NAME)
3241: THEN
3238: p_api_version,
3239: lc_api_name,
3240: G_PKG_NAME)
3241: THEN
3242: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
3243: END IF;
3244:
3245: -- Initialize message list if p_init_msg_list is set to TRUE.
3246: IF Fnd_Api.to_Boolean(p_init_msg_list)
3242: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
3243: END IF;
3244:
3245: -- Initialize message list if p_init_msg_list is set to TRUE.
3246: IF Fnd_Api.to_Boolean(p_init_msg_list)
3247: THEN
3248: Fnd_Msg_Pub.initialize;
3249: END IF;
3250:
3300: 'p_organization_id: ' || p_organization_id);
3301: END IF;
3302:
3303: -- Initialize API return status to success
3304: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
3305:
3306: --
3307: -- Begin API Body
3308: --
3307: -- Begin API Body
3308: --
3309:
3310: -- initialize the warning flag
3311: x_warning_flag := Fnd_Api.G_FALSE;
3312:
3313: -- Check the required parameters
3314: IF (Fnd_Log.Level_Procedure >= Fnd_Log.G_Current_Runtime_Level)
3315: THEN
3444: 'Calling CSD_GEN_ERRMSGS_PVT.purge_entity_msgs');
3445: END IF;
3446:
3447: -- initialize local return status before calling procedures
3448: l_return_status := Fnd_Api.G_RET_STS_SUCCESS;
3449:
3450: -- purge any existing messages before processing
3451: -- Module ACT (source entity ESTIMATE).
3452: Csd_Gen_Errmsgs_Pvt.purge_entity_msgs(p_api_version => 1.0,
3449:
3450: -- purge any existing messages before processing
3451: -- Module ACT (source entity ESTIMATE).
3452: Csd_Gen_Errmsgs_Pvt.purge_entity_msgs(p_api_version => 1.0,
3453: p_commit => Fnd_Api.G_TRUE,
3454: p_init_msg_list => Fnd_Api.G_FALSE,
3455: p_validation_level => Fnd_Api.G_VALID_LEVEL_FULL,
3456: p_module_code => 'EST',
3457: p_source_entity_id1 => p_repair_line_id,
3450: -- purge any existing messages before processing
3451: -- Module ACT (source entity ESTIMATE).
3452: Csd_Gen_Errmsgs_Pvt.purge_entity_msgs(p_api_version => 1.0,
3453: p_commit => Fnd_Api.G_TRUE,
3454: p_init_msg_list => Fnd_Api.G_FALSE,
3455: p_validation_level => Fnd_Api.G_VALID_LEVEL_FULL,
3456: p_module_code => 'EST',
3457: p_source_entity_id1 => p_repair_line_id,
3458: p_source_entity_type_code => NULL,
3451: -- Module ACT (source entity ESTIMATE).
3452: Csd_Gen_Errmsgs_Pvt.purge_entity_msgs(p_api_version => 1.0,
3453: p_commit => Fnd_Api.G_TRUE,
3454: p_init_msg_list => Fnd_Api.G_FALSE,
3455: p_validation_level => Fnd_Api.G_VALID_LEVEL_FULL,
3456: p_module_code => 'EST',
3457: p_source_entity_id1 => p_repair_line_id,
3458: p_source_entity_type_code => NULL,
3459: p_source_entity_id2 => NULL,
3465: Fnd_Log.STRING(Fnd_Log.Level_Procedure,
3466: lc_mod_name,
3467: 'Returned from CSD_GEN_ERRMSGS_PVT.purge_entity_msgs');
3468: END IF;
3469: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
3470: THEN
3471: RAISE Fnd_Api.G_EXC_ERROR;
3472: END IF;
3473:
3467: 'Returned from CSD_GEN_ERRMSGS_PVT.purge_entity_msgs');
3468: END IF;
3469: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
3470: THEN
3471: RAISE Fnd_Api.G_EXC_ERROR;
3472: END IF;
3473:
3474: -- Now, get info for estimate lines into l_est_lines_tbl
3475: IF p_repair_mode = 'TASK'
3481: 'Calling CSD_REPAIR_ESTIMATE_PVT.Get_Estimates_From_Task');
3482: END IF;
3483: Get_Estimates_From_Task(p_api_version => 1.0,
3484: p_commit => p_commit,
3485: p_init_msg_list => Fnd_Api.G_FALSE,
3486: p_validation_level => p_validation_level,
3487: x_return_status => l_return_status,
3488: x_msg_count => l_msg_count,
3489: x_msg_data => l_msg_data,
3515: 'Calling CSD_REPAIR_ESTIMATE_PVT.Get_Estimates_From_BOM');
3516: END IF;
3517: Get_Estimates_From_BOM(p_api_version => 1.0,
3518: p_commit => p_commit,
3519: p_init_msg_list => Fnd_Api.G_FALSE,
3520: p_validation_level => p_validation_level,
3521: x_return_status => l_return_status,
3522: x_msg_count => l_msg_count,
3523: x_msg_data => l_msg_data,
3550: RAISE CSD_EST_INAPPL_MODE;
3551: END IF;
3552:
3553: -- Loop through the estimates table of records and insert into Estimate lines and Charge lines.
3554: IF NOT (l_return_status = Fnd_Api.G_RET_STS_SUCCESS)
3555: THEN
3556: RAISE Fnd_Api.G_EXC_ERROR;
3557: ELSE
3558: -- if any warnings were raised already, then save them
3552:
3553: -- Loop through the estimates table of records and insert into Estimate lines and Charge lines.
3554: IF NOT (l_return_status = Fnd_Api.G_RET_STS_SUCCESS)
3555: THEN
3556: RAISE Fnd_Api.G_EXC_ERROR;
3557: ELSE
3558: -- if any warnings were raised already, then save them
3559: -- before attempting to create estimate lines
3560: IF (l_warning_flag = Fnd_Api.G_TRUE)
3556: RAISE Fnd_Api.G_EXC_ERROR;
3557: ELSE
3558: -- if any warnings were raised already, then save them
3559: -- before attempting to create estimate lines
3560: IF (l_warning_flag = Fnd_Api.G_TRUE)
3561: THEN
3562: x_warning_flag := l_warning_flag;
3563: IF (Fnd_Log.Level_Procedure >=
3564: Fnd_Log.G_Current_Runtime_Level)
3571: 'Number of messages in stack: ' ||
3572: Fnd_Msg_Pub.count_msg);
3573: END IF;
3574: Csd_Gen_Errmsgs_Pvt.Save_Fnd_Msgs(p_api_version => 1.0,
3575: p_commit => Fnd_Api.G_FALSE,
3576: p_init_msg_list => Fnd_Api.G_FALSE,
3577: p_validation_level => 0,
3578: p_module_code => 'EST',
3579: p_source_entity_id1 => p_repair_line_id,
3572: Fnd_Msg_Pub.count_msg);
3573: END IF;
3574: Csd_Gen_Errmsgs_Pvt.Save_Fnd_Msgs(p_api_version => 1.0,
3575: p_commit => Fnd_Api.G_FALSE,
3576: p_init_msg_list => Fnd_Api.G_FALSE,
3577: p_validation_level => 0,
3578: p_module_code => 'EST',
3579: p_source_entity_id1 => p_repair_line_id,
3580: p_source_entity_type_code => 'ESTIMATE',
3581: p_source_entity_id2 => p_estimate_id,
3582: x_return_status => l_return_status,
3583: x_msg_count => l_msg_count,
3584: x_msg_data => l_msg_data);
3585: IF NOT (l_return_status = Fnd_Api.G_RET_STS_SUCCESS)
3586: THEN
3587: RAISE Fnd_Api.G_EXC_ERROR;
3588: END IF;
3589: IF (Fnd_Log.Level_Procedure >=
3583: x_msg_count => l_msg_count,
3584: x_msg_data => l_msg_data);
3585: IF NOT (l_return_status = Fnd_Api.G_RET_STS_SUCCESS)
3586: THEN
3587: RAISE Fnd_Api.G_EXC_ERROR;
3588: END IF;
3589: IF (Fnd_Log.Level_Procedure >=
3590: Fnd_Log.G_Current_Runtime_Level)
3591: THEN
3627: l_est_lines_tbl(i).purchase_order_num := l_default_po;
3628: --bug#11902612
3629:
3630: create_repair_estimate_lines(p_api_version => 1.0,
3631: p_commit => Fnd_Api.G_FALSE,
3632: p_init_msg_list => Fnd_Api.G_FALSE,
3633: p_validation_level => 0,
3634: x_estimate_line_rec => l_est_lines_tbl(i),
3635: x_estimate_line_id => l_estimate_line_id, -- throw away
3628: --bug#11902612
3629:
3630: create_repair_estimate_lines(p_api_version => 1.0,
3631: p_commit => Fnd_Api.G_FALSE,
3632: p_init_msg_list => Fnd_Api.G_FALSE,
3633: p_validation_level => 0,
3634: x_estimate_line_rec => l_est_lines_tbl(i),
3635: x_estimate_line_id => l_estimate_line_id, -- throw away
3636: x_return_status => l_return_status,
3636: x_return_status => l_return_status,
3637: x_msg_count => l_msg_count,
3638: x_msg_data => l_msg_data);
3639: EXCEPTION
3640: WHEN Fnd_Api.G_EXC_ERROR THEN
3641: l_return_status := Fnd_Api.G_RET_STS_ERROR;
3642: WHEN OTHERS THEN
3643: l_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
3644: END;
3637: x_msg_count => l_msg_count,
3638: x_msg_data => l_msg_data);
3639: EXCEPTION
3640: WHEN Fnd_Api.G_EXC_ERROR THEN
3641: l_return_status := Fnd_Api.G_RET_STS_ERROR;
3642: WHEN OTHERS THEN
3643: l_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
3644: END;
3645:
3639: EXCEPTION
3640: WHEN Fnd_Api.G_EXC_ERROR THEN
3641: l_return_status := Fnd_Api.G_RET_STS_ERROR;
3642: WHEN OTHERS THEN
3643: l_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
3644: END;
3645:
3646: IF (Fnd_Log.Level_Statement >=
3647: Fnd_Log.G_Current_Runtime_Level)
3657:
3658: -- If SC have been applied to create estimate lines successfully,
3659: -- make sure to update CSD_RO_SERVICE_CODES table with the value `Y' for the
3660: -- column that indicates `applied to estimates'.
3661: IF (l_return_status = Fnd_Api.G_RET_STS_SUCCESS)
3662: THEN
3663: -- if previous ro_sc_id is same as current, no need to update
3664: -- ro_service_code id, since it should have been done already
3665: IF (NVL(l_prev_ro_sc_id, -999) <>
3697: lc_mod_name,
3698: 'Calling CSD_RO_SERVICE_CODES_PVT.Update_RO_Service_Code');
3699: END IF;
3700: Csd_Ro_Service_Codes_Pvt.Update_RO_Service_Code(p_api_version => 1.0,
3701: p_commit => Fnd_Api.G_FALSE,
3702: p_init_msg_list => Fnd_Api.G_FALSE,
3703: p_validation_level => 0,
3704: p_ro_service_code_rec => l_ro_sc_rec_type,
3705: x_obj_ver_number => l_obj_ver_number,
3698: 'Calling CSD_RO_SERVICE_CODES_PVT.Update_RO_Service_Code');
3699: END IF;
3700: Csd_Ro_Service_Codes_Pvt.Update_RO_Service_Code(p_api_version => 1.0,
3701: p_commit => Fnd_Api.G_FALSE,
3702: p_init_msg_list => Fnd_Api.G_FALSE,
3703: p_validation_level => 0,
3704: p_ro_service_code_rec => l_ro_sc_rec_type,
3705: x_obj_ver_number => l_obj_ver_number,
3706: x_return_status => l_return_status,
3706: x_return_status => l_return_status,
3707: x_msg_count => l_msg_count,
3708: x_msg_data => l_msg_data);
3709:
3710: IF (l_return_status = Fnd_Api.G_RET_STS_SUCCESS)
3711: THEN
3712: l_prev_ro_sc_id := l_est_lines_tbl(i)
3713: .RO_SERVICE_CODE_ID;
3714: ELSE
3712: l_prev_ro_sc_id := l_est_lines_tbl(i)
3713: .RO_SERVICE_CODE_ID;
3714: ELSE
3715: -- not able to update csd_ro_service_codes table to set as applied to est
3716: x_warning_flag := Fnd_Api.G_TRUE;
3717: IF (Fnd_Log.Level_Statement >=
3718: Fnd_Log.G_Current_Runtime_Level)
3719: THEN
3720: Fnd_Log.STRING(Fnd_Log.Level_Statement,
3735: 'Number of messages in stack: ' ||
3736: Fnd_Msg_Pub.count_msg);
3737: END IF;
3738: Csd_Gen_Errmsgs_Pvt.Save_Fnd_Msgs(p_api_version => 1.0,
3739: p_commit => Fnd_Api.G_FALSE,
3740: p_init_msg_list => Fnd_Api.G_FALSE,
3741: p_validation_level => 0,
3742: p_module_code => 'EST',
3743: p_source_entity_id1 => p_repair_line_id,
3736: Fnd_Msg_Pub.count_msg);
3737: END IF;
3738: Csd_Gen_Errmsgs_Pvt.Save_Fnd_Msgs(p_api_version => 1.0,
3739: p_commit => Fnd_Api.G_FALSE,
3740: p_init_msg_list => Fnd_Api.G_FALSE,
3741: p_validation_level => 0,
3742: p_module_code => 'EST',
3743: p_source_entity_id1 => p_repair_line_id,
3744: p_source_entity_type_code => l_est_lines_tbl(i)
3748: x_return_status => l_return_status,
3749: x_msg_count => l_msg_count,
3750: x_msg_data => l_msg_data);
3751: IF NOT
3752: (l_return_status = Fnd_Api.G_RET_STS_SUCCESS)
3753: THEN
3754: RAISE Fnd_Api.G_EXC_ERROR;
3755: END IF;
3756: IF (Fnd_Log.Level_Procedure >=
3750: x_msg_data => l_msg_data);
3751: IF NOT
3752: (l_return_status = Fnd_Api.G_RET_STS_SUCCESS)
3753: THEN
3754: RAISE Fnd_Api.G_EXC_ERROR;
3755: END IF;
3756: IF (Fnd_Log.Level_Procedure >=
3757: Fnd_Log.G_Current_Runtime_Level)
3758: THEN
3776: lc_mod_name,
3777: 'Unable to create repair estimate line for index ' || i);
3778: END IF;
3779:
3780: x_warning_flag := Fnd_Api.G_TRUE;
3781: BEGIN
3782: SELECT concatenated_segments
3783: INTO l_item_name
3784: FROM mtl_system_items_kfv
3816: 'Number of messages in stack: ' ||
3817: Fnd_Msg_Pub.count_msg);
3818: END IF;
3819: Csd_Gen_Errmsgs_Pvt.Save_Fnd_Msgs(p_api_version => 1.0,
3820: p_commit => Fnd_Api.G_FALSE,
3821: p_init_msg_list => Fnd_Api.G_FALSE,
3822: p_validation_level => 0,
3823: p_module_code => 'EST',
3824: p_source_entity_id1 => p_repair_line_id,
3817: Fnd_Msg_Pub.count_msg);
3818: END IF;
3819: Csd_Gen_Errmsgs_Pvt.Save_Fnd_Msgs(p_api_version => 1.0,
3820: p_commit => Fnd_Api.G_FALSE,
3821: p_init_msg_list => Fnd_Api.G_FALSE,
3822: p_validation_level => 0,
3823: p_module_code => 'EST',
3824: p_source_entity_id1 => p_repair_line_id,
3825: p_source_entity_type_code => l_est_lines_tbl(i)
3828: .est_line_source_id1,
3829: x_return_status => l_return_status,
3830: x_msg_count => l_msg_count,
3831: x_msg_data => l_msg_data);
3832: IF NOT (l_return_status = Fnd_Api.G_RET_STS_SUCCESS)
3833: THEN
3834: RAISE Fnd_Api.G_EXC_ERROR;
3835: END IF;
3836: IF (Fnd_Log.Level_Procedure >=
3830: x_msg_count => l_msg_count,
3831: x_msg_data => l_msg_data);
3832: IF NOT (l_return_status = Fnd_Api.G_RET_STS_SUCCESS)
3833: THEN
3834: RAISE Fnd_Api.G_EXC_ERROR;
3835: END IF;
3836: IF (Fnd_Log.Level_Procedure >=
3837: Fnd_Log.G_Current_Runtime_Level)
3838: THEN
3852: -- End API Body
3853: --
3854:
3855: -- Standard check of p_commit.
3856: IF Fnd_Api.To_Boolean(p_commit)
3857: THEN
3858: COMMIT WORK;
3859: END IF;
3860:
3879: EXCEPTION
3880: WHEN CSD_EST_SC_NO_APPL THEN
3881: ROLLBACK TO Autocreate_Estimate_Lines;
3882: -- No service codes found to apply
3883: x_return_status := Fnd_Api.G_RET_STS_ERROR;
3884: x_warning_flag := Fnd_Api.G_FALSE;
3885:
3886: -- save message in fnd stack
3887: IF (Fnd_Log.Level_Statement >= Fnd_Log.G_Current_Runtime_Level)
3880: WHEN CSD_EST_SC_NO_APPL THEN
3881: ROLLBACK TO Autocreate_Estimate_Lines;
3882: -- No service codes found to apply
3883: x_return_status := Fnd_Api.G_RET_STS_ERROR;
3884: x_warning_flag := Fnd_Api.G_FALSE;
3885:
3886: -- save message in fnd stack
3887: IF (Fnd_Log.Level_Statement >= Fnd_Log.G_Current_Runtime_Level)
3888: THEN
3904: END IF;
3905: WHEN CSD_EST_DEF_PL THEN
3906: -- Unable to determine default pricelist
3907: ROLLBACK TO Autocreate_Estimate_Lines;
3908: x_return_status := Fnd_Api.G_RET_STS_ERROR;
3909: x_warning_flag := Fnd_Api.G_FALSE;
3910:
3911: -- save message in fnd stack
3912: IF (Fnd_Log.Level_Statement >= Fnd_Log.G_Current_Runtime_Level)
3905: WHEN CSD_EST_DEF_PL THEN
3906: -- Unable to determine default pricelist
3907: ROLLBACK TO Autocreate_Estimate_Lines;
3908: x_return_status := Fnd_Api.G_RET_STS_ERROR;
3909: x_warning_flag := Fnd_Api.G_FALSE;
3910:
3911: -- save message in fnd stack
3912: IF (Fnd_Log.Level_Statement >= Fnd_Log.G_Current_Runtime_Level)
3913: THEN
3930:
3931: WHEN CSD_EST_INAPPL_MODE THEN
3932: -- cannot apply service code for repair mode
3933: ROLLBACK TO Autocreate_Estimate_Lines;
3934: x_return_status := Fnd_Api.G_RET_STS_ERROR;
3935: x_warning_flag := Fnd_Api.G_FALSE;
3936:
3937: -- save message in fnd stack
3938: IF (Fnd_Log.Level_Statement >= Fnd_Log.G_Current_Runtime_Level)
3931: WHEN CSD_EST_INAPPL_MODE THEN
3932: -- cannot apply service code for repair mode
3933: ROLLBACK TO Autocreate_Estimate_Lines;
3934: x_return_status := Fnd_Api.G_RET_STS_ERROR;
3935: x_warning_flag := Fnd_Api.G_FALSE;
3936:
3937: -- save message in fnd stack
3938: IF (Fnd_Log.Level_Statement >= Fnd_Log.G_Current_Runtime_Level)
3939: THEN
3965: Fnd_Log.STRING(Fnd_Log.Level_Exception,
3966: lc_mod_name,
3967: 'Cannot apply service code for repair mode');
3968: END IF;
3969: WHEN Fnd_Api.G_EXC_ERROR THEN
3970: ROLLBACK TO Autocreate_Estimate_Lines;
3971: x_return_status := Fnd_Api.G_RET_STS_ERROR;
3972:
3973: /*
3967: 'Cannot apply service code for repair mode');
3968: END IF;
3969: WHEN Fnd_Api.G_EXC_ERROR THEN
3970: ROLLBACK TO Autocreate_Estimate_Lines;
3971: x_return_status := Fnd_Api.G_RET_STS_ERROR;
3972:
3973: /*
3974: -- TO DO: Add seeded err message
3975: -- save message in fnd stack
3990: Fnd_Log.STRING(Fnd_Log.Level_Exception,
3991: lc_mod_name,
3992: 'EXC_ERROR[' || x_msg_data || ']');
3993: END IF;
3994: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
3995: ROLLBACK TO Autocreate_Estimate_Lines;
3996: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
3997:
3998: -- save message in fnd stack
3992: 'EXC_ERROR[' || x_msg_data || ']');
3993: END IF;
3994: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
3995: ROLLBACK TO Autocreate_Estimate_Lines;
3996: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
3997:
3998: -- save message in fnd stack
3999: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
4000: THEN
4018: 'EXC_UNEXPECTED_ERROR[' || x_msg_data || ']');
4019: END IF;
4020: WHEN OTHERS THEN
4021: ROLLBACK TO Autocreate_Estimate_Lines;
4022: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
4023:
4024: -- save message in fnd stack
4025: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
4026: THEN
4052: /* description : Fetches ML lines for the tasks */
4053: /* associated via Service Codes and */
4054: /* (optionally) Solution. */
4055: /* */
4056: /* x_warning_flag : FND_API.G_TRUE if any non-fatal */
4057: /* errors occured. FND_API.G_FALSE */
4058: /* if everything was successful. */
4059: /* Note that this value could be */
4060: /* G_TRUE even if x_return_status */
4053: /* associated via Service Codes and */
4054: /* (optionally) Solution. */
4055: /* */
4056: /* x_warning_flag : FND_API.G_TRUE if any non-fatal */
4057: /* errors occured. FND_API.G_FALSE */
4058: /* if everything was successful. */
4059: /* Note that this value could be */
4060: /* G_TRUE even if x_return_status */
4061: /* is G_RET_STS_SUCCESS */
4645: -- Standard Start of API savepoint
4646: SAVEPOINT Get_Estimates_From_Task;
4647:
4648: -- Standard call to check for call compatibility.
4649: IF NOT Fnd_Api.Compatible_API_Call(lc_api_version,
4650: p_api_version,
4651: lc_api_name,
4652: G_PKG_NAME)
4653: THEN
4650: p_api_version,
4651: lc_api_name,
4652: G_PKG_NAME)
4653: THEN
4654: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
4655: END IF;
4656:
4657: -- Initialize message list if p_init_msg_list is set to TRUE.
4658: IF Fnd_Api.to_Boolean(p_init_msg_list)
4654: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
4655: END IF;
4656:
4657: -- Initialize message list if p_init_msg_list is set to TRUE.
4658: IF Fnd_Api.to_Boolean(p_init_msg_list)
4659: THEN
4660: Fnd_Msg_Pub.initialize;
4661: END IF;
4662:
4660: Fnd_Msg_Pub.initialize;
4661: END IF;
4662:
4663: -- Initialize API return status to success
4664: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
4665:
4666: -- initialize the warning flag
4667: x_warning_flag := Fnd_Api.G_FALSE;
4668:
4663: -- Initialize API return status to success
4664: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
4665:
4666: -- initialize the warning flag
4667: x_warning_flag := Fnd_Api.G_FALSE;
4668:
4669: --
4670: -- Begin API Body
4671: --
4806: -- bugfix 3543135, vkjain.
4807: l_No_Eligible_Lines := FALSE;
4808:
4809: Convert_To_Est_Lines(p_api_version => 1.0,
4810: p_commit => Fnd_Api.G_FALSE,
4811: p_init_msg_list => Fnd_Api.G_FALSE,
4812: p_validation_level => p_validation_level,
4813: x_return_status => x_return_status,
4814: x_msg_count => x_msg_count,
4807: l_No_Eligible_Lines := FALSE;
4808:
4809: Convert_To_Est_Lines(p_api_version => 1.0,
4810: p_commit => Fnd_Api.G_FALSE,
4811: p_init_msg_list => Fnd_Api.G_FALSE,
4812: p_validation_level => p_validation_level,
4813: x_return_status => x_return_status,
4814: x_msg_count => x_msg_count,
4815: x_msg_data => x_msg_data,
4824: p_contract_line_id => p_contract_line_id,
4825: p_MLE_lines_tbl => l_materials_from_sc_tbl,
4826: x_est_lines_tbl => x_est_lines_tbl,
4827: x_warning_flag => l_warning_flag);
4828: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
4829: THEN
4830: x_warning_flag := Fnd_Api.G_TRUE;
4831: END IF;
4832: IF l_warning_flag <> Fnd_Api.G_FALSE
4826: x_est_lines_tbl => x_est_lines_tbl,
4827: x_warning_flag => l_warning_flag);
4828: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
4829: THEN
4830: x_warning_flag := Fnd_Api.G_TRUE;
4831: END IF;
4832: IF l_warning_flag <> Fnd_Api.G_FALSE
4833: THEN
4834: x_warning_flag := l_warning_flag;
4828: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
4829: THEN
4830: x_warning_flag := Fnd_Api.G_TRUE;
4831: END IF;
4832: IF l_warning_flag <> Fnd_Api.G_FALSE
4833: THEN
4834: x_warning_flag := l_warning_flag;
4835: END IF;
4836: END IF;
4883: -- bugfix 3543135, vkjain.
4884: l_No_Eligible_Lines := FALSE;
4885:
4886: Convert_To_Est_Lines(p_api_version => 1.0,
4887: p_commit => Fnd_Api.G_FALSE,
4888: p_init_msg_list => Fnd_Api.G_FALSE,
4889: p_validation_level => p_validation_level,
4890: x_return_status => x_return_status,
4891: x_msg_count => x_msg_count,
4884: l_No_Eligible_Lines := FALSE;
4885:
4886: Convert_To_Est_Lines(p_api_version => 1.0,
4887: p_commit => Fnd_Api.G_FALSE,
4888: p_init_msg_list => Fnd_Api.G_FALSE,
4889: p_validation_level => p_validation_level,
4890: x_return_status => x_return_status,
4891: x_msg_count => x_msg_count,
4892: x_msg_data => x_msg_data,
4901: p_contract_line_id => p_contract_line_id,
4902: p_MLE_lines_tbl => l_labor_from_sc_tbl,
4903: x_est_lines_tbl => x_est_lines_tbl,
4904: x_warning_flag => l_warning_flag);
4905: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
4906: THEN
4907: x_warning_flag := Fnd_Api.G_TRUE;
4908: END IF;
4909: IF l_warning_flag <> Fnd_Api.G_FALSE
4903: x_est_lines_tbl => x_est_lines_tbl,
4904: x_warning_flag => l_warning_flag);
4905: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
4906: THEN
4907: x_warning_flag := Fnd_Api.G_TRUE;
4908: END IF;
4909: IF l_warning_flag <> Fnd_Api.G_FALSE
4910: THEN
4911: x_warning_flag := l_warning_flag;
4905: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
4906: THEN
4907: x_warning_flag := Fnd_Api.G_TRUE;
4908: END IF;
4909: IF l_warning_flag <> Fnd_Api.G_FALSE
4910: THEN
4911: x_warning_flag := l_warning_flag;
4912: END IF;
4913: END IF;
4936: 'Getting all solution tasks with no product template');
4937: END IF;
4938: FOR r1 IN c_sol_tasks_no_prod(p_repair_line_id)
4939: LOOP
4940: x_warning_flag := Fnd_Api.G_TRUE;
4941: IF (Fnd_Log.Level_Statement >=
4942: Fnd_Log.G_Current_Runtime_Level)
4943: THEN
4944: Fnd_Log.STRING(Fnd_Log.Level_Statement,
4964: 'Number of messages in stack: ' ||
4965: Fnd_Msg_Pub.count_msg);
4966: END IF;
4967: Csd_Gen_Errmsgs_Pvt.Save_Fnd_Msgs(p_api_version => 1.0,
4968: p_commit => Fnd_Api.G_FALSE,
4969: p_init_msg_list => Fnd_Api.G_FALSE,
4970: p_validation_level => 0,
4971: p_module_code => 'EST',
4972: p_source_entity_id1 => p_repair_line_id,
4965: Fnd_Msg_Pub.count_msg);
4966: END IF;
4967: Csd_Gen_Errmsgs_Pvt.Save_Fnd_Msgs(p_api_version => 1.0,
4968: p_commit => Fnd_Api.G_FALSE,
4969: p_init_msg_list => Fnd_Api.G_FALSE,
4970: p_validation_level => 0,
4971: p_module_code => 'EST',
4972: p_source_entity_id1 => p_repair_line_id,
4973: p_source_entity_type_code => 'SOLUTION',
4974: p_source_entity_id2 => r1.solution_id,
4975: x_return_status => l_return_status,
4976: x_msg_count => l_msg_count,
4977: x_msg_data => l_msg_data);
4978: IF NOT (l_return_status = Fnd_Api.G_RET_STS_SUCCESS)
4979: THEN
4980: RAISE Fnd_Api.G_EXC_ERROR;
4981: END IF;
4982: IF (Fnd_Log.Level_Procedure >=
4976: x_msg_count => l_msg_count,
4977: x_msg_data => l_msg_data);
4978: IF NOT (l_return_status = Fnd_Api.G_RET_STS_SUCCESS)
4979: THEN
4980: RAISE Fnd_Api.G_EXC_ERROR;
4981: END IF;
4982: IF (Fnd_Log.Level_Procedure >=
4983: Fnd_Log.G_Current_Runtime_Level)
4984: THEN
5050: -- bugfix 3543135, vkjain.
5051: l_No_Eligible_Lines := FALSE;
5052:
5053: Convert_To_Est_Lines(p_api_version => 1.0,
5054: p_commit => Fnd_Api.G_FALSE,
5055: p_init_msg_list => Fnd_Api.G_FALSE,
5056: p_validation_level => p_validation_level,
5057: x_return_status => x_return_status,
5058: x_msg_count => x_msg_count,
5051: l_No_Eligible_Lines := FALSE;
5052:
5053: Convert_To_Est_Lines(p_api_version => 1.0,
5054: p_commit => Fnd_Api.G_FALSE,
5055: p_init_msg_list => Fnd_Api.G_FALSE,
5056: p_validation_level => p_validation_level,
5057: x_return_status => x_return_status,
5058: x_msg_count => x_msg_count,
5059: x_msg_data => x_msg_data,
5068: p_contract_line_id => p_contract_line_id,
5069: p_MLE_lines_tbl => l_materials_from_sol_tbl,
5070: x_est_lines_tbl => x_est_lines_tbl,
5071: x_warning_flag => l_warning_flag);
5072: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
5073: THEN
5074: x_warning_flag := Fnd_Api.G_TRUE;
5075: END IF;
5076: IF l_warning_flag <> Fnd_Api.G_FALSE
5070: x_est_lines_tbl => x_est_lines_tbl,
5071: x_warning_flag => l_warning_flag);
5072: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
5073: THEN
5074: x_warning_flag := Fnd_Api.G_TRUE;
5075: END IF;
5076: IF l_warning_flag <> Fnd_Api.G_FALSE
5077: THEN
5078: x_warning_flag := l_warning_flag;
5072: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
5073: THEN
5074: x_warning_flag := Fnd_Api.G_TRUE;
5075: END IF;
5076: IF l_warning_flag <> Fnd_Api.G_FALSE
5077: THEN
5078: x_warning_flag := l_warning_flag;
5079: END IF;
5080: END IF;
5133: -- bugfix 3543135, vkjain.
5134: l_No_Eligible_Lines := FALSE;
5135:
5136: Convert_To_Est_Lines(p_api_version => 1.0,
5137: p_commit => Fnd_Api.G_FALSE,
5138: p_init_msg_list => Fnd_Api.G_FALSE,
5139: p_validation_level => p_validation_level,
5140: x_return_status => x_return_status,
5141: x_msg_count => x_msg_count,
5134: l_No_Eligible_Lines := FALSE;
5135:
5136: Convert_To_Est_Lines(p_api_version => 1.0,
5137: p_commit => Fnd_Api.G_FALSE,
5138: p_init_msg_list => Fnd_Api.G_FALSE,
5139: p_validation_level => p_validation_level,
5140: x_return_status => x_return_status,
5141: x_msg_count => x_msg_count,
5142: x_msg_data => x_msg_data,
5151: p_contract_line_id => p_contract_line_id,
5152: p_MLE_lines_tbl => l_labor_from_sol_tbl,
5153: x_est_lines_tbl => x_est_lines_tbl,
5154: x_warning_flag => l_warning_flag);
5155: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
5156: THEN
5157: x_warning_flag := Fnd_Api.G_TRUE;
5158: END IF;
5159: IF l_warning_flag <> Fnd_Api.G_FALSE
5153: x_est_lines_tbl => x_est_lines_tbl,
5154: x_warning_flag => l_warning_flag);
5155: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
5156: THEN
5157: x_warning_flag := Fnd_Api.G_TRUE;
5158: END IF;
5159: IF l_warning_flag <> Fnd_Api.G_FALSE
5160: THEN
5161: x_warning_flag := l_warning_flag;
5155: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
5156: THEN
5157: x_warning_flag := Fnd_Api.G_TRUE;
5158: END IF;
5159: IF l_warning_flag <> Fnd_Api.G_FALSE
5160: THEN
5161: x_warning_flag := l_warning_flag;
5162: END IF;
5163: END IF;
5192: -- End API Body
5193: --
5194:
5195: -- Standard check of p_commit.
5196: IF Fnd_Api.To_Boolean(p_commit)
5197: THEN
5198: COMMIT WORK;
5199: END IF;
5200:
5202: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
5203: p_data => x_msg_data);
5204: EXCEPTION
5205: WHEN CSD_EST_NO_AUTOGEN THEN
5206: x_warning_flag := Fnd_Api.G_TRUE;
5207:
5208: -- save message in fnd stack
5209: IF (Fnd_Log.Level_Statement >= Fnd_Log.G_Current_Runtime_Level)
5210: THEN
5224: lc_mod_name,
5225: 'No estimate lines autogenerated');
5226: END IF;
5227:
5228: WHEN Fnd_Api.G_EXC_ERROR THEN
5229: ROLLBACK TO Get_Estimates_From_Task;
5230: x_return_status := Fnd_Api.G_RET_STS_ERROR;
5231:
5232: /*
5226: END IF;
5227:
5228: WHEN Fnd_Api.G_EXC_ERROR THEN
5229: ROLLBACK TO Get_Estimates_From_Task;
5230: x_return_status := Fnd_Api.G_RET_STS_ERROR;
5231:
5232: /*
5233: -- TO DO: Add seeded err message
5234: -- save message in fnd stack
5250: lc_mod_name,
5251: 'EXC_ERROR[' || x_msg_data || ']');
5252: END IF;
5253:
5254: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
5255: ROLLBACK TO Get_Estimates_From_Task;
5256: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
5257:
5258: -- save message in fnd stack
5252: END IF;
5253:
5254: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
5255: ROLLBACK TO Get_Estimates_From_Task;
5256: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
5257:
5258: -- save message in fnd stack
5259: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
5260: THEN
5279: END IF;
5280:
5281: WHEN OTHERS THEN
5282: ROLLBACK TO Get_Estimates_From_Task;
5283: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
5284:
5285: -- save message in fnd stack
5286: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
5287: THEN
5312: /* description : Fetches ML lines for the */
5313: /* BOM/Route references associated */
5314: /* via Service Codes. */
5315: /* */
5316: /* x_warning_flag : FND_API.G_TRUE if any non-fatal */
5317: /* errors occured. FND_API.G_FALSE */
5318: /* if everything was successful. */
5319: /* Note that this value could be */
5320: /* G_TRUE even if x_return_status */
5313: /* BOM/Route references associated */
5314: /* via Service Codes. */
5315: /* */
5316: /* x_warning_flag : FND_API.G_TRUE if any non-fatal */
5317: /* errors occured. FND_API.G_FALSE */
5318: /* if everything was successful. */
5319: /* Note that this value could be */
5320: /* G_TRUE even if x_return_status */
5321: /* is G_RET_STS_SUCCESS */
5590: -- Standard Start of API savepoint
5591: SAVEPOINT Get_Estimates_From_BOM;
5592:
5593: -- Standard call to check for call compatibility.
5594: IF NOT Fnd_Api.Compatible_API_Call(lc_api_version,
5595: p_api_version,
5596: lc_api_name,
5597: G_PKG_NAME)
5598: THEN
5595: p_api_version,
5596: lc_api_name,
5597: G_PKG_NAME)
5598: THEN
5599: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
5600: END IF;
5601:
5602: -- Initialize message list if p_init_msg_list is set to TRUE.
5603: IF Fnd_Api.to_Boolean(p_init_msg_list)
5599: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
5600: END IF;
5601:
5602: -- Initialize message list if p_init_msg_list is set to TRUE.
5603: IF Fnd_Api.to_Boolean(p_init_msg_list)
5604: THEN
5605: Fnd_Msg_Pub.initialize;
5606: END IF;
5607:
5662: 'p_contract_line_id: ' || p_contract_line_id);
5663: END IF;
5664:
5665: -- Initialize API return status to success
5666: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
5667:
5668: -- initialize the warning flag
5669: x_warning_flag := Fnd_Api.G_FALSE;
5670:
5665: -- Initialize API return status to success
5666: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
5667:
5668: -- initialize the warning flag
5669: x_warning_flag := Fnd_Api.G_FALSE;
5670:
5671: --
5672: -- Begin API Body
5673: --
5727: 'Calling Convert_To_Est_Lines');
5728: END IF;
5729:
5730: Convert_To_Est_Lines(p_api_version => 1.0,
5731: p_commit => Fnd_Api.G_FALSE,
5732: p_init_msg_list => Fnd_Api.G_FALSE,
5733: p_validation_level => p_validation_level,
5734: x_return_status => x_return_status,
5735: x_msg_count => x_msg_count,
5728: END IF;
5729:
5730: Convert_To_Est_Lines(p_api_version => 1.0,
5731: p_commit => Fnd_Api.G_FALSE,
5732: p_init_msg_list => Fnd_Api.G_FALSE,
5733: p_validation_level => p_validation_level,
5734: x_return_status => x_return_status,
5735: x_msg_count => x_msg_count,
5736: x_msg_data => x_msg_data,
5751: -- THEN
5752: -- Csd_Gen_Utility_Pvt.dump_repair_estimate_line_tbl(x_est_lines_tbl);
5753: -- END IF;
5754:
5755: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
5756: THEN
5757: RAISE Fnd_Api.G_EXC_ERROR;
5758: END IF;
5759:
5753: -- END IF;
5754:
5755: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
5756: THEN
5757: RAISE Fnd_Api.G_EXC_ERROR;
5758: END IF;
5759:
5760: IF l_warning_flag <> Fnd_Api.G_FALSE
5761: THEN
5756: THEN
5757: RAISE Fnd_Api.G_EXC_ERROR;
5758: END IF;
5759:
5760: IF l_warning_flag <> Fnd_Api.G_FALSE
5761: THEN
5762: x_warning_flag := l_warning_flag;
5763: END IF;
5764: --
5816: lc_mod_name,
5817: 'Calling Convert_To_Est_Lines');
5818: END IF;
5819: Convert_To_Est_Lines(p_api_version => 1.0,
5820: p_commit => Fnd_Api.G_FALSE,
5821: p_init_msg_list => Fnd_Api.G_FALSE,
5822: p_validation_level => p_validation_level,
5823: x_return_status => x_return_status,
5824: x_msg_count => x_msg_count,
5817: 'Calling Convert_To_Est_Lines');
5818: END IF;
5819: Convert_To_Est_Lines(p_api_version => 1.0,
5820: p_commit => Fnd_Api.G_FALSE,
5821: p_init_msg_list => Fnd_Api.G_FALSE,
5822: p_validation_level => p_validation_level,
5823: x_return_status => x_return_status,
5824: x_msg_count => x_msg_count,
5825: x_msg_data => x_msg_data,
5840: -- THEN
5841: -- Csd_Gen_Utility_Pvt.dump_repair_estimate_line_tbl(x_est_lines_tbl);
5842: -- END IF;
5843:
5844: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
5845: THEN
5846: RAISE Fnd_Api.G_EXC_ERROR;
5847: END IF;
5848: IF l_warning_flag <> Fnd_Api.G_FALSE
5842: -- END IF;
5843:
5844: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
5845: THEN
5846: RAISE Fnd_Api.G_EXC_ERROR;
5847: END IF;
5848: IF l_warning_flag <> Fnd_Api.G_FALSE
5849: THEN
5850: x_warning_flag := l_warning_flag;
5844: IF NOT (x_return_status = Fnd_Api.G_RET_STS_SUCCESS)
5845: THEN
5846: RAISE Fnd_Api.G_EXC_ERROR;
5847: END IF;
5848: IF l_warning_flag <> Fnd_Api.G_FALSE
5849: THEN
5850: x_warning_flag := l_warning_flag;
5851: END IF;
5852:
5880: -- End API Body
5881: --
5882:
5883: -- Standard check of p_commit.
5884: IF Fnd_Api.To_Boolean(p_commit)
5885: THEN
5886: COMMIT WORK;
5887: END IF;
5888:
5890: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
5891: p_data => x_msg_data);
5892: EXCEPTION
5893: WHEN CSD_EST_NO_AUTOGEN THEN
5894: x_warning_flag := Fnd_Api.G_TRUE;
5895:
5896: -- save message in fnd stack
5897: IF (Fnd_Log.Level_Statement >= Fnd_Log.G_Current_Runtime_Level)
5898: THEN
5911: Fnd_Log.STRING(Fnd_Log.Level_Exception,
5912: lc_mod_name,
5913: 'No estimate lines autogenerated');
5914: END IF;
5915: WHEN Fnd_Api.G_EXC_ERROR THEN
5916: ROLLBACK TO Get_Estimates_From_BOM;
5917: x_return_status := Fnd_Api.G_RET_STS_ERROR;
5918:
5919: /*
5913: 'No estimate lines autogenerated');
5914: END IF;
5915: WHEN Fnd_Api.G_EXC_ERROR THEN
5916: ROLLBACK TO Get_Estimates_From_BOM;
5917: x_return_status := Fnd_Api.G_RET_STS_ERROR;
5918:
5919: /*
5920: -- TO DO: Add seeded err message
5921: -- save message in fnd stack
5937: lc_mod_name,
5938: 'EXC_ERROR[' || x_msg_data || ']');
5939: END IF;
5940:
5941: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
5942: ROLLBACK TO Get_Estimates_From_BOM;
5943: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
5944:
5945: -- save message in fnd stack
5939: END IF;
5940:
5941: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
5942: ROLLBACK TO Get_Estimates_From_BOM;
5943: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
5944:
5945: -- save message in fnd stack
5946: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
5947: THEN
5966: END IF;
5967:
5968: WHEN OTHERS THEN
5969: ROLLBACK TO Get_Estimates_From_BOM;
5970: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
5971: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
5972: THEN
5973: IF (Fnd_Log.Level_Statement >=
5974: Fnd_Log.G_Current_Runtime_Level)
6000: /* REPAIR_ESTIMATE_LINE_REC. It also*/
6001: /* sets the item cost and logs */
6002: /* warnings. */
6003: /* */
6004: /* x_warning_flag : FND_API.G_TRUE if any non-fatal */
6005: /* errors occured. FND_API.G_FALSE */
6006: /* if everything was successful. */
6007: /* Note that this value could be */
6008: /* G_TRUE even if x_return_status */
6001: /* sets the item cost and logs */
6002: /* warnings. */
6003: /* */
6004: /* x_warning_flag : FND_API.G_TRUE if any non-fatal */
6005: /* errors occured. FND_API.G_FALSE */
6006: /* if everything was successful. */
6007: /* Note that this value could be */
6008: /* G_TRUE even if x_return_status */
6009: /* is G_RET_STS_SUCCESS */
6080: -- Standard Start of API savepoint
6081: SAVEPOINT Convert_To_Est_Lines;
6082:
6083: -- Standard call to check for call compatibility.
6084: IF NOT Fnd_Api.Compatible_API_Call(lc_api_version,
6085: p_api_version,
6086: lc_api_name,
6087: G_PKG_NAME)
6088: THEN
6085: p_api_version,
6086: lc_api_name,
6087: G_PKG_NAME)
6088: THEN
6089: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
6090: END IF;
6091:
6092: -- Initialize message list if p_init_msg_list is set to TRUE.
6093: IF Fnd_Api.to_Boolean(p_init_msg_list)
6089: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
6090: END IF;
6091:
6092: -- Initialize message list if p_init_msg_list is set to TRUE.
6093: IF Fnd_Api.to_Boolean(p_init_msg_list)
6094: THEN
6095: Fnd_Msg_Pub.initialize;
6096: END IF;
6097:
6146: 'p_contract_line_id: ' || p_contract_line_id);
6147: END IF;
6148:
6149: -- Initialize API return status to success
6150: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
6151:
6152: -- initialize the warning flag
6153: x_warning_flag := Fnd_Api.G_FALSE;
6154:
6149: -- Initialize API return status to success
6150: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
6151:
6152: -- initialize the warning flag
6153: x_warning_flag := Fnd_Api.G_FALSE;
6154:
6155: /* bug#3875036 */
6156: l_account_id := CSD_CHARGE_LINE_UTIL.Get_SR_AccountId(p_repair_line_id);
6157:
6212: lc_mod_name,
6213: 'l_selling_price = ' || l_selling_price);
6214: END IF;
6215: EXCEPTION
6216: WHEN Fnd_Api.G_EXC_ERROR THEN
6217: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6218: IF (Fnd_Log.Level_Procedure >=
6219: Fnd_Log.G_Current_Runtime_Level)
6220: THEN
6213: 'l_selling_price = ' || l_selling_price);
6214: END IF;
6215: EXCEPTION
6216: WHEN Fnd_Api.G_EXC_ERROR THEN
6217: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6218: IF (Fnd_Log.Level_Procedure >=
6219: Fnd_Log.G_Current_Runtime_Level)
6220: THEN
6221: Fnd_Log.STRING(Fnd_Log.Level_Procedure,
6219: Fnd_Log.G_Current_Runtime_Level)
6220: THEN
6221: Fnd_Log.STRING(Fnd_Log.Level_Procedure,
6222: lc_mod_name,
6223: 'Exception FND_API.G_EXC_ERROR occurred in CSD_PROCESS_UTIL.get_charge_selling_price');
6224: END IF;
6225: WHEN OTHERS THEN
6226: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6227: IF (Fnd_Log.Level_Procedure >=
6222: lc_mod_name,
6223: 'Exception FND_API.G_EXC_ERROR occurred in CSD_PROCESS_UTIL.get_charge_selling_price');
6224: END IF;
6225: WHEN OTHERS THEN
6226: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6227: IF (Fnd_Log.Level_Procedure >=
6228: Fnd_Log.G_Current_Runtime_Level)
6229: THEN
6230: Fnd_Log.STRING(Fnd_Log.Level_Procedure,
6232: 'Exception OTHERS occurred in CSD_PROCESS_UTIL.get_charge_selling_price');
6233: END IF;
6234: END;
6235:
6236: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS) OR
6237: (l_selling_price IS NULL)
6238: THEN
6239: IF (Fnd_Log.Level_Statement >=
6240: Fnd_Log.G_Current_Runtime_Level)
6414: .coverage_txn_group_id);
6415: END IF;
6416:
6417: EXCEPTION
6418: WHEN Fnd_Api.G_EXC_ERROR THEN
6419: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6420: WHEN OTHERS THEN
6421: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6422: END;
6415: END IF;
6416:
6417: EXCEPTION
6418: WHEN Fnd_Api.G_EXC_ERROR THEN
6419: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6420: WHEN OTHERS THEN
6421: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6422: END;
6423:
6417: EXCEPTION
6418: WHEN Fnd_Api.G_EXC_ERROR THEN
6419: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6420: WHEN OTHERS THEN
6421: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6422: END;
6423:
6424: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
6425: THEN
6420: WHEN OTHERS THEN
6421: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6422: END;
6423:
6424: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
6425: THEN
6426: l_error := TRUE;
6427: END IF;
6428:
6434: lc_mod_name,
6435: 'Calling CSD_CHARGE_LINE_UTIL.get_discountedprice');
6436: END IF;
6437: Csd_Charge_Line_Util.GET_DISCOUNTEDPRICE(p_api_version => 1.0,
6438: p_init_msg_list => Fnd_Api.G_FALSE,
6439: p_contract_line_id => p_contract_line_id,
6440: p_repair_type_id => p_repair_type_id,
6441: p_txn_billing_type_id => p_MLE_lines_tbl(i)
6442: .txn_billing_type_id,
6458: x_est_lines_tbl(l_curRow)
6459: .after_warranty_cost);
6460: END IF;
6461: EXCEPTION
6462: WHEN Fnd_Api.G_EXC_ERROR THEN
6463: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6464: WHEN OTHERS THEN
6465: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6466: END;
6459: .after_warranty_cost);
6460: END IF;
6461: EXCEPTION
6462: WHEN Fnd_Api.G_EXC_ERROR THEN
6463: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6464: WHEN OTHERS THEN
6465: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6466: END;
6467: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
6461: EXCEPTION
6462: WHEN Fnd_Api.G_EXC_ERROR THEN
6463: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6464: WHEN OTHERS THEN
6465: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6466: END;
6467: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
6468: THEN
6469: IF (Fnd_Log.Level_Statement >=
6463: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6464: WHEN OTHERS THEN
6465: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6466: END;
6467: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
6468: THEN
6469: IF (Fnd_Log.Level_Statement >=
6470: Fnd_Log.G_Current_Runtime_Level)
6471: THEN
6515: -- gets the item cost.
6516: -- CSD_COST_ANALYSIS_PVT.Get_InvItemCost(
6517: Csd_Cost_Analysis_Pvt.Get_ResItemCost(
6518: -- p_api_version => 1.0,
6519: -- p_commit => fnd_api.g_false,
6520: -- p_init_msg_list => fnd_api.g_false,
6521: -- p_validation_level => fnd_api.g_valid_level_full,
6522: x_return_status => l_return_status,
6523: x_msg_count => l_msg_count,
6516: -- CSD_COST_ANALYSIS_PVT.Get_InvItemCost(
6517: Csd_Cost_Analysis_Pvt.Get_ResItemCost(
6518: -- p_api_version => 1.0,
6519: -- p_commit => fnd_api.g_false,
6520: -- p_init_msg_list => fnd_api.g_false,
6521: -- p_validation_level => fnd_api.g_valid_level_full,
6522: x_return_status => l_return_status,
6523: x_msg_count => l_msg_count,
6524: x_msg_data => l_msg_data,
6517: Csd_Cost_Analysis_Pvt.Get_ResItemCost(
6518: -- p_api_version => 1.0,
6519: -- p_commit => fnd_api.g_false,
6520: -- p_init_msg_list => fnd_api.g_false,
6521: -- p_validation_level => fnd_api.g_valid_level_full,
6522: x_return_status => l_return_status,
6523: x_msg_count => l_msg_count,
6524: x_msg_data => l_msg_data,
6525: p_inventory_item_id => p_MLE_lines_tbl(i)
6540: 'x_item_cost = ' ||
6541: x_est_lines_tbl(l_curRow).item_cost);
6542: END IF;
6543: EXCEPTION
6544: WHEN Fnd_Api.G_EXC_ERROR THEN
6545: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6546: WHEN OTHERS THEN
6547: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6548: END;
6541: x_est_lines_tbl(l_curRow).item_cost);
6542: END IF;
6543: EXCEPTION
6544: WHEN Fnd_Api.G_EXC_ERROR THEN
6545: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6546: WHEN OTHERS THEN
6547: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6548: END;
6549:
6543: EXCEPTION
6544: WHEN Fnd_Api.G_EXC_ERROR THEN
6545: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6546: WHEN OTHERS THEN
6547: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6548: END;
6549:
6550: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
6551: THEN
6546: WHEN OTHERS THEN
6547: l_return_status := Fnd_Api.G_RET_STS_ERROR;
6548: END;
6549:
6550: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
6551: THEN
6552: x_est_lines_tbl(l_curRow).item_cost := NULL;
6553: --
6554: -- TO DO: give warning message that cost could not be determined?
6551: THEN
6552: x_est_lines_tbl(l_curRow).item_cost := NULL;
6553: --
6554: -- TO DO: give warning message that cost could not be determined?
6555: -- x_warning_flag := FND_API.G_TRUE;
6556: -- x_return_status := FND_API.G_RET_STS_ERROR;
6557: -- if (Fnd_Log.Level_Statement>= Fnd_Log.G_Current_Runtime_Level) then
6558: -- FND_LOG.STRING(Fnd_Log.Level_Statement, lc_mod_name,
6559: -- 'Adding message CSD_EST_ESTIMATED_CHARGE_ERR to FND_MSG stack');
6552: x_est_lines_tbl(l_curRow).item_cost := NULL;
6553: --
6554: -- TO DO: give warning message that cost could not be determined?
6555: -- x_warning_flag := FND_API.G_TRUE;
6556: -- x_return_status := FND_API.G_RET_STS_ERROR;
6557: -- if (Fnd_Log.Level_Statement>= Fnd_Log.G_Current_Runtime_Level) then
6558: -- FND_LOG.STRING(Fnd_Log.Level_Statement, lc_mod_name,
6559: -- 'Adding message CSD_EST_ESTIMATED_CHARGE_ERR to FND_MSG stack');
6560: -- end if;
6653: -- Note: Do NOT elsif this statement with the above "if (l_error = FALSE)",
6654: -- since the above section could potentially set l_error=TRUE as well.
6655: IF (l_error = TRUE)
6656: THEN
6657: x_warning_flag := Fnd_Api.G_TRUE;
6658: IF (Fnd_Log.Level_Procedure >=
6659: Fnd_Log.G_Current_Runtime_Level)
6660: THEN
6661: Fnd_Log.STRING(Fnd_Log.Level_Procedure,
6666: 'Number of messages in stack: ' ||
6667: Fnd_Msg_Pub.count_msg);
6668: END IF;
6669: Csd_Gen_Errmsgs_Pvt.Save_Fnd_Msgs(p_api_version => 1.0,
6670: p_commit => Fnd_Api.G_FALSE,
6671: p_init_msg_list => Fnd_Api.G_FALSE,
6672: p_validation_level => 0,
6673: p_module_code => 'EST',
6674: p_source_entity_id1 => p_repair_line_id,
6667: Fnd_Msg_Pub.count_msg);
6668: END IF;
6669: Csd_Gen_Errmsgs_Pvt.Save_Fnd_Msgs(p_api_version => 1.0,
6670: p_commit => Fnd_Api.G_FALSE,
6671: p_init_msg_list => Fnd_Api.G_FALSE,
6672: p_validation_level => 0,
6673: p_module_code => 'EST',
6674: p_source_entity_id1 => p_repair_line_id,
6675: p_source_entity_type_code => p_MLE_lines_tbl(i)
6678: .est_line_source_id1,
6679: x_return_status => l_return_status,
6680: x_msg_count => l_msg_count,
6681: x_msg_data => l_msg_data);
6682: IF NOT (l_return_status = Fnd_Api.G_RET_STS_SUCCESS)
6683: THEN
6684: RAISE Fnd_Api.G_EXC_ERROR;
6685: END IF;
6686: IF (Fnd_Log.Level_Procedure >=
6680: x_msg_count => l_msg_count,
6681: x_msg_data => l_msg_data);
6682: IF NOT (l_return_status = Fnd_Api.G_RET_STS_SUCCESS)
6683: THEN
6684: RAISE Fnd_Api.G_EXC_ERROR;
6685: END IF;
6686: IF (Fnd_Log.Level_Procedure >=
6687: Fnd_Log.G_Current_Runtime_Level)
6688: THEN
6714: -- End API Body
6715: --
6716:
6717: -- Standard check of p_commit.
6718: IF Fnd_Api.To_Boolean(p_commit)
6719: THEN
6720: COMMIT WORK;
6721: END IF;
6722:
6723: -- Standard call to get message count and IF count is get message info.
6724: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
6725: p_data => x_msg_data);
6726: EXCEPTION
6727: WHEN Fnd_Api.G_EXC_ERROR THEN
6728: ROLLBACK TO Convert_To_Est_Lines;
6729: x_return_status := Fnd_Api.G_RET_STS_ERROR;
6730:
6731: /*
6725: p_data => x_msg_data);
6726: EXCEPTION
6727: WHEN Fnd_Api.G_EXC_ERROR THEN
6728: ROLLBACK TO Convert_To_Est_Lines;
6729: x_return_status := Fnd_Api.G_RET_STS_ERROR;
6730:
6731: /*
6732: -- TO DO: Add seeded err message
6733: -- save message in fnd stack
6748: Fnd_Log.STRING(Fnd_Log.Level_Exception,
6749: lc_mod_name,
6750: 'EXC_ERROR[' || x_msg_data || ']');
6751: END IF;
6752: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
6753: ROLLBACK TO Convert_To_Est_Lines;
6754: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
6755:
6756: -- save message in fnd stack
6750: 'EXC_ERROR[' || x_msg_data || ']');
6751: END IF;
6752: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
6753: ROLLBACK TO Convert_To_Est_Lines;
6754: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
6755:
6756: -- save message in fnd stack
6757: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
6758: THEN
6776: 'EXC_UNEXPECTED_ERROR[' || x_msg_data || ']');
6777: END IF;
6778: WHEN OTHERS THEN
6779: ROLLBACK TO Convert_To_Est_Lines;
6780: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
6781:
6782: -- save message in fnd stack
6783: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
6784: THEN
6856: -- Standard Start of API savepoint
6857: SAVEPOINT CREATE_ESTIMATE_HEADER_PVT;
6858:
6859: -- Standard call to check for call compatibility.
6860: IF NOT Fnd_Api.Compatible_API_Call(l_api_version,
6861: p_api_version,
6862: l_api_name,
6863: G_PKG_NAME)
6864: THEN
6861: p_api_version,
6862: l_api_name,
6863: G_PKG_NAME)
6864: THEN
6865: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
6866: END IF;
6867:
6868: -- Initialize message list if p_init_msg_list is set to TRUE.
6869: IF Fnd_Api.to_Boolean(p_init_msg_list)
6865: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
6866: END IF;
6867:
6868: -- Initialize message list if p_init_msg_list is set to TRUE.
6869: IF Fnd_Api.to_Boolean(p_init_msg_list)
6870: THEN
6871: Fnd_Msg_Pub.initialize;
6872: END IF;
6873:
6871: Fnd_Msg_Pub.initialize;
6872: END IF;
6873:
6874: -- Initialize API return status to success
6875: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
6876:
6877: debug('Start of estiamte hdr creation for repair lineid[=' ||
6878: p_estimate_hdr_rec.repair_line_id || ']');
6879:
6908: l_estimate_hdr_rec.estimate_status))
6909: THEN
6910: debug('Invalid estimate_reason_code[' ||
6911: l_estimate_hdr_rec.estimate_reason_code || ']');
6912: RAISE Fnd_Api.G_EXC_ERROR;
6913: END IF;
6914:
6915: Csd_Repairs_Grp.UPDATE_APPROVAL_STATUS(p_repair_line_id => l_estimate_hdr_rec.repair_line_id,
6916: p_new_approval_status => l_approval_Status,
6922: x_return_status => l_return_status,
6923: x_msg_count => l_msg_count,
6924: x_msg_data => l_msg_data);
6925: debug('Updated ro status');
6926: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
6927: THEN
6928: debug('Updated ro status failed, x_msg_data[' ||
6929: l_msg_data || ']');
6930: RAISE Fnd_Api.G_EXC_ERROR;
6926: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
6927: THEN
6928: debug('Updated ro status failed, x_msg_data[' ||
6929: l_msg_data || ']');
6930: RAISE Fnd_Api.G_EXC_ERROR;
6931: END IF;
6932:
6933: ELSE
6934: l_estimate_hdr_rec.estimate_reason_code := NULL;
6937:
6938: csd_estimate_utils_pvt.COPY_TO_EST_HDR_REC(l_estimate_hdr_rec,
6939: l_est_hdr_pvt_rec);
6940: Csd_Repair_Estimate_Pvt.create_repair_estimate(p_api_version => 1.0,
6941: p_commit => Fnd_Api.G_FALSE,
6942: p_init_msg_list => Fnd_Api.G_FALSE,
6943: p_validation_level => Fnd_Api.G_VALID_LEVEL_FULL,
6944: x_estimate_rec => l_est_hdr_pvt_rec,
6945: x_estimate_id => x_estimate_hdr_id,
6938: csd_estimate_utils_pvt.COPY_TO_EST_HDR_REC(l_estimate_hdr_rec,
6939: l_est_hdr_pvt_rec);
6940: Csd_Repair_Estimate_Pvt.create_repair_estimate(p_api_version => 1.0,
6941: p_commit => Fnd_Api.G_FALSE,
6942: p_init_msg_list => Fnd_Api.G_FALSE,
6943: p_validation_level => Fnd_Api.G_VALID_LEVEL_FULL,
6944: x_estimate_rec => l_est_hdr_pvt_rec,
6945: x_estimate_id => x_estimate_hdr_id,
6946: x_return_status => l_return_status,
6939: l_est_hdr_pvt_rec);
6940: Csd_Repair_Estimate_Pvt.create_repair_estimate(p_api_version => 1.0,
6941: p_commit => Fnd_Api.G_FALSE,
6942: p_init_msg_list => Fnd_Api.G_FALSE,
6943: p_validation_level => Fnd_Api.G_VALID_LEVEL_FULL,
6944: x_estimate_rec => l_est_hdr_pvt_rec,
6945: x_estimate_id => x_estimate_hdr_id,
6946: x_return_status => l_return_status,
6947: x_msg_count => l_msg_count,
6948: x_msg_data => l_msg_data);
6949:
6950: debug('after creating the estimate header');
6951:
6952: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
6953: THEN
6954: debug('create estiamte header failed, x_msg_data[' ||
6955: l_msg_data || ']');
6956: RAISE Fnd_Api.G_EXC_ERROR;
6952: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
6953: THEN
6954: debug('create estiamte header failed, x_msg_data[' ||
6955: l_msg_data || ']');
6956: RAISE Fnd_Api.G_EXC_ERROR;
6957: END IF;
6958:
6959: -- Standard check of p_commit.
6960: IF Fnd_Api.To_Boolean(p_commit)
6956: RAISE Fnd_Api.G_EXC_ERROR;
6957: END IF;
6958:
6959: -- Standard check of p_commit.
6960: IF Fnd_Api.To_Boolean(p_commit)
6961: THEN
6962: COMMIT WORK;
6963: END IF;
6964:
6972: -- Standard call to get message count and IF count is get message info.
6973: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
6974: p_data => x_msg_data);
6975: EXCEPTION
6976: WHEN Fnd_Api.G_EXC_ERROR THEN
6977: x_return_status := Fnd_Api.G_RET_STS_ERROR;
6978: ROLLBACK TO create_estimate_header_pvt;
6979: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
6980: p_data => x_msg_data);
6973: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
6974: p_data => x_msg_data);
6975: EXCEPTION
6976: WHEN Fnd_Api.G_EXC_ERROR THEN
6977: x_return_status := Fnd_Api.G_RET_STS_ERROR;
6978: ROLLBACK TO create_estimate_header_pvt;
6979: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
6980: p_data => x_msg_data);
6981: IF (Fnd_Log.level_error >= Fnd_Log.g_current_runtime_level)
6983: Fnd_Log.STRING(Fnd_Log.level_error,
6984: 'csd.plsql.csd_repair_estimate_pvt.create_estimate_header',
6985: 'EXC_ERROR[' || x_msg_data || ']');
6986: END IF;
6987: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
6988: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
6989: ROLLBACK TO create_estimate_header_pvt;
6990: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
6991: p_data => x_msg_data);
6984: 'csd.plsql.csd_repair_estimate_pvt.create_estimate_header',
6985: 'EXC_ERROR[' || x_msg_data || ']');
6986: END IF;
6987: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
6988: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
6989: ROLLBACK TO create_estimate_header_pvt;
6990: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
6991: p_data => x_msg_data);
6992: IF (Fnd_Log.level_exception >= Fnd_Log.g_current_runtime_level)
6995: 'csd.plsql.csd_repair_estimate_pvt.create_estimate_header',
6996: 'EXC_UNEXP_ERROR[' || x_msg_data || ']');
6997: END IF;
6998: WHEN OTHERS THEN
6999: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
7000: ROLLBACK TO create_estimate_header_pvt;
7001: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
7002: THEN
7003: Fnd_Msg_Pub.Add_Exc_Msg(G_PKG_NAME, l_api_name);
7049: -- Standard Start of API savepoint
7050: SAVEPOINT CREATE_ESTIMATE_LINE_PVT;
7051:
7052: -- Standard call to check for call compatibility.
7053: IF NOT Fnd_Api.Compatible_API_Call(l_api_version,
7054: p_api_version,
7055: l_api_name,
7056: G_PKG_NAME)
7057: THEN
7054: p_api_version,
7055: l_api_name,
7056: G_PKG_NAME)
7057: THEN
7058: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
7059: END IF;
7060:
7061: -- Initialize message list if p_init_msg_list is set to TRUE.
7062: IF Fnd_Api.to_Boolean(p_init_msg_list)
7058: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
7059: END IF;
7060:
7061: -- Initialize message list if p_init_msg_list is set to TRUE.
7062: IF Fnd_Api.to_Boolean(p_init_msg_list)
7063: THEN
7064: Fnd_Msg_Pub.initialize;
7065: END IF;
7066:
7064: Fnd_Msg_Pub.initialize;
7065: END IF;
7066:
7067: -- Initialize API return status to success
7068: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
7069:
7070: debug('Start of estimate line creation for estimate id[=' ||
7071: p_estimate_line_rec.repair_estimate_id || ']');
7072:
7095:
7096: debug('Calling create estimate_lines...');
7097:
7098: create_repair_estimate_lines(p_api_version => 1.0,
7099: p_commit => Fnd_Api.G_FALSE,
7100: p_init_msg_list => Fnd_Api.G_FALSE,
7101: p_validation_level => Fnd_Api.G_VALID_LEVEL_FULL,
7102: x_estimate_line_rec => l_est_pvt_line_rec,
7103: x_estimate_line_id => x_estimate_line_id,
7096: debug('Calling create estimate_lines...');
7097:
7098: create_repair_estimate_lines(p_api_version => 1.0,
7099: p_commit => Fnd_Api.G_FALSE,
7100: p_init_msg_list => Fnd_Api.G_FALSE,
7101: p_validation_level => Fnd_Api.G_VALID_LEVEL_FULL,
7102: x_estimate_line_rec => l_est_pvt_line_rec,
7103: x_estimate_line_id => x_estimate_line_id,
7104: x_return_status => l_return_status,
7097:
7098: create_repair_estimate_lines(p_api_version => 1.0,
7099: p_commit => Fnd_Api.G_FALSE,
7100: p_init_msg_list => Fnd_Api.G_FALSE,
7101: p_validation_level => Fnd_Api.G_VALID_LEVEL_FULL,
7102: x_estimate_line_rec => l_est_pvt_line_rec,
7103: x_estimate_line_id => x_estimate_line_id,
7104: x_return_status => l_return_status,
7105: x_msg_count => l_msg_count,
7104: x_return_status => l_return_status,
7105: x_msg_count => l_msg_count,
7106: x_msg_data => l_msg_data);
7107:
7108: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
7109: THEN
7110: debug('create estimate_lines failed..');
7111: RAISE Fnd_Api.G_EXC_ERROR;
7112: END IF;
7107:
7108: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
7109: THEN
7110: debug('create estimate_lines failed..');
7111: RAISE Fnd_Api.G_EXC_ERROR;
7112: END IF;
7113:
7114: -- Standard check of p_commit.
7115: IF Fnd_Api.To_Boolean(p_commit)
7111: RAISE Fnd_Api.G_EXC_ERROR;
7112: END IF;
7113:
7114: -- Standard check of p_commit.
7115: IF Fnd_Api.To_Boolean(p_commit)
7116: THEN
7117: COMMIT WORK;
7118: END IF;
7119:
7127: 'csd.plsql.csd_repair_estimate_pvt.create_estimate_line.end',
7128: 'leaving create_estimate_line');
7129: END IF;
7130: EXCEPTION
7131: WHEN Fnd_Api.G_EXC_ERROR THEN
7132: x_return_status := Fnd_Api.G_RET_STS_ERROR;
7133: ROLLBACK TO CREATE_ESTIMATE_LINE_PVT;
7134: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
7135: p_data => x_msg_data);
7128: 'leaving create_estimate_line');
7129: END IF;
7130: EXCEPTION
7131: WHEN Fnd_Api.G_EXC_ERROR THEN
7132: x_return_status := Fnd_Api.G_RET_STS_ERROR;
7133: ROLLBACK TO CREATE_ESTIMATE_LINE_PVT;
7134: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
7135: p_data => x_msg_data);
7136: IF (Fnd_Log.level_error >= Fnd_Log.g_current_runtime_level)
7139: 'csd.plsql.csd_repair_estimate_pvt.create_estimate_line',
7140: 'EXC_ERROR[' || x_msg_data || ']');
7141: END IF;
7142:
7143: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
7144: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
7145: ROLLBACK TO CREATE_ESTIMATE_LINE_PVT;
7146: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
7147: p_data => x_msg_data);
7140: 'EXC_ERROR[' || x_msg_data || ']');
7141: END IF;
7142:
7143: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
7144: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
7145: ROLLBACK TO CREATE_ESTIMATE_LINE_PVT;
7146: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
7147: p_data => x_msg_data);
7148: IF (Fnd_Log.level_exception >= Fnd_Log.g_current_runtime_level)
7151: 'csd.plsql.csd_repair_estimate_pvt.create_estimate_line',
7152: 'EXC_UNEXP_ERROR[' || x_msg_data || ']');
7153: END IF;
7154: WHEN OTHERS THEN
7155: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
7156: ROLLBACK TO CREATE_ESTIMATE_LINE_PVT;
7157: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
7158: THEN
7159: Fnd_Msg_Pub.Add_Exc_Msg(G_PKG_NAME, l_api_name);
7239: -- Standard Start of API savepoint
7240: SAVEPOINT UPDATE_ESTIMATE_HEADER_PVT;
7241:
7242: -- Standard call to check for call compatibility.
7243: IF NOT Fnd_Api.Compatible_API_Call(l_api_version,
7244: p_api_version,
7245: l_api_name,
7246: G_PKG_NAME)
7247: THEN
7244: p_api_version,
7245: l_api_name,
7246: G_PKG_NAME)
7247: THEN
7248: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
7249: END IF;
7250:
7251: -- Initialize message list if p_init_msg_list is set to TRUE.
7252: IF Fnd_Api.to_Boolean(p_init_msg_list)
7248: RAISE Fnd_Api.G_EXC_UNEXPECTED_ERROR;
7249: END IF;
7250:
7251: -- Initialize message list if p_init_msg_list is set to TRUE.
7252: IF Fnd_Api.to_Boolean(p_init_msg_list)
7253: THEN
7254: Fnd_Msg_Pub.initialize;
7255: END IF;
7256:
7254: Fnd_Msg_Pub.initialize;
7255: END IF;
7256:
7257: -- Initialize API return status to success
7258: x_return_status := Fnd_Api.G_RET_STS_SUCCESS;
7259:
7260: debug('Start of update estimate header for estimate id[=' ||
7261: p_estimate_hdr_rec.repair_estimate_id || ']');
7262:
7308: IF (CUR_EST_HDR%NOTFOUND)
7309: THEN
7310: Fnd_Message.SET_NAME('CSD', 'CSD_INV_ESTIMATE_HEADER');
7311: Fnd_Msg_Pub.ADD;
7312: RAISE Fnd_Api.G_EXC_ERROR;
7313: END IF;
7314:
7315: IF (l_est_pvt_hdr_Rec.repair_line_id <>
7316: p_Estimate_hdr_Rec.repair_line_id)
7316: p_Estimate_hdr_Rec.repair_line_id)
7317: THEN
7318: Fnd_Message.SET_NAME('CSD', 'CSD_INV_ESTIMATE_INPUT');
7319: Fnd_Msg_Pub.ADD;
7320: RAISE Fnd_Api.G_EXC_ERROR;
7321: END IF;
7322: CLOSE CUR_EST_HDR;
7323:
7324: l_est_status_changed := FALSE;
7354: l_estimate_hdr_rec.estimate_status))
7355: THEN
7356: debug('Invalid estimate_reason_code[' ||
7357: l_estimate_hdr_rec.estimate_reason_code || ']');
7358: RAISE Fnd_Api.G_EXC_ERROR;
7359: END IF;
7360:
7361: Csd_Repairs_Grp.UPDATE_APPROVAL_STATUS(p_repair_line_id => l_estimate_hdr_rec.repair_line_id,
7362: p_new_approval_status => l_approval_Status,
7368: x_return_status => l_return_status,
7369: x_msg_count => l_msg_count,
7370: x_msg_data => l_msg_data);
7371: debug('Updated ro status');
7372: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
7373: THEN
7374: debug('Updated ro status failed, x_msg_data[' ||
7375: l_msg_data || ']');
7376: RAISE Fnd_Api.G_EXC_ERROR;
7372: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
7373: THEN
7374: debug('Updated ro status failed, x_msg_data[' ||
7375: l_msg_data || ']');
7376: RAISE Fnd_Api.G_EXC_ERROR;
7377: END IF;
7378:
7379: ELSE
7380: l_estimate_hdr_rec.estimate_reason_code := NULL;
7383: csd_estimate_utils_pvt.COPY_TO_EST_HDR_REC_UPD(l_estimate_hdr_rec,
7384: l_est_pvt_hdr_rec);
7385:
7386: Csd_Repair_Estimate_Pvt.update_repair_estimate(p_api_version => 1.0,
7387: p_commit => Fnd_Api.G_FALSE,
7388: p_init_msg_list => Fnd_Api.G_FALSE,
7389: p_validation_level => Fnd_Api.G_VALID_LEVEL_FULL,
7390: x_estimate_rec => l_est_pvt_hdr_rec,
7391: x_return_status => l_return_status,
7384: l_est_pvt_hdr_rec);
7385:
7386: Csd_Repair_Estimate_Pvt.update_repair_estimate(p_api_version => 1.0,
7387: p_commit => Fnd_Api.G_FALSE,
7388: p_init_msg_list => Fnd_Api.G_FALSE,
7389: p_validation_level => Fnd_Api.G_VALID_LEVEL_FULL,
7390: x_estimate_rec => l_est_pvt_hdr_rec,
7391: x_return_status => l_return_status,
7392: x_msg_count => l_msg_count,
7385:
7386: Csd_Repair_Estimate_Pvt.update_repair_estimate(p_api_version => 1.0,
7387: p_commit => Fnd_Api.G_FALSE,
7388: p_init_msg_list => Fnd_Api.G_FALSE,
7389: p_validation_level => Fnd_Api.G_VALID_LEVEL_FULL,
7390: x_estimate_rec => l_est_pvt_hdr_rec,
7391: x_return_status => l_return_status,
7392: x_msg_count => l_msg_count,
7393: x_msg_data => l_msg_data);
7394:
7395: debug('after creating the estimate header');
7396: x_object_version_number := l_estimate_hdr_rec.object_version_number;
7397:
7398: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
7399: THEN
7400: debug('update estiamte header failed, x_msg_data[' ||
7401: l_msg_data || ']');
7402: RAISE Fnd_Api.G_EXC_ERROR;
7398: IF (l_return_status <> Fnd_Api.G_RET_STS_SUCCESS)
7399: THEN
7400: debug('update estiamte header failed, x_msg_data[' ||
7401: l_msg_data || ']');
7402: RAISE Fnd_Api.G_EXC_ERROR;
7403: END IF;
7404:
7405: -- Standard check of p_commit.
7406: IF Fnd_Api.To_Boolean(p_commit)
7402: RAISE Fnd_Api.G_EXC_ERROR;
7403: END IF;
7404:
7405: -- Standard check of p_commit.
7406: IF Fnd_Api.To_Boolean(p_commit)
7407: THEN
7408: COMMIT WORK;
7409: END IF;
7410:
7418: 'csd.plsql.csd_repair_estimate_pvt.update_estimate_header.end',
7419: 'leaving update_estimate_header');
7420: END IF;
7421: EXCEPTION
7422: WHEN Fnd_Api.G_EXC_ERROR THEN
7423: x_return_status := Fnd_Api.G_RET_STS_ERROR;
7424: ROLLBACK TO UPDATE_ESTIMATE_HEADER_PVT;
7425: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
7426: p_data => x_msg_data);
7419: 'leaving update_estimate_header');
7420: END IF;
7421: EXCEPTION
7422: WHEN Fnd_Api.G_EXC_ERROR THEN
7423: x_return_status := Fnd_Api.G_RET_STS_ERROR;
7424: ROLLBACK TO UPDATE_ESTIMATE_HEADER_PVT;
7425: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
7426: p_data => x_msg_data);
7427: IF (Fnd_Log.level_error >= Fnd_Log.g_current_runtime_level)
7430: 'csd.plsql.csd_repair_estimate_pvt.update_estimate_header',
7431: 'EXC_ERROR[' || x_msg_data || ']');
7432: END IF;
7433:
7434: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
7435: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
7436: ROLLBACK TO UPDATE_ESTIMATE_HEADER_PVT;
7437: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
7438: p_data => x_msg_data);
7431: 'EXC_ERROR[' || x_msg_data || ']');
7432: END IF;
7433:
7434: WHEN Fnd_Api.G_EXC_UNEXPECTED_ERROR THEN
7435: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
7436: ROLLBACK TO UPDATE_ESTIMATE_HEADER_PVT;
7437: Fnd_Msg_Pub.Count_And_Get(p_count => x_msg_count,
7438: p_data => x_msg_data);
7439: IF (Fnd_Log.level_exception >= Fnd_Log.g_current_runtime_level)
7442: 'csd.plsql.csd_repair_estimate_pvt.update_estimate_header',
7443: 'EXC_UNEXP_ERROR[' || x_msg_data || ']');
7444: END IF;
7445: WHEN OTHERS THEN
7446: x_return_status := Fnd_Api.G_RET_STS_UNEXP_ERROR;
7447: Rollback TO UPDATE_ESTIMATE_HEADER_PVT;
7448: IF Fnd_Msg_Pub.Check_Msg_Level(Fnd_Msg_Pub.G_MSG_LVL_UNEXP_ERROR)
7449: THEN
7450: Fnd_Msg_Pub.Add_Exc_Msg(G_PKG_NAME, l_api_name);
7816: -- Standard Start of API savepoint
7817: SAVEPOINT Import_Estimates_wip_sp;
7818:
7819: -- Standard call to check for call compatibility.
7820: IF NOT FND_API.Compatible_API_Call( lc_api_version,
7821: p_api_version,
7822: lc_api_name,
7823: G_PKG_NAME ) THEN
7824: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7820: IF NOT FND_API.Compatible_API_Call( lc_api_version,
7821: p_api_version,
7822: lc_api_name,
7823: G_PKG_NAME ) THEN
7824: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7825: END IF;
7826:
7827: -- Initialize message list if p_init_msg_list is set to TRUE.
7828: IF FND_API.to_Boolean( p_init_msg_list ) THEN
7824: RAISE FND_API.G_EXC_UNEXPECTED_ERROR;
7825: END IF;
7826:
7827: -- Initialize message list if p_init_msg_list is set to TRUE.
7828: IF FND_API.to_Boolean( p_init_msg_list ) THEN
7829: FND_MSG_PUB.initialize;
7830: END IF;
7831:
7832: -- logging
7861: 'p_organization_id: ' || p_organization_id);
7862: end if;
7863:
7864: -- Initialize API return status to success
7865: x_return_status := FND_API.G_RET_STS_SUCCESS;
7866:
7867: --
7868: -- Begin API Body
7869: --
7867: --
7868: -- Begin API Body
7869: --
7870:
7871: x_warning_flag := FND_API.G_FALSE;
7872:
7873: -- Validate mandatory input parameters.
7874: if (lc_proc_level >= lc_debug_level) then
7875: FND_LOG.STRING(lc_proc_level, lc_mod_name,
7977: FND_MESSAGE.SET_NAME( 'CSD', 'CSD_EST_DEFAULT_PL_IMPORT');
7978: -- Unable to determine default price list for the repair order.
7979: -- A default price list must be selected for the repair order to import estimate lines.
7980: FND_MSG_PUB.ADD;
7981: RAISE FND_API.G_EXC_ERROR;
7982: END IF;
7983:
7984: -- Log info messages for all the wip jobs that are shared with other
7985: -- repair orders.
8035: if (lc_stat_level >= lc_debug_level) then
8036: FND_LOG.STRING(lc_stat_level, lc_mod_name,'Calling CREATE_REPAIR_ESTIMATE');
8037: end if;
8038: CREATE_REPAIR_ESTIMATE(p_api_version =>1.0,
8039: p_commit => Fnd_Api.g_false,
8040: p_init_msg_list => Fnd_Api.g_false,
8041: p_validation_level => Fnd_Api.g_valid_level_full,
8042: x_estimate_rec => l_repair_estimate_rec,
8043: x_estimate_id => l_repair_estimate_id,
8036: FND_LOG.STRING(lc_stat_level, lc_mod_name,'Calling CREATE_REPAIR_ESTIMATE');
8037: end if;
8038: CREATE_REPAIR_ESTIMATE(p_api_version =>1.0,
8039: p_commit => Fnd_Api.g_false,
8040: p_init_msg_list => Fnd_Api.g_false,
8041: p_validation_level => Fnd_Api.g_valid_level_full,
8042: x_estimate_rec => l_repair_estimate_rec,
8043: x_estimate_id => l_repair_estimate_id,
8044: x_return_status => x_return_status,
8037: end if;
8038: CREATE_REPAIR_ESTIMATE(p_api_version =>1.0,
8039: p_commit => Fnd_Api.g_false,
8040: p_init_msg_list => Fnd_Api.g_false,
8041: p_validation_level => Fnd_Api.g_valid_level_full,
8042: x_estimate_rec => l_repair_estimate_rec,
8043: x_estimate_id => l_repair_estimate_id,
8044: x_return_status => x_return_status,
8045: x_msg_count => x_msg_count,
8043: x_estimate_id => l_repair_estimate_id,
8044: x_return_status => x_return_status,
8045: x_msg_count => x_msg_count,
8046: x_msg_data => x_msg_data);
8047: IF ( x_return_status <> FND_API.G_RET_STS_SUCCESS ) THEN
8048: if (lc_proc_level >= lc_debug_level) then
8049: FND_LOG.STRING(lc_proc_level, lc_mod_name,
8050: 'Unable to create repair estimate header for repair_line_id ' || p_repair_line_id);
8051: end if;
8048: if (lc_proc_level >= lc_debug_level) then
8049: FND_LOG.STRING(lc_proc_level, lc_mod_name,
8050: 'Unable to create repair estimate header for repair_line_id ' || p_repair_line_id);
8051: end if;
8052: RAISE FND_API.G_EXC_ERROR;
8053: END IF;
8054: -- swai: create_repair_estimate doesn't actually return header id in x_estimate_id,
8055: -- so get it from the record instead.
8056: l_repair_estimate_id := l_repair_estimate_rec.repair_estimate_id;
8067: end if;
8068: FND_MESSAGE.SET_NAME( 'CSD', 'CSD_GEN_EST_STATUS_ERR');
8069: FND_MESSAGE.set_token( 'STATUS', l_repair_estimate_status_name);
8070: FND_MSG_PUB.add_detail(p_message_type => FND_MSG_PUB.G_ERROR_MSG);
8071: RAISE FND_API.G_EXC_ERROR;
8072: ELSE
8073: -- found estimte header, so change status to DRAFT
8074: -- required fields
8075: l_repair_estimate_rec.repair_estimate_id := l_repair_estimate_id;
8083: if (lc_stat_level >= lc_debug_level) then
8084: FND_LOG.STRING(lc_stat_level, lc_mod_name,'Calling UPDATE_REPAIR_ESTIMATE');
8085: end if;
8086: UPDATE_REPAIR_ESTIMATE(p_api_version =>1.0,
8087: p_commit => Fnd_Api.g_false,
8088: p_init_msg_list => Fnd_Api.g_false,
8089: p_validation_level => Fnd_Api.g_valid_level_full,
8090: x_estimate_rec => l_repair_estimate_rec,
8091: x_return_status => x_return_status,
8084: FND_LOG.STRING(lc_stat_level, lc_mod_name,'Calling UPDATE_REPAIR_ESTIMATE');
8085: end if;
8086: UPDATE_REPAIR_ESTIMATE(p_api_version =>1.0,
8087: p_commit => Fnd_Api.g_false,
8088: p_init_msg_list => Fnd_Api.g_false,
8089: p_validation_level => Fnd_Api.g_valid_level_full,
8090: x_estimate_rec => l_repair_estimate_rec,
8091: x_return_status => x_return_status,
8092: x_msg_count => x_msg_count,
8085: end if;
8086: UPDATE_REPAIR_ESTIMATE(p_api_version =>1.0,
8087: p_commit => Fnd_Api.g_false,
8088: p_init_msg_list => Fnd_Api.g_false,
8089: p_validation_level => Fnd_Api.g_valid_level_full,
8090: x_estimate_rec => l_repair_estimate_rec,
8091: x_return_status => x_return_status,
8092: x_msg_count => x_msg_count,
8093: x_msg_data => x_msg_data);
8090: x_estimate_rec => l_repair_estimate_rec,
8091: x_return_status => x_return_status,
8092: x_msg_count => x_msg_count,
8093: x_msg_data => x_msg_data);
8094: IF ( x_return_status <> FND_API.G_RET_STS_SUCCESS ) THEN
8095: if (lc_proc_level >= lc_debug_level) then
8096: FND_LOG.STRING(lc_proc_level, lc_mod_name,
8097: 'Unable to update repair estimate header for repair_line_id ' || p_repair_line_id);
8098: end if;
8095: if (lc_proc_level >= lc_debug_level) then
8096: FND_LOG.STRING(lc_proc_level, lc_mod_name,
8097: 'Unable to update repair estimate header for repair_line_id ' || p_repair_line_id);
8098: end if;
8099: RAISE FND_API.G_EXC_ERROR;
8100: END IF;
8101: if (lc_proc_level >= lc_debug_level) then
8102: FND_LOG.STRING(lc_proc_level, lc_mod_name,
8103: 'UPDATE_REPAIR_ESTIMATE returned l_repair_estimate_id='||l_repair_estimate_id);
8108: if (lc_stat_level >= lc_debug_level) then
8109: FND_LOG.STRING(lc_stat_level, lc_mod_name,'Calling DELETE_REPAIR_ESTIMATE_LINES');
8110: end if;
8111: DELETE_REPAIR_ESTIMATE_LINES(p_api_version =>1.0,
8112: p_commit => Fnd_Api.g_false,
8113: p_init_msg_list => Fnd_Api.g_false,
8114: p_validation_level => Fnd_Api.g_valid_level_full,
8115: p_estimate_line_id => curr_est_line_rec.repair_estimate_line_id,
8116: x_return_status => x_return_status,
8109: FND_LOG.STRING(lc_stat_level, lc_mod_name,'Calling DELETE_REPAIR_ESTIMATE_LINES');
8110: end if;
8111: DELETE_REPAIR_ESTIMATE_LINES(p_api_version =>1.0,
8112: p_commit => Fnd_Api.g_false,
8113: p_init_msg_list => Fnd_Api.g_false,
8114: p_validation_level => Fnd_Api.g_valid_level_full,
8115: p_estimate_line_id => curr_est_line_rec.repair_estimate_line_id,
8116: x_return_status => x_return_status,
8117: x_msg_count => x_msg_count,
8110: end if;
8111: DELETE_REPAIR_ESTIMATE_LINES(p_api_version =>1.0,
8112: p_commit => Fnd_Api.g_false,
8113: p_init_msg_list => Fnd_Api.g_false,
8114: p_validation_level => Fnd_Api.g_valid_level_full,
8115: p_estimate_line_id => curr_est_line_rec.repair_estimate_line_id,
8116: x_return_status => x_return_status,
8117: x_msg_count => x_msg_count,
8118: x_msg_data => x_msg_data);
8115: p_estimate_line_id => curr_est_line_rec.repair_estimate_line_id,
8116: x_return_status => x_return_status,
8117: x_msg_count => x_msg_count,
8118: x_msg_data => x_msg_data);
8119: IF ( x_return_status <> FND_API.G_RET_STS_SUCCESS ) THEN
8120: if (lc_proc_level >= lc_debug_level) then
8121: FND_LOG.STRING(lc_proc_level, lc_mod_name,
8122: 'Unable to delete repair estimate line ' || curr_est_line_rec.repair_estimate_line_id);
8123: end if;
8120: if (lc_proc_level >= lc_debug_level) then
8121: FND_LOG.STRING(lc_proc_level, lc_mod_name,
8122: 'Unable to delete repair estimate line ' || curr_est_line_rec.repair_estimate_line_id);
8123: end if;
8124: RAISE FND_API.G_EXC_ERROR;
8125: END IF;
8126: if (lc_proc_level >= lc_debug_level) then
8127: FND_LOG.STRING(lc_proc_level, lc_mod_name,
8128: 'Returned from DELETE_REPAIR_ESTIMATE_LINES');
8152:
8153: DECLARE
8154: l_estimate_lines_tbl CSD_REPAIR_ESTIMATE_PVT.REPAIR_ESTIMATE_LINE_TBL;
8155: l_Estimates_count NUMBER := 0;
8156: l_return_status VARCHAR2(1) := FND_API.G_RET_STS_SUCCESS;
8157: l_msg_count NUMBER;
8158: l_msg_data VARCHAR2(200);
8159:
8160: BEGIN
8436: FND_LOG.STRING(lc_stat_level, lc_mod_name,
8437: 'index = ' || TO_CHAR( i ));
8438: end if;
8439: CSD_REPAIR_ESTIMATE_PVT.create_repair_estimate_lines( p_api_version => 1.0,
8440: p_commit => FND_API.G_FALSE,
8441: p_init_msg_list => FND_API.G_FALSE,
8442: p_validation_level => 0,
8443: x_estimate_line_rec => l_estimate_lines_tbl( i ),
8444: x_estimate_line_id => l_estimate_lines_tbl( i ).repair_estimate_line_id,
8437: 'index = ' || TO_CHAR( i ));
8438: end if;
8439: CSD_REPAIR_ESTIMATE_PVT.create_repair_estimate_lines( p_api_version => 1.0,
8440: p_commit => FND_API.G_FALSE,
8441: p_init_msg_list => FND_API.G_FALSE,
8442: p_validation_level => 0,
8443: x_estimate_line_rec => l_estimate_lines_tbl( i ),
8444: x_estimate_line_id => l_estimate_lines_tbl( i ).repair_estimate_line_id,
8445: x_return_status => l_return_status,
8445: x_return_status => l_return_status,
8446: x_msg_count => l_msg_count,
8447: x_msg_data => l_msg_data );
8448:
8449: IF ( l_return_status <> FND_API.G_RET_STS_SUCCESS ) THEN
8450: if (lc_proc_level >= lc_debug_level) then
8451: FND_LOG.STRING(lc_proc_level, lc_mod_name,
8452: 'Unable to create repair estimate lines for index = ' || i);
8453: end if;
8451: FND_LOG.STRING(lc_proc_level, lc_mod_name,
8452: 'Unable to create repair estimate lines for index = ' || i);
8453: end if;
8454: -- swai: do not raise exception. Flag as warning and process the next line.
8455: -- RAISE FND_API.G_EXC_ERROR;
8456: x_warning_flag := FND_API.G_TRUE;
8457: -- Add an ERROR message.
8458: -- An error encountered while creating an estimate line for item $ITEM
8459: FND_MESSAGE.SET_NAME( 'CSD', 'CSD_EST_LINE_CREATED_ERR');
8452: 'Unable to create repair estimate lines for index = ' || i);
8453: end if;
8454: -- swai: do not raise exception. Flag as warning and process the next line.
8455: -- RAISE FND_API.G_EXC_ERROR;
8456: x_warning_flag := FND_API.G_TRUE;
8457: -- Add an ERROR message.
8458: -- An error encountered while creating an estimate line for item $ITEM
8459: FND_MESSAGE.SET_NAME( 'CSD', 'CSD_EST_LINE_CREATED_ERR');
8460: FND_MESSAGE.set_token( 'ITEM', l_estimate_lines_tbl( i ).inventory_item_id );
8466: 'Estimate line created:' || l_estimate_lines_tbl( i ).repair_estimate_line_id);
8467: end if;
8468: END IF;
8469: EXCEPTION
8470: WHEN FND_API.G_EXC_ERROR THEN
8471: x_warning_flag := FND_API.G_TRUE;
8472: -- Add an ERROR message.
8473: -- An error encountered while creating Estimate line $INDEX for inventory item $INV_ITEM_ID
8474: FND_MESSAGE.SET_NAME( 'CSD', 'CSD_EST_LINE_CREATED_ERR');
8467: end if;
8468: END IF;
8469: EXCEPTION
8470: WHEN FND_API.G_EXC_ERROR THEN
8471: x_warning_flag := FND_API.G_TRUE;
8472: -- Add an ERROR message.
8473: -- An error encountered while creating Estimate line $INDEX for inventory item $INV_ITEM_ID
8474: FND_MESSAGE.SET_NAME( 'CSD', 'CSD_EST_LINE_CREATED_ERR');
8475: FND_MESSAGE.set_token( 'ITEM', l_estimate_lines_tbl( i ).inventory_item_id );
8481: FND_LOG.STRING(lc_proc_level, lc_mod_name,
8482: 'End of loop for creating estimate lines. l_Estimates_count = ' || l_Estimates_count);
8483: end if;
8484:
8485: IF ( x_warning_flag <> FND_API.G_FALSE ) THEN
8486: -- Import for the WIP Job $JOB_NAME completed with warnings.
8487: -- $ESTIMATE_LINE_COUNT new repair estimate line(s) were created for the job.
8488: FND_MESSAGE.SET_NAME( 'CSD', 'CSD_EST_WIP_IMPORT_W_WARN' );
8489: FND_MESSAGE.set_token( 'JOB_NAME', curr_WIP_job_rec.JOB_NAME );
8500: -- If there is an error for a specific WIP Job then we
8501: -- do not consider it be a fatal error. We do not stop
8502: -- the process but continue with the next WIP job
8503:
8504: WHEN FND_API.G_EXC_ERROR THEN
8505: x_warning_flag := FND_API.G_TRUE;
8506:
8507: -- Add an ERROR message.
8508: FND_MESSAGE.SET_NAME( 'CSD', 'CSD_EST_WIP_IMPORT_ERROR');
8501: -- do not consider it be a fatal error. We do not stop
8502: -- the process but continue with the next WIP job
8503:
8504: WHEN FND_API.G_EXC_ERROR THEN
8505: x_warning_flag := FND_API.G_TRUE;
8506:
8507: -- Add an ERROR message.
8508: FND_MESSAGE.SET_NAME( 'CSD', 'CSD_EST_WIP_IMPORT_ERROR');
8509: -- An error encountered while importing WIP lines into Estimates for the WIP entity - $JOB_NAME.
8511: FND_MSG_PUB.add_detail(p_message_type => FND_MSG_PUB.G_ERROR_MSG);
8512:
8513: WHEN OTHERS THEN
8514: ROLLBACK TO curr_wip_job_sp;
8515: x_warning_flag := FND_API.G_TRUE;
8516:
8517: if (lc_proc_level >= lc_debug_level) then
8518: FND_LOG.STRING(lc_proc_level, lc_mod_name,
8519: 'Encountered an OTHERS error while creating a repair estimate lines ' ||
8539: 'End LOOP c_eligible_WIP_Jobs');
8540: end if;
8541:
8542: IF( l_wip_count <= 0 ) THEN
8543: x_warning_flag := FND_API.G_TRUE;
8544: FND_MESSAGE.SET_NAME( 'CSD', 'CSD_EST_NO_INELIGIBLE_WIP');
8545: -- No eligible WIP jobs found for import
8546: -- FND_MSG_PUB.add_detail(p_message_type => FND_MSG_PUB.G_INFORMATION_MSG);
8547: -- FND_MSG_PUB.add_detail(p_message_type => FND_MSG_PUB.G_WARNING_MSG);
8548: FND_MSG_PUB.add;
8549:
8550: -- if no lines were imported, then raise an error so we can rollback and save
8551: -- any pre-existing lines from being deleted/archived.
8552: RAISE FND_API.G_EXC_ERROR;
8553: END IF;
8554:
8555: IF( l_total_estimates_lines <= 0 ) THEN
8556: x_warning_flag := FND_API.G_TRUE;
8552: RAISE FND_API.G_EXC_ERROR;
8553: END IF;
8554:
8555: IF( l_total_estimates_lines <= 0 ) THEN
8556: x_warning_flag := FND_API.G_TRUE;
8557: FND_MESSAGE.SET_NAME( 'CSD', 'CSD_EST_NO_LINES_ELIGIBLE_WIP');
8558: FND_MSG_PUB.add;
8559:
8560: -- if no lines were imported, then raise an error so we can rollback and save
8558: FND_MSG_PUB.add;
8559:
8560: -- if no lines were imported, then raise an error so we can rollback and save
8561: -- any pre-existing lines from being deleted/archived.
8562: RAISE FND_API.G_EXC_ERROR;
8563: END IF;
8564:
8565: --
8566: -- End API Body
8566: -- End API Body
8567: --
8568:
8569: -- Standard check of p_commit.
8570: IF FND_API.To_Boolean( p_commit ) THEN
8571: COMMIT WORK;
8572: END IF;
8573:
8574: -- logging
8577: 'Leaving CSD_REPAIR_ESTIMATE_PVT.IMPORT_ESTIMATES_FROM_WIP');
8578: end if;
8579:
8580: EXCEPTION
8581: WHEN FND_API.G_EXC_ERROR THEN
8582: x_return_status := FND_API.G_RET_STS_ERROR;
8583: ROLLBACK TO Import_Estimates_wip_sp;
8584: FND_MSG_PUB.Count_And_Get( p_count => x_msg_count,
8585: p_data => x_msg_data );
8578: end if;
8579:
8580: EXCEPTION
8581: WHEN FND_API.G_EXC_ERROR THEN
8582: x_return_status := FND_API.G_RET_STS_ERROR;
8583: ROLLBACK TO Import_Estimates_wip_sp;
8584: FND_MSG_PUB.Count_And_Get( p_count => x_msg_count,
8585: p_data => x_msg_data );
8586:
8589: FND_LOG.STRING(lc_excep_level, lc_mod_name,
8590: 'EXC_ERROR['||x_msg_data||']');
8591: END IF;
8592:
8593: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
8594: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
8595: ROLLBACK TO Import_Estimates_wip_sp;
8596: FND_MSG_PUB.Count_And_Get( p_count => x_msg_count,
8597: p_data => x_msg_data );
8590: 'EXC_ERROR['||x_msg_data||']');
8591: END IF;
8592:
8593: WHEN FND_API.G_EXC_UNEXPECTED_ERROR THEN
8594: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
8595: ROLLBACK TO Import_Estimates_wip_sp;
8596: FND_MSG_PUB.Count_And_Get( p_count => x_msg_count,
8597: p_data => x_msg_data );
8598:
8602: 'EXC_UNEXPECTED_ERROR['||x_msg_data||']');
8603: END IF;
8604:
8605: WHEN OTHERS THEN
8606: x_return_status := FND_API.G_RET_STS_UNEXP_ERROR;
8607: ROLLBACK TO Import_Estimates_wip_sp;
8608:
8609: IF FND_MSG_PUB.Check_Msg_Level( FND_MSG_PUB.G_MSG_LVL_UNEXP_ERROR ) THEN
8610: FND_MSG_PUB.Add_Exc_Msg( G_PKG_NAME, lc_api_name );