175: SELECT batchstep_id
176: FROM gme_batch_steps
177: WHERE batch_id = v_batch_id;
178: BEGIN
179: IF g_debug <= gme_debug.g_log_procedure THEN
180: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
181: || l_api_name);
182: END IF;
183:
176: FROM gme_batch_steps
177: WHERE batch_id = v_batch_id;
178: BEGIN
179: IF g_debug <= gme_debug.g_log_procedure THEN
180: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
181: || l_api_name);
182: END IF;
183:
184: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
180: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
181: || l_api_name);
182: END IF;
183:
184: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
185: gme_debug.put_line ('BEGIN Create_step');
186: END IF;
187:
188: x_return_status := fnd_api.g_ret_sts_success;
181: || l_api_name);
182: END IF;
183:
184: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
185: gme_debug.put_line ('BEGIN Create_step');
186: END IF;
187:
188: x_return_status := fnd_api.g_ret_sts_success;
189: l_batch_id := p_gme_batch_header_rec.batch_id;
209: j := 0;
210: l_step_charge_rsrc_tab.DELETE ();
211:
212: --Bug#5112133
213: IF (NVL(g_debug, -1) = gme_debug.g_log_statement) THEN
214: gme_debug.put_line ('copy_routing_text_ind = '||gme_common_pvt.g_copy_routing_text_ind);
215: END IF;
216: WHILE i IS NOT NULL LOOP
217: l_gme_batch_steps.EXTEND;
210: l_step_charge_rsrc_tab.DELETE ();
211:
212: --Bug#5112133
213: IF (NVL(g_debug, -1) = gme_debug.g_log_statement) THEN
214: gme_debug.put_line ('copy_routing_text_ind = '||gme_common_pvt.g_copy_routing_text_ind);
215: END IF;
216: WHILE i IS NOT NULL LOOP
217: l_gme_batch_steps.EXTEND;
218:
258: ELSE
259: l_gme_batch_steps (j).due_date := p_step_due_date;
260: END IF;
261:
262: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
263: gme_debug.put_line ( ' minimum_transfer_qty '
264: || l_gme_batch_steps (j).minimum_transfer_qty);
265: gme_debug.put_line ( ' max step capacity '
266: || l_gme_batch_steps (j).max_step_capacity);
259: l_gme_batch_steps (j).due_date := p_step_due_date;
260: END IF;
261:
262: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
263: gme_debug.put_line ( ' minimum_transfer_qty '
264: || l_gme_batch_steps (j).minimum_transfer_qty);
265: gme_debug.put_line ( ' max step capacity '
266: || l_gme_batch_steps (j).max_step_capacity);
267: gme_debug.put_line ( ' max step capacity uom '
261:
262: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
263: gme_debug.put_line ( ' minimum_transfer_qty '
264: || l_gme_batch_steps (j).minimum_transfer_qty);
265: gme_debug.put_line ( ' max step capacity '
266: || l_gme_batch_steps (j).max_step_capacity);
267: gme_debug.put_line ( ' max step capacity uom '
268: || l_gme_batch_steps (j).max_step_capacity_um);
269: END IF;
263: gme_debug.put_line ( ' minimum_transfer_qty '
264: || l_gme_batch_steps (j).minimum_transfer_qty);
265: gme_debug.put_line ( ' max step capacity '
266: || l_gme_batch_steps (j).max_step_capacity);
267: gme_debug.put_line ( ' max step capacity uom '
268: || l_gme_batch_steps (j).max_step_capacity_um);
269: END IF;
270:
271: -- Insert text if copy text is on and there is text on the step passed in...
279: || '|';
280: l_text_string :=
281: l_text_string || l_gme_batch_steps (j).batchstep_no;
282: --Bug#5112133
283: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
284: gme_debug.put_line ('text code for step=' || l_gmd_text_code);
285: gme_debug.put_line ('key_field for step=' || l_text_string);
286: gme_debug.put_line ('calling copy_and_create_text for step line');
287: END IF;
280: l_text_string :=
281: l_text_string || l_gme_batch_steps (j).batchstep_no;
282: --Bug#5112133
283: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
284: gme_debug.put_line ('text code for step=' || l_gmd_text_code);
285: gme_debug.put_line ('key_field for step=' || l_text_string);
286: gme_debug.put_line ('calling copy_and_create_text for step line');
287: END IF;
288: copy_and_create_text (l_gmd_text_code
281: l_text_string || l_gme_batch_steps (j).batchstep_no;
282: --Bug#5112133
283: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
284: gme_debug.put_line ('text code for step=' || l_gmd_text_code);
285: gme_debug.put_line ('key_field for step=' || l_text_string);
286: gme_debug.put_line ('calling copy_and_create_text for step line');
287: END IF;
288: copy_and_create_text (l_gmd_text_code
289: ,l_text_string
282: --Bug#5112133
283: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
284: gme_debug.put_line ('text code for step=' || l_gmd_text_code);
285: gme_debug.put_line ('key_field for step=' || l_text_string);
286: gme_debug.put_line ('calling copy_and_create_text for step line');
287: END IF;
288: copy_and_create_text (l_gmd_text_code
289: ,l_text_string
290: ,l_gme_text_code
331: l_last_batchstep_id := l_gme_batch_steps (j).batchstep_id;
332: l_step_charge_rsrc_tab (l_last_batchstep_id).resources :=
333: p_recipe_rout_step_tbl (j).resources;
334:
335: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
336: gme_debug.put_line ( g_pkg_name
337: || '.'
338: || l_api_name
339: || 'resources name obtained from GMD is'
332: l_step_charge_rsrc_tab (l_last_batchstep_id).resources :=
333: p_recipe_rout_step_tbl (j).resources;
334:
335: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
336: gme_debug.put_line ( g_pkg_name
337: || '.'
338: || l_api_name
339: || 'resources name obtained from GMD is'
340: || p_recipe_rout_step_tbl (j).resources);
345:
346: i := p_recipe_rout_step_tbl.NEXT (i);
347: END LOOP; /* WHILE i IS NOT NULL; BATCH STEPS */
348:
349: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
350: gme_debug.put_line ('Completed batch steps');
351: gme_debug.put_line ('GME_BATCH_STEP_ACTIVITIES');
352: END IF;
353:
346: i := p_recipe_rout_step_tbl.NEXT (i);
347: END LOOP; /* WHILE i IS NOT NULL; BATCH STEPS */
348:
349: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
350: gme_debug.put_line ('Completed batch steps');
351: gme_debug.put_line ('GME_BATCH_STEP_ACTIVITIES');
352: END IF;
353:
354: i := p_recipe_rout_act_tbl.FIRST;
347: END LOOP; /* WHILE i IS NOT NULL; BATCH STEPS */
348:
349: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
350: gme_debug.put_line ('Completed batch steps');
351: gme_debug.put_line ('GME_BATCH_STEP_ACTIVITIES');
352: END IF;
353:
354: i := p_recipe_rout_act_tbl.FIRST;
355: j := 0;
421: l_text_string :=
422: l_text_string || p_recipe_rout_act_tbl (i).activity;
423:
424: --Bug#5112133
425: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
426: gme_debug.put_line ('text code for activity=' || l_gmd_text_code);
427: gme_debug.put_line ('key_field for activity=' || l_text_string);
428: gme_debug.put_line ('calling copy_and_create_text for activities');
429: END IF;
422: l_text_string || p_recipe_rout_act_tbl (i).activity;
423:
424: --Bug#5112133
425: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
426: gme_debug.put_line ('text code for activity=' || l_gmd_text_code);
427: gme_debug.put_line ('key_field for activity=' || l_text_string);
428: gme_debug.put_line ('calling copy_and_create_text for activities');
429: END IF;
430:
423:
424: --Bug#5112133
425: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
426: gme_debug.put_line ('text code for activity=' || l_gmd_text_code);
427: gme_debug.put_line ('key_field for activity=' || l_text_string);
428: gme_debug.put_line ('calling copy_and_create_text for activities');
429: END IF;
430:
431: copy_and_create_text (l_gmd_text_code
424: --Bug#5112133
425: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
426: gme_debug.put_line ('text code for activity=' || l_gmd_text_code);
427: gme_debug.put_line ('key_field for activity=' || l_text_string);
428: gme_debug.put_line ('calling copy_and_create_text for activities');
429: END IF;
430:
431: copy_and_create_text (l_gmd_text_code
432: ,l_text_string
465:
466: i := p_recipe_rout_act_tbl.NEXT (i);
467: END LOOP; /* WHILE i IS NOT NULL; STEP ACTIVITIES */
468:
469: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
470: gme_debug.put_line ('Completed GME_BATCH_STEP_ACTIVITIES');
471: -- Create data for GME_BATCH_STEP_RESOURCES and GME_RESOURCE_TXNS...
472: gme_debug.put_line ('GME_BATCH_STEP_RESOURCES');
473: END IF;
466: i := p_recipe_rout_act_tbl.NEXT (i);
467: END LOOP; /* WHILE i IS NOT NULL; STEP ACTIVITIES */
468:
469: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
470: gme_debug.put_line ('Completed GME_BATCH_STEP_ACTIVITIES');
471: -- Create data for GME_BATCH_STEP_RESOURCES and GME_RESOURCE_TXNS...
472: gme_debug.put_line ('GME_BATCH_STEP_RESOURCES');
473: END IF;
474:
468:
469: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
470: gme_debug.put_line ('Completed GME_BATCH_STEP_ACTIVITIES');
471: -- Create data for GME_BATCH_STEP_RESOURCES and GME_RESOURCE_TXNS...
472: gme_debug.put_line ('GME_BATCH_STEP_RESOURCES');
473: END IF;
474:
475: i := p_recipe_rout_resc_tbl.FIRST;
476: j := 0;
552: RAISE invalid_resource_qty_usage;
553: END IF;
554: END IF;
555:
556: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
557: gme_debug.put_line ( ' plan_rsrc_qty '
558: || l_gme_batch_step_resources (j).plan_rsrc_qty);
559: END IF;
560:
553: END IF;
554: END IF;
555:
556: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
557: gme_debug.put_line ( ' plan_rsrc_qty '
558: || l_gme_batch_step_resources (j).plan_rsrc_qty);
559: END IF;
560:
561: -- Link this resource to the batch step it belongs to...
608: l_text_string :=
609: l_text_string || p_recipe_rout_resc_tbl (i).resources;
610:
611: --Bug#5112133
612: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
613: gme_debug.put_line ('text code for resource=' || l_gmd_text_code);
614: gme_debug.put_line ('key_field for resource=' || l_text_string);
615: gme_debug.put_line ('calling copy_and_create_text for resources');
616: END IF;
609: l_text_string || p_recipe_rout_resc_tbl (i).resources;
610:
611: --Bug#5112133
612: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
613: gme_debug.put_line ('text code for resource=' || l_gmd_text_code);
614: gme_debug.put_line ('key_field for resource=' || l_text_string);
615: gme_debug.put_line ('calling copy_and_create_text for resources');
616: END IF;
617:
610:
611: --Bug#5112133
612: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
613: gme_debug.put_line ('text code for resource=' || l_gmd_text_code);
614: gme_debug.put_line ('key_field for resource=' || l_text_string);
615: gme_debug.put_line ('calling copy_and_create_text for resources');
616: END IF;
617:
618: copy_and_create_text (l_gmd_text_code
611: --Bug#5112133
612: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
613: gme_debug.put_line ('text code for resource=' || l_gmd_text_code);
614: gme_debug.put_line ('key_field for resource=' || l_text_string);
615: gme_debug.put_line ('calling copy_and_create_text for resources');
616: END IF;
617:
618: copy_and_create_text (l_gmd_text_code
619: ,l_text_string
656: IF l_gme_batch_step_resources.COUNT > 0 THEN
657: gme_batch_step_chg_pvt.set_sequence_dependent_id (l_batch_id);
658: END IF;
659:
660: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
661: gme_debug.put_line ('Completed GME_BATCH_STEP_RESOURCES');
662: gme_debug.put_line ('GME_step_process_parameters');
663: END IF;
664:
657: gme_batch_step_chg_pvt.set_sequence_dependent_id (l_batch_id);
658: END IF;
659:
660: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
661: gme_debug.put_line ('Completed GME_BATCH_STEP_RESOURCES');
662: gme_debug.put_line ('GME_step_process_parameters');
663: END IF;
664:
665: FOR m IN 1 .. p_resc_parameters_tbl.COUNT LOOP
658: END IF;
659:
660: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
661: gme_debug.put_line ('Completed GME_BATCH_STEP_RESOURCES');
662: gme_debug.put_line ('GME_step_process_parameters');
663: END IF;
664:
665: FOR m IN 1 .. p_resc_parameters_tbl.COUNT LOOP
666: l_gme_rsrc_parameters.EXTEND;
733: RAISE error_insert_b_res_param;
734: END IF;
735: END LOOP;
736:
737: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
738: gme_debug.put_line ('GME_BATCH_STEP_ITEMS');
739: END IF;
740:
741: -- Create data for GME_BATCH_STEP_ITEMS --> item/step assocations...
734: END IF;
735: END LOOP;
736:
737: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
738: gme_debug.put_line ('GME_BATCH_STEP_ITEMS');
739: END IF;
740:
741: -- Create data for GME_BATCH_STEP_ITEMS --> item/step assocations...
742: i := p_recipe_rout_matl_tbl.FIRST;
821:
822: i := p_recipe_rout_matl_tbl.NEXT (i);
823: END LOOP; /* WHILE i IS NOT NULL ; STEP ITEM ASSOCIATIONS*/
824:
825: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
826: gme_debug.put_line ('Completed GME_BATCH_STEP_ITEMS');
827: gme_debug.put_line ('GME_BATCH_STEP_DEPENDENCIES');
828: END IF;
829:
822: i := p_recipe_rout_matl_tbl.NEXT (i);
823: END LOOP; /* WHILE i IS NOT NULL ; STEP ITEM ASSOCIATIONS*/
824:
825: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
826: gme_debug.put_line ('Completed GME_BATCH_STEP_ITEMS');
827: gme_debug.put_line ('GME_BATCH_STEP_DEPENDENCIES');
828: END IF;
829:
830: -- Create data for GME_BATCH_STEP_DEPENDENCIES
823: END LOOP; /* WHILE i IS NOT NULL ; STEP ITEM ASSOCIATIONS*/
824:
825: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
826: gme_debug.put_line ('Completed GME_BATCH_STEP_ITEMS');
827: gme_debug.put_line ('GME_BATCH_STEP_DEPENDENCIES');
828: END IF;
829:
830: -- Create data for GME_BATCH_STEP_DEPENDENCIES
831: i := p_routing_depd_tbl.FIRST;
881:
882: i := p_routing_depd_tbl.NEXT (i);
883: END LOOP; /* WHILE i IS NOT NULL ; STEP DEPENDENCIES*/
884:
885: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
886: gme_debug.put_line ('Completed GME_BATCH_STEP_DEPENDENCIES');
887: END IF;
888:
889: -- Now calculate the step quantities...
882: i := p_routing_depd_tbl.NEXT (i);
883: END LOOP; /* WHILE i IS NOT NULL ; STEP DEPENDENCIES*/
884:
885: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
886: gme_debug.put_line ('Completed GME_BATCH_STEP_DEPENDENCIES');
887: END IF;
888:
889: -- Now calculate the step quantities...
890: IF ( p_recipe_rout_step_tbl.COUNT = 1
894: -- are no item_step_associations either... so do nothing...
895: NULL;
896: ELSE
897: IF (p_gme_batch_header_rec.automatic_step_calculation = 1) THEN
898: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
899: gme_debug.put_line ('auto step calc...');
900: END IF;
901:
902: gmd_auto_step_calc.calc_step_qty
895: NULL;
896: ELSE
897: IF (p_gme_batch_header_rec.automatic_step_calculation = 1) THEN
898: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
899: gme_debug.put_line ('auto step calc...');
900: END IF;
901:
902: gmd_auto_step_calc.calc_step_qty
903: (p_parent_id => l_batch_id
907: ,p_return_status => l_return_status
908: ,p_called_from_batch => 1
909: ,p_organization_id => p_gme_batch_header_rec.organization_id);
910: ELSE
911: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
912: gme_debug.put_line ('NO auto step calc...');
913: END IF;
914:
915: calc_step_qty (l_batch_id, l_step_tbl, l_return_status, 1);
908: ,p_called_from_batch => 1
909: ,p_organization_id => p_gme_batch_header_rec.organization_id);
910: ELSE
911: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
912: gme_debug.put_line ('NO auto step calc...');
913: END IF;
914:
915: calc_step_qty (l_batch_id, l_step_tbl, l_return_status, 1);
916: END IF;
915: calc_step_qty (l_batch_id, l_step_tbl, l_return_status, 1);
916: END IF;
917:
918: IF l_return_status <> x_return_status THEN
919: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
920: gme_debug.put_line
921: (fnd_msg_pub.get (p_encoded => fnd_api.g_false) );
922: END IF;
923:
916: END IF;
917:
918: IF l_return_status <> x_return_status THEN
919: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
920: gme_debug.put_line
921: (fnd_msg_pub.get (p_encoded => fnd_api.g_false) );
922: END IF;
923:
924: RAISE error_calc_step_qty;
923:
924: RAISE error_calc_step_qty;
925: END IF;
926:
927: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
928: gme_debug.put_line ('done step calc...');
929: END IF;
930:
931: -- Update the plan_step_qty in GME_BATCH_STEPS
924: RAISE error_calc_step_qty;
925: END IF;
926:
927: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
928: gme_debug.put_line ('done step calc...');
929: END IF;
930:
931: -- Update the plan_step_qty in GME_BATCH_STEPS
932: FOR i IN l_step_tbl.FIRST .. l_step_tbl.LAST LOOP
967: --multiply the step qty with standard factor to get vol qty
968: l_volume_qty := p_recipe_rout_step_tbl (1).step_qty * l_std_factor;
969: END IF;
970:
971: IF NVL (g_debug, -1) = gme_debug.g_log_statement THEN
972: gme_debug.put_line
973: ( g_pkg_name
974: || '.'
975: || l_api_name
968: l_volume_qty := p_recipe_rout_step_tbl (1).step_qty * l_std_factor;
969: END IF;
970:
971: IF NVL (g_debug, -1) = gme_debug.g_log_statement THEN
972: gme_debug.put_line
973: ( g_pkg_name
974: || '.'
975: || l_api_name
976: || 'resources name passed in case of single step insertion is'
974: || '.'
975: || l_api_name
976: || 'resources name passed in case of single step insertion is'
977: || p_recipe_rout_step_tbl (1).resources);
978: gme_debug.put_line
979: ( g_pkg_name
980: || '.'
981: || l_api_name
982: || ' Mass Qty, Volume Qty: '
994: IF l_return_status <> x_return_status THEN
995: RAISE error_calc_charges;
996: END IF;
997:
998: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
999: gme_debug.put_line ( ' return status from calc charge '
1000: || l_return_status);
1001: gme_debug.put_line (' charges ' || TO_CHAR (l_charge) );
1002: END IF;
995: RAISE error_calc_charges;
996: END IF;
997:
998: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
999: gme_debug.put_line ( ' return status from calc charge '
1000: || l_return_status);
1001: gme_debug.put_line (' charges ' || TO_CHAR (l_charge) );
1002: END IF;
1003:
997:
998: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
999: gme_debug.put_line ( ' return status from calc charge '
1000: || l_return_status);
1001: gme_debug.put_line (' charges ' || TO_CHAR (l_charge) );
1002: END IF;
1003:
1004: UPDATE gme_batch_steps
1005: SET plan_charges = l_charge
1057: -- if scale_type = 0, then let's leave the plan_rsrc_qty to that passed in by GMD... scale_type = 0 is fixed
1058: AND plan_rsrc_qty <> 0;
1059:
1060: -- Update the resource quantities for all resources and usage if scale by charge...
1061: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1062: gme_debug.put_line (' plan charges ' || TO_CHAR (l_plan_charges) );
1063: END IF;
1064:
1065: IF l_plan_charges IS NOT NULL THEN
1058: AND plan_rsrc_qty <> 0;
1059:
1060: -- Update the resource quantities for all resources and usage if scale by charge...
1061: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1062: gme_debug.put_line (' plan charges ' || TO_CHAR (l_plan_charges) );
1063: END IF;
1064:
1065: IF l_plan_charges IS NOT NULL THEN
1066: UPDATE gme_batch_step_resources
1079: WHERE batchstep_id = l_last_batchstep_id AND scale_type = 2;
1080: -- scale_type = 2 denotes scale by charge...
1081: END IF;
1082:
1083: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1084: gme_debug.put_line ( ' total scale by charge '
1085: || TO_CHAR (l_total_scale_by_charge) );
1086: END IF;
1087:
1080: -- scale_type = 2 denotes scale by charge...
1081: END IF;
1082:
1083: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1084: gme_debug.put_line ( ' total scale by charge '
1085: || TO_CHAR (l_total_scale_by_charge) );
1086: END IF;
1087:
1088: l_total_scale_by_charge := l_count_scale_by_charge;
1134: AND scale_type <> 0
1135: AND plan_rsrc_qty <> 0;
1136:
1137: -- if scale_type = 0, then let's leave the plan_rsrc_qty to that passed in by GMD... scale_type = 0 is fixed
1138: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1139: gme_debug.put_line ( ' plan charges batch steps '
1140: || TO_CHAR (l_plan_charges) );
1141: END IF;
1142:
1135: AND plan_rsrc_qty <> 0;
1136:
1137: -- if scale_type = 0, then let's leave the plan_rsrc_qty to that passed in by GMD... scale_type = 0 is fixed
1138: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1139: gme_debug.put_line ( ' plan charges batch steps '
1140: || TO_CHAR (l_plan_charges) );
1141: END IF;
1142:
1143: IF l_plan_charges IS NOT NULL THEN
1160:
1161: l_total_scale_by_charge :=
1162: l_total_scale_by_charge + l_count_scale_by_charge;
1163:
1164: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1165: gme_debug.put_line ( ' l_total scale by charge loop '
1166: || TO_CHAR (l_total_scale_by_charge) );
1167: END IF;
1168:
1161: l_total_scale_by_charge :=
1162: l_total_scale_by_charge + l_count_scale_by_charge;
1163:
1164: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1165: gme_debug.put_line ( ' l_total scale by charge loop '
1166: || TO_CHAR (l_total_scale_by_charge) );
1167: END IF;
1168:
1169: FETCH cur_get_batch_steps
1214: RAISE process_qty_below_cap;
1215: END IF;
1216: END IF; /* IF NOT (p_ignore_qty_below_cap) */
1217:
1218: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1219: gme_debug.put_line ( 'l_total_scale_by_charge='
1220: || l_total_scale_by_charge);
1221: END IF;
1222:
1215: END IF;
1216: END IF; /* IF NOT (p_ignore_qty_below_cap) */
1217:
1218: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1219: gme_debug.put_line ( 'l_total_scale_by_charge='
1220: || l_total_scale_by_charge);
1221: END IF;
1222:
1223: IF l_total_scale_by_charge > 0 THEN
1221: END IF;
1222:
1223: IF l_total_scale_by_charge > 0 THEN
1224: -- we are not raising an error, just warn the user.
1225: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1226: gme_debug.put_line ('undefined charge warning');
1227: END IF;
1228:
1229: fnd_message.set_name ('GME', 'GME_UNDEF_CHRG_RSRC_SCALE');
1222:
1223: IF l_total_scale_by_charge > 0 THEN
1224: -- we are not raising an error, just warn the user.
1225: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1226: gme_debug.put_line ('undefined charge warning');
1227: END IF;
1228:
1229: fnd_message.set_name ('GME', 'GME_UNDEF_CHRG_RSRC_SCALE');
1230: fnd_msg_pub.ADD;
1265: INTO l_step_plan_start_date, l_step_plan_cmplt_date;
1266:
1267: CLOSE cur_step_dates;
1268:
1269: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1270: gme_debug.put_line ( l_api_name
1271: || 'start,cmplt dates for step are '
1272: || TO_CHAR (l_step_plan_start_date
1273: ,'DD-MON-YYYY HH24:MI:SS')
1266:
1267: CLOSE cur_step_dates;
1268:
1269: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1270: gme_debug.put_line ( l_api_name
1271: || 'start,cmplt dates for step are '
1272: || TO_CHAR (l_step_plan_start_date
1273: ,'DD-MON-YYYY HH24:MI:SS')
1274: || ' '
1273: ,'DD-MON-YYYY HH24:MI:SS')
1274: || ' '
1275: || TO_CHAR (l_step_plan_cmplt_date
1276: ,'DD-MON-YYYY HH24:MI:SS') );
1277: gme_debug.put_line
1278: ( 'user supplied start,cmplt dates for step are'
1279: || TO_CHAR (p_step_start_date
1280: ,'DD-MON-YYYY HH24:MI:SS')
1281: || ' '
1280: ,'DD-MON-YYYY HH24:MI:SS')
1281: || ' '
1282: || TO_CHAR (p_step_cmplt_date
1283: ,'DD-MON-YYYY HH24:MI:SS') );
1284: gme_debug.put_line
1285: ( 'start,cmplt dates for batch are'
1286: || TO_CHAR (p_gme_batch_header_rec.plan_start_date
1287: ,'DD-MON-YYYY HH24:MI:SS')
1288: || TO_CHAR (p_gme_batch_header_rec.plan_cmplt_date
1290: END IF;
1291:
1292: IF (p_step_cmplt_date IS NOT NULL)
1293: AND (p_step_cmplt_date <> l_step_plan_cmplt_date) THEN
1294: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1295: gme_debug.put_line
1296: ('p_step_cmplt_date diff from l_step_plan_cmplt_date');
1297: END IF;
1298:
1291:
1292: IF (p_step_cmplt_date IS NOT NULL)
1293: AND (p_step_cmplt_date <> l_step_plan_cmplt_date) THEN
1294: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1295: gme_debug.put_line
1296: ('p_step_cmplt_date diff from l_step_plan_cmplt_date');
1297: END IF;
1298:
1299: IF (p_step_cmplt_date > l_step_plan_cmplt_date) THEN
1323: l_step_plan_cmplt_date := p_step_cmplt_date;
1324: END IF; /* p_step_cmplt_date is not null */
1325:
1326: --picking the step values again
1327: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1328: gme_debug.put_line
1329: ( 'step start,cmplt dates for step after comparision with user step dates are'
1330: || TO_CHAR (l_step_plan_start_date, 'DD-MON-YYYY HH24:MI:SS')
1331: || ' '
1324: END IF; /* p_step_cmplt_date is not null */
1325:
1326: --picking the step values again
1327: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1328: gme_debug.put_line
1329: ( 'step start,cmplt dates for step after comparision with user step dates are'
1330: || TO_CHAR (l_step_plan_start_date, 'DD-MON-YYYY HH24:MI:SS')
1331: || ' '
1332: || TO_CHAR (l_step_plan_cmplt_date, 'DD-MON-YYYY HH24:MI:SS') );
1333: END IF;
1334:
1335: --checking against the batch dates
1336: IF (l_step_plan_start_date < p_gme_batch_header_rec.plan_start_date) THEN
1337: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1338: gme_debug.put_line
1339: ('l_step_plan_start_date diff from batch start date');
1340: END IF;
1341:
1334:
1335: --checking against the batch dates
1336: IF (l_step_plan_start_date < p_gme_batch_header_rec.plan_start_date) THEN
1337: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1338: gme_debug.put_line
1339: ('l_step_plan_start_date diff from batch start date');
1340: END IF;
1341:
1342: gme_reschedule_batch_pvt.truncate_date
1351: END IF;
1352: /* (l_step_plan_start_date < p_gme_batch_header_rec.plan_start_date) */
1353:
1354: IF (l_step_plan_cmplt_date > p_gme_batch_header_rec.plan_cmplt_date) THEN
1355: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1356: gme_debug.put_line
1357: ('l_step_plan_cmplt_date diff from batch cmplt date');
1358: END IF;
1359:
1352: /* (l_step_plan_start_date < p_gme_batch_header_rec.plan_start_date) */
1353:
1354: IF (l_step_plan_cmplt_date > p_gme_batch_header_rec.plan_cmplt_date) THEN
1355: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1356: gme_debug.put_line
1357: ('l_step_plan_cmplt_date diff from batch cmplt date');
1358: END IF;
1359:
1360: gme_reschedule_batch_pvt.truncate_date
1377:
1378: CLOSE cur_get_batchstep_ids;
1379:
1380: FOR i IN 1 .. l_batchstep_ids_tab.COUNT LOOP
1381: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1382: gme_debug.put_line ( 'batch,step ids are'
1383: || p_gme_batch_header_rec.batch_id
1384: || l_batchstep_ids_tab (i) );
1385: END IF;
1378: CLOSE cur_get_batchstep_ids;
1379:
1380: FOR i IN 1 .. l_batchstep_ids_tab.COUNT LOOP
1381: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1382: gme_debug.put_line ( 'batch,step ids are'
1383: || p_gme_batch_header_rec.batch_id
1384: || l_batchstep_ids_tab (i) );
1385: END IF;
1386:
1399:
1400: FETCH cur_get_resource_dates
1401: INTO l_rsrc_start_date, l_rsrc_cmplt_date;
1402:
1403: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1404: gme_debug.put_line ( g_pkg_name
1405: || '.'
1406: || l_api_name
1407: || 'rsrc start,cmplt dates are'
1400: FETCH cur_get_resource_dates
1401: INTO l_rsrc_start_date, l_rsrc_cmplt_date;
1402:
1403: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1404: gme_debug.put_line ( g_pkg_name
1405: || '.'
1406: || l_api_name
1407: || 'rsrc start,cmplt dates are'
1408: || l_rsrc_start_date
1426: wf_event.RAISE (p_event_name => gme_common_pvt.G_BATCHSTEP_CREATED
1427: ,p_event_key => l_gme_batch_steps (1).batchstep_id);
1428: END IF;
1429:
1430: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1431: gme_debug.put_line
1432: ( 'Done with Create Batch steps with return code = '
1433: || x_return_status);
1434: END IF;
1427: ,p_event_key => l_gme_batch_steps (1).batchstep_id);
1428: END IF;
1429:
1430: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1431: gme_debug.put_line
1432: ( 'Done with Create Batch steps with return code = '
1433: || x_return_status);
1434: END IF;
1435:
1432: ( 'Done with Create Batch steps with return code = '
1433: || x_return_status);
1434: END IF;
1435:
1436: IF g_debug <= gme_debug.g_log_procedure THEN
1437: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
1438: END IF;
1439: EXCEPTION
1440: WHEN error_insert_batch_step THEN
1433: || x_return_status);
1434: END IF;
1435:
1436: IF g_debug <= gme_debug.g_log_procedure THEN
1437: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
1438: END IF;
1439: EXCEPTION
1440: WHEN error_insert_batch_step THEN
1441: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1437: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
1438: END IF;
1439: EXCEPTION
1440: WHEN error_insert_batch_step THEN
1441: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1442: gme_debug.put_line ('insert batch step error');
1443: END IF;
1444:
1445: x_return_status := fnd_api.g_ret_sts_error;
1438: END IF;
1439: EXCEPTION
1440: WHEN error_insert_batch_step THEN
1441: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1442: gme_debug.put_line ('insert batch step error');
1443: END IF;
1444:
1445: x_return_status := fnd_api.g_ret_sts_error;
1446: WHEN error_insert_b_step_act THEN
1443: END IF;
1444:
1445: x_return_status := fnd_api.g_ret_sts_error;
1446: WHEN error_insert_b_step_act THEN
1447: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1448: gme_debug.put_line ('insert batch step activity error');
1449: END IF;
1450:
1451: x_return_status := fnd_api.g_ret_sts_error;
1444:
1445: x_return_status := fnd_api.g_ret_sts_error;
1446: WHEN error_insert_b_step_act THEN
1447: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1448: gme_debug.put_line ('insert batch step activity error');
1449: END IF;
1450:
1451: x_return_status := fnd_api.g_ret_sts_error;
1452: WHEN error_insert_b_step_res THEN
1449: END IF;
1450:
1451: x_return_status := fnd_api.g_ret_sts_error;
1452: WHEN error_insert_b_step_res THEN
1453: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1454: gme_debug.put_line ('insert batch step resource error');
1455: END IF;
1456:
1457: x_return_status := fnd_api.g_ret_sts_error;
1450:
1451: x_return_status := fnd_api.g_ret_sts_error;
1452: WHEN error_insert_b_step_res THEN
1453: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1454: gme_debug.put_line ('insert batch step resource error');
1455: END IF;
1456:
1457: x_return_status := fnd_api.g_ret_sts_error;
1458: WHEN error_insert_res_txns THEN
1455: END IF;
1456:
1457: x_return_status := fnd_api.g_ret_sts_error;
1458: WHEN error_insert_res_txns THEN
1459: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1460: gme_debug.put_line ('insert resource txns error');
1461: END IF;
1462:
1463: x_return_status := fnd_api.g_ret_sts_error;
1456:
1457: x_return_status := fnd_api.g_ret_sts_error;
1458: WHEN error_insert_res_txns THEN
1459: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1460: gme_debug.put_line ('insert resource txns error');
1461: END IF;
1462:
1463: x_return_status := fnd_api.g_ret_sts_error;
1464: WHEN error_insert_b_res_param THEN
1461: END IF;
1462:
1463: x_return_status := fnd_api.g_ret_sts_error;
1464: WHEN error_insert_b_res_param THEN
1465: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1466: gme_debug.put_line ('insert resource param error');
1467: END IF;
1468:
1469: x_return_status := fnd_api.g_ret_sts_error;
1462:
1463: x_return_status := fnd_api.g_ret_sts_error;
1464: WHEN error_insert_b_res_param THEN
1465: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1466: gme_debug.put_line ('insert resource param error');
1467: END IF;
1468:
1469: x_return_status := fnd_api.g_ret_sts_error;
1470: WHEN error_insert_b_step_items THEN
1467: END IF;
1468:
1469: x_return_status := fnd_api.g_ret_sts_error;
1470: WHEN error_insert_b_step_items THEN
1471: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1472: gme_debug.put_line ('insert batch step items error');
1473: END IF;
1474:
1475: x_return_status := fnd_api.g_ret_sts_error;
1468:
1469: x_return_status := fnd_api.g_ret_sts_error;
1470: WHEN error_insert_b_step_items THEN
1471: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1472: gme_debug.put_line ('insert batch step items error');
1473: END IF;
1474:
1475: x_return_status := fnd_api.g_ret_sts_error;
1476: WHEN error_insert_b_step_depend THEN
1473: END IF;
1474:
1475: x_return_status := fnd_api.g_ret_sts_error;
1476: WHEN error_insert_b_step_depend THEN
1477: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1478: gme_debug.put_line ('insert batch step depend error');
1479: END IF;
1480:
1481: x_return_status := fnd_api.g_ret_sts_error;
1474:
1475: x_return_status := fnd_api.g_ret_sts_error;
1476: WHEN error_insert_b_step_depend THEN
1477: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1478: gme_debug.put_line ('insert batch step depend error');
1479: END IF;
1480:
1481: x_return_status := fnd_api.g_ret_sts_error;
1482: WHEN error_calc_step_qty THEN
1479: END IF;
1480:
1481: x_return_status := fnd_api.g_ret_sts_error;
1482: WHEN error_calc_step_qty THEN
1483: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1484: gme_debug.put_line ('calc step qty error');
1485: END IF;
1486:
1487: x_return_status := fnd_api.g_ret_sts_error;
1480:
1481: x_return_status := fnd_api.g_ret_sts_error;
1482: WHEN error_calc_step_qty THEN
1483: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1484: gme_debug.put_line ('calc step qty error');
1485: END IF;
1486:
1487: x_return_status := fnd_api.g_ret_sts_error;
1488: WHEN error_calc_dates THEN
1485: END IF;
1486:
1487: x_return_status := fnd_api.g_ret_sts_error;
1488: WHEN error_calc_dates THEN
1489: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1490: gme_debug.put_line ('calc dates error');
1491: END IF;
1492:
1493: x_return_status := l_return_status;
1486:
1487: x_return_status := fnd_api.g_ret_sts_error;
1488: WHEN error_calc_dates THEN
1489: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1490: gme_debug.put_line ('calc dates error');
1491: END IF;
1492:
1493: x_return_status := l_return_status;
1494: WHEN error_calc_charges THEN
1491: END IF;
1492:
1493: x_return_status := l_return_status;
1494: WHEN error_calc_charges THEN
1495: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1496: gme_debug.put_line ('calc charge error');
1497: END IF;
1498:
1499: x_return_status := fnd_api.g_ret_sts_error;
1492:
1493: x_return_status := l_return_status;
1494: WHEN error_calc_charges THEN
1495: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1496: gme_debug.put_line ('calc charge error');
1497: END IF;
1498:
1499: x_return_status := fnd_api.g_ret_sts_error;
1500: WHEN error_create_text THEN
1497: END IF;
1498:
1499: x_return_status := fnd_api.g_ret_sts_error;
1500: WHEN error_create_text THEN
1501: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1502: gme_debug.put_line ('create text error');
1503: END IF;
1504:
1505: x_return_status := l_return_status;
1498:
1499: x_return_status := fnd_api.g_ret_sts_error;
1500: WHEN error_create_text THEN
1501: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1502: gme_debug.put_line ('create text error');
1503: END IF;
1504:
1505: x_return_status := l_return_status;
1506: WHEN process_qty_below_cap THEN
1503: END IF;
1504:
1505: x_return_status := l_return_status;
1506: WHEN process_qty_below_cap THEN
1507: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1508: gme_debug.put_line ('process qty below capacity');
1509: END IF;
1510:
1511: x_return_status := fnd_api.g_ret_sts_error;
1504:
1505: x_return_status := l_return_status;
1506: WHEN process_qty_below_cap THEN
1507: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1508: gme_debug.put_line ('process qty below capacity');
1509: END IF;
1510:
1511: x_return_status := fnd_api.g_ret_sts_error;
1512: WHEN invalid_resource_qty_usage THEN
1509: END IF;
1510:
1511: x_return_status := fnd_api.g_ret_sts_error;
1512: WHEN invalid_resource_qty_usage THEN
1513: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1514: gme_debug.put_line
1515: ('invalild resource process quantity and usage');
1516: END IF;
1517: x_return_status := fnd_api.g_ret_sts_error;
1510:
1511: x_return_status := fnd_api.g_ret_sts_error;
1512: WHEN invalid_resource_qty_usage THEN
1513: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1514: gme_debug.put_line
1515: ('invalild resource process quantity and usage');
1516: END IF;
1517: x_return_status := fnd_api.g_ret_sts_error;
1518: WHEN error_truncate_date THEN
1515: ('invalild resource process quantity and usage');
1516: END IF;
1517: x_return_status := fnd_api.g_ret_sts_error;
1518: WHEN error_truncate_date THEN
1519: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1520: gme_debug.put_line ('truncate date procedure error');
1521: END IF;
1522:
1523: x_return_status := fnd_api.g_ret_sts_error;
1516: END IF;
1517: x_return_status := fnd_api.g_ret_sts_error;
1518: WHEN error_truncate_date THEN
1519: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1520: gme_debug.put_line ('truncate date procedure error');
1521: END IF;
1522:
1523: x_return_status := fnd_api.g_ret_sts_error;
1524: --FPBug#4395561
1523: x_return_status := fnd_api.g_ret_sts_error;
1524: --FPBug#4395561
1525: WHEN create_flex_failure THEN
1526: x_return_status := l_return_status;
1527: IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
1528: gme_debug.put_line ('Creating the default values of the DFF failure');
1529: END IF;
1530: WHEN OTHERS THEN
1531: IF g_debug <= gme_debug.g_log_unexpected THEN
1524: --FPBug#4395561
1525: WHEN create_flex_failure THEN
1526: x_return_status := l_return_status;
1527: IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
1528: gme_debug.put_line ('Creating the default values of the DFF failure');
1529: END IF;
1530: WHEN OTHERS THEN
1531: IF g_debug <= gme_debug.g_log_unexpected THEN
1532: gme_debug.put_line ( 'When others exception in '
1527: IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
1528: gme_debug.put_line ('Creating the default values of the DFF failure');
1529: END IF;
1530: WHEN OTHERS THEN
1531: IF g_debug <= gme_debug.g_log_unexpected THEN
1532: gme_debug.put_line ( 'When others exception in '
1533: || g_pkg_name
1534: || '.'
1535: || l_api_name
1528: gme_debug.put_line ('Creating the default values of the DFF failure');
1529: END IF;
1530: WHEN OTHERS THEN
1531: IF g_debug <= gme_debug.g_log_unexpected THEN
1532: gme_debug.put_line ( 'When others exception in '
1533: || g_pkg_name
1534: || '.'
1535: || l_api_name
1536: || ' Error is '
1562:
1563: x_cur_step_rec cur_get_steps%ROWTYPE;
1564: error_calc_charge EXCEPTION;
1565: BEGIN
1566: IF g_debug <= gme_debug.g_log_procedure THEN
1567: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
1568: || l_api_name);
1569: END IF;
1570:
1563: x_cur_step_rec cur_get_steps%ROWTYPE;
1564: error_calc_charge EXCEPTION;
1565: BEGIN
1566: IF g_debug <= gme_debug.g_log_procedure THEN
1567: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
1568: || l_api_name);
1569: END IF;
1570:
1571: x_return_status := fnd_api.g_ret_sts_success;
1576: FETCH cur_get_steps
1577: INTO x_cur_step_rec;
1578:
1579: WHILE cur_get_steps%FOUND LOOP
1580: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1581: gme_debug.put_line
1582: ( g_pkg_name
1583: || '.'
1584: || l_api_name
1577: INTO x_cur_step_rec;
1578:
1579: WHILE cur_get_steps%FOUND LOOP
1580: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1581: gme_debug.put_line
1582: ( g_pkg_name
1583: || '.'
1584: || l_api_name
1585: || 'p_step_charge_rsrc_tab(batchstep_id).resources is '
1594: ,p_vol_qty => x_cur_step_rec.plan_volume_qty
1595: ,x_charge => x_charge
1596: ,x_return_status => l_return_status);
1597:
1598: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1599: gme_debug.put_line
1600: ( ' update charges >calc charges > return charge '
1601: || TO_CHAR (x_charge) );
1602: gme_debug.put_line
1595: ,x_charge => x_charge
1596: ,x_return_status => l_return_status);
1597:
1598: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1599: gme_debug.put_line
1600: ( ' update charges >calc charges > return charge '
1601: || TO_CHAR (x_charge) );
1602: gme_debug.put_line
1603: ( ' update charges >calc charges >batchstep_id '
1598: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1599: gme_debug.put_line
1600: ( ' update charges >calc charges > return charge '
1601: || TO_CHAR (x_charge) );
1602: gme_debug.put_line
1603: ( ' update charges >calc charges >batchstep_id '
1604: || TO_CHAR (x_cur_step_rec.batchstep_id) );
1605: END IF;
1606:
1621: SET plan_charges = x_charge_tab (i).charge
1622: WHERE batchstep_id = x_charge_tab (i).step_id;
1623: END LOOP;
1624:
1625: IF g_debug <= gme_debug.g_log_procedure THEN
1626: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
1627: END IF;
1628: EXCEPTION
1629: WHEN error_calc_charge THEN
1622: WHERE batchstep_id = x_charge_tab (i).step_id;
1623: END LOOP;
1624:
1625: IF g_debug <= gme_debug.g_log_procedure THEN
1626: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
1627: END IF;
1628: EXCEPTION
1629: WHEN error_calc_charge THEN
1630: x_return_status := l_return_status;
1628: EXCEPTION
1629: WHEN error_calc_charge THEN
1630: x_return_status := l_return_status;
1631: WHEN OTHERS THEN
1632: IF g_debug <= gme_debug.g_log_unexpected THEN
1633: gme_debug.put_line ( 'When others exception in '
1634: || g_pkg_name
1635: || '.'
1636: || l_api_name
1629: WHEN error_calc_charge THEN
1630: x_return_status := l_return_status;
1631: WHEN OTHERS THEN
1632: IF g_debug <= gme_debug.g_log_unexpected THEN
1633: gme_debug.put_line ( 'When others exception in '
1634: || g_pkg_name
1635: || '.'
1636: || l_api_name
1637: || ' Error is '
1688: l_max_date DATE;
1689: l_plan_start_date DATE;
1690: l_api_name CONSTANT VARCHAR2 (30) := 'get_max_step_date';
1691: BEGIN
1692: IF g_debug <= gme_debug.g_log_procedure THEN
1693: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
1694: || l_api_name);
1695: END IF;
1696:
1689: l_plan_start_date DATE;
1690: l_api_name CONSTANT VARCHAR2 (30) := 'get_max_step_date';
1691: BEGIN
1692: IF g_debug <= gme_debug.g_log_procedure THEN
1693: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
1694: || l_api_name);
1695: END IF;
1696:
1697: l_max_date := NULL;
1723: FETCH cur_get_step_date
1724: INTO l_date;
1725:
1726: IF (cur_get_step_date%FOUND) AND (l_date IS NOT NULL) THEN
1727: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1728: gme_debug.put_line ( 'GET_MAX_STEP_DATE: from cursor'
1729: || TO_CHAR (l_date
1730: ,'DD-MON-YYYY HH24:MI:SS') );
1731: END IF;
1724: INTO l_date;
1725:
1726: IF (cur_get_step_date%FOUND) AND (l_date IS NOT NULL) THEN
1727: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1728: gme_debug.put_line ( 'GET_MAX_STEP_DATE: from cursor'
1729: || TO_CHAR (l_date
1730: ,'DD-MON-YYYY HH24:MI:SS') );
1731: END IF;
1732:
1731: END IF;
1732:
1733: l_max_date := l_date;
1734: ELSE
1735: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1736: gme_debug.put_line ('No prior step here');
1737: END IF;
1738: END IF;
1739:
1732:
1733: l_max_date := l_date;
1734: ELSE
1735: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
1736: gme_debug.put_line ('No prior step here');
1737: END IF;
1738: END IF;
1739:
1740: CLOSE cur_get_step_date;
1743: IF l_max_date IS NULL THEN
1744: l_max_date := p_batch_start_date;
1745: END IF;
1746:
1747: IF g_debug <= gme_debug.g_log_procedure THEN
1748: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
1749: END IF;
1750:
1751: RETURN l_max_date;
1744: l_max_date := p_batch_start_date;
1745: END IF;
1746:
1747: IF g_debug <= gme_debug.g_log_procedure THEN
1748: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
1749: END IF;
1750:
1751: RETURN l_max_date;
1752: EXCEPTION
1750:
1751: RETURN l_max_date;
1752: EXCEPTION
1753: WHEN OTHERS THEN
1754: IF g_debug <= gme_debug.g_log_unexpected THEN
1755: gme_debug.put_line ( 'When others exception in '
1756: || g_pkg_name
1757: || '.'
1758: || l_api_name
1751: RETURN l_max_date;
1752: EXCEPTION
1753: WHEN OTHERS THEN
1754: IF g_debug <= gme_debug.g_log_unexpected THEN
1755: gme_debug.put_line ( 'When others exception in '
1756: || g_pkg_name
1757: || '.'
1758: || l_api_name
1759: || ' Error is '
1795: l_cal_count NUMBER;
1796: l_return_status VARCHAR2 (1);
1797: l_api_name CONSTANT VARCHAR2 (30) := 'get_working_time';
1798: BEGIN
1799: IF g_debug <= gme_debug.g_log_procedure THEN
1800: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
1801: || l_api_name);
1802: END IF;
1803:
1796: l_return_status VARCHAR2 (1);
1797: l_api_name CONSTANT VARCHAR2 (30) := 'get_working_time';
1798: BEGIN
1799: IF g_debug <= gme_debug.g_log_procedure THEN
1800: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
1801: || l_api_name);
1802: END IF;
1803:
1804: IF p_start_date IS NULL THEN
1851: RETURN l_start_date;
1852: ELSE /* gmp_calendar_api.is_working_daytime */
1853: l_diff := 1 / 3600;
1854:
1855: IF NVL (g_debug, -1) = gme_debug.g_log_statement THEN
1856: gme_debug.put_line (l_api_name || ':l_diff ' || l_diff);
1857: END IF;
1858:
1859: IF p_offset > 0 THEN
1852: ELSE /* gmp_calendar_api.is_working_daytime */
1853: l_diff := 1 / 3600;
1854:
1855: IF NVL (g_debug, -1) = gme_debug.g_log_statement THEN
1856: gme_debug.put_line (l_api_name || ':l_diff ' || l_diff);
1857: END IF;
1858:
1859: IF p_offset > 0 THEN
1860: /* If offset was 0 then the l_start_date is the working date time */
1895: (l_contig_period_tbl (l_cal_count).start_date + (l_diff / 24) );
1896: END IF; /* p_offset > 0 */
1897: END IF; /* gmp_calendar_api.is_working_daytime */
1898:
1899: IF g_debug <= gme_debug.g_log_procedure THEN
1900: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
1901: END IF;
1902:
1903: RETURN l_start_date;
1896: END IF; /* p_offset > 0 */
1897: END IF; /* gmp_calendar_api.is_working_daytime */
1898:
1899: IF g_debug <= gme_debug.g_log_procedure THEN
1900: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
1901: END IF;
1902:
1903: RETURN l_start_date;
1904: EXCEPTION
1902:
1903: RETURN l_start_date;
1904: EXCEPTION
1905: WHEN OTHERS THEN
1906: IF g_debug <= gme_debug.g_log_unexpected THEN
1907: gme_debug.put_line ( 'When others exception in '
1908: || g_pkg_name
1909: || '.'
1910: || l_api_name
1903: RETURN l_start_date;
1904: EXCEPTION
1905: WHEN OTHERS THEN
1906: IF g_debug <= gme_debug.g_log_unexpected THEN
1907: gme_debug.put_line ( 'When others exception in '
1908: || g_pkg_name
1909: || '.'
1910: || l_api_name
1911: || ' Error is '
2018: l_cont_ind NUMBER;
2019: l_item_id NUMBER;
2020: l_use_workday_cal VARCHAR2 (5);
2021: BEGIN
2022: IF g_debug <= gme_debug.g_log_procedure THEN
2023: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
2024: || l_api_name);
2025: END IF;
2026:
2019: l_item_id NUMBER;
2020: l_use_workday_cal VARCHAR2 (5);
2021: BEGIN
2022: IF g_debug <= gme_debug.g_log_procedure THEN
2023: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
2024: || l_api_name);
2025: END IF;
2026:
2027: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2023: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
2024: || l_api_name);
2025: END IF;
2026:
2027: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2028: gme_debug.put_line ('start calc_dates');
2029: END IF;
2030:
2031: p_return_status := fnd_api.g_ret_sts_success;
2024: || l_api_name);
2025: END IF;
2026:
2027: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2028: gme_debug.put_line ('start calc_dates');
2029: END IF;
2030:
2031: p_return_status := fnd_api.g_ret_sts_success;
2032: l_batch_id := p_gme_batch_header_rec.batch_id;
2038: END IF;
2039:
2040: l_use_workday_cal := p_use_workday_cal;
2041:
2042: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2043: gme_debug.put_line ('batch_id=' || l_batch_id);
2044: END IF;
2045:
2046: l_calendar_code := gme_common_pvt.g_calendar_code;
2039:
2040: l_use_workday_cal := p_use_workday_cal;
2041:
2042: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2043: gme_debug.put_line ('batch_id=' || l_batch_id);
2044: END IF;
2045:
2046: l_calendar_code := gme_common_pvt.g_calendar_code;
2047:
2094: END IF;
2095:
2096: -- Calculate the duration of each step...
2097: FOR i IN x_step_tbl.FIRST .. x_step_tbl.LAST LOOP
2098: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2099: gme_debug.put_line ('step_no ' || x_gmd_step_tbl (i).step_no);
2100: gme_debug.put_line ('step_id ' || x_gmd_step_tbl (i).step_id);
2101: END IF;
2102:
2095:
2096: -- Calculate the duration of each step...
2097: FOR i IN x_step_tbl.FIRST .. x_step_tbl.LAST LOOP
2098: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2099: gme_debug.put_line ('step_no ' || x_gmd_step_tbl (i).step_no);
2100: gme_debug.put_line ('step_id ' || x_gmd_step_tbl (i).step_id);
2101: END IF;
2102:
2103: l_step_duration_tab (x_gmd_step_tbl (i).step_no) :=
2096: -- Calculate the duration of each step...
2097: FOR i IN x_step_tbl.FIRST .. x_step_tbl.LAST LOOP
2098: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2099: gme_debug.put_line ('step_no ' || x_gmd_step_tbl (i).step_no);
2100: gme_debug.put_line ('step_id ' || x_gmd_step_tbl (i).step_id);
2101: END IF;
2102:
2103: l_step_duration_tab (x_gmd_step_tbl (i).step_no) :=
2104: get_max_duration (x_step_tbl (i), l_batch_id);
2102:
2103: l_step_duration_tab (x_gmd_step_tbl (i).step_no) :=
2104: get_max_duration (x_step_tbl (i), l_batch_id);
2105:
2106: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2107: gme_debug.put_line
2108: ( 'stepduration '
2109: || l_step_duration_tab
2110: (x_gmd_step_tbl (i).step_no) );
2103: l_step_duration_tab (x_gmd_step_tbl (i).step_no) :=
2104: get_max_duration (x_step_tbl (i), l_batch_id);
2105:
2106: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2107: gme_debug.put_line
2108: ( 'stepduration '
2109: || l_step_duration_tab
2110: (x_gmd_step_tbl (i).step_no) );
2111: END IF;
2124: FROM gme_batch_steps
2125: WHERE batchstep_id = p_step_id;
2126:
2127: IF l_use_workday_cal = fnd_api.g_true THEN
2128: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2129: gme_debug.put_line ( 'plan_cmplt date is not null'
2130: || TO_CHAR (p_plan_cmplt_date
2131: ,'DD-MON-YYYY HH24:MI:SS') );
2132: END IF;
2125: WHERE batchstep_id = p_step_id;
2126:
2127: IF l_use_workday_cal = fnd_api.g_true THEN
2128: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2129: gme_debug.put_line ( 'plan_cmplt date is not null'
2130: || TO_CHAR (p_plan_cmplt_date
2131: ,'DD-MON-YYYY HH24:MI:SS') );
2132: END IF;
2133:
2161: p_plan_cmplt_date - l_step_duration_tab (x_step_no)
2162: / 24;
2163: END IF;
2164:
2165: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2166: gme_debug.put_line ( 'calculated step start date is '
2167: || TO_CHAR (x_step_start_date
2168: ,'DD-MON-YYYY HH24:MI:SS') );
2169: END IF;
2162: / 24;
2163: END IF;
2164:
2165: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2166: gme_debug.put_line ( 'calculated step start date is '
2167: || TO_CHAR (x_step_start_date
2168: ,'DD-MON-YYYY HH24:MI:SS') );
2169: END IF;
2170: END IF;
2175: ,x_batch_duration
2176: ,l_return_status);
2177:
2178: IF l_use_workday_cal = fnd_api.g_true THEN
2179: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2180: gme_debug.put_line
2181: ( 'start date is not null'
2182: || TO_CHAR
2183: (p_gme_batch_header_rec.plan_cmplt_date
2176: ,l_return_status);
2177:
2178: IF l_use_workday_cal = fnd_api.g_true THEN
2179: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2180: gme_debug.put_line
2181: ( 'start date is not null'
2182: || TO_CHAR
2183: (p_gme_batch_header_rec.plan_cmplt_date
2184: ,'DD-MON-YYYY HH24:MI:SS') );
2215: ,l_step_duration_tab
2216: ,x_batch_duration
2217: ,l_return_status);
2218:
2219: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2220: gme_debug.put_line ('duration of batch is ' || x_batch_duration);
2221: gme_debug.put_line
2222: ( 'batch completion date is '
2223: || TO_CHAR
2216: ,x_batch_duration
2217: ,l_return_status);
2218:
2219: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2220: gme_debug.put_line ('duration of batch is ' || x_batch_duration);
2221: gme_debug.put_line
2222: ( 'batch completion date is '
2223: || TO_CHAR
2224: (p_gme_batch_header_rec.plan_cmplt_date
2217: ,l_return_status);
2218:
2219: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2220: gme_debug.put_line ('duration of batch is ' || x_batch_duration);
2221: gme_debug.put_line
2222: ( 'batch completion date is '
2223: || TO_CHAR
2224: (p_gme_batch_header_rec.plan_cmplt_date
2225: ,'DD-MON-YYYY HH24:MI:SS') );
2225: ,'DD-MON-YYYY HH24:MI:SS') );
2226: END IF;
2227:
2228: IF l_use_workday_cal = fnd_api.g_true THEN
2229: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2230: gme_debug.put_line ('end date null ' || l_use_workday_cal);
2231: gme_debug.put_line
2232: ( 'batch completion date is '
2233: || TO_CHAR
2226: END IF;
2227:
2228: IF l_use_workday_cal = fnd_api.g_true THEN
2229: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2230: gme_debug.put_line ('end date null ' || l_use_workday_cal);
2231: gme_debug.put_line
2232: ( 'batch completion date is '
2233: || TO_CHAR
2234: (p_gme_batch_header_rec.plan_cmplt_date
2227:
2228: IF l_use_workday_cal = fnd_api.g_true THEN
2229: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2230: gme_debug.put_line ('end date null ' || l_use_workday_cal);
2231: gme_debug.put_line
2232: ( 'batch completion date is '
2233: || TO_CHAR
2234: (p_gme_batch_header_rec.plan_cmplt_date
2235: ,'DD-MON-YYYY HH24:MI:SS') );
2264: p_gme_batch_header_rec.plan_cmplt_date
2265: - x_batch_duration / 24;
2266: END IF;
2267:
2268: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2269: gme_debug.put_line ( 'calculated batch start date is '
2270: || TO_CHAR (x_batch_start_date
2271: ,'DD-MON-YYYY HH24:MI:SS') );
2272: END IF;
2265: - x_batch_duration / 24;
2266: END IF;
2267:
2268: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2269: gme_debug.put_line ( 'calculated batch start date is '
2270: || TO_CHAR (x_batch_start_date
2271: ,'DD-MON-YYYY HH24:MI:SS') );
2272: END IF;
2273: ELSIF (p_gme_batch_header_rec.plan_start_date IS NULL)
2277: ,x_batch_duration
2278: ,l_return_status);
2279:
2280: IF l_use_workday_cal = fnd_api.g_true THEN
2281: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2282: gme_debug.put_line ( ' both dates null '
2283: || p_contiguity_override);
2284: gme_debug.put_line
2285: ( 'batch completion date is '
2278: ,l_return_status);
2279:
2280: IF l_use_workday_cal = fnd_api.g_true THEN
2281: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2282: gme_debug.put_line ( ' both dates null '
2283: || p_contiguity_override);
2284: gme_debug.put_line
2285: ( 'batch completion date is '
2286: || TO_CHAR
2280: IF l_use_workday_cal = fnd_api.g_true THEN
2281: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2282: gme_debug.put_line ( ' both dates null '
2283: || p_contiguity_override);
2284: gme_debug.put_line
2285: ( 'batch completion date is '
2286: || TO_CHAR
2287: (p_gme_batch_header_rec.plan_cmplt_date
2288: ,'DD-MON-YYYY HH24:MI:SS') );
2321: INTO x_step_row
2322: FROM gme_batch_steps
2323: WHERE batchstep_id = x_step_tbl (i);
2324:
2325: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2326: gme_debug.put_line ('step_id=' || x_step_tbl (i) );
2327: END IF;
2328:
2329: -- For individual steps you can pass in a plan_start date or use the setup data.
2322: FROM gme_batch_steps
2323: WHERE batchstep_id = x_step_tbl (i);
2324:
2325: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2326: gme_debug.put_line ('step_id=' || x_step_tbl (i) );
2327: END IF;
2328:
2329: -- For individual steps you can pass in a plan_start date or use the setup data.
2330: IF (x_step_start_date IS NULL) THEN
2337: ELSE
2338: x_step_row.plan_start_date := x_step_start_date;
2339: END IF;
2340:
2341: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2342: gme_debug.put_line ( '1 '
2343: || TO_CHAR (x_step_row.plan_start_date
2344: ,'DD-MON-YYYY HH24:MI:SS') );
2345: END IF;
2338: x_step_row.plan_start_date := x_step_start_date;
2339: END IF;
2340:
2341: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2342: gme_debug.put_line ( '1 '
2343: || TO_CHAR (x_step_row.plan_start_date
2344: ,'DD-MON-YYYY HH24:MI:SS') );
2345: END IF;
2346:
2368: END IF;
2369:
2370: FOR j IN x_act_tab.FIRST .. x_act_tab.LAST LOOP
2371: IF l_use_workday_cal = fnd_api.g_true THEN
2372: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2373: gme_debug.put_line ( ' step start date '
2374: || TO_CHAR (x_step_row.plan_start_date
2375: ,'DD-MON-YYYY HH24:MI:SS') );
2376: END IF;
2369:
2370: FOR j IN x_act_tab.FIRST .. x_act_tab.LAST LOOP
2371: IF l_use_workday_cal = fnd_api.g_true THEN
2372: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2373: gme_debug.put_line ( ' step start date '
2374: || TO_CHAR (x_step_row.plan_start_date
2375: ,'DD-MON-YYYY HH24:MI:SS') );
2376: END IF;
2377:
2389: x_step_row.plan_start_date
2390: + x_act_tab (j).offset_interval / 24;
2391: END IF;
2392:
2393: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2394: gme_debug.put_line ('offset' || x_act_tab (j).offset_interval);
2395: gme_debug.put_line ( 'x_act_tab(j).plan_start_date '
2396: || TO_CHAR (x_act_tab (j).plan_start_date
2397: ,'DD-MON-YYYY HH24:MI:SS') );
2390: + x_act_tab (j).offset_interval / 24;
2391: END IF;
2392:
2393: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2394: gme_debug.put_line ('offset' || x_act_tab (j).offset_interval);
2395: gme_debug.put_line ( 'x_act_tab(j).plan_start_date '
2396: || TO_CHAR (x_act_tab (j).plan_start_date
2397: ,'DD-MON-YYYY HH24:MI:SS') );
2398: END IF;
2391: END IF;
2392:
2393: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2394: gme_debug.put_line ('offset' || x_act_tab (j).offset_interval);
2395: gme_debug.put_line ( 'x_act_tab(j).plan_start_date '
2396: || TO_CHAR (x_act_tab (j).plan_start_date
2397: ,'DD-MON-YYYY HH24:MI:SS') );
2398: END IF;
2399:
2438: IF x_rsrc_tab (k).plan_start_date IS NULL THEN
2439: RAISE error_cont_period;
2440: END IF;
2441:
2442: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2443: gme_debug.put_line
2444: ( 'rsrc_start_date '
2445: || TO_CHAR
2446: (x_rsrc_tab (k).plan_start_date
2439: RAISE error_cont_period;
2440: END IF;
2441:
2442: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2443: gme_debug.put_line
2444: ( 'rsrc_start_date '
2445: || TO_CHAR
2446: (x_rsrc_tab (k).plan_start_date
2447: ,'DD-MON-YYYY HH24:MI:SS') );
2512: END LOOP; /* FOR resources */
2513:
2514: x_act_tab (j).plan_cmplt_date := x_max_rsrc_date;
2515:
2516: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2517: gme_debug.put_line ( '2 '
2518: || TO_CHAR (x_act_tab (j).plan_cmplt_date
2519: ,'DD-MON-YYYY HH24:MI:SS') );
2520: END IF;
2513:
2514: x_act_tab (j).plan_cmplt_date := x_max_rsrc_date;
2515:
2516: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2517: gme_debug.put_line ( '2 '
2518: || TO_CHAR (x_act_tab (j).plan_cmplt_date
2519: ,'DD-MON-YYYY HH24:MI:SS') );
2520: END IF;
2521:
2535:
2536: x_step_row.plan_cmplt_date := x_max_act_date;
2537: x_step_row.due_date := x_step_row.plan_cmplt_date;
2538:
2539: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2540: gme_debug.put_line ( '1 '
2541: || TO_CHAR (x_step_row.plan_cmplt_date
2542: ,'DD-MON-YYYY HH24:MI:SS') );
2543: gme_debug.put_line ( 'due_date = '
2536: x_step_row.plan_cmplt_date := x_max_act_date;
2537: x_step_row.due_date := x_step_row.plan_cmplt_date;
2538:
2539: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2540: gme_debug.put_line ( '1 '
2541: || TO_CHAR (x_step_row.plan_cmplt_date
2542: ,'DD-MON-YYYY HH24:MI:SS') );
2543: gme_debug.put_line ( 'due_date = '
2544: || TO_CHAR (x_step_row.due_date
2539: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2540: gme_debug.put_line ( '1 '
2541: || TO_CHAR (x_step_row.plan_cmplt_date
2542: ,'DD-MON-YYYY HH24:MI:SS') );
2543: gme_debug.put_line ( 'due_date = '
2544: || TO_CHAR (x_step_row.due_date
2545: ,'DD-MON-YYYY HH24:MI:SS') );
2546: END IF;
2547:
2607: WHERE batch_id = l_batch_id
2608: AND due_date = gme_common_pvt.g_timestamp;
2609: END IF;
2610:
2611: IF g_debug <= gme_debug.g_log_procedure THEN
2612: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
2613: END IF;
2614: EXCEPTION
2615: WHEN load_steps_failed THEN
2608: AND due_date = gme_common_pvt.g_timestamp;
2609: END IF;
2610:
2611: IF g_debug <= gme_debug.g_log_procedure THEN
2612: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
2613: END IF;
2614: EXCEPTION
2615: WHEN load_steps_failed THEN
2616: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2612: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
2613: END IF;
2614: EXCEPTION
2615: WHEN load_steps_failed THEN
2616: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2617: gme_debug.put_line ('calc_dates... load_steps_failed');
2618: END IF;
2619:
2620: p_return_status := fnd_api.g_ret_sts_error;
2613: END IF;
2614: EXCEPTION
2615: WHEN load_steps_failed THEN
2616: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2617: gme_debug.put_line ('calc_dates... load_steps_failed');
2618: END IF;
2619:
2620: p_return_status := fnd_api.g_ret_sts_error;
2621: WHEN error_cont_period THEN
2618: END IF;
2619:
2620: p_return_status := fnd_api.g_ret_sts_error;
2621: WHEN error_cont_period THEN
2622: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2623: gme_debug.put_line ('Contiguity period ... _failed');
2624: END IF;
2625:
2626: p_return_status := l_return_status;
2619:
2620: p_return_status := fnd_api.g_ret_sts_error;
2621: WHEN error_cont_period THEN
2622: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2623: gme_debug.put_line ('Contiguity period ... _failed');
2624: END IF;
2625:
2626: p_return_status := l_return_status;
2627: WHEN error_non_contiguious THEN
2624: END IF;
2625:
2626: p_return_status := l_return_status;
2627: WHEN error_non_contiguious THEN
2628: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2629: gme_debug.put_line ('Contiguity period ... not found');
2630: END IF;
2631:
2632: gme_common_pvt.log_message ('GME_NON_CONTIGUOUS_TIME');
2625:
2626: p_return_status := l_return_status;
2627: WHEN error_non_contiguious THEN
2628: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2629: gme_debug.put_line ('Contiguity period ... not found');
2630: END IF;
2631:
2632: gme_common_pvt.log_message ('GME_NON_CONTIGUOUS_TIME');
2633: p_return_status := 'C';
2656: gme_common_pvt.log_message ('GME_NO_RESOURCES'
2657: ,'ACTIVITY'
2658: ,l_activity);
2659: WHEN OTHERS THEN
2660: IF g_debug <= gme_debug.g_log_unexpected THEN
2661: gme_debug.put_line ( 'When others exception in '
2662: || g_pkg_name
2663: || '.'
2664: || l_api_name
2657: ,'ACTIVITY'
2658: ,l_activity);
2659: WHEN OTHERS THEN
2660: IF g_debug <= gme_debug.g_log_unexpected THEN
2661: gme_debug.put_line ( 'When others exception in '
2662: || g_pkg_name
2663: || '.'
2664: || l_api_name
2665: || ' Error is '
2731: l_dep_step_no NUMBER;
2732: l_dep_type NUMBER;
2733: l_standard_delay NUMBER;
2734: BEGIN
2735: IF g_debug <= gme_debug.g_log_procedure THEN
2736: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'|| l_api_name);
2737: END IF;
2738: x_return_status := fnd_api.g_ret_sts_success;
2739: x_batch_duration := 0;
2732: l_dep_type NUMBER;
2733: l_standard_delay NUMBER;
2734: BEGIN
2735: IF g_debug <= gme_debug.g_log_procedure THEN
2736: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'|| l_api_name);
2737: END IF;
2738: x_return_status := fnd_api.g_ret_sts_success;
2739: x_batch_duration := 0;
2740: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2736: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'|| l_api_name);
2737: END IF;
2738: x_return_status := fnd_api.g_ret_sts_success;
2739: x_batch_duration := 0;
2740: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2741: gme_debug.put_line (g_pkg_name || '.'|| l_api_name||' calculate duration');
2742: END IF;
2743: OPEN Cur_get_leaf_nodes (l_batch_id);
2744: FETCH Cur_get_leaf_nodes BULK COLLECT INTO l_leaf_nodes_tbl;
2737: END IF;
2738: x_return_status := fnd_api.g_ret_sts_success;
2739: x_batch_duration := 0;
2740: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2741: gme_debug.put_line (g_pkg_name || '.'|| l_api_name||' calculate duration');
2742: END IF;
2743: OPEN Cur_get_leaf_nodes (l_batch_id);
2744: FETCH Cur_get_leaf_nodes BULK COLLECT INTO l_leaf_nodes_tbl;
2745: CLOSE Cur_get_leaf_nodes;
2742: END IF;
2743: OPEN Cur_get_leaf_nodes (l_batch_id);
2744: FETCH Cur_get_leaf_nodes BULK COLLECT INTO l_leaf_nodes_tbl;
2745: CLOSE Cur_get_leaf_nodes;
2746: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2747: gme_debug.put_line (g_pkg_name || '.'|| l_api_name||' number of leaf nodes: ' || l_leaf_nodes_tbl.COUNT);
2748: END IF;
2749: FOR i IN 1..l_leaf_nodes_tbl.COUNT LOOP
2750: OPEN Cur_get_branches(l_batch_id, l_leaf_nodes_tbl(i).leaf_batchstep_id);
2743: OPEN Cur_get_leaf_nodes (l_batch_id);
2744: FETCH Cur_get_leaf_nodes BULK COLLECT INTO l_leaf_nodes_tbl;
2745: CLOSE Cur_get_leaf_nodes;
2746: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2747: gme_debug.put_line (g_pkg_name || '.'|| l_api_name||' number of leaf nodes: ' || l_leaf_nodes_tbl.COUNT);
2748: END IF;
2749: FOR i IN 1..l_leaf_nodes_tbl.COUNT LOOP
2750: OPEN Cur_get_branches(l_batch_id, l_leaf_nodes_tbl(i).leaf_batchstep_id);
2751: FETCH Cur_get_branches BULK COLLECT INTO l_branches_tbl;
2749: FOR i IN 1..l_leaf_nodes_tbl.COUNT LOOP
2750: OPEN Cur_get_branches(l_batch_id, l_leaf_nodes_tbl(i).leaf_batchstep_id);
2751: FETCH Cur_get_branches BULK COLLECT INTO l_branches_tbl;
2752: CLOSE Cur_get_branches;
2753: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2754: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' number of branches: ' || l_branches_tbl.COUNT);
2755: END IF;
2756: FOR j IN 1..l_branches_tbl.COUNT LOOP
2757: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2750: OPEN Cur_get_branches(l_batch_id, l_leaf_nodes_tbl(i).leaf_batchstep_id);
2751: FETCH Cur_get_branches BULK COLLECT INTO l_branches_tbl;
2752: CLOSE Cur_get_branches;
2753: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2754: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' number of branches: ' || l_branches_tbl.COUNT);
2755: END IF;
2756: FOR j IN 1..l_branches_tbl.COUNT LOOP
2757: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2758: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' current branch: ' || l_branches_tbl(j).branch);
2753: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2754: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' number of branches: ' || l_branches_tbl.COUNT);
2755: END IF;
2756: FOR j IN 1..l_branches_tbl.COUNT LOOP
2757: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2758: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' current branch: ' || l_branches_tbl(j).branch);
2759: END IF;
2760: m := 1;
2761: n := 5;
2754: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' number of branches: ' || l_branches_tbl.COUNT);
2755: END IF;
2756: FOR j IN 1..l_branches_tbl.COUNT LOOP
2757: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2758: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' current branch: ' || l_branches_tbl(j).branch);
2759: END IF;
2760: m := 1;
2761: n := 5;
2762: /* Divide by 14 because length of step_no = 5, dep_step_no = 5, dep_type = 1, standard_delay = 3 */
2770: l_dep_type := SUBSTR(l_branches_tbl(j).branch, m, 1);
2771: m := n + 1;
2772: n := m + 2;
2773: l_standard_delay := SUBSTR(l_branches_tbl(j).branch, m, 3);
2774: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2775: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' Step->Depstep->Deptype->Delay = '||l_step_no||'->'||l_dep_step_no||'->'||l_dep_type||'->'||l_standard_delay);
2776: END IF;
2777: IF (k = 1) THEN
2778: l_duration := l_step_duration_tab(l_step_no);
2771: m := n + 1;
2772: n := m + 2;
2773: l_standard_delay := SUBSTR(l_branches_tbl(j).branch, m, 3);
2774: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2775: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' Step->Depstep->Deptype->Delay = '||l_step_no||'->'||l_dep_step_no||'->'||l_dep_type||'->'||l_standard_delay);
2776: END IF;
2777: IF (k = 1) THEN
2778: l_duration := l_step_duration_tab(l_step_no);
2779: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2775: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' Step->Depstep->Deptype->Delay = '||l_step_no||'->'||l_dep_step_no||'->'||l_dep_type||'->'||l_standard_delay);
2776: END IF;
2777: IF (k = 1) THEN
2778: l_duration := l_step_duration_tab(l_step_no);
2779: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2780: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' step->duration: ' || l_step_no||'->'||l_duration);
2781: END IF;
2782: END IF;
2783: l_duration := l_duration + l_standard_delay;
2776: END IF;
2777: IF (k = 1) THEN
2778: l_duration := l_step_duration_tab(l_step_no);
2779: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2780: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' step->duration: ' || l_step_no||'->'||l_duration);
2781: END IF;
2782: END IF;
2783: l_duration := l_duration + l_standard_delay;
2784: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2780: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' step->duration: ' || l_step_no||'->'||l_duration);
2781: END IF;
2782: END IF;
2783: l_duration := l_duration + l_standard_delay;
2784: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2785: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' depstep->duration: ' || l_dep_step_no||'->'||l_duration);
2786: END IF;
2787: IF (l_dep_type = 1) THEN -- Start to Start
2788: IF l_step_duration_tab(l_dep_step_no) > l_duration THEN
2781: END IF;
2782: END IF;
2783: l_duration := l_duration + l_standard_delay;
2784: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2785: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' depstep->duration: ' || l_dep_step_no||'->'||l_duration);
2786: END IF;
2787: IF (l_dep_type = 1) THEN -- Start to Start
2788: IF l_step_duration_tab(l_dep_step_no) > l_duration THEN
2789: l_duration := l_step_duration_tab(l_dep_step_no);
2793: END IF;
2794: m := n + 1;
2795: n := m + 4;
2796: END LOOP; -- parsing loop
2797: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2798: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' duration of branch: ' || l_duration);
2799: END IF;
2800: IF l_duration > x_batch_duration THEN
2801: x_batch_duration := l_duration;
2794: m := n + 1;
2795: n := m + 4;
2796: END LOOP; -- parsing loop
2797: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2798: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' duration of branch: ' || l_duration);
2799: END IF;
2800: IF l_duration > x_batch_duration THEN
2801: x_batch_duration := l_duration;
2802: END IF;
2802: END IF;
2803: l_duration := 0;
2804: END LOOP; -- branches loop
2805: END LOOP; -- leaf nodes loop
2806: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2807: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' duration of batch: ' || x_batch_duration);
2808: END IF;
2809: EXCEPTION
2810: WHEN OTHERS THEN
2803: l_duration := 0;
2804: END LOOP; -- branches loop
2805: END LOOP; -- leaf nodes loop
2806: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2807: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' duration of batch: ' || x_batch_duration);
2808: END IF;
2809: EXCEPTION
2810: WHEN OTHERS THEN
2811: IF g_debug <= gme_debug.g_log_unexpected THEN
2807: gme_debug.put_line(g_pkg_name || '.'|| l_api_name||' duration of batch: ' || x_batch_duration);
2808: END IF;
2809: EXCEPTION
2810: WHEN OTHERS THEN
2811: IF g_debug <= gme_debug.g_log_unexpected THEN
2812: gme_debug.put_line('When others exception in '|| g_pkg_name|| '.'|| l_api_name|| ' Error is '|| SQLERRM);
2813: END IF;
2814: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
2815: x_return_status := fnd_api.g_ret_sts_unexp_error;
2808: END IF;
2809: EXCEPTION
2810: WHEN OTHERS THEN
2811: IF g_debug <= gme_debug.g_log_unexpected THEN
2812: gme_debug.put_line('When others exception in '|| g_pkg_name|| '.'|| l_api_name|| ' Error is '|| SQLERRM);
2813: END IF;
2814: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
2815: x_return_status := fnd_api.g_ret_sts_unexp_error;
2816: END calc_longest_time;
2868:
2869: load_steps_failed EXCEPTION;
2870: error_calculating_scale_factor EXCEPTION;
2871: BEGIN
2872: IF g_debug <= gme_debug.g_log_procedure THEN
2873: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
2874: || l_api_name);
2875: END IF;
2876:
2869: load_steps_failed EXCEPTION;
2870: error_calculating_scale_factor EXCEPTION;
2871: BEGIN
2872: IF g_debug <= gme_debug.g_log_procedure THEN
2873: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
2874: || l_api_name);
2875: END IF;
2876:
2877: p_return_status := fnd_api.g_ret_sts_success;
2935: p_step_tbl (i).step_vol_uom := gmd_auto_step_calc.g_vol_std_um;
2936: END IF;
2937: END LOOP; /*FOR i IN 1..X_step_rows*/
2938:
2939: IF g_debug <= gme_debug.g_log_procedure THEN
2940: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
2941: END IF;
2942: EXCEPTION
2943: WHEN load_steps_failed THEN
2936: END IF;
2937: END LOOP; /*FOR i IN 1..X_step_rows*/
2938:
2939: IF g_debug <= gme_debug.g_log_procedure THEN
2940: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
2941: END IF;
2942: EXCEPTION
2943: WHEN load_steps_failed THEN
2944: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2940: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
2941: END IF;
2942: EXCEPTION
2943: WHEN load_steps_failed THEN
2944: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2945: gme_debug.put_line ('GME auto step calc -- load steps failed');
2946: END IF;
2947:
2948: p_return_status := fnd_api.g_ret_sts_error;
2941: END IF;
2942: EXCEPTION
2943: WHEN load_steps_failed THEN
2944: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2945: gme_debug.put_line ('GME auto step calc -- load steps failed');
2946: END IF;
2947:
2948: p_return_status := fnd_api.g_ret_sts_error;
2949: WHEN error_calculating_scale_factor THEN
2946: END IF;
2947:
2948: p_return_status := fnd_api.g_ret_sts_error;
2949: WHEN error_calculating_scale_factor THEN
2950: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2951: gme_debug.put_line
2952: ('GME_auto step calc -- error calc scale factor');
2953: END IF;
2954:
2947:
2948: p_return_status := fnd_api.g_ret_sts_error;
2949: WHEN error_calculating_scale_factor THEN
2950: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2951: gme_debug.put_line
2952: ('GME_auto step calc -- error calc scale factor');
2953: END IF;
2954:
2955: p_return_status := fnd_api.g_ret_sts_error;
2953: END IF;
2954:
2955: p_return_status := fnd_api.g_ret_sts_error;
2956: WHEN OTHERS THEN
2957: IF g_debug <= gme_debug.g_log_unexpected THEN
2958: gme_debug.put_line ( 'When others exception in '
2959: || g_pkg_name
2960: || '.'
2961: || l_api_name
2954:
2955: p_return_status := fnd_api.g_ret_sts_error;
2956: WHEN OTHERS THEN
2957: IF g_debug <= gme_debug.g_log_unexpected THEN
2958: gme_debug.put_line ( 'When others exception in '
2959: || g_pkg_name
2960: || '.'
2961: || l_api_name
2962: || ' Error is '
2986: FROM fm_text_tbl
2987: WHERE text_code = p_text_code
2988: ORDER BY line_no;
2989: BEGIN
2990: IF g_debug <= gme_debug.g_log_procedure THEN
2991: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
2992: || l_api_name);
2993: END IF;
2994:
2987: WHERE text_code = p_text_code
2988: ORDER BY line_no;
2989: BEGIN
2990: IF g_debug <= gme_debug.g_log_procedure THEN
2991: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
2992: || l_api_name);
2993: END IF;
2994:
2995: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2991: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
2992: || l_api_name);
2993: END IF;
2994:
2995: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2996: gme_debug.put_line ('BEGIN copy and create text for '
2997: || p_text_string);
2998: END IF;
2999:
2992: || l_api_name);
2993: END IF;
2994:
2995: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
2996: gme_debug.put_line ('BEGIN copy and create text for '
2997: || p_text_string);
2998: END IF;
2999:
3000: x_return_status := fnd_api.g_ret_sts_success;
3025: ELSE
3026: l_text_table (l_number_of_text_lines).text :=
3027: l_fm_text_tbl_row.text;
3028:
3029: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3030: gme_debug.put_line
3031: ( 'text for line no '
3032: || l_fm_text_tbl_row.line_no
3033: || ' is '
3026: l_text_table (l_number_of_text_lines).text :=
3027: l_fm_text_tbl_row.text;
3028:
3029: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3030: gme_debug.put_line
3031: ( 'text for line no '
3032: || l_fm_text_tbl_row.line_no
3033: || ' is '
3034: || l_text_table (l_number_of_text_lines).text);
3047: gme_text_dbl.insert_text_row (l_text_table (l_row_count)
3048: ,l_text_table (l_row_count) );
3049:
3050: IF NOT l_return THEN
3051: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3052: gme_debug.put_line ( 'trouble inserting text for '
3053: || p_text_string);
3054: END IF;
3055:
3048: ,l_text_table (l_row_count) );
3049:
3050: IF NOT l_return THEN
3051: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3052: gme_debug.put_line ( 'trouble inserting text for '
3053: || p_text_string);
3054: END IF;
3055:
3056: -- We could not insert the text info. Error message pushed on stack in dbl code.
3056: -- We could not insert the text info. Error message pushed on stack in dbl code.
3057: RAISE unexpected_error;
3058: END IF;
3059:
3060: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3061: gme_debug.put_line ('inserted text for ' || p_text_string);
3062: END IF;
3063: END LOOP; /* FOR l_row_count IN 1 .. l_text_table.COUNT */
3064:
3057: RAISE unexpected_error;
3058: END IF;
3059:
3060: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3061: gme_debug.put_line ('inserted text for ' || p_text_string);
3062: END IF;
3063: END LOOP; /* FOR l_row_count IN 1 .. l_text_table.COUNT */
3064:
3065: IF g_debug <= gme_debug.g_log_procedure THEN
3061: gme_debug.put_line ('inserted text for ' || p_text_string);
3062: END IF;
3063: END LOOP; /* FOR l_row_count IN 1 .. l_text_table.COUNT */
3064:
3065: IF g_debug <= gme_debug.g_log_procedure THEN
3066: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
3067: END IF;
3068: EXCEPTION
3069: WHEN unexpected_error THEN
3062: END IF;
3063: END LOOP; /* FOR l_row_count IN 1 .. l_text_table.COUNT */
3064:
3065: IF g_debug <= gme_debug.g_log_procedure THEN
3066: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
3067: END IF;
3068: EXCEPTION
3069: WHEN unexpected_error THEN
3070: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3066: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
3067: END IF;
3068: EXCEPTION
3069: WHEN unexpected_error THEN
3070: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3071: gme_debug.put_line
3072: ('ERROR - unexpected error in copy and create text while inserting header or dtl');
3073: END IF;
3074:
3067: END IF;
3068: EXCEPTION
3069: WHEN unexpected_error THEN
3070: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3071: gme_debug.put_line
3072: ('ERROR - unexpected error in copy and create text while inserting header or dtl');
3073: END IF;
3074:
3075: x_return_status := fnd_api.g_ret_sts_unexp_error;
3073: END IF;
3074:
3075: x_return_status := fnd_api.g_ret_sts_unexp_error;
3076: WHEN OTHERS THEN
3077: IF g_debug <= gme_debug.g_log_unexpected THEN
3078: gme_debug.put_line ( 'When others exception in '
3079: || g_pkg_name
3080: || '.'
3081: || l_api_name
3074:
3075: x_return_status := fnd_api.g_ret_sts_unexp_error;
3076: WHEN OTHERS THEN
3077: IF g_debug <= gme_debug.g_log_unexpected THEN
3078: gme_debug.put_line ( 'When others exception in '
3079: || g_pkg_name
3080: || '.'
3081: || l_api_name
3082: || ' Error is '
3108: WHERE a.uom_code = b.uom_code
3109: AND a.inventory_item_id = 0
3110: AND b.uom_code = v_uom_code;
3111: BEGIN
3112: IF g_debug <= gme_debug.g_log_procedure THEN
3113: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
3114: || l_api_name);
3115: END IF;
3116:
3109: AND a.inventory_item_id = 0
3110: AND b.uom_code = v_uom_code;
3111: BEGIN
3112: IF g_debug <= gme_debug.g_log_procedure THEN
3113: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
3114: || l_api_name);
3115: END IF;
3116:
3117: x_return_status := fnd_api.g_ret_sts_success;
3156: p_plan_rsrc_usage * l_usage_std_factor / l_hour_std_factor;
3157: END IF;
3158: END IF;
3159:
3160: IF g_debug <= gme_debug.g_log_procedure THEN
3161: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
3162: END IF;
3163: EXCEPTION
3164: WHEN OTHERS THEN
3157: END IF;
3158: END IF;
3159:
3160: IF g_debug <= gme_debug.g_log_procedure THEN
3161: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
3162: END IF;
3163: EXCEPTION
3164: WHEN OTHERS THEN
3165: IF g_debug <= gme_debug.g_log_unexpected THEN
3161: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
3162: END IF;
3163: EXCEPTION
3164: WHEN OTHERS THEN
3165: IF g_debug <= gme_debug.g_log_unexpected THEN
3166: gme_debug.put_line ( 'When others exception in '
3167: || g_pkg_name
3168: || '.'
3169: || l_api_name
3162: END IF;
3163: EXCEPTION
3164: WHEN OTHERS THEN
3165: IF g_debug <= gme_debug.g_log_unexpected THEN
3166: gme_debug.put_line ( 'When others exception in '
3167: || g_pkg_name
3168: || '.'
3169: || l_api_name
3170: || ' Error is '
3207: l_return_status VARCHAR2 (1);
3208: missing_profile_option EXCEPTION;
3209: l_api_name CONSTANT VARCHAR2 (30) := 'get_max_duration';
3210: BEGIN
3211: IF g_debug <= gme_debug.g_log_procedure THEN
3212: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
3213: || l_api_name);
3214: END IF;
3215:
3208: missing_profile_option EXCEPTION;
3209: l_api_name CONSTANT VARCHAR2 (30) := 'get_max_duration';
3210: BEGIN
3211: IF g_debug <= gme_debug.g_log_procedure THEN
3212: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
3213: || l_api_name);
3214: END IF;
3215:
3216: l_hour_um := gme_common_pvt.g_hour_uom_code;
3252: l_max_act_duration := l_act_duration;
3253: END IF;
3254: END LOOP;
3255:
3256: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3257: gme_debug.put_line ('l_max_act_duration ' || l_max_act_duration);
3258: END IF;
3259:
3260: IF g_debug <= gme_debug.g_log_procedure THEN
3253: END IF;
3254: END LOOP;
3255:
3256: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3257: gme_debug.put_line ('l_max_act_duration ' || l_max_act_duration);
3258: END IF;
3259:
3260: IF g_debug <= gme_debug.g_log_procedure THEN
3261: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
3256: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3257: gme_debug.put_line ('l_max_act_duration ' || l_max_act_duration);
3258: END IF;
3259:
3260: IF g_debug <= gme_debug.g_log_procedure THEN
3261: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
3262: END IF;
3263:
3264: RETURN l_max_act_duration;
3257: gme_debug.put_line ('l_max_act_duration ' || l_max_act_duration);
3258: END IF;
3259:
3260: IF g_debug <= gme_debug.g_log_procedure THEN
3261: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
3262: END IF;
3263:
3264: RETURN l_max_act_duration;
3265: EXCEPTION
3263:
3264: RETURN l_max_act_duration;
3265: EXCEPTION
3266: WHEN missing_profile_option THEN
3267: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3268: gme_debug.put_line (l_api_name
3269: || ' ERROR - missing_profile_option');
3270: END IF;
3271:
3264: RETURN l_max_act_duration;
3265: EXCEPTION
3266: WHEN missing_profile_option THEN
3267: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3268: gme_debug.put_line (l_api_name
3269: || ' ERROR - missing_profile_option');
3270: END IF;
3271:
3272: l_max_act_duration := 0;
3271:
3272: l_max_act_duration := 0;
3273: RETURN 0;
3274: WHEN OTHERS THEN
3275: IF g_debug <= gme_debug.g_log_unexpected THEN
3276: gme_debug.put_line ( 'When others exception in '
3277: || g_pkg_name
3278: || '.'
3279: || l_api_name
3272: l_max_act_duration := 0;
3273: RETURN 0;
3274: WHEN OTHERS THEN
3275: IF g_debug <= gme_debug.g_log_unexpected THEN
3276: gme_debug.put_line ( 'When others exception in '
3277: || g_pkg_name
3278: || '.'
3279: || l_api_name
3280: || ' Error is '
3301: --FPBug#4395561
3302: create_flex_failure EXCEPTION;
3303: l_return_status VARCHAR2(1);
3304: BEGIN
3305: IF g_debug <= gme_debug.g_log_procedure THEN
3306: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
3307: || l_api_name);
3308: END IF;
3309:
3302: create_flex_failure EXCEPTION;
3303: l_return_status VARCHAR2(1);
3304: BEGIN
3305: IF g_debug <= gme_debug.g_log_procedure THEN
3306: gme_debug.put_line ('Entering api ' || g_pkg_name || '.'
3307: || l_api_name);
3308: END IF;
3309:
3310: l_usage_time :=
3352: p_batch_step_resources_rec.plan_cmplt_date;
3353: l_gme_resource_txns.delete_mark := 0;
3354:
3355: FOR i IN 1 .. p_batch_step_resources_rec.plan_rsrc_count LOOP
3356: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3357: gme_debug.put_line ( g_pkg_name
3358: || '.'
3359: || l_api_name
3360: || ' '
3353: l_gme_resource_txns.delete_mark := 0;
3354:
3355: FOR i IN 1 .. p_batch_step_resources_rec.plan_rsrc_count LOOP
3356: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3357: gme_debug.put_line ( g_pkg_name
3358: || '.'
3359: || l_api_name
3360: || ' '
3361: || 'resource transaction # '
3396: END IF;
3397: END LOOP;
3398: END IF;
3399:
3400: IF g_debug <= gme_debug.g_log_procedure THEN
3401: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
3402: END IF;
3403: EXCEPTION
3404: WHEN error_insert_res_txns THEN
3397: END LOOP;
3398: END IF;
3399:
3400: IF g_debug <= gme_debug.g_log_procedure THEN
3401: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
3402: END IF;
3403: EXCEPTION
3404: WHEN error_insert_res_txns THEN
3405: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3401: gme_debug.put_line ('Exiting api ' || g_pkg_name || '.' || l_api_name);
3402: END IF;
3403: EXCEPTION
3404: WHEN error_insert_res_txns THEN
3405: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3406: gme_debug.put_line ('insert resource txns error');
3407: END IF;
3408:
3409: x_return_status := fnd_api.g_ret_sts_error;
3402: END IF;
3403: EXCEPTION
3404: WHEN error_insert_res_txns THEN
3405: IF (NVL (g_debug, -1) = gme_debug.g_log_statement) THEN
3406: gme_debug.put_line ('insert resource txns error');
3407: END IF;
3408:
3409: x_return_status := fnd_api.g_ret_sts_error;
3410: WHEN missing_profile_option THEN
3413: x_return_status := fnd_api.g_ret_sts_error;
3414: --FPBug#4395561
3415: WHEN create_flex_failure THEN
3416: x_return_status := l_return_status;
3417: IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
3418: gme_debug.put_line ('Creating the default values of the DFF failure');
3419: END IF;
3420: WHEN OTHERS THEN
3421: IF g_debug <= gme_debug.g_log_unexpected THEN
3414: --FPBug#4395561
3415: WHEN create_flex_failure THEN
3416: x_return_status := l_return_status;
3417: IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
3418: gme_debug.put_line ('Creating the default values of the DFF failure');
3419: END IF;
3420: WHEN OTHERS THEN
3421: IF g_debug <= gme_debug.g_log_unexpected THEN
3422: gme_debug.put_line ( 'When others exception in '
3417: IF (NVL(G_DEBUG,-1) = GME_DEBUG.G_LOG_STATEMENT) THEN
3418: gme_debug.put_line ('Creating the default values of the DFF failure');
3419: END IF;
3420: WHEN OTHERS THEN
3421: IF g_debug <= gme_debug.g_log_unexpected THEN
3422: gme_debug.put_line ( 'When others exception in '
3423: || g_pkg_name
3424: || '.'
3425: || l_api_name
3418: gme_debug.put_line ('Creating the default values of the DFF failure');
3419: END IF;
3420: WHEN OTHERS THEN
3421: IF g_debug <= gme_debug.g_log_unexpected THEN
3422: gme_debug.put_line ( 'When others exception in '
3423: || g_pkg_name
3424: || '.'
3425: || l_api_name
3426: || ' Error is '