695: IF l_req_distribution_id IS NOT NULL
696: THEN
697: IF(l_is_complex_work_po = FALSE) --BUG 5553581
698: THEN
699: x_message_text := PO_CORE_S.get_translated_text('PO_PO_DEL_DIST_ONLINE_REQ_NA');
700: RAISE PO_CORE_S.G_EARLY_RETURN_EXC;
701: ELSE
702: BEGIN --5553581
703: select po_distribution_id
696: THEN
697: IF(l_is_complex_work_po = FALSE) --BUG 5553581
698: THEN
699: x_message_text := PO_CORE_S.get_translated_text('PO_PO_DEL_DIST_ONLINE_REQ_NA');
700: RAISE PO_CORE_S.G_EARLY_RETURN_EXC;
701: ELSE
702: BEGIN --5553581
703: select po_distribution_id
704: into l_dummy
705: FROM po_distributions_all pod
706: WHERE pod.line_location_id = p_line_loc_id
707: AND pod.req_distribution_id = l_req_distribution_id;
708:
709: x_message_text := PO_CORE_S.get_translated_text('PO_PO_DEL_DIST_ONLINE_REQ_NA');
710: RAISE PO_CORE_S.G_EARLY_RETURN_EXC;
711: EXCEPTION
712: WHEN TOO_MANY_ROWS THEN
713: --If there are multiple rows then we can go ahead and delete
706: WHERE pod.line_location_id = p_line_loc_id
707: AND pod.req_distribution_id = l_req_distribution_id;
708:
709: x_message_text := PO_CORE_S.get_translated_text('PO_PO_DEL_DIST_ONLINE_REQ_NA');
710: RAISE PO_CORE_S.G_EARLY_RETURN_EXC;
711: EXCEPTION
712: WHEN TOO_MANY_ROWS THEN
713: --If there are multiple rows then we can go ahead and delete
714: NULL;
720: -- Has been Delivered
721: IF l_quantity_delivered > 0
722: OR l_amount_delivered > 0
723: THEN
724: x_message_text := PO_CORE_S.get_translated_text('PO_PO_DELETE_DEL_DIST_NA');
725: RAISE PO_CORE_S.G_EARLY_RETURN_EXC;
726: END IF;
727:
728: d_pos := 30;
721: IF l_quantity_delivered > 0
722: OR l_amount_delivered > 0
723: THEN
724: x_message_text := PO_CORE_S.get_translated_text('PO_PO_DELETE_DEL_DIST_NA');
725: RAISE PO_CORE_S.G_EARLY_RETURN_EXC;
726: END IF;
727:
728: d_pos := 30;
729: --Has been Billed
729: --Has been Billed
730: IF l_quantity_billed > 0
731: OR l_amount_billed > 0
732: THEN
733: x_message_text := PO_CORE_S.get_translated_text('PO_PO_DELETE_DIST_BILLED_NA');
734: RAISE PO_CORE_S.G_EARLY_RETURN_EXC;
735: END IF;
736:
737: d_pos := 40;
730: IF l_quantity_billed > 0
731: OR l_amount_billed > 0
732: THEN
733: x_message_text := PO_CORE_S.get_translated_text('PO_PO_DELETE_DIST_BILLED_NA');
734: RAISE PO_CORE_S.G_EARLY_RETURN_EXC;
735: END IF;
736:
737: d_pos := 40;
738: -- is Encumbered
737: d_pos := 40;
738: -- is Encumbered
739: IF l_encumbered_flag = 'Y'
740: THEN
741: x_message_text := PO_CORE_S.get_translated_text('PO_PO_USE_CANCEL_ON_ENCUMB_PO');
742: RAISE PO_CORE_S.G_EARLY_RETURN_EXC;
743: END IF;
744:
745: d_pos := 50;
738: -- is Encumbered
739: IF l_encumbered_flag = 'Y'
740: THEN
741: x_message_text := PO_CORE_S.get_translated_text('PO_PO_USE_CANCEL_ON_ENCUMB_PO');
742: RAISE PO_CORE_S.G_EARLY_RETURN_EXC;
743: END IF;
744:
745: d_pos := 50;
746: -- Approved atleast once
745: d_pos := 50;
746: -- Approved atleast once
747: IF (l_creation_date <= p_approved_date)
748: THEN
749: x_message_text := PO_CORE_S.get_translated_text('PO_PO_USE_CANCEL_ON_APRVD_PO3');
750: RAISE PO_CORE_S.G_EARLY_RETURN_EXC;
751: END IF;
752:
753: d_pos := 60;
746: -- Approved atleast once
747: IF (l_creation_date <= p_approved_date)
748: THEN
749: x_message_text := PO_CORE_S.get_translated_text('PO_PO_USE_CANCEL_ON_APRVD_PO3');
750: RAISE PO_CORE_S.G_EARLY_RETURN_EXC;
751: END IF;
752:
753: d_pos := 60;
754: -- If there is only one single viable distribution then we should not allow to
758: into l_dummy
759: FROM po_distributions_all pod
760: WHERE pod.line_location_id = p_line_loc_id;
761:
762: x_message_text := PO_CORE_S.get_translated_text('PO_CANT_DELETE_ONLY_DIST');
763: RAISE PO_CORE_S.G_EARLY_RETURN_EXC;
764: EXCEPTION
765: WHEN TOO_MANY_ROWS THEN
766: --If there are multiple rows then we can go ahead and delete
759: FROM po_distributions_all pod
760: WHERE pod.line_location_id = p_line_loc_id;
761:
762: x_message_text := PO_CORE_S.get_translated_text('PO_CANT_DELETE_ONLY_DIST');
763: RAISE PO_CORE_S.G_EARLY_RETURN_EXC;
764: EXCEPTION
765: WHEN TOO_MANY_ROWS THEN
766: --If there are multiple rows then we can go ahead and delete
767: NULL;
766: --If there are multiple rows then we can go ahead and delete
767: NULL;
768: END;
769: EXCEPTION
770: WHEN PO_CORE_S.G_EARLY_RETURN_EXC THEN
771: NULL;
772: IF (PO_LOG.d_stmt) THEN
773: PO_LOG.stmt(d_module,d_pos,'x_message_text',x_message_text);
774: END IF;