82:
83: BEGIN
84:
85: -- If Actuals are passed, then Trip has to be Queried based on the passed Actuals
86: IF NVL(p_actual_start_date, fnd_api.g_miss_date) <> fnd_api.g_miss_date THEN
87: l_new_start_date := p_actual_start_date;
88: l_new_end_date := p_actual_end_date;
89:
90: IF NVL(l_new_end_date, fnd_api.g_miss_date) = fnd_api.g_miss_date
86: IF NVL(p_actual_start_date, fnd_api.g_miss_date) <> fnd_api.g_miss_date THEN
87: l_new_start_date := p_actual_start_date;
88: l_new_end_date := p_actual_end_date;
89:
90: IF NVL(l_new_end_date, fnd_api.g_miss_date) = fnd_api.g_miss_date
91: AND NVL(p_actual_effort, fnd_api.g_miss_num) <> fnd_api.g_miss_num
92: THEN
93: l_new_end_date := l_new_start_date
94: + csf_util_pvt.convert_to_minutes(
87: l_new_start_date := p_actual_start_date;
88: l_new_end_date := p_actual_end_date;
89:
90: IF NVL(l_new_end_date, fnd_api.g_miss_date) = fnd_api.g_miss_date
91: AND NVL(p_actual_effort, fnd_api.g_miss_num) <> fnd_api.g_miss_num
92: THEN
93: l_new_end_date := l_new_start_date
94: + csf_util_pvt.convert_to_minutes(
95: p_actual_effort
120: END IF;
121: END IF;
122:
123: -- If the Caller wants to treat the given Old Trip Id as the Old Trip Id, then change it in our DataStructure.
124: IF NVL(p_old_trip_id, fnd_api.g_miss_num) <> fnd_api.g_miss_num
125: AND NVL(p_old_trip_ovn, fnd_api.g_miss_num) <> fnd_api.g_miss_num
126: THEN
127: l_task_info.old_trip_id := p_old_trip_id;
128: l_task_info.old_trip_ovn := p_old_trip_id;
121: END IF;
122:
123: -- If the Caller wants to treat the given Old Trip Id as the Old Trip Id, then change it in our DataStructure.
124: IF NVL(p_old_trip_id, fnd_api.g_miss_num) <> fnd_api.g_miss_num
125: AND NVL(p_old_trip_ovn, fnd_api.g_miss_num) <> fnd_api.g_miss_num
126: THEN
127: l_task_info.old_trip_id := p_old_trip_id;
128: l_task_info.old_trip_ovn := p_old_trip_id;
129: END IF;
128: l_task_info.old_trip_ovn := p_old_trip_id;
129: END IF;
130:
131: -- If the Caller wants to treat the given Old Trip Id as the Old Trip Id, then change it in our DataStructure.
132: IF NVL(p_resource_id, fnd_api.g_miss_num) <> fnd_api.g_miss_num
133: THEN
134: l_task_info.resource_id := p_resource_id;
135: l_task_info.resource_type_code := p_resource_type_code;
136: END IF;
136: END IF;
137:
138: csf_trips_pub.find_trip(
139: p_api_version => 1
140: , p_init_msg_list => fnd_api.g_false
141: , x_return_status => x_return_status
142: , x_msg_data => x_msg_data
143: , x_msg_count => x_msg_count
144: , p_resource_id => l_task_info.resource_id
144: , p_resource_id => l_task_info.resource_id
145: , p_resource_type => l_task_info.resource_type_code
146: , p_start_date_time => l_new_start_date
147: , p_end_date_time => l_new_end_date
148: , p_overtime_flag => fnd_api.g_true
149: , x_trip => l_trip
150: );
151:
152: -- Error would be returned only if there are no trips or multiple trips
150: );
151:
152: -- Error would be returned only if there are no trips or multiple trips
153: -- found. We should continue in those cases.
154: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
155: RAISE fnd_api.g_exc_unexpected_error;
156: END IF;
157:
158: IF l_new_start_date IS NULL THEN
151:
152: -- Error would be returned only if there are no trips or multiple trips
153: -- found. We should continue in those cases.
154: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
155: RAISE fnd_api.g_exc_unexpected_error;
156: END IF;
157:
158: IF l_new_start_date IS NULL THEN
159: -- Start Date is NULL. That means there is no timings. Clear the Trip Id
194:
195: IF l_task_info.old_trip_id <> NVL(l_trip.trip_id, -999) THEN
196: csf_trips_pub.update_trip(
197: p_api_version => 1
198: , p_init_msg_list => fnd_api.g_false
199: , x_return_status => x_return_status
200: , x_msg_data => x_msg_data
201: , x_msg_count => x_msg_count
202: , p_trip_id => l_task_info.old_trip_id
203: , p_object_version_number => l_task_info.old_trip_ovn
204: , p_upd_available_hours => l_old_booked_time
205: );
206:
207: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
208: RAISE fnd_api.g_exc_unexpected_error;
209: ELSIF x_return_status = fnd_api.g_ret_sts_error THEN
210: RAISE fnd_api.g_exc_error;
211: END IF;
204: , p_upd_available_hours => l_old_booked_time
205: );
206:
207: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
208: RAISE fnd_api.g_exc_unexpected_error;
209: ELSIF x_return_status = fnd_api.g_ret_sts_error THEN
210: RAISE fnd_api.g_exc_error;
211: END IF;
212:
205: );
206:
207: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
208: RAISE fnd_api.g_exc_unexpected_error;
209: ELSIF x_return_status = fnd_api.g_ret_sts_error THEN
210: RAISE fnd_api.g_exc_error;
211: END IF;
212:
213: l_old_booked_time := 0; -- Clear it so that it doesnt affect the new trip
206:
207: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
208: RAISE fnd_api.g_exc_unexpected_error;
209: ELSIF x_return_status = fnd_api.g_ret_sts_error THEN
210: RAISE fnd_api.g_exc_error;
211: END IF;
212:
213: l_old_booked_time := 0; -- Clear it so that it doesnt affect the new trip
214: END IF;
216:
217: --
218: -- Determine whether we have to update the availability of the New Trip
219: --
220: IF NVL(l_trip.trip_id, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
221: l_travel_time := 0;
222: IF NVL(p_actual_travel_duration, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
223: l_travel_time := csf_util_pvt.convert_to_minutes(p_actual_travel_duration, p_actual_travel_duration_uom);
224: ELSIF NVL(p_sched_travel_duration, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
218: -- Determine whether we have to update the availability of the New Trip
219: --
220: IF NVL(l_trip.trip_id, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
221: l_travel_time := 0;
222: IF NVL(p_actual_travel_duration, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
223: l_travel_time := csf_util_pvt.convert_to_minutes(p_actual_travel_duration, p_actual_travel_duration_uom);
224: ELSIF NVL(p_sched_travel_duration, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
225: l_travel_time := csf_util_pvt.convert_to_minutes(p_sched_travel_duration, p_sched_travel_duration);
226: ELSIF NVL(l_task_info.actual_travel_duration, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
220: IF NVL(l_trip.trip_id, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
221: l_travel_time := 0;
222: IF NVL(p_actual_travel_duration, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
223: l_travel_time := csf_util_pvt.convert_to_minutes(p_actual_travel_duration, p_actual_travel_duration_uom);
224: ELSIF NVL(p_sched_travel_duration, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
225: l_travel_time := csf_util_pvt.convert_to_minutes(p_sched_travel_duration, p_sched_travel_duration);
226: ELSIF NVL(l_task_info.actual_travel_duration, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
227: l_travel_time := l_task_info.actual_travel_duration;
228: ELSIF NVL(l_task_info.sched_travel_duration, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
222: IF NVL(p_actual_travel_duration, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
223: l_travel_time := csf_util_pvt.convert_to_minutes(p_actual_travel_duration, p_actual_travel_duration_uom);
224: ELSIF NVL(p_sched_travel_duration, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
225: l_travel_time := csf_util_pvt.convert_to_minutes(p_sched_travel_duration, p_sched_travel_duration);
226: ELSIF NVL(l_task_info.actual_travel_duration, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
227: l_travel_time := l_task_info.actual_travel_duration;
228: ELSIF NVL(l_task_info.sched_travel_duration, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
229: l_travel_time := l_task_info.sched_travel_duration;
230: END IF;
224: ELSIF NVL(p_sched_travel_duration, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
225: l_travel_time := csf_util_pvt.convert_to_minutes(p_sched_travel_duration, p_sched_travel_duration);
226: ELSIF NVL(l_task_info.actual_travel_duration, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
227: l_travel_time := l_task_info.actual_travel_duration;
228: ELSIF NVL(l_task_info.sched_travel_duration, fnd_api.g_miss_num) <> fnd_api.g_miss_num THEN
229: l_travel_time := l_task_info.sched_travel_duration;
230: END IF;
231:
232: l_new_booked_time := (l_new_end_date - l_new_start_date) * 24 -- Scheduled Dates
235:
236: IF ROUND(l_new_booked_time, 5) <> 0 THEN
237: csf_trips_pub.update_trip(
238: p_api_version => 1
239: , p_init_msg_list => fnd_api.g_false
240: , x_return_status => x_return_status
241: , x_msg_data => x_msg_data
242: , x_msg_count => x_msg_count
243: , p_trip_id => l_trip.trip_id
243: , p_trip_id => l_trip.trip_id
244: , p_object_version_number => l_trip.object_version_number
245: , p_upd_available_hours => - l_new_booked_time
246: );
247: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
248: RAISE fnd_api.g_exc_unexpected_error;
249: ELSIF x_return_status = fnd_api.g_ret_sts_error THEN
250: RAISE fnd_api.g_exc_error;
251: END IF;
244: , p_object_version_number => l_trip.object_version_number
245: , p_upd_available_hours => - l_new_booked_time
246: );
247: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
248: RAISE fnd_api.g_exc_unexpected_error;
249: ELSIF x_return_status = fnd_api.g_ret_sts_error THEN
250: RAISE fnd_api.g_exc_error;
251: END IF;
252: END IF;
245: , p_upd_available_hours => - l_new_booked_time
246: );
247: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
248: RAISE fnd_api.g_exc_unexpected_error;
249: ELSIF x_return_status = fnd_api.g_ret_sts_error THEN
250: RAISE fnd_api.g_exc_error;
251: END IF;
252: END IF;
253:
246: );
247: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
248: RAISE fnd_api.g_exc_unexpected_error;
249: ELSIF x_return_status = fnd_api.g_ret_sts_error THEN
250: RAISE fnd_api.g_exc_error;
251: END IF;
252: END IF;
253:
254: END IF;
254: END IF;
255:
256: x_trip_id := l_trip.trip_id;
257: EXCEPTION
258: WHEN fnd_api.g_exc_error THEN
259: x_trip_id := NULL;
260: x_return_status := fnd_api.g_ret_sts_error;
261: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
262: WHEN fnd_api.g_exc_unexpected_error THEN
256: x_trip_id := l_trip.trip_id;
257: EXCEPTION
258: WHEN fnd_api.g_exc_error THEN
259: x_trip_id := NULL;
260: x_return_status := fnd_api.g_ret_sts_error;
261: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
262: WHEN fnd_api.g_exc_unexpected_error THEN
263: x_trip_id := NULL;
264: x_return_status := fnd_api.g_ret_sts_unexp_error;
258: WHEN fnd_api.g_exc_error THEN
259: x_trip_id := NULL;
260: x_return_status := fnd_api.g_ret_sts_error;
261: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
262: WHEN fnd_api.g_exc_unexpected_error THEN
263: x_trip_id := NULL;
264: x_return_status := fnd_api.g_ret_sts_unexp_error;
265: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
266: WHEN OTHERS THEN
260: x_return_status := fnd_api.g_ret_sts_error;
261: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
262: WHEN fnd_api.g_exc_unexpected_error THEN
263: x_trip_id := NULL;
264: x_return_status := fnd_api.g_ret_sts_unexp_error;
265: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
266: WHEN OTHERS THEN
267: x_return_status := fnd_api.g_ret_sts_unexp_error;
268: x_trip_id := NULL;
263: x_trip_id := NULL;
264: x_return_status := fnd_api.g_ret_sts_unexp_error;
265: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
266: WHEN OTHERS THEN
267: x_return_status := fnd_api.g_ret_sts_unexp_error;
268: x_trip_id := NULL;
269: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
270: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
271: END IF;
329: l_task_info c_task_info%ROWTYPE;
330: l_scheduled_start DATE;
331: l_scheduled_end DATE;
332: BEGIN
333: x_return_status := fnd_api.g_ret_sts_success;
334:
335: OPEN c_task_info;
336: FETCH c_task_info INTO l_task_info;
337: CLOSE c_task_info;
340: -- or Rejected Assignments), then the new Status should be propagated to Task also
341: -- for both of them to be in Sync.
342: x_task_object_version_number := l_task_info.object_version_number;
343: x_task_status_id := l_task_info.task_status_id;
344: IF p_update_task IS NULL OR p_update_task = fnd_api.g_true THEN
345: IF l_task_info.other_ta_exists = 'N' AND l_task_info.task_status_id <> p_new_assignment_status_id THEN
346: x_task_status_id := p_new_assignment_status_id;
347:
348: -- The Task is going to be cancelled... Clear the Scheduled Dates
364: , p_task_status_id => x_task_status_id
365: , p_object_version_number => x_task_object_version_number
366: , p_scheduled_start_date => l_scheduled_start
367: , p_scheduled_end_date => l_scheduled_end
368: , p_enable_workflow => fnd_api.g_miss_char
369: , p_abort_workflow => fnd_api.g_miss_char
370: );
371:
372: IF x_return_status = fnd_api.g_ret_sts_error THEN
365: , p_object_version_number => x_task_object_version_number
366: , p_scheduled_start_date => l_scheduled_start
367: , p_scheduled_end_date => l_scheduled_end
368: , p_enable_workflow => fnd_api.g_miss_char
369: , p_abort_workflow => fnd_api.g_miss_char
370: );
371:
372: IF x_return_status = fnd_api.g_ret_sts_error THEN
373: RAISE fnd_api.g_exc_error;
368: , p_enable_workflow => fnd_api.g_miss_char
369: , p_abort_workflow => fnd_api.g_miss_char
370: );
371:
372: IF x_return_status = fnd_api.g_ret_sts_error THEN
373: RAISE fnd_api.g_exc_error;
374: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
375: RAISE fnd_api.g_exc_unexpected_error;
376: END IF;
369: , p_abort_workflow => fnd_api.g_miss_char
370: );
371:
372: IF x_return_status = fnd_api.g_ret_sts_error THEN
373: RAISE fnd_api.g_exc_error;
374: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
375: RAISE fnd_api.g_exc_unexpected_error;
376: END IF;
377: END IF;
370: );
371:
372: IF x_return_status = fnd_api.g_ret_sts_error THEN
373: RAISE fnd_api.g_exc_error;
374: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
375: RAISE fnd_api.g_exc_unexpected_error;
376: END IF;
377: END IF;
378:
371:
372: IF x_return_status = fnd_api.g_ret_sts_error THEN
373: RAISE fnd_api.g_exc_error;
374: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
375: RAISE fnd_api.g_exc_unexpected_error;
376: END IF;
377: END IF;
378:
379: -- update the Parent Task so that it is having the correct Scheduled Dates.
380: IF l_task_info.task_split_flag = 'D' THEN
381: -- Sync up the Parent and all the other Siblings
382: csf_tasks_pub.update_task_longer_than_shift(
383: p_api_version => 1.0
384: , p_init_msg_list => fnd_api.g_false
385: , p_commit => fnd_api.g_false
386: , x_return_status => x_return_status
387: , x_msg_count => x_msg_count
388: , x_msg_data => x_msg_data
381: -- Sync up the Parent and all the other Siblings
382: csf_tasks_pub.update_task_longer_than_shift(
383: p_api_version => 1.0
384: , p_init_msg_list => fnd_api.g_false
385: , p_commit => fnd_api.g_false
386: , x_return_status => x_return_status
387: , x_msg_count => x_msg_count
388: , x_msg_data => x_msg_data
389: , p_task_id => l_task_info.parent_task_id
389: , p_task_id => l_task_info.parent_task_id
390: , p_object_version_number => l_task_info.parent_task_ovn
391: , p_action => csf_tasks_pub.g_action_normal_to_parent
392: );
393: IF x_return_status = fnd_api.g_ret_sts_error THEN
394: RAISE fnd_api.g_exc_error;
395: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
396: RAISE fnd_api.g_exc_unexpected_error;
397: END IF;
390: , p_object_version_number => l_task_info.parent_task_ovn
391: , p_action => csf_tasks_pub.g_action_normal_to_parent
392: );
393: IF x_return_status = fnd_api.g_ret_sts_error THEN
394: RAISE fnd_api.g_exc_error;
395: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
396: RAISE fnd_api.g_exc_unexpected_error;
397: END IF;
398: END IF;
391: , p_action => csf_tasks_pub.g_action_normal_to_parent
392: );
393: IF x_return_status = fnd_api.g_ret_sts_error THEN
394: RAISE fnd_api.g_exc_error;
395: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
396: RAISE fnd_api.g_exc_unexpected_error;
397: END IF;
398: END IF;
399: END IF;
392: );
393: IF x_return_status = fnd_api.g_ret_sts_error THEN
394: RAISE fnd_api.g_exc_error;
395: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
396: RAISE fnd_api.g_exc_unexpected_error;
397: END IF;
398: END IF;
399: END IF;
400:
408: , x_return_status => x_return_status
409: , x_msg_count => x_msg_count
410: , x_msg_data => x_msg_data
411: );
412: IF x_return_status = fnd_api.g_ret_sts_error THEN
413: RAISE fnd_api.g_exc_error;
414: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
415: RAISE fnd_api.g_exc_unexpected_error;
416: END IF;
409: , x_msg_count => x_msg_count
410: , x_msg_data => x_msg_data
411: );
412: IF x_return_status = fnd_api.g_ret_sts_error THEN
413: RAISE fnd_api.g_exc_error;
414: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
415: RAISE fnd_api.g_exc_unexpected_error;
416: END IF;
417:
410: , x_msg_data => x_msg_data
411: );
412: IF x_return_status = fnd_api.g_ret_sts_error THEN
413: RAISE fnd_api.g_exc_error;
414: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
415: RAISE fnd_api.g_exc_unexpected_error;
416: END IF;
417:
418: -- Assignment was previously linked to a trip. Increase its Availability
411: );
412: IF x_return_status = fnd_api.g_ret_sts_error THEN
413: RAISE fnd_api.g_exc_error;
414: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
415: RAISE fnd_api.g_exc_unexpected_error;
416: END IF;
417:
418: -- Assignment was previously linked to a trip. Increase its Availability
419: IF l_task_info.trip_id IS NOT NULL THEN
430: , x_trip_id => l_task_info.trip_id
431: );
432:
433: -- Error out only when we have unexpected error.
434: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
435: RAISE fnd_api.g_exc_unexpected_error;
436: END IF;
437: END IF;
438: END IF;
431: );
432:
433: -- Error out only when we have unexpected error.
434: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
435: RAISE fnd_api.g_exc_unexpected_error;
436: END IF;
437: END IF;
438: END IF;
439: END propagate_status_change;
444: * If there exists any Cancelled Task Assignment for the Task with the given
445: * Resource Information, then that Task Assignment is reused rather than creating a
446: * new Task Assignment afresh.
447: *
448: * If the Trip ID corresponding to the Task Assignment is passed as FND_API.G_MISS_NUM
449: * then the user doesnt want to link the Assignment to any Trip. So the Trip ID will
450: * be saved as NULL corresponding to the Task Assignment.
451: * If Trip ID is passed as NULL or not passed at all, then the API will try to find a
452: * Trip corresponding to the Assignment. Since we are dependent on Trips Model, any
452: * Trip corresponding to the Assignment. Since we are dependent on Trips Model, any
453: * Assignment created for a Field Service Task should be linked to a Trip (based on
454: * Actual Date / Scheduled Dates). If there exists no Trip or there exists multiple trips,
455: * then the API will error out. If Assignment shouldnt be linked to any Trip, then
456: * Trip ID should be passed as FND_API.G_MISS_NUM.
457: *
458: * Except for Task ID, Resouce ID, Resource Type Code all other parameters are optional.
459: */
460: PROCEDURE create_task_assignment(
529: l_end_date DATE;
530: BEGIN
531: SAVEPOINT csf_create_task_assignment_pub;
532:
533: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
534: RAISE fnd_api.g_exc_unexpected_error;
535: END IF;
536:
537: IF fnd_api.to_boolean(p_init_msg_list) THEN
530: BEGIN
531: SAVEPOINT csf_create_task_assignment_pub;
532:
533: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
534: RAISE fnd_api.g_exc_unexpected_error;
535: END IF;
536:
537: IF fnd_api.to_boolean(p_init_msg_list) THEN
538: fnd_msg_pub.initialize;
533: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
534: RAISE fnd_api.g_exc_unexpected_error;
535: END IF;
536:
537: IF fnd_api.to_boolean(p_init_msg_list) THEN
538: fnd_msg_pub.initialize;
539: END IF;
540:
541: x_return_status := fnd_api.g_ret_sts_success;
537: IF fnd_api.to_boolean(p_init_msg_list) THEN
538: fnd_msg_pub.initialize;
539: END IF;
540:
541: x_return_status := fnd_api.g_ret_sts_success;
542: l_trip_id := p_object_capacity_id;
543:
544: IF (p_validation_level IS NULL OR p_validation_level = fnd_api.g_valid_level_full) THEN
545: -- Validate Field Service status flow
540:
541: x_return_status := fnd_api.g_ret_sts_success;
542: l_trip_id := p_object_capacity_id;
543:
544: IF (p_validation_level IS NULL OR p_validation_level = fnd_api.g_valid_level_full) THEN
545: -- Validate Field Service status flow
546: csf_tasks_pub.validate_status_change(NULL, p_assignment_status_id);
547:
548: -- Validate Trip ID passed. Trip ID has to a valid Trip given the Dates
546: csf_tasks_pub.validate_status_change(NULL, p_assignment_status_id);
547:
548: -- Validate Trip ID passed. Trip ID has to a valid Trip given the Dates
549: -- and Resource Critieria.
550: -- If FND_API.G_MISS_NUM, then the caller wants to make Trip ID as NULL in the DB.
551: IF l_trip_id = fnd_api.g_miss_num THEN
552: l_trip_id := NULL;
553: ELSE
554: update_trip_info(
547:
548: -- Validate Trip ID passed. Trip ID has to a valid Trip given the Dates
549: -- and Resource Critieria.
550: -- If FND_API.G_MISS_NUM, then the caller wants to make Trip ID as NULL in the DB.
551: IF l_trip_id = fnd_api.g_miss_num THEN
552: l_trip_id := NULL;
553: ELSE
554: update_trip_info(
555: x_return_status => x_return_status
568: , p_sched_travel_duration => p_sched_travel_duration
569: , p_sched_travel_duration_uom => p_sched_travel_duration_uom
570: , x_trip_id => l_trip_id
571: );
572: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
573: RAISE fnd_api.g_exc_unexpected_error;
574: END IF;
575: END IF;
576: END IF;
569: , p_sched_travel_duration_uom => p_sched_travel_duration_uom
570: , x_trip_id => l_trip_id
571: );
572: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
573: RAISE fnd_api.g_exc_unexpected_error;
574: END IF;
575: END IF;
576: END IF;
577:
585: x_task_assignment_id := l_cancelled_assignments.task_assignment_id;
586: update_task_assignment(
587: p_api_version => p_api_version
588: , p_init_msg_list => p_init_msg_list
589: , p_commit => fnd_api.g_false
590: , p_validation_level => fnd_api.g_valid_level_none
591: , x_return_status => x_return_status
592: , x_msg_count => x_msg_count
593: , x_msg_data => x_msg_data
586: update_task_assignment(
587: p_api_version => p_api_version
588: , p_init_msg_list => p_init_msg_list
589: , p_commit => fnd_api.g_false
590: , p_validation_level => fnd_api.g_valid_level_none
591: , x_return_status => x_return_status
592: , x_msg_count => x_msg_count
593: , x_msg_data => x_msg_data
594: , p_task_assignment_id => x_task_assignment_id
643: , p_device2_flag => p_device2_flag
644: , p_device3_flag => p_device3_flag
645: , p_resource_territory_id => p_resource_territory_id
646: , p_shift_construct_id => p_shift_construct_id
647: , p_enable_workflow => fnd_api.g_miss_char
648: , p_abort_workflow => fnd_api.g_miss_char
649: , x_task_assignment_id => x_task_assignment_id
650: );
651:
644: , p_device3_flag => p_device3_flag
645: , p_resource_territory_id => p_resource_territory_id
646: , p_shift_construct_id => p_shift_construct_id
647: , p_enable_workflow => fnd_api.g_miss_char
648: , p_abort_workflow => fnd_api.g_miss_char
649: , x_task_assignment_id => x_task_assignment_id
650: );
651:
652: IF x_return_status = fnd_api.g_ret_sts_error THEN
648: , p_abort_workflow => fnd_api.g_miss_char
649: , x_task_assignment_id => x_task_assignment_id
650: );
651:
652: IF x_return_status = fnd_api.g_ret_sts_error THEN
653: RAISE fnd_api.g_exc_error;
654: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
655: RAISE fnd_api.g_exc_unexpected_error;
656: END IF;
649: , x_task_assignment_id => x_task_assignment_id
650: );
651:
652: IF x_return_status = fnd_api.g_ret_sts_error THEN
653: RAISE fnd_api.g_exc_error;
654: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
655: RAISE fnd_api.g_exc_unexpected_error;
656: END IF;
657:
650: );
651:
652: IF x_return_status = fnd_api.g_ret_sts_error THEN
653: RAISE fnd_api.g_exc_error;
654: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
655: RAISE fnd_api.g_exc_unexpected_error;
656: END IF;
657:
658: OPEN c_assignment_info;
651:
652: IF x_return_status = fnd_api.g_ret_sts_error THEN
653: RAISE fnd_api.g_exc_error;
654: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
655: RAISE fnd_api.g_exc_unexpected_error;
656: END IF;
657:
658: OPEN c_assignment_info;
659: FETCH c_assignment_info INTO x_ta_object_version_number;
674: );
675: END IF;
676:
677: -- Standard check of p_commit
678: IF fnd_api.to_boolean(p_commit) THEN
679: COMMIT WORK;
680: END IF;
681: EXCEPTION
682: WHEN fnd_api.g_exc_error THEN
678: IF fnd_api.to_boolean(p_commit) THEN
679: COMMIT WORK;
680: END IF;
681: EXCEPTION
682: WHEN fnd_api.g_exc_error THEN
683: ROLLBACK TO csf_create_task_assignment_pub;
684: x_return_status := fnd_api.g_ret_sts_error;
685: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
686: WHEN fnd_api.g_exc_unexpected_error THEN
680: END IF;
681: EXCEPTION
682: WHEN fnd_api.g_exc_error THEN
683: ROLLBACK TO csf_create_task_assignment_pub;
684: x_return_status := fnd_api.g_ret_sts_error;
685: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
686: WHEN fnd_api.g_exc_unexpected_error THEN
687: ROLLBACK TO csf_create_task_assignment_pub;
688: x_return_status := fnd_api.g_ret_sts_unexp_error;
682: WHEN fnd_api.g_exc_error THEN
683: ROLLBACK TO csf_create_task_assignment_pub;
684: x_return_status := fnd_api.g_ret_sts_error;
685: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
686: WHEN fnd_api.g_exc_unexpected_error THEN
687: ROLLBACK TO csf_create_task_assignment_pub;
688: x_return_status := fnd_api.g_ret_sts_unexp_error;
689: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
690: WHEN OTHERS THEN
684: x_return_status := fnd_api.g_ret_sts_error;
685: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
686: WHEN fnd_api.g_exc_unexpected_error THEN
687: ROLLBACK TO csf_create_task_assignment_pub;
688: x_return_status := fnd_api.g_ret_sts_unexp_error;
689: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
690: WHEN OTHERS THEN
691: x_return_status := fnd_api.g_ret_sts_unexp_error;
692: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
687: ROLLBACK TO csf_create_task_assignment_pub;
688: x_return_status := fnd_api.g_ret_sts_unexp_error;
689: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
690: WHEN OTHERS THEN
691: x_return_status := fnd_api.g_ret_sts_unexp_error;
692: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
693: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
694: END IF;
695: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
702: * Given the Task Assignment ID and Task Object Version Number, it calls
703: * JTF Task Assignment API to update the Task Assignment with the new Attributes.
704: * It is actually a two step process
705: * 1. Updating the Task Assignment with the new Task Attributes except Status
706: * 2. Updating the Task Assignment with the new Task Status (if not FND_API.G_MISS_NUM)
707: * by calling UPDATE_ASSIGNMENT_STATUS.
708: *
709: * Because of the two step process, the returned Task Assignment Object
710: * Version Number might be incremented by 2 when user might have expected an
799: l_duration_uom VARCHAR2(3);
800: BEGIN
801: SAVEPOINT csf_update_task_assignment_pub;
802:
803: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
804: RAISE fnd_api.g_exc_unexpected_error;
805: END IF;
806:
807: IF fnd_api.to_boolean(p_init_msg_list) THEN
800: BEGIN
801: SAVEPOINT csf_update_task_assignment_pub;
802:
803: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
804: RAISE fnd_api.g_exc_unexpected_error;
805: END IF;
806:
807: IF fnd_api.to_boolean(p_init_msg_list) THEN
808: fnd_msg_pub.initialize;
803: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
804: RAISE fnd_api.g_exc_unexpected_error;
805: END IF;
806:
807: IF fnd_api.to_boolean(p_init_msg_list) THEN
808: fnd_msg_pub.initialize;
809: END IF;
810:
811: x_return_status := fnd_api.g_ret_sts_success;
807: IF fnd_api.to_boolean(p_init_msg_list) THEN
808: fnd_msg_pub.initialize;
809: END IF;
810:
811: x_return_status := fnd_api.g_ret_sts_success;
812:
813: -- Fetch the Task Assignment Information
814: OPEN c_task_assignment_info;
815: FETCH c_task_assignment_info INTO l_old_assignment_status_id, l_task_id;
817:
818: -- We require Task Id for computations. If the caller doesnt pass Task Id
819: -- lets retrieve it from JTF_TASK_ASSIGNMENTS. If the caller has indeeed
820: -- passed it, then use that value.
821: IF p_task_id <> fnd_api.g_miss_num AND p_task_id IS NOT NULL THEN
822: l_task_id := p_task_id;
823: END IF;
824:
825: l_trip_id := p_object_capacity_id;
829: l_distance := p_sched_travel_distance;
830: l_duration := p_sched_travel_duration;
831: l_duration_uom := p_sched_travel_duration_uom;
832: l_new_sts_cancelled_flag := 'N';
833: IF p_assignment_status_id <> fnd_api.g_miss_num THEN
834: OPEN c_task_status_info;
835: FETCH c_task_status_info INTO l_new_sts_cancelled_flag;
836: CLOSE c_task_status_info;
837:
842: l_trip_id := NULL;
843: END IF;
844: END IF;
845:
846: IF (p_validation_level IS NULL OR p_validation_level = fnd_api.g_valid_level_full) THEN
847:
848: -- Validate Field Service status flow
849: IF p_assignment_status_id <> fnd_api.g_miss_num
850: AND NVL(l_old_assignment_status_id, -1) <> NVL(p_assignment_status_id, -1)
845:
846: IF (p_validation_level IS NULL OR p_validation_level = fnd_api.g_valid_level_full) THEN
847:
848: -- Validate Field Service status flow
849: IF p_assignment_status_id <> fnd_api.g_miss_num
850: AND NVL(l_old_assignment_status_id, -1) <> NVL(p_assignment_status_id, -1)
851: THEN
852: csf_tasks_pub.validate_status_change(l_old_assignment_status_id, p_assignment_status_id);
853: END IF;
851: THEN
852: csf_tasks_pub.validate_status_change(l_old_assignment_status_id, p_assignment_status_id);
853: END IF;
854:
855: -- If Trip ID is passed as FND_API.G_MISS_NUM.. and Actuals are passed, we need to link
856: -- the Task Assignment to the correct Trip.
857: IF l_trip_id IS NOT NULL AND l_new_sts_cancelled_flag = 'N' THEN
858: update_trip_info(
859: x_return_status => x_return_status
872: , p_sched_travel_duration => p_sched_travel_duration
873: , p_sched_travel_duration_uom => p_sched_travel_duration_uom
874: , x_trip_id => l_trip_id
875: );
876: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
877: RAISE fnd_api.g_exc_unexpected_error;
878: END IF;
879: END IF;
880: END IF;
873: , p_sched_travel_duration_uom => p_sched_travel_duration_uom
874: , x_trip_id => l_trip_id
875: );
876: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
877: RAISE fnd_api.g_exc_unexpected_error;
878: END IF;
879: END IF;
880: END IF;
881:
936: , p_enable_workflow => p_enable_workflow
937: , p_abort_workflow => p_abort_workflow
938: );
939:
940: IF x_return_status = fnd_api.g_ret_sts_error THEN
941: RAISE fnd_api.g_exc_error;
942: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
943: RAISE fnd_api.g_exc_unexpected_error;
944: END IF;
937: , p_abort_workflow => p_abort_workflow
938: );
939:
940: IF x_return_status = fnd_api.g_ret_sts_error THEN
941: RAISE fnd_api.g_exc_error;
942: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
943: RAISE fnd_api.g_exc_unexpected_error;
944: END IF;
945:
938: );
939:
940: IF x_return_status = fnd_api.g_ret_sts_error THEN
941: RAISE fnd_api.g_exc_error;
942: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
943: RAISE fnd_api.g_exc_unexpected_error;
944: END IF;
945:
946: -- If Assignment Status is updated, then propagate the status to other objects
939:
940: IF x_return_status = fnd_api.g_ret_sts_error THEN
941: RAISE fnd_api.g_exc_error;
942: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
943: RAISE fnd_api.g_exc_unexpected_error;
944: END IF;
945:
946: -- If Assignment Status is updated, then propagate the status to other objects
947: IF p_assignment_status_id <> fnd_api.g_miss_num THEN
943: RAISE fnd_api.g_exc_unexpected_error;
944: END IF;
945:
946: -- If Assignment Status is updated, then propagate the status to other objects
947: IF p_assignment_status_id <> fnd_api.g_miss_num THEN
948: propagate_status_change(
949: x_return_status => x_return_status
950: , x_msg_count => x_msg_count
951: , x_msg_data => x_msg_data
956: , p_new_sts_cancelled_flag => l_new_sts_cancelled_flag
957: , x_task_object_version_number => x_task_object_version_number
958: , x_task_status_id => x_task_status_id
959: );
960: IF x_return_status = fnd_api.g_ret_sts_error THEN
961: RAISE fnd_api.g_exc_error;
962: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
963: RAISE fnd_api.g_exc_unexpected_error;
964: END IF;
957: , x_task_object_version_number => x_task_object_version_number
958: , x_task_status_id => x_task_status_id
959: );
960: IF x_return_status = fnd_api.g_ret_sts_error THEN
961: RAISE fnd_api.g_exc_error;
962: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
963: RAISE fnd_api.g_exc_unexpected_error;
964: END IF;
965: END IF;
958: , x_task_status_id => x_task_status_id
959: );
960: IF x_return_status = fnd_api.g_ret_sts_error THEN
961: RAISE fnd_api.g_exc_error;
962: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
963: RAISE fnd_api.g_exc_unexpected_error;
964: END IF;
965: END IF;
966:
959: );
960: IF x_return_status = fnd_api.g_ret_sts_error THEN
961: RAISE fnd_api.g_exc_error;
962: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
963: RAISE fnd_api.g_exc_unexpected_error;
964: END IF;
965: END IF;
966:
967: -- Standard check of p_commit
964: END IF;
965: END IF;
966:
967: -- Standard check of p_commit
968: IF fnd_api.to_boolean(p_commit) THEN
969: COMMIT WORK;
970: END IF;
971:
972: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
970: END IF;
971:
972: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
973: EXCEPTION
974: WHEN fnd_api.g_exc_error THEN
975: ROLLBACK TO csf_update_task_assignment_pub;
976: x_return_status := fnd_api.g_ret_sts_error;
977: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
978: WHEN fnd_api.g_exc_unexpected_error THEN
972: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
973: EXCEPTION
974: WHEN fnd_api.g_exc_error THEN
975: ROLLBACK TO csf_update_task_assignment_pub;
976: x_return_status := fnd_api.g_ret_sts_error;
977: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
978: WHEN fnd_api.g_exc_unexpected_error THEN
979: ROLLBACK TO csf_update_task_assignment_pub;
980: x_return_status := fnd_api.g_ret_sts_unexp_error;
974: WHEN fnd_api.g_exc_error THEN
975: ROLLBACK TO csf_update_task_assignment_pub;
976: x_return_status := fnd_api.g_ret_sts_error;
977: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
978: WHEN fnd_api.g_exc_unexpected_error THEN
979: ROLLBACK TO csf_update_task_assignment_pub;
980: x_return_status := fnd_api.g_ret_sts_unexp_error;
981: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
982: WHEN OTHERS THEN
976: x_return_status := fnd_api.g_ret_sts_error;
977: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
978: WHEN fnd_api.g_exc_unexpected_error THEN
979: ROLLBACK TO csf_update_task_assignment_pub;
980: x_return_status := fnd_api.g_ret_sts_unexp_error;
981: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
982: WHEN OTHERS THEN
983: x_return_status := fnd_api.g_ret_sts_unexp_error;
984: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
979: ROLLBACK TO csf_update_task_assignment_pub;
980: x_return_status := fnd_api.g_ret_sts_unexp_error;
981: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
982: WHEN OTHERS THEN
983: x_return_status := fnd_api.g_ret_sts_unexp_error;
984: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
985: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
986: END IF;
987: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1073: l_trip_id NUMBER;
1074: BEGIN
1075: SAVEPOINT csf_update_assign_status_pub;
1076:
1077: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1078: RAISE fnd_api.g_exc_unexpected_error;
1079: END IF;
1080:
1081: IF fnd_api.to_boolean(p_init_msg_list) THEN
1074: BEGIN
1075: SAVEPOINT csf_update_assign_status_pub;
1076:
1077: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1078: RAISE fnd_api.g_exc_unexpected_error;
1079: END IF;
1080:
1081: IF fnd_api.to_boolean(p_init_msg_list) THEN
1082: fnd_msg_pub.initialize;
1077: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1078: RAISE fnd_api.g_exc_unexpected_error;
1079: END IF;
1080:
1081: IF fnd_api.to_boolean(p_init_msg_list) THEN
1082: fnd_msg_pub.initialize;
1083: END IF;
1084:
1085: x_return_status := fnd_api.g_ret_sts_success;
1081: IF fnd_api.to_boolean(p_init_msg_list) THEN
1082: fnd_msg_pub.initialize;
1083: END IF;
1084:
1085: x_return_status := fnd_api.g_ret_sts_success;
1086:
1087: -- Check whether there is anything update in Assignment Status.
1088: IF p_assignment_status_id = fnd_api.g_miss_num THEN
1089: RETURN;
1084:
1085: x_return_status := fnd_api.g_ret_sts_success;
1086:
1087: -- Check whether there is anything update in Assignment Status.
1088: IF p_assignment_status_id = fnd_api.g_miss_num THEN
1089: RETURN;
1090: END IF;
1091:
1092: OPEN c_task_assignment_info;
1096: IF l_old_assignment_status_id = p_assignment_status_id THEN
1097: RETURN;
1098: END IF;
1099:
1100: IF (p_validation_level IS NULL OR p_validation_level = fnd_api.g_valid_level_full) THEN
1101: -- Validate Field Service status flow
1102: csf_tasks_pub.validate_status_change(l_old_assignment_status_id, p_assignment_status_id);
1103: END IF;
1104:
1132: , p_sched_travel_duration_uom => l_duration_uom
1133: , p_object_capacity_id => l_trip_id
1134: , p_show_on_calendar => p_show_on_calendar
1135: , p_category_id => NULL
1136: , p_enable_workflow => fnd_api.g_false
1137: , p_abort_workflow => fnd_api.g_false
1138: );
1139:
1140: IF x_return_status = fnd_api.g_ret_sts_error THEN
1133: , p_object_capacity_id => l_trip_id
1134: , p_show_on_calendar => p_show_on_calendar
1135: , p_category_id => NULL
1136: , p_enable_workflow => fnd_api.g_false
1137: , p_abort_workflow => fnd_api.g_false
1138: );
1139:
1140: IF x_return_status = fnd_api.g_ret_sts_error THEN
1141: RAISE fnd_api.g_exc_error;
1136: , p_enable_workflow => fnd_api.g_false
1137: , p_abort_workflow => fnd_api.g_false
1138: );
1139:
1140: IF x_return_status = fnd_api.g_ret_sts_error THEN
1141: RAISE fnd_api.g_exc_error;
1142: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1143: RAISE fnd_api.g_exc_unexpected_error;
1144: END IF;
1137: , p_abort_workflow => fnd_api.g_false
1138: );
1139:
1140: IF x_return_status = fnd_api.g_ret_sts_error THEN
1141: RAISE fnd_api.g_exc_error;
1142: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1143: RAISE fnd_api.g_exc_unexpected_error;
1144: END IF;
1145:
1138: );
1139:
1140: IF x_return_status = fnd_api.g_ret_sts_error THEN
1141: RAISE fnd_api.g_exc_error;
1142: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1143: RAISE fnd_api.g_exc_unexpected_error;
1144: END IF;
1145:
1146: -- Propagate the changes to Task, Parent Task, Child Tasks, Spares, etc.
1139:
1140: IF x_return_status = fnd_api.g_ret_sts_error THEN
1141: RAISE fnd_api.g_exc_error;
1142: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1143: RAISE fnd_api.g_exc_unexpected_error;
1144: END IF;
1145:
1146: -- Propagate the changes to Task, Parent Task, Child Tasks, Spares, etc.
1147: propagate_status_change(
1156: , x_task_object_version_number => x_task_object_version_number
1157: , x_task_status_id => x_task_status_id
1158: );
1159:
1160: IF x_return_status = fnd_api.g_ret_sts_error THEN
1161: RAISE fnd_api.g_exc_error;
1162: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1163: RAISE fnd_api.g_exc_unexpected_error;
1164: END IF;
1157: , x_task_status_id => x_task_status_id
1158: );
1159:
1160: IF x_return_status = fnd_api.g_ret_sts_error THEN
1161: RAISE fnd_api.g_exc_error;
1162: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1163: RAISE fnd_api.g_exc_unexpected_error;
1164: END IF;
1165:
1158: );
1159:
1160: IF x_return_status = fnd_api.g_ret_sts_error THEN
1161: RAISE fnd_api.g_exc_error;
1162: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1163: RAISE fnd_api.g_exc_unexpected_error;
1164: END IF;
1165:
1166: IF fnd_api.to_boolean(p_commit) THEN
1159:
1160: IF x_return_status = fnd_api.g_ret_sts_error THEN
1161: RAISE fnd_api.g_exc_error;
1162: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1163: RAISE fnd_api.g_exc_unexpected_error;
1164: END IF;
1165:
1166: IF fnd_api.to_boolean(p_commit) THEN
1167: COMMIT WORK;
1162: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1163: RAISE fnd_api.g_exc_unexpected_error;
1164: END IF;
1165:
1166: IF fnd_api.to_boolean(p_commit) THEN
1167: COMMIT WORK;
1168: END IF;
1169:
1170: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1168: END IF;
1169:
1170: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1171: EXCEPTION
1172: WHEN fnd_api.g_exc_error THEN
1173: ROLLBACK TO csf_update_assign_status_pub;
1174: x_return_status := fnd_api.g_ret_sts_error;
1175: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1176: WHEN fnd_api.g_exc_unexpected_error THEN
1170: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1171: EXCEPTION
1172: WHEN fnd_api.g_exc_error THEN
1173: ROLLBACK TO csf_update_assign_status_pub;
1174: x_return_status := fnd_api.g_ret_sts_error;
1175: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1176: WHEN fnd_api.g_exc_unexpected_error THEN
1177: ROLLBACK TO csf_update_assign_status_pub;
1178: x_return_status := fnd_api.g_ret_sts_unexp_error;
1172: WHEN fnd_api.g_exc_error THEN
1173: ROLLBACK TO csf_update_assign_status_pub;
1174: x_return_status := fnd_api.g_ret_sts_error;
1175: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1176: WHEN fnd_api.g_exc_unexpected_error THEN
1177: ROLLBACK TO csf_update_assign_status_pub;
1178: x_return_status := fnd_api.g_ret_sts_unexp_error;
1179: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1180: WHEN OTHERS THEN
1174: x_return_status := fnd_api.g_ret_sts_error;
1175: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1176: WHEN fnd_api.g_exc_unexpected_error THEN
1177: ROLLBACK TO csf_update_assign_status_pub;
1178: x_return_status := fnd_api.g_ret_sts_unexp_error;
1179: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1180: WHEN OTHERS THEN
1181: x_return_status := fnd_api.g_ret_sts_unexp_error;
1182: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
1177: ROLLBACK TO csf_update_assign_status_pub;
1178: x_return_status := fnd_api.g_ret_sts_unexp_error;
1179: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1180: WHEN OTHERS THEN
1181: x_return_status := fnd_api.g_ret_sts_unexp_error;
1182: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
1183: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
1184: END IF;
1185: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);