30: PROCEDURE reroute_batch (
31: p_batch_header_rec IN gme_batch_header%ROWTYPE
32: ,p_validity_rule_id IN NUMBER
33: ,p_use_workday_cal IN VARCHAR2
34: DEFAULT fnd_api.g_false
35: ,p_contiguity_override IN VARCHAR2
36: DEFAULT fnd_api.g_false
37: ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE
38: ,x_return_status OUT NOCOPY VARCHAR2)
32: ,p_validity_rule_id IN NUMBER
33: ,p_use_workday_cal IN VARCHAR2
34: DEFAULT fnd_api.g_false
35: ,p_contiguity_override IN VARCHAR2
36: DEFAULT fnd_api.g_false
37: ,x_batch_header_rec OUT NOCOPY gme_batch_header%ROWTYPE
38: ,x_return_status OUT NOCOPY VARCHAR2)
39: IS
40: l_api_name CONSTANT VARCHAR2 (30) := 'REROUTE_BATCH';
111: || 'Entering');
112: END IF;
113:
114: /* Set the return status to success initially */
115: x_return_status := fnd_api.g_ret_sts_success;
116:
117: /* Get the Batch header */
118: IF (NOT gme_common_pvt.get_batch_header
119: (p_batch_header_rec => p_batch_header_rec
119: (p_batch_header_rec => p_batch_header_rec
120: ,p_org_code => NULL
121: ,p_batch_type => NULL
122: ,x_batch_header_rec => x_batch_header_rec) ) THEN
123: RAISE fnd_api.g_exc_error;
124: END IF;
125:
126: /* Validation for the new validity rule */
127: gme_reroute_batch_pvt.validate_validity_id
128: (p_batch_header_rec => x_batch_header_rec
129: ,p_validity_rule_id => p_validity_rule_id
130: ,x_return_status => x_return_status);
131:
132: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
133: RAISE fnd_api.g_exc_error;
134: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
135: RAISE fnd_api.g_exc_unexpected_error;
136: END IF;
129: ,p_validity_rule_id => p_validity_rule_id
130: ,x_return_status => x_return_status);
131:
132: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
133: RAISE fnd_api.g_exc_error;
134: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
135: RAISE fnd_api.g_exc_unexpected_error;
136: END IF;
137:
130: ,x_return_status => x_return_status);
131:
132: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
133: RAISE fnd_api.g_exc_error;
134: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
135: RAISE fnd_api.g_exc_unexpected_error;
136: END IF;
137:
138: /* Now we have to delete the existing poc data */
131:
132: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
133: RAISE fnd_api.g_exc_error;
134: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
135: RAISE fnd_api.g_exc_unexpected_error;
136: END IF;
137:
138: /* Now we have to delete the existing poc data */
139: gme_reroute_batch_pvt.delete_all_steps (x_batch_header_rec.batch_id
138: /* Now we have to delete the existing poc data */
139: gme_reroute_batch_pvt.delete_all_steps (x_batch_header_rec.batch_id
140: ,x_return_status);
141:
142: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
143: RAISE fnd_api.g_exc_error;
144: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
145: RAISE fnd_api.g_exc_unexpected_error;
146: END IF;
139: gme_reroute_batch_pvt.delete_all_steps (x_batch_header_rec.batch_id
140: ,x_return_status);
141:
142: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
143: RAISE fnd_api.g_exc_error;
144: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
145: RAISE fnd_api.g_exc_unexpected_error;
146: END IF;
147:
140: ,x_return_status);
141:
142: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
143: RAISE fnd_api.g_exc_error;
144: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
145: RAISE fnd_api.g_exc_unexpected_error;
146: END IF;
147:
148: /* Get the recipe id for the validity rule */
141:
142: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
143: RAISE fnd_api.g_exc_error;
144: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
145: RAISE fnd_api.g_exc_unexpected_error;
146: END IF;
147:
148: /* Get the recipe id for the validity rule */
149: OPEN cur_get_recipe (p_validity_rule_id);
161: IF x_batch_header_rec.routing_id IS NOT NULL THEN
162: x_batch_header_rec.poc_ind := 'Y';
163: gmd_recipe_data_pub.get_recipe_data
164: (p_api_version => 1
165: ,p_init_msg_list => fnd_api.g_false
166: ,p_recipe_id => l_recipe_id
167: ,p_organization_id => NULL
168: ,x_return_status => x_return_status
169: ,x_msg_count => l_message_count
178: ,x_recp_resc_proc_param_tbl => l_process_parameters_tab
179: ,x_formula_header_rec => l_formula_master
180: ,x_formula_dtl_tbl => gme_common_pvt.materials);
181:
182: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
183: RAISE fnd_api.g_exc_error;
184: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
185: RAISE fnd_api.g_exc_unexpected_error;
186: END IF;
179: ,x_formula_header_rec => l_formula_master
180: ,x_formula_dtl_tbl => gme_common_pvt.materials);
181:
182: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
183: RAISE fnd_api.g_exc_error;
184: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
185: RAISE fnd_api.g_exc_unexpected_error;
186: END IF;
187:
180: ,x_formula_dtl_tbl => gme_common_pvt.materials);
181:
182: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
183: RAISE fnd_api.g_exc_error;
184: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
185: RAISE fnd_api.g_exc_unexpected_error;
186: END IF;
187:
188: -- Added code for Enforce Step Dependency
181:
182: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
183: RAISE fnd_api.g_exc_error;
184: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
185: RAISE fnd_api.g_exc_unexpected_error;
186: END IF;
187:
188: -- Added code for Enforce Step Dependency
189: IF gme_common_pvt.routings.COUNT > 0 THEN
225: ,p_token2_value => gme_common_pvt.routings (1).routing_uom
226: ,p_token3_name => 'module'
227: ,p_token3_value => 'GME_REROUTE_BATCH_PVT.validate_validity_id'
228: ,p_product_code => 'INV');
229: RAISE fnd_api.g_exc_error;
230: ELSE
231: l_total_output_qty_c :=
232: l_total_output_qty_c + l_temp_qty;
233: END IF;
236: END LOOP;
237:
238: IF l_total_output_qty_c = 0 THEN
239: gme_common_pvt.log_message ('GME_API_PROD_QTY_CANT_ZERO');
240: RAISE fnd_api.g_exc_error;
241: END IF;
242:
243: /* Batch Quantities calculation */
244: l_gme_material_details.batch_id := x_batch_header_rec.batch_id;
283: (1).routing_uom
284: ,p_token3_name => 'module'
285: ,p_token3_value => 'GME_REROUTE_BATCH_PVT.validate_validity_id'
286: ,p_product_code => 'INV');
287: RAISE fnd_api.g_exc_error;
288: ELSE
289: l_total_output_qty_b :=
290: l_total_output_qty_b + l_temp_qty;
291: END IF;
294: END LOOP; -- l_row_count IN 1 .. l_material_details.Count
295:
296: IF l_total_output_qty_b = 0 THEN
297: gme_common_pvt.log_message ('GME_API_PROD_QTY_CANT_ZERO');
298: RAISE fnd_api.g_exc_error;
299: END IF;
300: END IF;--}
301:
302: gme_common_pvt.g_routing_scale_factor :=
325: ,x_return_status => x_return_status);
326:
327: IF (x_return_status = 'C') THEN
328: RAISE no_continous_periods;
329: ELSIF (x_return_status = fnd_api.g_ret_sts_error) THEN
330: RAISE fnd_api.g_exc_error;
331: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
332: RAISE fnd_api.g_exc_unexpected_error;
333: END IF;
326:
327: IF (x_return_status = 'C') THEN
328: RAISE no_continous_periods;
329: ELSIF (x_return_status = fnd_api.g_ret_sts_error) THEN
330: RAISE fnd_api.g_exc_error;
331: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
332: RAISE fnd_api.g_exc_unexpected_error;
333: END IF;
334:
327: IF (x_return_status = 'C') THEN
328: RAISE no_continous_periods;
329: ELSIF (x_return_status = fnd_api.g_ret_sts_error) THEN
330: RAISE fnd_api.g_exc_error;
331: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
332: RAISE fnd_api.g_exc_unexpected_error;
333: END IF;
334:
335: --create batch steps updates the batch header
328: RAISE no_continous_periods;
329: ELSIF (x_return_status = fnd_api.g_ret_sts_error) THEN
330: RAISE fnd_api.g_exc_error;
331: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
332: RAISE fnd_api.g_exc_unexpected_error;
333: END IF;
334:
335: --create batch steps updates the batch header
336: IF (gme_common_pvt.steps.COUNT > 0) THEN
396: ,p_token2_value => l_prim_item_um
397: ,p_token3_name => 'module'
398: ,p_token3_value => 'GME_REROUTE_BATCH_PVT.reroute_batch'
399: ,p_product_code => 'INV');
400: RAISE fnd_api.g_exc_error;
401: END IF;
402:
403: IF (gme_common_pvt.calc_date_from_prod_rule
404: (p_organization_id => x_batch_header_rec.organization_id
476: ||to_char(l_material_detail_ids_tab (i))
477: ||' return status = '||x_return_status);
478: END IF;
479:
480: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
481: RAISE fnd_api.g_exc_error;
482: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
483: RAISE fnd_api.g_exc_unexpected_error;
484: END IF;
477: ||' return status = '||x_return_status);
478: END IF;
479:
480: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
481: RAISE fnd_api.g_exc_error;
482: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
483: RAISE fnd_api.g_exc_unexpected_error;
484: END IF;
485: /*Sunitha Ch Bug 5353941 seperated the check whether the material is assciated with step or not and
478: END IF;
479:
480: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
481: RAISE fnd_api.g_exc_error;
482: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
483: RAISE fnd_api.g_exc_unexpected_error;
484: END IF;
485: /*Sunitha Ch Bug 5353941 seperated the check whether the material is assciated with step or not and
486: if it is not assciated then added a select statement to retrieve the planed start date of the parent batch into l_phantom_batch_header_rec.plan_cmplt_date*/
479:
480: IF (x_return_status = fnd_api.g_ret_sts_error) THEN
481: RAISE fnd_api.g_exc_error;
482: ELSIF (x_return_status = fnd_api.g_ret_sts_unexp_error) THEN
483: RAISE fnd_api.g_exc_unexpected_error;
484: END IF;
485: /*Sunitha Ch Bug 5353941 seperated the check whether the material is assciated with step or not and
486: if it is not assciated then added a select statement to retrieve the planed start date of the parent batch into l_phantom_batch_header_rec.plan_cmplt_date*/
487:
511: l_phantom_batch_step_rec.plan_start_date:=NULL;
512: gme_reschedule_step_pvt.reschedule_step
513: (p_batch_step_rec => l_phantom_batch_step_rec
514: ,p_source_step_id_tbl => l_step_tbl
515: ,p_contiguity_override => fnd_api.g_true
516: ,p_reschedule_preceding => fnd_api.g_true
517: ,p_reschedule_succeeding => fnd_api.g_true
518: ,p_use_workday_cal => fnd_api.g_false
519: ,x_batch_step_rec => x_batch_step_rec
512: gme_reschedule_step_pvt.reschedule_step
513: (p_batch_step_rec => l_phantom_batch_step_rec
514: ,p_source_step_id_tbl => l_step_tbl
515: ,p_contiguity_override => fnd_api.g_true
516: ,p_reschedule_preceding => fnd_api.g_true
517: ,p_reschedule_succeeding => fnd_api.g_true
518: ,p_use_workday_cal => fnd_api.g_false
519: ,x_batch_step_rec => x_batch_step_rec
520: ,x_return_status => x_return_status);
513: (p_batch_step_rec => l_phantom_batch_step_rec
514: ,p_source_step_id_tbl => l_step_tbl
515: ,p_contiguity_override => fnd_api.g_true
516: ,p_reschedule_preceding => fnd_api.g_true
517: ,p_reschedule_succeeding => fnd_api.g_true
518: ,p_use_workday_cal => fnd_api.g_false
519: ,x_batch_step_rec => x_batch_step_rec
520: ,x_return_status => x_return_status);
521: ELSE
514: ,p_source_step_id_tbl => l_step_tbl
515: ,p_contiguity_override => fnd_api.g_true
516: ,p_reschedule_preceding => fnd_api.g_true
517: ,p_reschedule_succeeding => fnd_api.g_true
518: ,p_use_workday_cal => fnd_api.g_false
519: ,x_batch_step_rec => x_batch_step_rec
520: ,x_return_status => x_return_status);
521: ELSE
522: gme_debug.put_line('sc l_phantom_batch_header_rec.batch_id is '||l_phantom_batch_header_rec.batch_id);
523: l_phantom_batch_header_rec.plan_cmplt_date:=l_material_detail_rec.material_requirement_date;
524: gme_debug.put_line('sc l_phantom_batch_header_rec.plan_cmplt_date is '||to_char(l_phantom_batch_step_rec.plan_cmplt_date, 'DD-MON-YY HH24:MI:SS'));
525: gme_reschedule_batch_pvt.reschedule_batch
526: (p_batch_header_rec => l_phantom_batch_header_rec
527: ,p_use_workday_cal => fnd_api.g_false
528: ,p_contiguity_override => fnd_api.g_true
529: ,x_batch_header_rec => l_phantom_batch_header_rec_out
530: ,x_return_status => x_return_status);
531: gme_debug.put_line('sc l_phantom_batch_header_rec_out.plan_cmplt_date is '||to_char(l_phantom_batch_header_rec_out.plan_cmplt_date, 'DD-MON-YY HH24:MI:SS'));
524: gme_debug.put_line('sc l_phantom_batch_header_rec.plan_cmplt_date is '||to_char(l_phantom_batch_step_rec.plan_cmplt_date, 'DD-MON-YY HH24:MI:SS'));
525: gme_reschedule_batch_pvt.reschedule_batch
526: (p_batch_header_rec => l_phantom_batch_header_rec
527: ,p_use_workday_cal => fnd_api.g_false
528: ,p_contiguity_override => fnd_api.g_true
529: ,x_batch_header_rec => l_phantom_batch_header_rec_out
530: ,x_return_status => x_return_status);
531: gme_debug.put_line('sc l_phantom_batch_header_rec_out.plan_cmplt_date is '||to_char(l_phantom_batch_header_rec_out.plan_cmplt_date, 'DD-MON-YY HH24:MI:SS'));
532: gme_debug.put_line('sc l_phantom_batch_header_rec_out.batch_id is '||l_phantom_batch_header_rec_out.batch_id);
557: END LOOP; /* FOR i IN 1..l_material_detail_ids_tab.COUNT */
558:
559: --FPBug#4585491 Begin
560: --commented the following code
561: /*IF (l_W_ReturnedAtLeastOnce) AND (x_return_status = fnd_api.g_ret_sts_success) THEN
562: x_return_status := 'W';
563: END IF; */
564:
565: /* If any of the reservations are MO allocations deleted then respective message
576: ----atleast for one material line MO allocations are deleted
577: gme_common_pvt.log_message('GME_EXPIRED_MO_DELETED');
578: --x_return_status := 'W';
579: END IF;
580: x_return_status := fnd_api.g_ret_sts_success;
581: --FPBug#4585491 End
582: --Susruth Bug#5359091 Finite Scheduled indicator is set back to 0 once the batch is rerouted. start.
583: IF x_batch_header_rec.FINITE_SCHEDULED_IND = 1 THEN
584: x_batch_header_rec.FINITE_SCHEDULED_IND := 0;
584: x_batch_header_rec.FINITE_SCHEDULED_IND := 0;
585: END IF;
586: -- Bug#5359091 end.
587: IF NOT gme_batch_header_dbl.update_row (x_batch_header_rec) THEN
588: RAISE fnd_api.g_exc_error;
589: END IF;
590:
591: IF (NVL (g_debug, 0) IN
592: (gme_debug.g_log_statement, gme_debug.g_log_procedure) ) THEN
599: END IF;
600: EXCEPTION
601: WHEN no_continous_periods THEN
602: RETURN;
603: WHEN fnd_api.g_exc_error THEN
604: x_return_status := fnd_api.g_ret_sts_error;
605: WHEN fnd_api.g_exc_unexpected_error THEN
606: x_return_status := fnd_api.g_ret_sts_unexp_error;
607:
600: EXCEPTION
601: WHEN no_continous_periods THEN
602: RETURN;
603: WHEN fnd_api.g_exc_error THEN
604: x_return_status := fnd_api.g_ret_sts_error;
605: WHEN fnd_api.g_exc_unexpected_error THEN
606: x_return_status := fnd_api.g_ret_sts_unexp_error;
607:
608: IF (NVL (g_debug, 0) > 0) THEN
601: WHEN no_continous_periods THEN
602: RETURN;
603: WHEN fnd_api.g_exc_error THEN
604: x_return_status := fnd_api.g_ret_sts_error;
605: WHEN fnd_api.g_exc_unexpected_error THEN
606: x_return_status := fnd_api.g_ret_sts_unexp_error;
607:
608: IF (NVL (g_debug, 0) > 0) THEN
609: gme_debug.put_line ( g_pkg_name
602: RETURN;
603: WHEN fnd_api.g_exc_error THEN
604: x_return_status := fnd_api.g_ret_sts_error;
605: WHEN fnd_api.g_exc_unexpected_error THEN
606: x_return_status := fnd_api.g_ret_sts_unexp_error;
607:
608: IF (NVL (g_debug, 0) > 0) THEN
609: gme_debug.put_line ( g_pkg_name
610: || '.'
614: || SQLERRM);
615: END IF;
616: WHEN error_dbl THEN
617: gme_common_pvt.log_message ('GME_UNEXPECTED_ERROR', 'ERROR', SQLERRM);
618: x_return_status := FND_API.g_ret_sts_unexp_error;
619:
620: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
621: gme_debug.put_line (g_pkg_name||'.'||l_api_name|| ': '
622: || l_proc|| ' unexpected error: '|| SQLERRM);
622: || l_proc|| ' unexpected error: '|| SQLERRM);
623: END IF;
624: WHEN OTHERS THEN
625: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
626: x_return_status := fnd_api.g_ret_sts_unexp_error;
627:
628: IF (NVL (g_debug, 0) > 0) THEN
629: gme_debug.put_line ( g_pkg_name
630: || '.'
659: || 'Entering');
660: END IF;
661:
662: /* Set the return status to success initially */
663: x_return_status := fnd_api.g_ret_sts_success;
664:
665: DELETE FROM gme_process_parameters
666: WHERE batch_id = p_batch_id;
667:
698: || 'Exiting with '
699: || x_return_status);
700: END IF;
701: EXCEPTION
702: WHEN fnd_api.g_exc_error THEN
703: x_return_status := fnd_api.g_ret_sts_error;
704: WHEN fnd_api.g_exc_unexpected_error THEN
705: x_return_status := fnd_api.g_ret_sts_unexp_error;
706:
699: || x_return_status);
700: END IF;
701: EXCEPTION
702: WHEN fnd_api.g_exc_error THEN
703: x_return_status := fnd_api.g_ret_sts_error;
704: WHEN fnd_api.g_exc_unexpected_error THEN
705: x_return_status := fnd_api.g_ret_sts_unexp_error;
706:
707: IF (NVL (g_debug, 0) > 0) THEN
700: END IF;
701: EXCEPTION
702: WHEN fnd_api.g_exc_error THEN
703: x_return_status := fnd_api.g_ret_sts_error;
704: WHEN fnd_api.g_exc_unexpected_error THEN
705: x_return_status := fnd_api.g_ret_sts_unexp_error;
706:
707: IF (NVL (g_debug, 0) > 0) THEN
708: gme_debug.put_line ( g_pkg_name
701: EXCEPTION
702: WHEN fnd_api.g_exc_error THEN
703: x_return_status := fnd_api.g_ret_sts_error;
704: WHEN fnd_api.g_exc_unexpected_error THEN
705: x_return_status := fnd_api.g_ret_sts_unexp_error;
706:
707: IF (NVL (g_debug, 0) > 0) THEN
708: gme_debug.put_line ( g_pkg_name
709: || '.'
713: || SQLERRM);
714: END IF;
715: WHEN OTHERS THEN
716: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
717: x_return_status := fnd_api.g_ret_sts_unexp_error;
718:
719: IF (NVL (g_debug, 0) > 0) THEN
720: gme_debug.put_line ( g_pkg_name
721: || '.'
761: || 'Entering');
762: END IF;
763:
764: /* Set the return status to success initially */
765: x_return_status := fnd_api.g_ret_sts_success;
766:
767: /* Don't allow the Batch to be Rerouted if the Batch Status is not pending */
768: IF (p_batch_header_rec.batch_status <> 1) THEN
769: gme_common_pvt.log_message ('GME_API_INVALID_BATCH_REROUTE');
766:
767: /* Don't allow the Batch to be Rerouted if the Batch Status is not pending */
768: IF (p_batch_header_rec.batch_status <> 1) THEN
769: gme_common_pvt.log_message ('GME_API_INVALID_BATCH_REROUTE');
770: RAISE fnd_api.g_exc_error;
771: END IF;
772:
773: /* LCF Batches may not have a validity rule
774: We do not want to allow reroute for these batches */
774: We do not want to allow reroute for these batches */
775: IF (p_batch_header_rec.recipe_validity_rule_id IS NULL) THEN
776: --Bug#5439736 replaced the message
777: gme_common_pvt.log_message ('GME_REROUTE_NOT_FOR_LCF');
778: RAISE fnd_api.g_exc_error;
779: END IF;
780:
781: /* New validity rule should be different from the existing */
782: IF p_batch_header_rec.recipe_validity_rule_id = p_validity_rule_id THEN
780:
781: /* New validity rule should be different from the existing */
782: IF p_batch_header_rec.recipe_validity_rule_id = p_validity_rule_id THEN
783: gme_common_pvt.log_message ('GME_API_SAME_VALIDITY_RULE');
784: RAISE fnd_api.g_exc_error;
785: END IF;
786:
787: OPEN cur_get_validity_rule_details (p_validity_rule_id);
788:
792: IF (cur_get_validity_rule_details%NOTFOUND) THEN
793: CLOSE cur_get_validity_rule_details;
794:
795: gme_common_pvt.log_message ('GME_API_INVALID_VALIDITY');
796: RAISE fnd_api.g_exc_error;
797: END IF;
798:
799: CLOSE cur_get_validity_rule_details;
800:
808: IF (cur_get_material_details%NOTFOUND) THEN
809: CLOSE cur_get_material_details;
810: --Bug#5439736 replaced the message
811: gme_common_pvt.log_message ('GME_REROUTE_NO_PRIM_PROD');
812: RAISE fnd_api.g_exc_error;
813: END IF;
814:
815: CLOSE cur_get_material_details;
816:
816:
817: /* whether the new validity rule belongs to the same formula as the batch */
818: IF (p_batch_header_rec.formula_id <> l_formula_id) THEN
819: gme_common_pvt.log_message ('GME_API_VALIDITY_DIFF_FORM');
820: RAISE fnd_api.g_exc_error;
821: END IF;
822:
823: IF (NVL (g_debug, 0) IN
824: (gme_debug.g_log_statement, gme_debug.g_log_procedure) ) THEN
829: || 'Exiting with '
830: || x_return_status);
831: END IF;
832: EXCEPTION
833: WHEN fnd_api.g_exc_error THEN
834: x_return_status := fnd_api.g_ret_sts_error;
835: WHEN fnd_api.g_exc_unexpected_error THEN
836: x_return_status := fnd_api.g_ret_sts_unexp_error;
837:
830: || x_return_status);
831: END IF;
832: EXCEPTION
833: WHEN fnd_api.g_exc_error THEN
834: x_return_status := fnd_api.g_ret_sts_error;
835: WHEN fnd_api.g_exc_unexpected_error THEN
836: x_return_status := fnd_api.g_ret_sts_unexp_error;
837:
838: IF (NVL (g_debug, 0) > 0) THEN
831: END IF;
832: EXCEPTION
833: WHEN fnd_api.g_exc_error THEN
834: x_return_status := fnd_api.g_ret_sts_error;
835: WHEN fnd_api.g_exc_unexpected_error THEN
836: x_return_status := fnd_api.g_ret_sts_unexp_error;
837:
838: IF (NVL (g_debug, 0) > 0) THEN
839: gme_debug.put_line ( g_pkg_name
832: EXCEPTION
833: WHEN fnd_api.g_exc_error THEN
834: x_return_status := fnd_api.g_ret_sts_error;
835: WHEN fnd_api.g_exc_unexpected_error THEN
836: x_return_status := fnd_api.g_ret_sts_unexp_error;
837:
838: IF (NVL (g_debug, 0) > 0) THEN
839: gme_debug.put_line ( g_pkg_name
840: || '.'
844: || SQLERRM);
845: END IF;
846: WHEN OTHERS THEN
847: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
848: x_return_status := fnd_api.g_ret_sts_unexp_error;
849:
850: IF (NVL (g_debug, 0) > 0) THEN
851: gme_debug.put_line ( g_pkg_name
852: || '.'
918: || 'Entering');
919: END IF;
920:
921: /* Set the return status to success initially */
922: x_return_status := fnd_api.g_ret_sts_success;
923:
924: /* determine prod qty and passing */
925: /* item_id, qty and uom to pass to cursor validate_validity */
926: FOR get_rec IN cur_prod_details (p_batch_header_rec.batch_id
947: ,p_token2_value => get_rec.item_um
948: ,p_token3_name => 'module'
949: ,p_token3_value => 'GME_REROUTE_BATCH_PVT.validate_validity_id'
950: ,p_product_code => 'INV');
951: RAISE fnd_api.g_exc_error;
952: ELSE
953: l_prod_qty := NVL (l_prod_qty, 0) + l_conv_qty;
954: END IF;
955: END IF;
966: CLOSE cur_validate_validity;
967:
968: IF (l_count = 0) THEN
969: gme_common_pvt.log_message ('GME_API_INVALID_VALIDITY');
970: RAISE fnd_api.g_exc_error;
971: END IF;
972:
973: IF (NVL (g_debug, 0) IN
974: (gme_debug.g_log_statement, gme_debug.g_log_procedure) ) THEN
979: || 'Exiting with '
980: || x_return_status);
981: END IF;
982: EXCEPTION
983: WHEN fnd_api.g_exc_error THEN
984: x_return_status := fnd_api.g_ret_sts_error;
985: WHEN fnd_api.g_exc_unexpected_error THEN
986: x_return_status := fnd_api.g_ret_sts_unexp_error;
987:
980: || x_return_status);
981: END IF;
982: EXCEPTION
983: WHEN fnd_api.g_exc_error THEN
984: x_return_status := fnd_api.g_ret_sts_error;
985: WHEN fnd_api.g_exc_unexpected_error THEN
986: x_return_status := fnd_api.g_ret_sts_unexp_error;
987:
988: IF (NVL (g_debug, 0) > 0) THEN
981: END IF;
982: EXCEPTION
983: WHEN fnd_api.g_exc_error THEN
984: x_return_status := fnd_api.g_ret_sts_error;
985: WHEN fnd_api.g_exc_unexpected_error THEN
986: x_return_status := fnd_api.g_ret_sts_unexp_error;
987:
988: IF (NVL (g_debug, 0) > 0) THEN
989: gme_debug.put_line ( g_pkg_name
982: EXCEPTION
983: WHEN fnd_api.g_exc_error THEN
984: x_return_status := fnd_api.g_ret_sts_error;
985: WHEN fnd_api.g_exc_unexpected_error THEN
986: x_return_status := fnd_api.g_ret_sts_unexp_error;
987:
988: IF (NVL (g_debug, 0) > 0) THEN
989: gme_debug.put_line ( g_pkg_name
990: || '.'
994: || SQLERRM);
995: END IF;
996: WHEN OTHERS THEN
997: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
998: x_return_status := fnd_api.g_ret_sts_unexp_error;
999:
1000: IF (NVL (g_debug, 0) > 0) THEN
1001: gme_debug.put_line ( g_pkg_name
1002: || '.'