71:
72: BEGIN
73:
74: -- Standard call to check for call compatibility.
75: IF NOT fnd_api.compatible_api_call(
76: l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
77: RAISE fnd_api.g_exc_unexpected_error;
78: END IF;
79:
73:
74: -- Standard call to check for call compatibility.
75: IF NOT fnd_api.compatible_api_call(
76: l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
77: RAISE fnd_api.g_exc_unexpected_error;
78: END IF;
79:
80: -- Initialize message list if p_init_msg_list is set to TRUE.
81: IF fnd_api.to_boolean(p_init_msg_list) THEN
77: RAISE fnd_api.g_exc_unexpected_error;
78: END IF;
79:
80: -- Initialize message list if p_init_msg_list is set to TRUE.
81: IF fnd_api.to_boolean(p_init_msg_list) THEN
82: fnd_msg_pub.initialize;
83: END IF;
84:
85: -- Initialize API return status to success
82: fnd_msg_pub.initialize;
83: END IF;
84:
85: -- Initialize API return status to success
86: x_return_status := fnd_api.g_ret_sts_success;
87:
88: l_user_id := get_user_id(p_user_name);
89: IF l_user_id = -1 THEN
90: fnd_message.set_name('QA', 'QA_API_INVALID_USER');
88: l_user_id := get_user_id(p_user_name);
89: IF l_user_id = -1 THEN
90: fnd_message.set_name('QA', 'QA_API_INVALID_USER');
91: fnd_msg_pub.add();
92: raise fnd_api.g_exc_error;
93: END IF;
94:
95: UPDATE qa_device_data_values
96: SET event_data = p_device_data,
106: IF sql%rowcount = 0 THEN
107: fnd_message.set_name('QA', 'QA_DEV_INSERT_FAILED');
108: fnd_message.set_token('DEVNAME',p_device_name);
109: fnd_msg_pub.add();
110: raise fnd_api.g_exc_error;
111: END IF;
112:
113: IF fnd_api.to_boolean(p_commit) THEN
114: COMMIT;
109: fnd_msg_pub.add();
110: raise fnd_api.g_exc_error;
111: END IF;
112:
113: IF fnd_api.to_boolean(p_commit) THEN
114: COMMIT;
115: END IF;
116: EXCEPTION
117:
114: COMMIT;
115: END IF;
116: EXCEPTION
117:
118: WHEN fnd_api.g_exc_error THEN
119: x_return_status := fnd_api.g_ret_sts_error;
120: fnd_msg_pub.count_and_get(
121: p_count => x_msg_count,
122: p_data => x_msg_data
115: END IF;
116: EXCEPTION
117:
118: WHEN fnd_api.g_exc_error THEN
119: x_return_status := fnd_api.g_ret_sts_error;
120: fnd_msg_pub.count_and_get(
121: p_count => x_msg_count,
122: p_data => x_msg_data
123: );
121: p_count => x_msg_count,
122: p_data => x_msg_data
123: );
124:
125: WHEN fnd_api.g_exc_unexpected_error THEN
126: x_return_status := fnd_api.g_ret_sts_unexp_error;
127: fnd_msg_pub.count_and_get(
128: p_count => x_msg_count,
129: p_data => x_msg_data
122: p_data => x_msg_data
123: );
124:
125: WHEN fnd_api.g_exc_unexpected_error THEN
126: x_return_status := fnd_api.g_ret_sts_unexp_error;
127: fnd_msg_pub.count_and_get(
128: p_count => x_msg_count,
129: p_data => x_msg_data
130: );
132: WHEN others THEN
133: fnd_message.set_name('QA', 'QA_DEV_INSERT_FAILED');
134: fnd_message.set_token('DEVNAME',p_device_name);
135: fnd_msg_pub.add();
136: x_return_status := fnd_api.g_ret_sts_error;
137: fnd_msg_pub.count_and_get(
138: p_count => x_msg_count,
139: p_data => x_msg_data
140: );
166:
167: BEGIN
168:
169: -- Standard call to check for call compatibility.
170: IF NOT fnd_api.compatible_api_call(
171: l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
172: RAISE fnd_api.g_exc_unexpected_error;
173: END IF;
174:
168:
169: -- Standard call to check for call compatibility.
170: IF NOT fnd_api.compatible_api_call(
171: l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
172: RAISE fnd_api.g_exc_unexpected_error;
173: END IF;
174:
175: -- Initialize message list if p_init_msg_list is set to TRUE.
176: IF fnd_api.to_boolean(p_init_msg_list) THEN
172: RAISE fnd_api.g_exc_unexpected_error;
173: END IF;
174:
175: -- Initialize message list if p_init_msg_list is set to TRUE.
176: IF fnd_api.to_boolean(p_init_msg_list) THEN
177: fnd_msg_pub.initialize;
178: END IF;
179:
180: -- Initialize API return status to success
177: fnd_msg_pub.initialize;
178: END IF;
179:
180: -- Initialize API return status to success
181: x_return_status := fnd_api.g_ret_sts_success;
182:
183: l_user_id := get_user_id(p_user_name);
184: IF l_user_id = -1 THEN
185: fnd_message.set_name('QA', 'QA_API_INVALID_USER');
183: l_user_id := get_user_id(p_user_name);
184: IF l_user_id = -1 THEN
185: fnd_message.set_name('QA', 'QA_API_INVALID_USER');
186: fnd_msg_pub.add();
187: raise fnd_api.g_exc_error;
188: END IF;
189:
190: -- Check if data for all devices has been passed.
191: IF p_device_name.COUNT <> p_device_data.COUNT
192: OR p_device_name.COUNT <> p_device_event_time.COUNT
193: OR p_device_name.COUNT <> p_quality_code.COUNT THEN
194: fnd_message.set_name('QA', 'QA_DEV_INCOMPLETE_DATA');
195: fnd_msg_pub.add();
196: raise fnd_api.g_exc_error;
197: END IF;
198:
199: FORALL i IN p_device_name.FIRST..p_device_name.LAST SAVE EXCEPTIONS
200: UPDATE qa_device_data_values
218: END IF;
219: END IF;
220: END LOOP;
221:
222: IF fnd_api.to_boolean(p_commit) THEN
223: COMMIT;
224: END IF;
225:
226: IF l_err_device_names IS NOT NULL THEN
226: IF l_err_device_names IS NOT NULL THEN
227: fnd_message.set_name('QA', 'QA_DEV_INSERT_FAILED');
228: fnd_message.set_token('DEVNAME',l_err_device_names);
229: fnd_msg_pub.add();
230: raise fnd_api.g_exc_error;
231: END IF;
232: EXCEPTION
233:
234: WHEN fnd_api.g_exc_error THEN
230: raise fnd_api.g_exc_error;
231: END IF;
232: EXCEPTION
233:
234: WHEN fnd_api.g_exc_error THEN
235: x_return_status := fnd_api.g_ret_sts_error;
236: fnd_msg_pub.count_and_get(
237: p_count => x_msg_count,
238: p_data => x_msg_data
231: END IF;
232: EXCEPTION
233:
234: WHEN fnd_api.g_exc_error THEN
235: x_return_status := fnd_api.g_ret_sts_error;
236: fnd_msg_pub.count_and_get(
237: p_count => x_msg_count,
238: p_data => x_msg_data
239: );
237: p_count => x_msg_count,
238: p_data => x_msg_data
239: );
240:
241: WHEN fnd_api.g_exc_unexpected_error THEN
242: x_return_status := fnd_api.g_ret_sts_unexp_error;
243: fnd_msg_pub.count_and_get(
244: p_count => x_msg_count,
245: p_data => x_msg_data
238: p_data => x_msg_data
239: );
240:
241: WHEN fnd_api.g_exc_unexpected_error THEN
242: x_return_status := fnd_api.g_ret_sts_unexp_error;
243: fnd_msg_pub.count_and_get(
244: p_count => x_msg_count,
245: p_data => x_msg_data
246: );
255: END LOOP;
256: fnd_message.set_name('QA', 'QA_DEV_INSERT_FAILED');
257: fnd_message.set_token('DEVNAME',l_err_device_names);
258: fnd_msg_pub.add();
259: x_return_status := fnd_api.g_ret_sts_error;
260: fnd_msg_pub.count_and_get(
261: p_count => x_msg_count,
262: p_data => x_msg_data
263: );
285: exists_count NUMBER;
286: BEGIN
287:
288: -- Standard call to check for call compatibility.
289: IF NOT fnd_api.compatible_api_call(
290: l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
291: RAISE fnd_api.g_exc_unexpected_error;
292: END IF;
293:
287:
288: -- Standard call to check for call compatibility.
289: IF NOT fnd_api.compatible_api_call(
290: l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
291: RAISE fnd_api.g_exc_unexpected_error;
292: END IF;
293:
294: -- Initialize message list if p_init_msg_list is set to TRUE.
295: IF fnd_api.to_boolean(p_init_msg_list) THEN
291: RAISE fnd_api.g_exc_unexpected_error;
292: END IF;
293:
294: -- Initialize message list if p_init_msg_list is set to TRUE.
295: IF fnd_api.to_boolean(p_init_msg_list) THEN
296: fnd_msg_pub.initialize;
297: END IF;
298:
299: -- Initialize API return status to success
296: fnd_msg_pub.initialize;
297: END IF;
298:
299: -- Initialize API return status to success
300: x_return_status := fnd_api.g_ret_sts_success;
301:
302: l_user_id := get_user_id(p_user_name);
303: IF l_user_id = -1 THEN
304: fnd_message.set_name('QA', 'QA_API_INVALID_USER');
302: l_user_id := get_user_id(p_user_name);
303: IF l_user_id = -1 THEN
304: fnd_message.set_name('QA', 'QA_API_INVALID_USER');
305: fnd_msg_pub.add();
306: raise fnd_api.g_exc_error;
307: END IF;
308:
309: -- Check if data for all devices has been passed.
310: IF p_device_name.COUNT <> p_device_desc.COUNT OR p_device_name.COUNT <> p_expiration.COUNT THEN
309: -- Check if data for all devices has been passed.
310: IF p_device_name.COUNT <> p_device_desc.COUNT OR p_device_name.COUNT <> p_expiration.COUNT THEN
311: fnd_message.set_name('QA', 'QA_DEV_INCOMPLETE_DATA');
312: fnd_msg_pub.add();
313: raise fnd_api.g_exc_error;
314: END IF;
315:
316: --
317: -- Bug 7661085
400: END IF;
401: END LOOP;
402:
403:
404: IF fnd_api.to_boolean(p_commit) THEN
405: COMMIT;
406: END IF;
407:
408: EXCEPTION
406: END IF;
407:
408: EXCEPTION
409:
410: WHEN fnd_api.g_exc_error THEN
411: x_return_status := fnd_api.g_ret_sts_error;
412: fnd_msg_pub.count_and_get(
413: p_count => x_msg_count,
414: p_data => x_msg_data
407:
408: EXCEPTION
409:
410: WHEN fnd_api.g_exc_error THEN
411: x_return_status := fnd_api.g_ret_sts_error;
412: fnd_msg_pub.count_and_get(
413: p_count => x_msg_count,
414: p_data => x_msg_data
415: );
413: p_count => x_msg_count,
414: p_data => x_msg_data
415: );
416:
417: WHEN fnd_api.g_exc_unexpected_error THEN
418: x_return_status := fnd_api.g_ret_sts_unexp_error;
419: fnd_msg_pub.count_and_get(
420: p_count => x_msg_count,
421: p_data => x_msg_data
414: p_data => x_msg_data
415: );
416:
417: WHEN fnd_api.g_exc_unexpected_error THEN
418: x_return_status := fnd_api.g_ret_sts_unexp_error;
419: fnd_msg_pub.count_and_get(
420: p_count => x_msg_count,
421: p_data => x_msg_data
422: );
446:
447: BEGIN
448:
449: -- Standard call to check for call compatibility.
450: IF NOT fnd_api.compatible_api_call(
451: l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
452: RAISE fnd_api.g_exc_unexpected_error;
453: END IF;
454:
448:
449: -- Standard call to check for call compatibility.
450: IF NOT fnd_api.compatible_api_call(
451: l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
452: RAISE fnd_api.g_exc_unexpected_error;
453: END IF;
454:
455: -- Initialize message list if p_init_msg_list is set to TRUE.
456: IF fnd_api.to_boolean(p_init_msg_list) THEN
452: RAISE fnd_api.g_exc_unexpected_error;
453: END IF;
454:
455: -- Initialize message list if p_init_msg_list is set to TRUE.
456: IF fnd_api.to_boolean(p_init_msg_list) THEN
457: fnd_msg_pub.initialize;
458: END IF;
459:
460: -- Initialize API return status to success
457: fnd_msg_pub.initialize;
458: END IF;
459:
460: -- Initialize API return status to success
461: x_return_status := fnd_api.g_ret_sts_success;
462:
463: l_user_id := get_user_id(p_user_name);
464: IF l_user_id = -1 THEN
465: fnd_message.set_name('QA', 'QA_API_INVALID_USER');
463: l_user_id := get_user_id(p_user_name);
464: IF l_user_id = -1 THEN
465: fnd_message.set_name('QA', 'QA_API_INVALID_USER');
466: fnd_msg_pub.add();
467: raise fnd_api.g_exc_error;
468: END IF;
469:
470: --Disable all required devices
471: FORALL i IN p_device_name.FIRST..p_device_name.LAST SAVE EXCEPTIONS
482: DELETE FROM qa_device_data_values
483: WHERE device_name = p_device_name(i)
484: AND device_source = p_device_source;
485:
486: IF fnd_api.to_boolean(p_commit) THEN
487: COMMIT;
488: END IF;
489:
490: EXCEPTION
488: END IF;
489:
490: EXCEPTION
491:
492: WHEN fnd_api.g_exc_error THEN
493: x_return_status := fnd_api.g_ret_sts_error;
494: fnd_msg_pub.count_and_get(
495: p_count => x_msg_count,
496: p_data => x_msg_data
489:
490: EXCEPTION
491:
492: WHEN fnd_api.g_exc_error THEN
493: x_return_status := fnd_api.g_ret_sts_error;
494: fnd_msg_pub.count_and_get(
495: p_count => x_msg_count,
496: p_data => x_msg_data
497: );
495: p_count => x_msg_count,
496: p_data => x_msg_data
497: );
498:
499: WHEN fnd_api.g_exc_unexpected_error THEN
500: x_return_status := fnd_api.g_ret_sts_unexp_error;
501: fnd_msg_pub.count_and_get(
502: p_count => x_msg_count,
503: p_data => x_msg_data
496: p_data => x_msg_data
497: );
498:
499: WHEN fnd_api.g_exc_unexpected_error THEN
500: x_return_status := fnd_api.g_ret_sts_unexp_error;
501: fnd_msg_pub.count_and_get(
502: p_count => x_msg_count,
503: p_data => x_msg_data
504: );