39: x_temp_rec Cur_get_activities%ROWTYPE;
40: x_activity LONG;
41: x_o_res_act_cnt NUMBER := 0;
42: BEGIN
43: x_return_status := FND_API.G_RET_STS_SUCCESS;
44: FOR oprn_rec IN Cur_get_activities(oprn_id) LOOP
45: x_o_res_act_cnt := x_o_res_act_cnt + 1;
46: X_activity := x_activity||oprn_rec.activity||', ';
47: END LOOP;
48: IF (x_o_res_act_cnt > 0) THEN
49: FND_MESSAGE.SET_NAME('GMD','GMD_ATTACH_RESOURCES');
50: FND_MESSAGE.SET_TOKEN('ACTIVITY',x_activity);
51: FND_MSG_PUB.ADD;
52: x_return_status := FND_API.G_RET_STS_ERROR;
53: END IF;
54: END validate_operation;
55:
56: /* =============================================================== */
305: gmd_debug.put_line('Begin of modify_status() ');
306: END IF;
307:
308: /* Set the return status to success initially */
309: x_return_status := FND_API.G_RET_STS_SUCCESS;
310:
311: /* Initialize message list and count if needed */
312: IF p_init_msg_list THEN
313: fnd_msg_pub.initialize;
321: RAISE setup_failure;
322: END IF;
323:
324: /* Make sure we have call compatibility */
325: IF NOT FND_API.compatible_api_call ( GMD_STATUS_PUB.m_api_version
326: ,p_api_version
327: ,l_api_name
328: ,GMD_STATUS_PUB.m_pkg_name) THEN
329: x_return_status := FND_API.G_RET_STS_ERROR;
325: IF NOT FND_API.compatible_api_call ( GMD_STATUS_PUB.m_api_version
326: ,p_api_version
327: ,l_api_name
328: ,GMD_STATUS_PUB.m_pkg_name) THEN
329: x_return_status := FND_API.G_RET_STS_ERROR;
330: RAISE invalid_version;
331: END IF;
332:
333: /* Get the TO status type and description */
336: IF get_To_status_details%NOTFOUND THEN
337: FND_MESSAGE.SET_NAME ('GMI', 'GMI_MISSING');
338: FND_MESSAGE.SET_TOKEN ('MISSING', FND_MESSAGE.GET);
339: FND_MSG_PUB.ADD;
340: x_return_status := FND_API.g_ret_sts_error;
341: CLOSE get_To_status_details;
342: RAISE status_update_failure;
343: END IF;
344: CLOSE get_To_status_details;
358: FND_MESSAGE.SET_TOKEN ('ID',P_entity_id);
359: FND_MESSAGE.SET_TOKEN ('NO',P_entity_no);
360: FND_MESSAGE.SET_TOKEN ('VERS',P_entity_version);
361: FND_MSG_PUB.ADD;
362: x_return_status := FND_API.g_ret_sts_error;
363: CLOSE get_curr_recipe_status;
364: RAISE status_update_failure;
365: END IF;
366: CLOSE get_curr_recipe_status;
377: FND_MESSAGE.SET_TOKEN ('ID',P_entity_id);
378: FND_MESSAGE.SET_TOKEN ('NO',P_entity_no);
379: FND_MESSAGE.SET_TOKEN ('VERS',P_entity_version);
380: FND_MSG_PUB.ADD;
381: x_return_status := FND_API.g_ret_sts_error;
382: CLOSE get_curr_formula_status;
383: RAISE status_update_failure;
384: END IF;
385: CLOSE get_curr_formula_status;
402:
403: IF (l_toq = 0) THEN
404: FND_MESSAGE.SET_NAME('GMD','GMD_TOTAL_OUTPUT_ZERO');
405: FND_MSG_PUB.ADD;
406: x_return_status := FND_API.g_ret_sts_error;
407: RAISE status_update_failure;
408: END IF;
409:
410: -- Sriram - Bug 5035818
415: CLOSE Cur_experimental_items;
416: IF l_expr_items_found > 0 THEN
417: FND_MESSAGE.SET_NAME('GMD', 'GMD_EXPR_ITEMS_FOUND');
418: FND_MSG_PUB.ADD;
419: x_return_status := FND_API.g_ret_sts_error;
420: RAISE status_update_failure;
421: END IF;
422: END IF;
423:
436: FND_MESSAGE.SET_TOKEN ('ID',P_entity_id);
437: FND_MESSAGE.SET_TOKEN ('NO',P_entity_no);
438: FND_MESSAGE.SET_TOKEN ('VERS',P_entity_version);
439: FND_MSG_PUB.ADD;
440: x_return_status := FND_API.g_ret_sts_error;
441: CLOSE get_curr_routing_status;
442: RAISE status_update_failure;
443: END IF;
444: CLOSE get_curr_routing_status;
455: FND_MESSAGE.SET_TOKEN ('ID',P_entity_id);
456: FND_MESSAGE.SET_TOKEN ('NO',P_entity_no);
457: FND_MESSAGE.SET_TOKEN ('VERS',P_entity_version);
458: FND_MSG_PUB.ADD;
459: x_return_status := FND_API.g_ret_sts_error;
460: CLOSE get_curr_operation_status;
461: RAISE status_update_failure;
462: END IF;
463: CLOSE get_curr_operation_status;
472: IF l_debug = 'Y' THEN
473: gmd_debug.put_line('The return status after calling val operation is '||
474: x_return_status);
475: END IF;
476: IF (x_return_status = FND_API.g_ret_sts_error) THEN
477: RAISE status_update_failure;
478: END IF;
479: END IF;
480: ELSIF (UPPER(P_entity_name) like '%VALIDITY%') THEN
485: IF get_curr_vr_status%NOTFOUND THEN
486: FND_MESSAGE.SET_NAME ('GMI', 'GMI_MISSING');
487: FND_MESSAGE.SET_TOKEN ('MISSING','P_ENTITY_ID');
488: FND_MSG_PUB.ADD;
489: x_return_status := FND_API.g_ret_sts_error;
490: CLOSE get_curr_vr_status;
491: RAISE status_update_failure;
492: END IF;
493: CLOSE get_curr_vr_status;
508: x_return_status => l_return_status,
509: p_organization_id => l_org_id,
510: p_production_check => TRUE);
511:
512: IF l_return_status <> FND_API.g_ret_sts_success THEN
513: FND_MSG_PUB.GET (p_msg_index => 1,
514: p_data => l_mesg_data,
515: p_encoded => 'F',
516: p_msg_index_out => l_mesg_count);
514: p_data => l_mesg_data,
515: p_encoded => 'F',
516: p_msg_index_out => l_mesg_count);
517: --FND_MSG_PUB.ADD;
518: x_return_status := FND_API.g_ret_sts_error;
519: RAISE status_update_failure;
520: END IF;
521: ELSIF l_recipe_use = 2 THEN
522: GMD_API_GRP.check_item_exists( p_formula_id => l_form_id,
523: x_return_status => l_return_status,
524: p_organization_id => l_org_id,
525: p_costing_check => TRUE);
526:
527: IF l_return_status <> FND_API.g_ret_sts_success THEN
528: FND_MSG_PUB.GET (p_msg_index => 1,
529: p_data => l_mesg_data,
530: p_encoded => 'F',
531: p_msg_index_out => l_mesg_count);
529: p_data => l_mesg_data,
530: p_encoded => 'F',
531: p_msg_index_out => l_mesg_count);
532: --FND_MSG_PUB.ADD;
533: x_return_status := FND_API.g_ret_sts_error;
534: RAISE status_update_failure;
535: END IF;
536: END IF;
537:
555: FND_MESSAGE.SET_TOKEN ('ID',P_entity_id);
556: FND_MESSAGE.SET_TOKEN ('NO',P_entity_no);
557: FND_MESSAGE.SET_TOKEN ('VERS',P_entity_version);
558: FND_MSG_PUB.ADD;
559: x_return_status := FND_API.g_ret_sts_error;
560: CLOSE get_curr_subst_status;
561: RAISE status_update_failure;
562: END IF;
563: CLOSE get_curr_subst_status;
564: ELSE -- not able to recognize the entity name
565: FND_MESSAGE.SET_NAME('GMD', 'GMD_UNKNOWN_ENTITY');
566: FND_MESSAGE.SET_TOKEN('ENTITY_NAME', P_entity_name);
567: FND_MSG_PUB.ADD;
568: x_return_status := FND_API.g_ret_sts_error;
569: RAISE status_update_failure;
570: END IF;
571:
572: IF (l_debug = 'Y') THEN
593: IF validate_To_status%NOTFOUND THEN
594: FND_MESSAGE.SET_NAME ('GMD', 'GMD_INV_TARGET_STATUS');
595: FND_MESSAGE.SET_TOKEN ('TO_STATUS', l_to_status_desc);
596: FND_MSG_PUB.ADD;
597: x_return_status := FND_API.g_ret_sts_error;
598: CLOSE validate_To_status;
599: RAISE status_update_failure;
600: END IF;
601: CLOSE validate_To_status;
631:
632: IF l_entity_name IN ('FORMULA','OPERATION','ROUTING') THEN
633: FND_MESSAGE.SET_NAME('GMD',l_mesg_text);
634: FND_MSG_PUB.ADD;
635: x_return_status := FND_API.g_ret_sts_error;
636: RAISE status_update_failure;
637: ELSIF l_entity_name IN ('RECIPE','VALIDITY') THEN
638: IF NOT P_ignore_flag THEN
639: FND_MESSAGE.SET_NAME('GMD',l_mesg_text);
637: ELSIF l_entity_name IN ('RECIPE','VALIDITY') THEN
638: IF NOT P_ignore_flag THEN
639: FND_MESSAGE.SET_NAME('GMD',l_mesg_text);
640: FND_MSG_PUB.ADD;
641: x_return_status := FND_API.g_ret_sts_error;
642: RAISE status_update_failure;
643: END IF; -- p_ignore_flag is false
644: END IF; -- entity type check
645: END IF; -- Checking parent status
672: * operation) or if to_status does not require the check
673: * (frozen, on-hold, obsolete, some version of New). */
674: FND_MESSAGE.SET_NAME('GMD', 'GMD_STATUS_DEPEND_NOT_APPROVED');
675: FND_MSG_PUB.ADD;
676: x_return_status := FND_API.g_ret_sts_error;
677: RAISE status_update_failure;
678: ELSE
679:
680: IF (l_debug = 'Y') THEN
713: ,p_to_status => P_to_status) THEN
714: FND_MESSAGE.SET_NAME('GMD', 'GMD_VLDT_APPR_REQD');
715: FND_MESSAGE.SET_TOKEN('STATUS', l_to_status_desc);
716: FND_MSG_PUB.ADD;
717: x_return_status := FND_API.g_ret_sts_error;
718: RAISE status_update_failure;
719: END IF;
720:
721: /* Check if the VR for this recipe needs to be updated */
745: ELSE
746: FND_MESSAGE.SET_NAME('GMD', 'GMD_RCP_VR_STATUS');
747: FND_MESSAGE.SET_TOKEN('TO_STATUS',P_to_status);
748: FND_MSG_PUB.ADD;
749: x_return_status := FND_API.g_ret_sts_error;
750: RAISE status_update_failure;
751: END IF; /* if feedback is OK */
752: END IF ; /* if validity rules exists , l_check_vr=1 */
753: END IF; /* IF (l_entity_name = 'RECIPE') */
752: END IF ; /* if validity rules exists , l_check_vr=1 */
753: END IF; /* IF (l_entity_name = 'RECIPE') */
754: END IF; /* Check Dependent Status */
755:
756: IF (x_return_status = FND_API.G_RET_STS_SUCCESS) THEN
757: IF (l_from_status <> P_to_status) THEN
758: IF (l_debug = 'Y') THEN
759: gmd_debug.put_line('About to get the pending and rework status ');
760: END IF;
887: fnd_message.set_token('PENDING_STATUS',get_status_meaning(l_pending_status) );
888: END IF;
889:
890: ELSE
891: x_return_status := FND_API.G_RET_STS_ERROR;
892: RAISE status_update_failure;
893: END IF;
894:
895: END IF; --IF (l_from_status <> P_to_status)
896: END IF;
897:
898: fnd_msg_pub.count_and_get (
899: p_count => x_message_count
900: ,p_encoded => FND_API.g_false
901: ,p_data => x_message_list);
902:
903: IF (l_debug = 'Y') THEN
904: gmd_debug.put_line('Status was updated successfullly');
916: gmd_debug.put_line (m_pkg_name||'.'||l_api_name||':'||'API not complete');
917: END IF;
918: fnd_msg_pub.count_and_get (
919: p_count => x_message_count
920: ,p_encoded => FND_API.g_false
921: ,p_data => x_message_list);
922: x_return_status := FND_API.G_RET_STS_ERROR;
923: WHEN setup_failure THEN
924: ROLLBACK TO SAVEPOINT modify_status;
918: fnd_msg_pub.count_and_get (
919: p_count => x_message_count
920: ,p_encoded => FND_API.g_false
921: ,p_data => x_message_list);
922: x_return_status := FND_API.G_RET_STS_ERROR;
923: WHEN setup_failure THEN
924: ROLLBACK TO SAVEPOINT modify_status;
925: x_return_status := FND_API.G_RET_STS_ERROR;
926: fnd_msg_pub.count_and_get (
921: ,p_data => x_message_list);
922: x_return_status := FND_API.G_RET_STS_ERROR;
923: WHEN setup_failure THEN
924: ROLLBACK TO SAVEPOINT modify_status;
925: x_return_status := FND_API.G_RET_STS_ERROR;
926: fnd_msg_pub.count_and_get (
927: p_count => x_message_count
928: ,p_encoded => FND_API.g_false
929: ,p_data => x_message_list);
924: ROLLBACK TO SAVEPOINT modify_status;
925: x_return_status := FND_API.G_RET_STS_ERROR;
926: fnd_msg_pub.count_and_get (
927: p_count => x_message_count
928: ,p_encoded => FND_API.g_false
929: ,p_data => x_message_list);
930: WHEN app_exception.record_lock_exception THEN
931: ROLLBACK TO SAVEPOINT modify_status;
932: x_return_status := FND_API.G_RET_STS_ERROR;
928: ,p_encoded => FND_API.g_false
929: ,p_data => x_message_list);
930: WHEN app_exception.record_lock_exception THEN
931: ROLLBACK TO SAVEPOINT modify_status;
932: x_return_status := FND_API.G_RET_STS_ERROR;
933:
934: IF (l_debug = 'Y') THEN
935: gmd_debug.put_line ('In locked exception section ');
936: END IF;
947: );
948: -- Bug #3437582 (JKB) Changed gmd_api_pub to gmd_api_grp above.
949: fnd_msg_pub.count_and_get (
950: p_count => x_message_count
951: ,p_encoded => FND_API.g_false
952: ,p_data => x_message_list);
953: WHEN OTHERS THEN
954: ROLLBACK TO SAVEPOINT modify_status;
955: fnd_msg_pub.add_exc_msg (gmd_status_pub.m_pkg_name, l_api_name);
957: gmd_debug.put_line (m_pkg_name||'.'||l_api_name||':'||'When others exception:'||SQLERRM);
958: END IF;
959: fnd_msg_pub.count_and_get (
960: p_count => x_message_count
961: ,p_encoded => FND_API.g_false
962: ,p_data => x_message_list);
963: x_return_status := FND_API.g_ret_sts_unexp_error;
964: END Modify_status;
965:
959: fnd_msg_pub.count_and_get (
960: p_count => x_message_count
961: ,p_encoded => FND_API.g_false
962: ,p_data => x_message_list);
963: x_return_status := FND_API.g_ret_sts_unexp_error;
964: END Modify_status;
965:
966: END GMD_STATUS_PUB;