103: l_address_info c_address_info%ROWTYPE;
104: l_locus_valid VARCHAR2(6);
105: l_geo_status_code hz_locations.geometry_status_code%TYPE;
106: BEGIN
107: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
108: RAISE fnd_api.g_exc_unexpected_error;
109: END IF;
110:
111: IF fnd_api.to_boolean(p_init_msg_list) THEN
104: l_locus_valid VARCHAR2(6);
105: l_geo_status_code hz_locations.geometry_status_code%TYPE;
106: BEGIN
107: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
108: RAISE fnd_api.g_exc_unexpected_error;
109: END IF;
110:
111: IF fnd_api.to_boolean(p_init_msg_list) THEN
112: fnd_msg_pub.initialize;
107: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
108: RAISE fnd_api.g_exc_unexpected_error;
109: END IF;
110:
111: IF fnd_api.to_boolean(p_init_msg_list) THEN
112: fnd_msg_pub.initialize;
113: END IF;
114:
115: x_return_status := fnd_api.g_ret_sts_success;
111: IF fnd_api.to_boolean(p_init_msg_list) THEN
112: fnd_msg_pub.initialize;
113: END IF;
114:
115: x_return_status := fnd_api.g_ret_sts_success;
116:
117: OPEN c_address_info;
118: FETCH c_address_info INTO l_address_info;
119: CLOSE c_address_info;
120:
121: -- The Task has no Address Information.
122: IF l_address_info.location_id IS NULL THEN
123: -- Need to throw with proper error message
124: RAISE fnd_api.g_exc_error;
125: END IF;
126:
127: l_geo_status_code := NVL(l_address_info.geometry_status_code, 'ERROR');
128:
144: -- Geocode of the Task is invalid. Try to Geocode the Task
145: IF l_locus_valid = 'FALSE' THEN
146: csf_resource_address_pvt.resolve_address(
147: p_api_version => 1
148: , p_init_msg_list => fnd_api.g_false
149: , x_return_status => x_return_status
150: , x_msg_count => x_msg_count
151: , x_msg_data => x_msg_data
152: , p_location_id => l_address_info.location_id
161: , p_country => l_address_info.country
162: , p_country_code => l_address_info.country_code
163: , x_geometry => l_address_info.geometry
164: );
165: IF x_return_status = fnd_api.g_ret_sts_error THEN
166: RAISE fnd_api.g_exc_error;
167: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
168: RAISE fnd_api.g_exc_unexpected_error;
169: END IF;
162: , p_country_code => l_address_info.country_code
163: , x_geometry => l_address_info.geometry
164: );
165: IF x_return_status = fnd_api.g_ret_sts_error THEN
166: RAISE fnd_api.g_exc_error;
167: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
168: RAISE fnd_api.g_exc_unexpected_error;
169: END IF;
170: END IF;
163: , x_geometry => l_address_info.geometry
164: );
165: IF x_return_status = fnd_api.g_ret_sts_error THEN
166: RAISE fnd_api.g_exc_error;
167: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
168: RAISE fnd_api.g_exc_unexpected_error;
169: END IF;
170: END IF;
171:
164: );
165: IF x_return_status = fnd_api.g_ret_sts_error THEN
166: RAISE fnd_api.g_exc_error;
167: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
168: RAISE fnd_api.g_exc_unexpected_error;
169: END IF;
170: END IF;
171:
172: IF x_return_status = fnd_api.g_ret_sts_success AND l_address_info.geometry IS NOT NULL THEN
168: RAISE fnd_api.g_exc_unexpected_error;
169: END IF;
170: END IF;
171:
172: IF x_return_status = fnd_api.g_ret_sts_success AND l_address_info.geometry IS NOT NULL THEN
173: x_locus_segment_id := csf_locus_pub.get_locus_segmentid(l_address_info.geometry);
174: x_locus_side := csf_locus_pub.get_locus_side(l_address_info.geometry);
175: x_locus_spot := csf_locus_pub.get_locus_spot(l_address_info.geometry);
176: x_locus_lat := csf_locus_pub.get_locus_lat(l_address_info.geometry);
179: x_location_id := l_address_info.location_id;
180: x_srid := csf_locus_pub.get_locus_srid(l_address_info.geometry);
181: x_country_code := l_address_info.country_code;
182:
183: IF fnd_api.to_boolean(p_commit) THEN
184: COMMIT;
185: END IF;
186: END IF;
187: EXCEPTION
184: COMMIT;
185: END IF;
186: END IF;
187: EXCEPTION
188: WHEN fnd_api.g_exc_error THEN
189: x_return_status := fnd_api.g_ret_sts_error;
190: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
191: WHEN fnd_api.g_exc_unexpected_error THEN
192: x_return_status := fnd_api.g_ret_sts_unexp_error;
185: END IF;
186: END IF;
187: EXCEPTION
188: WHEN fnd_api.g_exc_error THEN
189: x_return_status := fnd_api.g_ret_sts_error;
190: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
191: WHEN fnd_api.g_exc_unexpected_error THEN
192: x_return_status := fnd_api.g_ret_sts_unexp_error;
193: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
187: EXCEPTION
188: WHEN fnd_api.g_exc_error THEN
189: x_return_status := fnd_api.g_ret_sts_error;
190: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
191: WHEN fnd_api.g_exc_unexpected_error THEN
192: x_return_status := fnd_api.g_ret_sts_unexp_error;
193: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
194: WHEN OTHERS THEN
195: x_return_status := fnd_api.g_ret_sts_unexp_error;
188: WHEN fnd_api.g_exc_error THEN
189: x_return_status := fnd_api.g_ret_sts_error;
190: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
191: WHEN fnd_api.g_exc_unexpected_error THEN
192: x_return_status := fnd_api.g_ret_sts_unexp_error;
193: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
194: WHEN OTHERS THEN
195: x_return_status := fnd_api.g_ret_sts_unexp_error;
196: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
191: WHEN fnd_api.g_exc_unexpected_error THEN
192: x_return_status := fnd_api.g_ret_sts_unexp_error;
193: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
194: WHEN OTHERS THEN
195: x_return_status := fnd_api.g_ret_sts_unexp_error;
196: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
197: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
198: END IF;
199: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
312: , 'DD-MM-YYYY HH24:MI'
313: );
314:
315: hz_timezone_pub.get_time(p_api_version => 1
316: , p_init_msg_list => fnd_api.g_false
317: , x_return_status => l_return_status
318: , x_msg_count => l_msg_count
319: , x_msg_data => l_msg_data
320: , p_source_tz_id => p_timezone_id
397:
398: l_task_info c_task_info%ROWTYPE;
399:
400: BEGIN
401: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
402: RAISE fnd_api.g_exc_unexpected_error;
403: END IF;
404:
405: IF fnd_api.to_boolean(p_init_msg_list) THEN
398: l_task_info c_task_info%ROWTYPE;
399:
400: BEGIN
401: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
402: RAISE fnd_api.g_exc_unexpected_error;
403: END IF;
404:
405: IF fnd_api.to_boolean(p_init_msg_list) THEN
406: fnd_msg_pub.initialize;
401: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
402: RAISE fnd_api.g_exc_unexpected_error;
403: END IF;
404:
405: IF fnd_api.to_boolean(p_init_msg_list) THEN
406: fnd_msg_pub.initialize;
407: END IF;
408:
409: x_return_status := fnd_api.g_ret_sts_success;
405: IF fnd_api.to_boolean(p_init_msg_list) THEN
406: fnd_msg_pub.initialize;
407: END IF;
408:
409: x_return_status := fnd_api.g_ret_sts_success;
410:
411: -- Find the qualified resoucres for the task based on the given resoucer qualifiers
412:
413: OPEN c_task_info;
422: csf_tasks_pub.validate_planned_dates(l_task_info.planned_start_date, l_task_info.planned_end_date);
423:
424: csf_resource_pub.get_resources_to_schedule(
425: p_api_version => 1
426: , p_init_msg_list => fnd_api.g_false
427: , x_return_status => x_return_status
428: , x_msg_count => x_msg_count
429: , x_msg_data => x_msg_data
430: , p_scheduling_mode => 'X' -- Auto Assign mode
443: );
444:
445: -- Unless it is an Unexpected Error... continue even with
446: -- "No Resources Found" error. Java will do the proper error handling.
447: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
448: RAISE fnd_api.g_exc_unexpected_error;
449: END IF;
450:
451: -- Create Scheduler Search Request based on the given information.
444:
445: -- Unless it is an Unexpected Error... continue even with
446: -- "No Resources Found" error. Java will do the proper error handling.
447: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
448: RAISE fnd_api.g_exc_unexpected_error;
449: END IF;
450:
451: -- Create Scheduler Search Request based on the given information.
452: csf_requests_pvt.create_scheduler_request(
450:
451: -- Create Scheduler Search Request based on the given information.
452: csf_requests_pvt.create_scheduler_request(
453: p_api_version => 1
454: , p_init_msg_list => fnd_api.g_false
455: , p_commit => fnd_api.g_false
456: , x_return_status => x_return_status
457: , x_msg_count => x_msg_count
458: , x_msg_data => x_msg_data
451: -- Create Scheduler Search Request based on the given information.
452: csf_requests_pvt.create_scheduler_request(
453: p_api_version => 1
454: , p_init_msg_list => fnd_api.g_false
455: , p_commit => fnd_api.g_false
456: , x_return_status => x_return_status
457: , x_msg_count => x_msg_count
458: , x_msg_data => x_msg_data
459: , p_name => p_request_name
466: , p_standby_param => p_consider_standby_shifts
467: , x_request_id => x_request_id
468: );
469:
470: IF x_return_status = fnd_api.g_ret_sts_error THEN
471: RAISE fnd_api.g_exc_error;
472: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
473: RAISE fnd_api.g_exc_unexpected_error;
474: END IF;
467: , x_request_id => x_request_id
468: );
469:
470: IF x_return_status = fnd_api.g_ret_sts_error THEN
471: RAISE fnd_api.g_exc_error;
472: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
473: RAISE fnd_api.g_exc_unexpected_error;
474: END IF;
475:
468: );
469:
470: IF x_return_status = fnd_api.g_ret_sts_error THEN
471: RAISE fnd_api.g_exc_error;
472: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
473: RAISE fnd_api.g_exc_unexpected_error;
474: END IF;
475:
476: IF fnd_api.to_boolean(p_commit) THEN
469:
470: IF x_return_status = fnd_api.g_ret_sts_error THEN
471: RAISE fnd_api.g_exc_error;
472: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
473: RAISE fnd_api.g_exc_unexpected_error;
474: END IF;
475:
476: IF fnd_api.to_boolean(p_commit) THEN
477: COMMIT;
472: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
473: RAISE fnd_api.g_exc_unexpected_error;
474: END IF;
475:
476: IF fnd_api.to_boolean(p_commit) THEN
477: COMMIT;
478: END IF;
479:
480: EXCEPTION
477: COMMIT;
478: END IF;
479:
480: EXCEPTION
481: WHEN fnd_api.g_exc_error THEN
482: x_return_status := fnd_api.g_ret_sts_error;
483: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
484: WHEN fnd_api.g_exc_unexpected_error THEN
485: x_return_status := fnd_api.g_ret_sts_unexp_error;
478: END IF;
479:
480: EXCEPTION
481: WHEN fnd_api.g_exc_error THEN
482: x_return_status := fnd_api.g_ret_sts_error;
483: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
484: WHEN fnd_api.g_exc_unexpected_error THEN
485: x_return_status := fnd_api.g_ret_sts_unexp_error;
486: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
480: EXCEPTION
481: WHEN fnd_api.g_exc_error THEN
482: x_return_status := fnd_api.g_ret_sts_error;
483: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
484: WHEN fnd_api.g_exc_unexpected_error THEN
485: x_return_status := fnd_api.g_ret_sts_unexp_error;
486: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
487: WHEN OTHERS THEN
488: x_return_status := fnd_api.g_ret_sts_unexp_error;
481: WHEN fnd_api.g_exc_error THEN
482: x_return_status := fnd_api.g_ret_sts_error;
483: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
484: WHEN fnd_api.g_exc_unexpected_error THEN
485: x_return_status := fnd_api.g_ret_sts_unexp_error;
486: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
487: WHEN OTHERS THEN
488: x_return_status := fnd_api.g_ret_sts_unexp_error;
489: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
484: WHEN fnd_api.g_exc_unexpected_error THEN
485: x_return_status := fnd_api.g_ret_sts_unexp_error;
486: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
487: WHEN OTHERS THEN
488: x_return_status := fnd_api.g_ret_sts_unexp_error;
489: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
490: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
491: END IF;
492: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
523: ) IS
524: l_api_version CONSTANT NUMBER := 1.0;
525: l_api_name CONSTANT VARCHAR2(30) := 'CREATE_SCHEDULE_OPTION_REQUEST';
526: BEGIN
527: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
528: RAISE fnd_api.g_exc_unexpected_error;
529: END IF;
530:
531: IF fnd_api.to_boolean(p_init_msg_list) THEN
524: l_api_version CONSTANT NUMBER := 1.0;
525: l_api_name CONSTANT VARCHAR2(30) := 'CREATE_SCHEDULE_OPTION_REQUEST';
526: BEGIN
527: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
528: RAISE fnd_api.g_exc_unexpected_error;
529: END IF;
530:
531: IF fnd_api.to_boolean(p_init_msg_list) THEN
532: fnd_msg_pub.initialize;
527: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
528: RAISE fnd_api.g_exc_unexpected_error;
529: END IF;
530:
531: IF fnd_api.to_boolean(p_init_msg_list) THEN
532: fnd_msg_pub.initialize;
533: END IF;
534:
535: x_return_status := fnd_api.g_ret_sts_success;
531: IF fnd_api.to_boolean(p_init_msg_list) THEN
532: fnd_msg_pub.initialize;
533: END IF;
534:
535: x_return_status := fnd_api.g_ret_sts_success;
536:
537: csf_requests_pvt.create_scheduler_request(
538: p_api_version => 1
539: , x_return_status => x_return_status
545: , p_set_plan_task_confirmed => p_set_plan_task_confirmed
546: , x_request_id => x_request_id
547: );
548:
549: IF x_return_status = fnd_api.g_ret_sts_error THEN
550: RAISE fnd_api.g_exc_error;
551: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
552: RAISE fnd_api.g_exc_unexpected_error;
553: END IF;
546: , x_request_id => x_request_id
547: );
548:
549: IF x_return_status = fnd_api.g_ret_sts_error THEN
550: RAISE fnd_api.g_exc_error;
551: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
552: RAISE fnd_api.g_exc_unexpected_error;
553: END IF;
554:
547: );
548:
549: IF x_return_status = fnd_api.g_ret_sts_error THEN
550: RAISE fnd_api.g_exc_error;
551: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
552: RAISE fnd_api.g_exc_unexpected_error;
553: END IF;
554:
555: IF fnd_api.to_boolean(p_commit) THEN
548:
549: IF x_return_status = fnd_api.g_ret_sts_error THEN
550: RAISE fnd_api.g_exc_error;
551: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
552: RAISE fnd_api.g_exc_unexpected_error;
553: END IF;
554:
555: IF fnd_api.to_boolean(p_commit) THEN
556: COMMIT;
551: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
552: RAISE fnd_api.g_exc_unexpected_error;
553: END IF;
554:
555: IF fnd_api.to_boolean(p_commit) THEN
556: COMMIT;
557: END IF;
558:
559: EXCEPTION
556: COMMIT;
557: END IF;
558:
559: EXCEPTION
560: WHEN fnd_api.g_exc_error THEN
561: x_return_status := fnd_api.g_ret_sts_error;
562: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
563: WHEN fnd_api.g_exc_unexpected_error THEN
564: x_return_status := fnd_api.g_ret_sts_unexp_error;
557: END IF;
558:
559: EXCEPTION
560: WHEN fnd_api.g_exc_error THEN
561: x_return_status := fnd_api.g_ret_sts_error;
562: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
563: WHEN fnd_api.g_exc_unexpected_error THEN
564: x_return_status := fnd_api.g_ret_sts_unexp_error;
565: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
559: EXCEPTION
560: WHEN fnd_api.g_exc_error THEN
561: x_return_status := fnd_api.g_ret_sts_error;
562: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
563: WHEN fnd_api.g_exc_unexpected_error THEN
564: x_return_status := fnd_api.g_ret_sts_unexp_error;
565: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
566: WHEN OTHERS THEN
567: x_return_status := fnd_api.g_ret_sts_unexp_error;
560: WHEN fnd_api.g_exc_error THEN
561: x_return_status := fnd_api.g_ret_sts_error;
562: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
563: WHEN fnd_api.g_exc_unexpected_error THEN
564: x_return_status := fnd_api.g_ret_sts_unexp_error;
565: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
566: WHEN OTHERS THEN
567: x_return_status := fnd_api.g_ret_sts_unexp_error;
568: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
563: WHEN fnd_api.g_exc_unexpected_error THEN
564: x_return_status := fnd_api.g_ret_sts_unexp_error;
565: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
566: WHEN OTHERS THEN
567: x_return_status := fnd_api.g_ret_sts_unexp_error;
568: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
569: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
570: END IF;
571: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
575: x_return_status OUT NOCOPY VARCHAR2
576: , x_msg_count OUT NOCOPY NUMBER
577: , x_msg_data OUT NOCOPY VARCHAR2
578: , p_task_tbl IN csf_requests_pvt.object_tbl_type
579: , p_find_resources IN VARCHAR2 DEFAULT fnd_api.g_true
580: , x_request_id OUT NOCOPY NUMBER
581: ) IS
582: l_api_name CONSTANT VARCHAR2(30) := 'CREATE_AUTO_REQUEST';
583:
592: WHERE t.task_id = p_task_id;
593:
594: l_task_info c_task_info%ROWTYPE;
595: BEGIN
596: x_return_status := fnd_api.g_ret_sts_success;
597:
598:
599: IF p_task_tbl IS NULL OR p_task_tbl.COUNT <= 0 THEN
600: x_request_id := -1;
605: -- Create the SearchAndScheduleAuto Request which will serve as
606: -- the Parent Request for the subsequents requests created for each Task.
607: csf_requests_pvt.create_scheduler_request(
608: p_api_version => 1
609: , p_init_msg_list => fnd_api.g_true
610: , p_commit => fnd_api.g_false
611: , x_return_status => x_return_status
612: , x_msg_count => x_msg_count
613: , x_msg_data => x_msg_data
606: -- the Parent Request for the subsequents requests created for each Task.
607: csf_requests_pvt.create_scheduler_request(
608: p_api_version => 1
609: , p_init_msg_list => fnd_api.g_true
610: , p_commit => fnd_api.g_false
611: , x_return_status => x_return_status
612: , x_msg_count => x_msg_count
613: , x_msg_data => x_msg_data
614: , p_name => 'SearchAndScheduleAuto'
615: , p_object_id => -1
616: , x_request_id => x_request_id
617: );
618:
619: IF x_return_status <> fnd_api.g_ret_sts_success THEN
620: RAISE fnd_api.g_exc_error;
621: END IF;
622:
623:
616: , x_request_id => x_request_id
617: );
618:
619: IF x_return_status <> fnd_api.g_ret_sts_success THEN
620: RAISE fnd_api.g_exc_error;
621: END IF;
622:
623:
624: -- For each task, create a SearchAndSchedule Request with Parent
624: -- For each task, create a SearchAndSchedule Request with Parent
625: -- Request being the Request created above.
626: i := p_task_tbl.FIRST;
627: WHILE i IS NOT NULL LOOP
628: IF p_find_resources = fnd_api.g_true THEN
629:
630: OPEN c_task_info(p_task_tbl(i));
631: FETCH c_task_info INTO l_task_info;
632: CLOSE c_task_info;
636:
637: -- Get the Resources for this Task.
638: csf_resource_pub.get_resources_to_schedule(
639: p_api_version => 1
640: , p_init_msg_list => fnd_api.g_false
641: , x_return_status => x_return_status
642: , x_msg_count => x_msg_count
643: , x_msg_data => x_msg_data
644: , p_scheduling_mode => 'X' -- Auto Assign mode
655: );
656:
657: -- Unless it is an Unexpected Error... continue even with
658: -- "No Resources Found" error. Java will do the proper error handling.
659: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
660: RAISE fnd_api.g_exc_unexpected_error;
661: END IF;
662: END IF;
663:
656:
657: -- Unless it is an Unexpected Error... continue even with
658: -- "No Resources Found" error. Java will do the proper error handling.
659: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
660: RAISE fnd_api.g_exc_unexpected_error;
661: END IF;
662: END IF;
663:
664: csf_requests_pvt.create_scheduler_request(
662: END IF;
663:
664: csf_requests_pvt.create_scheduler_request(
665: p_api_version => 1
666: , p_init_msg_list => fnd_api.g_false
667: , p_commit => fnd_api.g_false
668: , x_return_status => x_return_status
669: , x_msg_count => x_msg_count
670: , x_msg_data => x_msg_data
663:
664: csf_requests_pvt.create_scheduler_request(
665: p_api_version => 1
666: , p_init_msg_list => fnd_api.g_false
667: , p_commit => fnd_api.g_false
668: , x_return_status => x_return_status
669: , x_msg_count => x_msg_count
670: , x_msg_data => x_msg_data
671: , p_name => 'SearchAndSchedule'
681: i := p_task_tbl.NEXT(i);
682:
683: END LOOP;
684: EXCEPTION
685: WHEN fnd_api.g_exc_error THEN
686: x_return_status := fnd_api.g_ret_sts_error;
687: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
688: WHEN fnd_api.g_exc_unexpected_error THEN
689: x_return_status := fnd_api.g_ret_sts_unexp_error;
682:
683: END LOOP;
684: EXCEPTION
685: WHEN fnd_api.g_exc_error THEN
686: x_return_status := fnd_api.g_ret_sts_error;
687: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
688: WHEN fnd_api.g_exc_unexpected_error THEN
689: x_return_status := fnd_api.g_ret_sts_unexp_error;
690: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
684: EXCEPTION
685: WHEN fnd_api.g_exc_error THEN
686: x_return_status := fnd_api.g_ret_sts_error;
687: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
688: WHEN fnd_api.g_exc_unexpected_error THEN
689: x_return_status := fnd_api.g_ret_sts_unexp_error;
690: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
691: WHEN OTHERS THEN
692: x_return_status := fnd_api.g_ret_sts_unexp_error;
685: WHEN fnd_api.g_exc_error THEN
686: x_return_status := fnd_api.g_ret_sts_error;
687: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
688: WHEN fnd_api.g_exc_unexpected_error THEN
689: x_return_status := fnd_api.g_ret_sts_unexp_error;
690: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
691: WHEN OTHERS THEN
692: x_return_status := fnd_api.g_ret_sts_unexp_error;
693: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
688: WHEN fnd_api.g_exc_unexpected_error THEN
689: x_return_status := fnd_api.g_ret_sts_unexp_error;
690: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
691: WHEN OTHERS THEN
692: x_return_status := fnd_api.g_ret_sts_unexp_error;
693: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
694: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
695: END IF;
696: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
750:
751: BEGIN
752: SAVEPOINT fill_request_resources;
753:
754: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
755: RAISE fnd_api.g_exc_unexpected_error;
756: END IF;
757:
758: IF fnd_api.to_boolean(p_init_msg_list) THEN
751: BEGIN
752: SAVEPOINT fill_request_resources;
753:
754: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
755: RAISE fnd_api.g_exc_unexpected_error;
756: END IF;
757:
758: IF fnd_api.to_boolean(p_init_msg_list) THEN
759: fnd_msg_pub.initialize;
754: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
755: RAISE fnd_api.g_exc_unexpected_error;
756: END IF;
757:
758: IF fnd_api.to_boolean(p_init_msg_list) THEN
759: fnd_msg_pub.initialize;
760: END IF;
761:
762: x_return_status := fnd_api.g_ret_sts_success;
758: IF fnd_api.to_boolean(p_init_msg_list) THEN
759: fnd_msg_pub.initialize;
760: END IF;
761:
762: x_return_status := fnd_api.g_ret_sts_success;
763:
764: FOR l_task_rec IN c_request_task_list LOOP
765:
766: -- Get the Qualified Resources for this Task.
769:
770: -- Get the Resources for this Task.
771: csf_resource_pub.get_resources_to_schedule(
772: p_api_version => 1
773: , p_init_msg_list => fnd_api.g_true
774: , x_return_status => x_return_status
775: , x_msg_count => x_msg_count
776: , x_msg_data => x_msg_data
777: , p_scheduling_mode => 'X' -- Auto Assign mode
788: );
789:
790: -- Unless it is an Unexpected Error... continue even with
791: -- "No Resources Found" error. Java will do the proper error handling.
792: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
793: RAISE fnd_api.g_exc_unexpected_error;
794: END IF;
795:
796:
789:
790: -- Unless it is an Unexpected Error... continue even with
791: -- "No Resources Found" error. Java will do the proper error handling.
792: IF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
793: RAISE fnd_api.g_exc_unexpected_error;
794: END IF;
795:
796:
797: -- Filter out the Resources with Third Party Service provider Role.
809: END IF;
810: iIndex := l_res_tbl.NEXT(iIndex);
811: END LOOP; */
812:
813: IF x_return_status <> fnd_api.g_ret_sts_success
814: THEN
815: l_task_num_tbl.extend();
816: l_task_id_tbl.extend();
817: l_msg_tbl.extend();
822:
823: l_count := l_count + 1;
824:
825: --Setting success for each task
826: x_return_status := fnd_api.g_ret_sts_success;
827: END IF;
828:
829: IF l_res_tbl.count > 0 THEN
830: csf_requests_pvt.create_resource_results(
828:
829: IF l_res_tbl.count > 0 THEN
830: csf_requests_pvt.create_resource_results(
831: p_api_version => 1
832: , p_init_msg_list => fnd_api.g_false
833: , p_commit => fnd_api.g_false
834: , x_return_status => x_return_status
835: , x_msg_count => x_msg_count
836: , x_msg_data => x_msg_data
829: IF l_res_tbl.count > 0 THEN
830: csf_requests_pvt.create_resource_results(
831: p_api_version => 1
832: , p_init_msg_list => fnd_api.g_false
833: , p_commit => fnd_api.g_false
834: , x_return_status => x_return_status
835: , x_msg_count => x_msg_count
836: , x_msg_data => x_msg_data
837: , p_request_task_id => l_task_rec.request_task_id
843: x_task_num_tbl := l_task_num_tbl;
844: x_task_id_tbl := l_task_id_tbl;
845: x_msg_tbl := l_msg_tbl;
846:
847: IF fnd_api.to_boolean(p_commit) THEN
848: COMMIT WORK;
849: END IF;
850: EXCEPTION
851: WHEN fnd_api.g_exc_error THEN
847: IF fnd_api.to_boolean(p_commit) THEN
848: COMMIT WORK;
849: END IF;
850: EXCEPTION
851: WHEN fnd_api.g_exc_error THEN
852: ROLLBACK TO fill_request_resources;
853: x_return_status := fnd_api.g_ret_sts_error;
854: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
855: WHEN fnd_api.g_exc_unexpected_error THEN
849: END IF;
850: EXCEPTION
851: WHEN fnd_api.g_exc_error THEN
852: ROLLBACK TO fill_request_resources;
853: x_return_status := fnd_api.g_ret_sts_error;
854: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
855: WHEN fnd_api.g_exc_unexpected_error THEN
856: ROLLBACK TO fill_request_resources;
857: x_return_status := fnd_api.g_ret_sts_unexp_error;
851: WHEN fnd_api.g_exc_error THEN
852: ROLLBACK TO fill_request_resources;
853: x_return_status := fnd_api.g_ret_sts_error;
854: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
855: WHEN fnd_api.g_exc_unexpected_error THEN
856: ROLLBACK TO fill_request_resources;
857: x_return_status := fnd_api.g_ret_sts_unexp_error;
858: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
859: WHEN OTHERS THEN
853: x_return_status := fnd_api.g_ret_sts_error;
854: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
855: WHEN fnd_api.g_exc_unexpected_error THEN
856: ROLLBACK TO fill_request_resources;
857: x_return_status := fnd_api.g_ret_sts_unexp_error;
858: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
859: WHEN OTHERS THEN
860: x_return_status := fnd_api.g_ret_sts_unexp_error;
861: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
856: ROLLBACK TO fill_request_resources;
857: x_return_status := fnd_api.g_ret_sts_unexp_error;
858: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
859: WHEN OTHERS THEN
860: x_return_status := fnd_api.g_ret_sts_unexp_error;
861: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
862: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
863: END IF;
864: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
880: l_api_name CONSTANT VARCHAR2(30) := 'SEARCH_AND_SCHEDULE_AUTO';
881: BEGIN
882: SAVEPOINT search_and_schedule_auto_pub;
883:
884: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
885: RAISE fnd_api.g_exc_unexpected_error;
886: END IF;
887:
888: IF fnd_api.to_boolean(p_init_msg_list) THEN
881: BEGIN
882: SAVEPOINT search_and_schedule_auto_pub;
883:
884: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
885: RAISE fnd_api.g_exc_unexpected_error;
886: END IF;
887:
888: IF fnd_api.to_boolean(p_init_msg_list) THEN
889: fnd_msg_pub.initialize;
884: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
885: RAISE fnd_api.g_exc_unexpected_error;
886: END IF;
887:
888: IF fnd_api.to_boolean(p_init_msg_list) THEN
889: fnd_msg_pub.initialize;
890: END IF;
891:
892: x_return_status := fnd_api.g_ret_sts_success;
888: IF fnd_api.to_boolean(p_init_msg_list) THEN
889: fnd_msg_pub.initialize;
890: END IF;
891:
892: x_return_status := fnd_api.g_ret_sts_success;
893:
894: IF NOT p_task_tbl.LAST > 0 THEN
895: IF NOT valid_argument(NULL, 'task_tbl', l_api_name) THEN
896: RAISE fnd_api.g_exc_error;
892: x_return_status := fnd_api.g_ret_sts_success;
893:
894: IF NOT p_task_tbl.LAST > 0 THEN
895: IF NOT valid_argument(NULL, 'task_tbl', l_api_name) THEN
896: RAISE fnd_api.g_exc_error;
897: END IF;
898: END IF;
899:
900: -- Create the SearchAndScheduleAuto Request.
902: x_return_status => x_return_status
903: , x_msg_count => x_msg_count
904: , x_msg_data => x_msg_data
905: , p_task_tbl => p_task_tbl
906: , p_find_resources => fnd_api.g_false
907: , x_request_id => x_sched_request_id
908: );
909:
910: IF x_return_status = fnd_api.g_ret_sts_error THEN
906: , p_find_resources => fnd_api.g_false
907: , x_request_id => x_sched_request_id
908: );
909:
910: IF x_return_status = fnd_api.g_ret_sts_error THEN
911: RAISE fnd_api.g_exc_error;
912: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
913: RAISE fnd_api.g_exc_unexpected_error;
914: END IF;
907: , x_request_id => x_sched_request_id
908: );
909:
910: IF x_return_status = fnd_api.g_ret_sts_error THEN
911: RAISE fnd_api.g_exc_error;
912: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
913: RAISE fnd_api.g_exc_unexpected_error;
914: END IF;
915:
908: );
909:
910: IF x_return_status = fnd_api.g_ret_sts_error THEN
911: RAISE fnd_api.g_exc_error;
912: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
913: RAISE fnd_api.g_exc_unexpected_error;
914: END IF;
915:
916: -- Submit the Scheduler concurrent program
909:
910: IF x_return_status = fnd_api.g_ret_sts_error THEN
911: RAISE fnd_api.g_exc_error;
912: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
913: RAISE fnd_api.g_exc_unexpected_error;
914: END IF;
915:
916: -- Submit the Scheduler concurrent program
917: x_conc_request_id := fnd_request.submit_request(
923: );
924:
925: IF x_conc_request_id = 0 THEN
926: -- FND_REQUEST.SUBMIT_REQUEST should have populated the Message Stack.
927: RAISE fnd_api.g_exc_error;
928: END IF;
929:
930: IF fnd_api.to_boolean(p_commit) THEN
931: COMMIT WORK;
926: -- FND_REQUEST.SUBMIT_REQUEST should have populated the Message Stack.
927: RAISE fnd_api.g_exc_error;
928: END IF;
929:
930: IF fnd_api.to_boolean(p_commit) THEN
931: COMMIT WORK;
932: END IF;
933: EXCEPTION
934: WHEN fnd_api.g_exc_error THEN
930: IF fnd_api.to_boolean(p_commit) THEN
931: COMMIT WORK;
932: END IF;
933: EXCEPTION
934: WHEN fnd_api.g_exc_error THEN
935: ROLLBACK TO search_and_schedule_auto_pub;
936: x_return_status := fnd_api.g_ret_sts_error;
937: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
938: WHEN fnd_api.g_exc_unexpected_error THEN
932: END IF;
933: EXCEPTION
934: WHEN fnd_api.g_exc_error THEN
935: ROLLBACK TO search_and_schedule_auto_pub;
936: x_return_status := fnd_api.g_ret_sts_error;
937: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
938: WHEN fnd_api.g_exc_unexpected_error THEN
939: ROLLBACK TO search_and_schedule_auto_pub;
940: x_return_status := fnd_api.g_ret_sts_unexp_error;
934: WHEN fnd_api.g_exc_error THEN
935: ROLLBACK TO search_and_schedule_auto_pub;
936: x_return_status := fnd_api.g_ret_sts_error;
937: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
938: WHEN fnd_api.g_exc_unexpected_error THEN
939: ROLLBACK TO search_and_schedule_auto_pub;
940: x_return_status := fnd_api.g_ret_sts_unexp_error;
941: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
942: WHEN OTHERS THEN
936: x_return_status := fnd_api.g_ret_sts_error;
937: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
938: WHEN fnd_api.g_exc_unexpected_error THEN
939: ROLLBACK TO search_and_schedule_auto_pub;
940: x_return_status := fnd_api.g_ret_sts_unexp_error;
941: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
942: WHEN OTHERS THEN
943: x_return_status := fnd_api.g_ret_sts_unexp_error;
944: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
939: ROLLBACK TO search_and_schedule_auto_pub;
940: x_return_status := fnd_api.g_ret_sts_unexp_error;
941: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
942: WHEN OTHERS THEN
943: x_return_status := fnd_api.g_ret_sts_unexp_error;
944: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
945: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
946: END IF;
947: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
967: l_task_tbl csf_requests_pvt.object_tbl_type;
968: BEGIN
969: SAVEPOINT create_auto_request_pub;
970:
971: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
972: RAISE fnd_api.g_exc_error;
973: END IF;
974:
975: IF fnd_api.to_boolean(p_init_msg_list) THEN
968: BEGIN
969: SAVEPOINT create_auto_request_pub;
970:
971: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
972: RAISE fnd_api.g_exc_error;
973: END IF;
974:
975: IF fnd_api.to_boolean(p_init_msg_list) THEN
976: fnd_msg_pub.initialize;
971: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
972: RAISE fnd_api.g_exc_error;
973: END IF;
974:
975: IF fnd_api.to_boolean(p_init_msg_list) THEN
976: fnd_msg_pub.initialize;
977: END IF;
978:
979: IF NOT valid_argument(p_query_id, 'query_id', l_api_name) THEN
976: fnd_msg_pub.initialize;
977: END IF;
978:
979: IF NOT valid_argument(p_query_id, 'query_id', l_api_name) THEN
980: RAISE fnd_api.g_exc_error;
981: END IF;
982:
983: -- Get the WHERE CLAUSE for the Given Query ID.
984:
1006: , p_task_tbl => l_task_tbl
1007: , x_request_id => x_sched_request_id
1008: );
1009:
1010: IF x_return_status = fnd_api.g_ret_sts_error THEN
1011: RAISE fnd_api.g_exc_error;
1012: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1013: RAISE fnd_api.g_exc_unexpected_error;
1014: END IF;
1007: , x_request_id => x_sched_request_id
1008: );
1009:
1010: IF x_return_status = fnd_api.g_ret_sts_error THEN
1011: RAISE fnd_api.g_exc_error;
1012: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1013: RAISE fnd_api.g_exc_unexpected_error;
1014: END IF;
1015:
1008: );
1009:
1010: IF x_return_status = fnd_api.g_ret_sts_error THEN
1011: RAISE fnd_api.g_exc_error;
1012: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1013: RAISE fnd_api.g_exc_unexpected_error;
1014: END IF;
1015:
1016: IF fnd_api.to_boolean(p_commit) THEN
1009:
1010: IF x_return_status = fnd_api.g_ret_sts_error THEN
1011: RAISE fnd_api.g_exc_error;
1012: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1013: RAISE fnd_api.g_exc_unexpected_error;
1014: END IF;
1015:
1016: IF fnd_api.to_boolean(p_commit) THEN
1017: COMMIT WORK;
1012: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1013: RAISE fnd_api.g_exc_unexpected_error;
1014: END IF;
1015:
1016: IF fnd_api.to_boolean(p_commit) THEN
1017: COMMIT WORK;
1018: END IF;
1019: EXCEPTION
1020: WHEN fnd_api.g_exc_error THEN
1016: IF fnd_api.to_boolean(p_commit) THEN
1017: COMMIT WORK;
1018: END IF;
1019: EXCEPTION
1020: WHEN fnd_api.g_exc_error THEN
1021: ROLLBACK TO create_auto_request_pub;
1022: x_return_status := fnd_api.g_ret_sts_error;
1023: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1024: WHEN fnd_api.g_exc_unexpected_error THEN
1018: END IF;
1019: EXCEPTION
1020: WHEN fnd_api.g_exc_error THEN
1021: ROLLBACK TO create_auto_request_pub;
1022: x_return_status := fnd_api.g_ret_sts_error;
1023: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1024: WHEN fnd_api.g_exc_unexpected_error THEN
1025: ROLLBACK TO create_auto_request_pub;
1026: x_return_status := fnd_api.g_ret_sts_unexp_error;
1020: WHEN fnd_api.g_exc_error THEN
1021: ROLLBACK TO create_auto_request_pub;
1022: x_return_status := fnd_api.g_ret_sts_error;
1023: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1024: WHEN fnd_api.g_exc_unexpected_error THEN
1025: ROLLBACK TO create_auto_request_pub;
1026: x_return_status := fnd_api.g_ret_sts_unexp_error;
1027: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1028: WHEN OTHERS THEN
1022: x_return_status := fnd_api.g_ret_sts_error;
1023: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1024: WHEN fnd_api.g_exc_unexpected_error THEN
1025: ROLLBACK TO create_auto_request_pub;
1026: x_return_status := fnd_api.g_ret_sts_unexp_error;
1027: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1028: WHEN OTHERS THEN
1029: x_return_status := fnd_api.g_ret_sts_unexp_error;
1030: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
1025: ROLLBACK TO create_auto_request_pub;
1026: x_return_status := fnd_api.g_ret_sts_unexp_error;
1027: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1028: WHEN OTHERS THEN
1029: x_return_status := fnd_api.g_ret_sts_unexp_error;
1030: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
1031: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
1032: END IF;
1033: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1069: l_resource_tbl csf_requests_pvt.resource_tbl_type;
1070: BEGIN
1071: SAVEPOINT create_opt_request_pub;
1072:
1073: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1074: RAISE fnd_api.g_exc_error;
1075: END IF;
1076:
1077: IF fnd_api.to_boolean(p_init_msg_list) THEN
1070: BEGIN
1071: SAVEPOINT create_opt_request_pub;
1072:
1073: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1074: RAISE fnd_api.g_exc_error;
1075: END IF;
1076:
1077: IF fnd_api.to_boolean(p_init_msg_list) THEN
1078: fnd_msg_pub.initialize;
1073: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1074: RAISE fnd_api.g_exc_error;
1075: END IF;
1076:
1077: IF fnd_api.to_boolean(p_init_msg_list) THEN
1078: fnd_msg_pub.initialize;
1079: END IF;
1080:
1081: OPEN c_resources;
1104: , p_resource_tbl => l_resource_tbl
1105: , x_request_id => x_sched_request_id
1106: );
1107:
1108: IF x_return_status = fnd_api.g_ret_sts_error THEN
1109: RAISE fnd_api.g_exc_error;
1110: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1111: RAISE fnd_api.g_exc_unexpected_error;
1112: END IF;
1105: , x_request_id => x_sched_request_id
1106: );
1107:
1108: IF x_return_status = fnd_api.g_ret_sts_error THEN
1109: RAISE fnd_api.g_exc_error;
1110: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1111: RAISE fnd_api.g_exc_unexpected_error;
1112: END IF;
1113:
1106: );
1107:
1108: IF x_return_status = fnd_api.g_ret_sts_error THEN
1109: RAISE fnd_api.g_exc_error;
1110: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1111: RAISE fnd_api.g_exc_unexpected_error;
1112: END IF;
1113:
1114: IF fnd_api.to_boolean(p_commit) THEN
1107:
1108: IF x_return_status = fnd_api.g_ret_sts_error THEN
1109: RAISE fnd_api.g_exc_error;
1110: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1111: RAISE fnd_api.g_exc_unexpected_error;
1112: END IF;
1113:
1114: IF fnd_api.to_boolean(p_commit) THEN
1115: COMMIT WORK;
1110: ELSIF x_return_status = fnd_api.g_ret_sts_unexp_error THEN
1111: RAISE fnd_api.g_exc_unexpected_error;
1112: END IF;
1113:
1114: IF fnd_api.to_boolean(p_commit) THEN
1115: COMMIT WORK;
1116: END IF;
1117: EXCEPTION
1118: WHEN fnd_api.g_exc_error THEN
1114: IF fnd_api.to_boolean(p_commit) THEN
1115: COMMIT WORK;
1116: END IF;
1117: EXCEPTION
1118: WHEN fnd_api.g_exc_error THEN
1119: ROLLBACK TO create_opt_request_pub;
1120: x_return_status := fnd_api.g_ret_sts_error;
1121: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1122: WHEN fnd_api.g_exc_unexpected_error THEN
1116: END IF;
1117: EXCEPTION
1118: WHEN fnd_api.g_exc_error THEN
1119: ROLLBACK TO create_opt_request_pub;
1120: x_return_status := fnd_api.g_ret_sts_error;
1121: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1122: WHEN fnd_api.g_exc_unexpected_error THEN
1123: ROLLBACK TO create_opt_request_pub;
1124: x_return_status := fnd_api.g_ret_sts_unexp_error;
1118: WHEN fnd_api.g_exc_error THEN
1119: ROLLBACK TO create_opt_request_pub;
1120: x_return_status := fnd_api.g_ret_sts_error;
1121: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1122: WHEN fnd_api.g_exc_unexpected_error THEN
1123: ROLLBACK TO create_opt_request_pub;
1124: x_return_status := fnd_api.g_ret_sts_unexp_error;
1125: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1126: WHEN OTHERS THEN
1120: x_return_status := fnd_api.g_ret_sts_error;
1121: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1122: WHEN fnd_api.g_exc_unexpected_error THEN
1123: ROLLBACK TO create_opt_request_pub;
1124: x_return_status := fnd_api.g_ret_sts_unexp_error;
1125: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1126: WHEN OTHERS THEN
1127: x_return_status := fnd_api.g_ret_sts_unexp_error;
1128: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
1123: ROLLBACK TO create_opt_request_pub;
1124: x_return_status := fnd_api.g_ret_sts_unexp_error;
1125: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1126: WHEN OTHERS THEN
1127: x_return_status := fnd_api.g_ret_sts_unexp_error;
1128: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
1129: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
1130: END IF;
1131: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1162: l_start_date DATE;
1163: l_end_date DATE;
1164:
1165: BEGIN
1166: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1167: RAISE fnd_api.g_exc_error;
1168: END IF;
1169:
1170: IF fnd_api.to_boolean(p_init_msg_list) THEN
1163: l_end_date DATE;
1164:
1165: BEGIN
1166: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1167: RAISE fnd_api.g_exc_error;
1168: END IF;
1169:
1170: IF fnd_api.to_boolean(p_init_msg_list) THEN
1171: fnd_msg_pub.initialize;
1166: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1167: RAISE fnd_api.g_exc_error;
1168: END IF;
1169:
1170: IF fnd_api.to_boolean(p_init_msg_list) THEN
1171: fnd_msg_pub.initialize;
1172: END IF;
1173:
1174: x_return_status := fnd_api.g_ret_sts_success;
1170: IF fnd_api.to_boolean(p_init_msg_list) THEN
1171: fnd_msg_pub.initialize;
1172: END IF;
1173:
1174: x_return_status := fnd_api.g_ret_sts_success;
1175:
1176: l_task_res_tbl := csf_resource_tbl();
1177: x_task_resources_tbl := csf_task_resources_tbl_type();
1178:
1190:
1191: -- Get the Resources for this Task.
1192: csf_resource_pub.get_resources_to_schedule(
1193: p_api_version => 1.0
1194: , p_init_msg_list => fnd_api.g_false
1195: , x_return_status => x_return_status
1196: , x_msg_count => x_msg_count
1197: , x_msg_data => x_msg_data
1198: , p_scheduling_mode => 'O' -- Optimizer mode
1240: x_task_resources_tbl.EXTEND();
1241: x_task_resources_tbl(i) := l_task_res_tbl;
1242: END LOOP;
1243: EXCEPTION
1244: WHEN fnd_api.g_exc_error THEN
1245: x_return_status := fnd_api.g_ret_sts_error;
1246: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1247: WHEN fnd_api.g_exc_unexpected_error THEN
1248: x_return_status := fnd_api.g_ret_sts_unexp_error;
1241: x_task_resources_tbl(i) := l_task_res_tbl;
1242: END LOOP;
1243: EXCEPTION
1244: WHEN fnd_api.g_exc_error THEN
1245: x_return_status := fnd_api.g_ret_sts_error;
1246: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1247: WHEN fnd_api.g_exc_unexpected_error THEN
1248: x_return_status := fnd_api.g_ret_sts_unexp_error;
1249: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1243: EXCEPTION
1244: WHEN fnd_api.g_exc_error THEN
1245: x_return_status := fnd_api.g_ret_sts_error;
1246: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1247: WHEN fnd_api.g_exc_unexpected_error THEN
1248: x_return_status := fnd_api.g_ret_sts_unexp_error;
1249: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1250: WHEN OTHERS THEN
1251: x_return_status := fnd_api.g_ret_sts_unexp_error;
1244: WHEN fnd_api.g_exc_error THEN
1245: x_return_status := fnd_api.g_ret_sts_error;
1246: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1247: WHEN fnd_api.g_exc_unexpected_error THEN
1248: x_return_status := fnd_api.g_ret_sts_unexp_error;
1249: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1250: WHEN OTHERS THEN
1251: x_return_status := fnd_api.g_ret_sts_unexp_error;
1252: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
1247: WHEN fnd_api.g_exc_unexpected_error THEN
1248: x_return_status := fnd_api.g_ret_sts_unexp_error;
1249: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1250: WHEN OTHERS THEN
1251: x_return_status := fnd_api.g_ret_sts_unexp_error;
1252: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
1253: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
1254: END IF;
1255: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1371: FOR UPDATE OF t.task_id, ta.task_assignment_id, ah.access_hour_id, oc.object_capacity_id NOWAIT;
1372:
1373: l_objects_locked BOOLEAN;
1374: BEGIN
1375: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1376: RAISE fnd_api.g_exc_error;
1377: END IF;
1378:
1379: IF fnd_api.to_boolean(p_init_msg_list) THEN
1372:
1373: l_objects_locked BOOLEAN;
1374: BEGIN
1375: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1376: RAISE fnd_api.g_exc_error;
1377: END IF;
1378:
1379: IF fnd_api.to_boolean(p_init_msg_list) THEN
1380: fnd_msg_pub.initialize;
1375: IF NOT fnd_api.compatible_api_call(l_api_version, p_api_version, l_api_name, g_pkg_name) THEN
1376: RAISE fnd_api.g_exc_error;
1377: END IF;
1378:
1379: IF fnd_api.to_boolean(p_init_msg_list) THEN
1380: fnd_msg_pub.initialize;
1381: END IF;
1382:
1383: x_return_status := fnd_api.g_ret_sts_success;
1379: IF fnd_api.to_boolean(p_init_msg_list) THEN
1380: fnd_msg_pub.initialize;
1381: END IF;
1382:
1383: x_return_status := fnd_api.g_ret_sts_success;
1384:
1385: l_objects_locked := FALSE;
1386:
1387: FOR i IN 1..3 LOOP
1403:
1404: IF NOT l_objects_locked THEN
1405: fnd_message.set_name ('CSR', 'CSR_LOCKING_RES_TRIPS_FAILED');
1406: fnd_msg_pub.ADD;
1407: RAISE fnd_api.g_exc_error;
1408: END IF;
1409:
1410: EXCEPTION
1411: WHEN fnd_api.g_exc_error THEN
1407: RAISE fnd_api.g_exc_error;
1408: END IF;
1409:
1410: EXCEPTION
1411: WHEN fnd_api.g_exc_error THEN
1412: x_return_status := fnd_api.g_ret_sts_error;
1413: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1414: WHEN OTHERS THEN
1415: x_return_status := fnd_api.g_ret_sts_unexp_error;
1408: END IF;
1409:
1410: EXCEPTION
1411: WHEN fnd_api.g_exc_error THEN
1412: x_return_status := fnd_api.g_ret_sts_error;
1413: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1414: WHEN OTHERS THEN
1415: x_return_status := fnd_api.g_ret_sts_unexp_error;
1416: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
1411: WHEN fnd_api.g_exc_error THEN
1412: x_return_status := fnd_api.g_ret_sts_error;
1413: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);
1414: WHEN OTHERS THEN
1415: x_return_status := fnd_api.g_ret_sts_unexp_error;
1416: IF fnd_msg_pub.check_msg_level(fnd_msg_pub.g_msg_lvl_unexp_error) THEN
1417: fnd_msg_pub.add_exc_msg(g_pkg_name, l_api_name);
1418: END IF;
1419: fnd_msg_pub.count_and_get(p_count => x_msg_count, p_data => x_msg_data);