3723: END IF;
3724: END IF;
3725:
3726: --
3727: PO_CORE_S.is_fully_reserved(
3728: p_doc_type => p_doc_type
3729: , p_doc_level => PO_CORE_S.g_doc_level_header
3730: , p_doc_level_id => p_doc_id
3731: , x_fully_reserved_flag => l_fully_reserved_flag
3725:
3726: --
3727: PO_CORE_S.is_fully_reserved(
3728: p_doc_type => p_doc_type
3729: , p_doc_level => PO_CORE_S.g_doc_level_header
3730: , p_doc_level_id => p_doc_id
3731: , x_fully_reserved_flag => l_fully_reserved_flag
3732: );
3733:
4044: -- if there are any submitted/approved timecards associated with the
4045: -- PO header/line. If so, return an error.
4046: IF (p_doc_subtype = PO_CONSTANTS_SV.STANDARD) THEN
4047: d_pos := 50;
4048: IF p_doc_level = PO_CORE_S.g_doc_level_HEADER THEN
4049: l_otl_field_name := PO_HXC_INTERFACE_PVT.field_PO_HEADER_ID;
4050: l_otl_field_value := p_doc_header_id;
4051: ELSE
4052: -- line or shipment level
4294: END IF; --IGC_CBC_PO_GRP.cbc_po_enabled_flag = 'Y'
4295:
4296: -- call to Contracts API to cancel deliverables only on the header level
4297: -- for finally close
4298: IF (p_doc_level = PO_CORE_S.g_doc_level_HEADER) THEN
4299: d_pos := 60;
4300: select conterms_exist_flag, start_date,
4301: end_date, decode(cancel_flag,'I',null,cancel_flag)
4302: into l_conterms_exist_flag, l_document_start_date,
4359: -- If the Cancel action was initiated from PO Summary at
4360: -- Header/Line/Shipment level
4361: -- OR if the Cancel action was from Enter PO at Header Leve
4362: d_pos := 120;
4363: IF(p_mode = 'SUMMARY' OR p_doc_level= PO_CORE_S.g_doc_level_HEADER) THEN
4364: l_launch_approvals_flag := 'Y';
4365: ELSE
4366: l_launch_approvals_flag := 'N';
4367: END if;
4449: ,x_exception_msg => l_exc_msg);
4450:
4451: ELSE -- closed-state related action
4452: d_pos := 180;
4453: IF (p_doc_level = PO_CORE_S.g_doc_level_SHIPMENT)
4454: THEN
4455: select shipment_type
4456: into l_doc_subtype
4457: from po_line_locations_all
4904: PO_LOG.proc_begin(d_module,'p_doc_level_id',p_doc_level_id);
4905: PO_LOG.proc_begin(d_module,'p_doc_level',p_doc_level);
4906: END IF;
4907:
4908: IF(p_doc_level = PO_CORE_S.g_doc_level_LINE) THEN
4909: l_po_line_id := p_doc_level_id;
4910: ELSIF(p_doc_level = PO_CORE_S.g_doc_level_SHIPMENT) THEN
4911: l_line_location_id := p_doc_level_id;
4912: END IF;
4906: END IF;
4907:
4908: IF(p_doc_level = PO_CORE_S.g_doc_level_LINE) THEN
4909: l_po_line_id := p_doc_level_id;
4910: ELSIF(p_doc_level = PO_CORE_S.g_doc_level_SHIPMENT) THEN
4911: l_line_location_id := p_doc_level_id;
4912: END IF;
4913:
4914: d_pos := 10;
5016: x_return_status := FND_API.g_ret_sts_success;
5017: --Check for dropship PO
5018: IF(PO_COPYDOC_S1.po_is_dropship(p_doc_header_id)) THEN
5019: x_drop_ship_flag := 'Y';
5020: RAISE PO_CORE_S.g_early_return_exc;
5021: END IF;
5022:
5023: d_pos := 20;
5024:
5028: IF(is_backing_req_labor_expense(p_doc_level_id => p_doc_level_id,
5029: p_doc_level => p_doc_level)) THEN
5030: d_pos := 30;
5031: x_labor_expense_req_flag := 'Y';
5032: RAISE PO_CORE_S.g_early_return_exc;
5033: END IF;
5034:
5035: d_pos := 40;
5036: -- Check if a given PO contains at least one Services line, i.e. if the
5034:
5035: d_pos := 40;
5036: -- Check if a given PO contains at least one Services line, i.e. if the
5037: -- value basis of any line is FIXED PRICE or RATE
5038: IF(p_doc_level = PO_CORE_S.g_doc_level_HEADER
5039: AND p_doc_subtype = PO_CONSTANTS_SV.STANDARD) THEN
5040:
5041: IF (PO_SERVICES_PVT.check_po_has_svc_line_with_req(p_doc_header_id)) THEN
5042: d_pos := 50;
5040:
5041: IF (PO_SERVICES_PVT.check_po_has_svc_line_with_req(p_doc_header_id)) THEN
5042: d_pos := 50;
5043: x_svc_line_with_req_flag := 'Y';
5044: RAISE PO_CORE_S.g_early_return_exc;
5045: END IF;
5046: END IF; --p_doc_level = 'HEADER' AND docSubType = 'STANDARD'
5047:
5048: d_pos := 60;
5048: d_pos := 60;
5049: -- Checks if the line type is Fixed Price Service AND a backing
5050: -- requisition exists for the given line or shipment
5051: IF(p_doc_subtype = PO_CONSTANTS_SV.STANDARD) THEN
5052: IF p_doc_level = PO_CORE_S.g_doc_level_LINE THEN
5053: IF PO_SERVICES_PVT.is_FPS_po_line_with_req(p_doc_level_id) THEN
5054: x_fps_line_ship_with_req_flag := 'Y';
5055: END IF;
5056: ELSIF p_doc_level = PO_CORE_S.g_doc_level_SHIPMENT THEN
5052: IF p_doc_level = PO_CORE_S.g_doc_level_LINE THEN
5053: IF PO_SERVICES_PVT.is_FPS_po_line_with_req(p_doc_level_id) THEN
5054: x_fps_line_ship_with_req_flag := 'Y';
5055: END IF;
5056: ELSIF p_doc_level = PO_CORE_S.g_doc_level_SHIPMENT THEN
5057: IF PO_SERVICES_PVT.is_FPS_po_shipment_with_req(p_doc_level_id) THEN
5058: x_fps_line_ship_with_req_flag := 'Y';
5059: END IF;
5060: END IF; --p_doc_level = 'LINE'
5070: PO_LOG.proc_end(d_module);
5071: END IF;
5072:
5073: EXCEPTION
5074: WHEN PO_CORE_S.g_early_return_exc THEN
5075: IF PO_LOG.d_stmt THEN
5076: PO_LOG.stmt(d_module,d_pos,'Early exit from ' || d_module);
5077: END IF;
5078: WHEN OTHERS THEN
5160: d_pos := 10;
5161: --Get the Employee Id of the Current User
5162: l_agent_id := fnd_global.employee_id;
5163: --Get Document Sub type
5164: IF(p_doc_type IN (PO_CORE_S.g_doc_type_PO, PO_CORE_S.g_doc_type_PA)) THEN
5165: SELECT type_lookup_code
5166: INTO l_doc_subtype
5167: FROM po_headers_all
5168: WHERE po_header_id = p_doc_header_id;
5171: IF (PO_LOG.d_stmt) THEN
5172: PO_LOG.stmt(d_module,d_pos,'l_agent_id',l_agent_id);
5173: PO_LOG.stmt(d_module,d_pos,'l_doc_subtype',l_doc_subtype);
5174: END IF;
5175: IF (p_doc_level = PO_CORE_S.g_doc_level_HEADER) THEN --header level
5176: d_pos := 30;
5177: PO_DOCUMENT_CONTROL_PVT.get_header_actions
5178: ( p_doc_subtype => l_doc_subtype
5179: , p_doc_id => p_doc_level_id
5182: , x_displayed_field_tbl => l_displayed_field_tbl
5183: , x_return_status => x_return_status
5184: , p_mode => l_mode);
5185:
5186: ELSIF (p_doc_level = PO_CORE_S.g_doc_level_LINE) THEN --line level
5187: d_pos := 40;
5188: --get the itme_id for the consumption transaction existence check
5189: SELECT item_id
5190: INTO l_item_id
5203: , x_displayed_field_tbl => l_displayed_field_tbl
5204: , x_return_status => x_return_status
5205: , p_mode => l_mode);
5206:
5207: ELSIF (p_doc_level = PO_CORE_S.g_doc_level_SHIPMENT) THEN
5208: d_pos := 50;
5209: --shipment levl
5210: PO_DOCUMENT_CONTROL_PVT.get_shipment_actions
5211: ( p_doc_type => p_doc_type
5224: d_pos := 60;
5225:
5226: IF (x_return_status = FND_API.g_ret_sts_success)then
5227:
5228: IF p_doc_level IN (PO_CORE_S.g_doc_level_HEADER, PO_CORE_S.g_doc_level_LINE) THEN
5229: -- Checks if there exists a consumption transaction that is in process for
5230: -- the passed in transaction source document ID and and item ID.
5231: l_cons_trans_exist := PO_INV_THIRD_PARTY_STOCK_MDTR.consumption_trans_exist(
5232: p_doc_header_id,
5238: END IF;
5239: --
5240: --Prevent cancel option for shipment if it is the only shipment on the
5241: --line that is not cancelled or finally closed.
5242: IF(p_doc_level = PO_CORE_S.g_doc_level_SHIPMENT) THEN
5243:
5244: BEGIN
5245: d_pos := 75;
5246: SELECT 'N'
5266: END IF;
5267: l_ship_invalid_for_ctrl_actn := 'Y';
5268: END;
5269:
5270: END IF; --p_doc_level = PO_CORE_S.g_doc_level_SHIPMENT
5271: --
5272:
5273: FOR i IN l_valid_actions_tbl.first..l_valid_actions_tbl.last
5274: LOOP
5303: END IF;
5304: x_valid_ctrl_ctn_tbl(l_index) := PO_DOCUMENT_ACTION_PVT.g_doc_action_CANCEL;
5305: ELSIF(l_mode = 'UPDATE' AND l_current_action = 'CANCEL PO') THEN
5306:
5307: IF(p_doc_type = PO_CORE_S.g_doc_type_PO) THEN
5308: -- For Update mode we Show Cancel Action at Header as Cancel Order
5309: d_pos := 100;
5310: IF (PO_LOG.d_stmt) THEN
5311: PO_LOG.stmt(d_module,d_pos,l_current_action || 'is replaced by CANCEL ORDER for update mode');
5310: IF (PO_LOG.d_stmt) THEN
5311: PO_LOG.stmt(d_module,d_pos,l_current_action || 'is replaced by CANCEL ORDER for update mode');
5312: END IF;
5313: x_valid_ctrl_ctn_tbl(l_index) := 'CANCEL ORDER';
5314: ELSIF(p_doc_type = PO_CORE_S.g_doc_type_PA) THEN
5315: -- For Update mode we Show Cancel Action at Header as Cancel Agreement.
5316: d_pos := 110;
5317: IF (PO_LOG.d_stmt) THEN
5318: PO_LOG.stmt(d_module,d_pos,l_current_action || 'is replaced by CANCEL AGREEMENT for update mode');