52: || p_batch_step_rec.batchstep_id);
53: END IF;
54:
55: /* Set the return status to success initially */
56: x_return_status := fnd_api.g_ret_sts_success;
57: l_batch_step_rec := p_batch_step_rec;
58: l_batch_header_rec := p_batch_header_rec;
59:
60: /* Bug#5109119 initialize with NULL and it should be NULL as we are testing
69: ,x_exception_material_tbl => x_exception_material_tbl
70: ,x_return_status => l_return_status);
71:
72: IF l_return_status NOT IN
73: (fnd_api.g_ret_sts_success, gme_common_pvt.g_exceptions_err) THEN
74: x_return_status := l_return_status;
75: RAISE error_release_step_rec;
76: END IF;
77:
98: ,x_return_status => l_return_status
99: ,x_exception_material_tbl => x_exception_material_tbl);
100:
101: IF l_return_status NOT IN
102: (fnd_api.g_ret_sts_success, gme_common_pvt.g_exceptions_err) THEN
103: x_return_status := l_return_status;
104: RAISE error_release_batch;
105: END IF;
106:
128: || ': '
129: || SQLERRM);
130: END IF;
131:
132: x_return_status := fnd_api.g_ret_sts_unexp_error;
133: END release_step;
134:
135: /*===========================================================================================
136: Procedure
186: || to_char(p_batch_step_rec.actual_start_date,'YYYY-MON-DD HH24:MI:SS'));
187: END IF;
188:
189: /* Set the return status to success initially */
190: x_return_status := fnd_api.g_ret_sts_success;
191:
192: /* Exit the recursive loop if the step is already released, completed or closed */
193: IF p_batch_step_rec.step_status IN
194: (gme_common_pvt.g_step_wip
201: (p_batch_step => p_batch_step_rec
202: ,x_batch_step => l_batch_step_rec
203: ,x_return_status => x_return_status);
204:
205: IF x_return_status <> fnd_api.g_ret_sts_success THEN
206: RAISE error_validation;
207: END IF;
208:
209: process_dependent_steps
212: ,x_exception_material_tbl => x_exception_material_tbl
213: ,x_return_status => l_return_status);
214:
215: IF l_return_status NOT IN
216: (fnd_api.g_ret_sts_success, gme_common_pvt.g_exceptions_err) THEN
217: x_return_status := l_return_status;
218: RAISE error_process_dep_steps;
219: END IF;
220:
232: ,x_batch_step_rec => x_batch_step_rec
233: ,x_exception_material_tbl => x_exception_material_tbl
234: ,x_return_status => l_return_status);
235:
236: IF l_return_status <> fnd_api.g_ret_sts_success THEN
237: x_return_status := l_return_status;
238: RAISE rel_step_line_error;
239: END IF;
240:
244: ,x_exception_material_tbl => x_exception_material_tbl
245: ,x_return_status => l_return_status);
246:
247: IF l_return_status NOT IN
248: (fnd_api.g_ret_sts_success, gme_common_pvt.g_exceptions_err) THEN
249: x_return_status := l_return_status;
250: RAISE rel_step_ing_error;
251: END IF;
252:
263: ,x_message_list => l_msg_stack
264: ,x_return_status => l_return_status
265: ,x_batch_step_rec => x_batch_step_rec);
266:
267: IF l_return_status <> fnd_api.g_ret_sts_success THEN
268: RAISE update_step_qty_error;
269: END IF;
270:
271: /* Needs to be done for each step released */
298: || ': '
299: || SQLERRM);
300: END IF;
301:
302: x_return_status := fnd_api.g_ret_sts_unexp_error;
303: END release_step_recursive;
304:
305: PROCEDURE process_dependent_steps (
306: p_batch_step_rec IN gme_batch_steps%ROWTYPE
344: || p_batch_step_rec.batchstep_id);
345: END IF;
346:
347: /* Set the return status to success initially */
348: x_return_status := fnd_api.g_ret_sts_success;
349:
350: /* Bug#5109119 Begin check the close period for current step. this check will be done for current step and dependent steps
351: also as process_dependent_steps will be called for each step*/
352: IF NOT gme_common_pvt.check_close_period(p_org_id => p_batch_header_rec.organization_id
441: ,x_exception_material_tbl => x_exception_material_tbl
442: ,x_return_status => l_return_status);
443:
444: IF l_return_status NOT IN
445: (fnd_api.g_ret_sts_success
446: ,gme_common_pvt.g_exceptions_err) THEN
447: x_return_status := l_return_status;
448: RAISE dep_step_rel_error;
449: END IF;
477: ,x_batch_step_rec => l_batch_step_rec
478: ,x_exception_material_tbl => x_exception_material_tbl);
479:
480: IF l_return_status NOT IN
481: (fnd_api.g_ret_sts_success
482: ,gme_common_pvt.g_exceptions_err) THEN
483: x_return_status := l_return_status;
484: RAISE dep_step_cmpl_error;
485: END IF;
507: END IF;
508: EXCEPTION
509: --Bug#5109119 Begin
510: WHEN error_close_period THEN
511: x_return_status := FND_API.G_RET_STS_ERROR;
512: WHEN error_future_date THEN
513: fnd_message.set_name ('GMA', 'SY_NOFUTUREDATE');
514: fnd_msg_pub.ADD;
515: x_return_status := FND_API.G_RET_STS_ERROR;
511: x_return_status := FND_API.G_RET_STS_ERROR;
512: WHEN error_future_date THEN
513: fnd_message.set_name ('GMA', 'SY_NOFUTUREDATE');
514: fnd_msg_pub.ADD;
515: x_return_status := FND_API.G_RET_STS_ERROR;
516: --Bug#5109119 End
517: WHEN batch_step_fetch_error THEN
518: gme_common_pvt.log_message ('GME_UNEXPECTED_ERROR', 'ERROR'
519: ,SQLERRM);
516: --Bug#5109119 End
517: WHEN batch_step_fetch_error THEN
518: gme_common_pvt.log_message ('GME_UNEXPECTED_ERROR', 'ERROR'
519: ,SQLERRM);
520: x_return_status := fnd_api.g_ret_sts_unexp_error;
521: WHEN dep_step_rel_error OR dep_step_cmpl_error THEN
522: NULL;
523: WHEN OTHERS THEN
524: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
531: || ': '
532: || SQLERRM);
533: END IF;
534:
535: x_return_status := fnd_api.g_ret_sts_unexp_error;
536: END process_dependent_steps;
537:
538: /*===========================================================================================
539: Procedure
573: || ' Release step line batchstep_id='
574: || p_batch_step_rec.batchstep_id);
575: END IF;
576:
577: x_return_status := fnd_api.g_ret_sts_success;
578: -- Each time this is called, p_batch_step_rec has already been retrieved from DB... has all
579: -- latest data and in addition has the actual start date calculated and set
580: x_batch_step_rec := p_batch_step_rec;
581: /* Update the Batch Step Status to WIP */
616: EXCEPTION
617: WHEN batch_step_upd_err THEN
618: gme_common_pvt.log_message ('GME_UNEXPECTED_ERROR', 'ERROR'
619: ,SQLERRM);
620: x_return_status := fnd_api.g_ret_sts_unexp_error;
621: WHEN OTHERS THEN
622: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
623:
624: IF g_debug <= gme_debug.g_log_procedure THEN
629: || ': '
630: || SQLERRM);
631: END IF;
632:
633: x_return_status := fnd_api.g_ret_sts_unexp_error;
634: END release_step_line;
635:
636: PROCEDURE release_step_ingredients (
637: p_batch_step_rec IN gme_batch_steps%ROWTYPE
666: || p_batch_step_rec.batchstep_id);
667: END IF;
668:
669: /* Set the return status to success initially */
670: x_return_status := fnd_api.g_ret_sts_success;
671:
672: -- retrieve all autobystep ingredients associated to the step...
673: OPEN cur_step_ingredients (p_batch_step_rec.batchstep_id);
674:
689: ,x_exception_material_tbl => x_exception_material_tbl
690: ,x_return_status => l_return_status);
691:
692: IF l_return_status NOT IN
693: (fnd_api.g_ret_sts_success, gme_common_pvt.g_exceptions_err) THEN
694: x_return_status := l_return_status;
695: RAISE error_process_ing;
696: END IF;
697:
718: || ': '
719: || SQLERRM);
720: END IF;
721:
722: x_return_status := fnd_api.g_ret_sts_unexp_error;
723: END release_step_ingredients;
724:
725: PROCEDURE validate_step_for_release (p_batch_header_rec IN gme_batch_header%ROWTYPE
726: ,p_batch_step_rec IN gme_batch_steps%ROWTYPE
757: || l_api_name);
758: gme_debug.put_line (g_pkg_name||'.'||l_api_name||' batchstep_id = '||p_batch_step_rec.batchstep_id);
759: END IF;
760:
761: x_return_status := fnd_api.g_ret_sts_success;
762:
763: -- set output structure
764: x_batch_step_rec := p_batch_step_rec;
765:
810: ,p_start_date => p_batch_header_rec.actual_start_date
811: ,p_cmplt_date => p_batch_header_rec.actual_cmplt_date
812: ,p_batch_header_rec => p_batch_header_rec
813: ,p_validate_plan_dates_ind => 1) THEN
814: x_return_status := fnd_api.g_ret_sts_error;
815: RAISE error_vr_dates;
816: END IF;
817: -- End Bug 5336007
818: END IF; -- IF p_batch_header_rec.recipe_validity_rule_id IS NOT NULL
833: ,p_step_id => x_batch_step_rec.batchstep_id
834: ,p_step_actual_start_date => x_batch_step_rec.actual_start_date
835: ,x_return_status => x_return_status);
836:
837: IF x_return_status <> fnd_api.g_ret_sts_success THEN
838: RAISE error_validation;
839: END IF;
840: END IF;
841:
845: ,p_auto_by_step => 1 -- auto by step ingredients
846: ,p_batchstep_id => x_batch_step_rec.batchstep_id -- assoc to this step
847: ,x_return_status => x_return_status);
848:
849: IF x_return_status <> fnd_api.g_ret_sts_success THEN
850: RAISE error_validation;
851: END IF;
852:
853: IF NVL (g_debug, gme_debug.g_log_procedure + 1) <=
857:
858: EXCEPTION
859: --Bug#5109119
860: WHEN error_close_period THEN
861: x_return_status := FND_API.G_RET_STS_ERROR;
862: WHEN error_future_date THEN
863: fnd_message.set_name ('GMA', 'SY_NOFUTUREDATE');
864: fnd_msg_pub.ADD;
865: x_return_status := FND_API.G_RET_STS_ERROR;
861: x_return_status := FND_API.G_RET_STS_ERROR;
862: WHEN error_future_date THEN
863: fnd_message.set_name ('GMA', 'SY_NOFUTUREDATE');
864: fnd_msg_pub.ADD;
865: x_return_status := FND_API.G_RET_STS_ERROR;
866: WHEN error_validation THEN
867: NULL;
868: WHEN error_actual_start_date THEN
869: gme_common_pvt.log_message ('GME_STEP_START_BATCH_START_ERR');
866: WHEN error_validation THEN
867: NULL;
868: WHEN error_actual_start_date THEN
869: gme_common_pvt.log_message ('GME_STEP_START_BATCH_START_ERR');
870: x_return_status := FND_API.G_RET_STS_ERROR;
871: WHEN error_vr_dates THEN
872: x_return_status := FND_API.G_RET_STS_ERROR;
873: WHEN OTHERS THEN
874: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
868: WHEN error_actual_start_date THEN
869: gme_common_pvt.log_message ('GME_STEP_START_BATCH_START_ERR');
870: x_return_status := FND_API.G_RET_STS_ERROR;
871: WHEN error_vr_dates THEN
872: x_return_status := FND_API.G_RET_STS_ERROR;
873: WHEN OTHERS THEN
874: fnd_msg_pub.add_exc_msg (g_pkg_name, l_api_name);
875:
876: IF g_debug <= gme_debug.g_log_procedure THEN
880: || l_api_name
881: || ': '
882: || SQLERRM);
883: END IF;
884: x_return_status := fnd_api.g_ret_sts_unexp_error;
885: END validate_step_for_release;
886:
887: END gme_release_batch_step_pvt;