[Home] [Help]
954:
955: select sum(nvl(reservation_quantity, 0))
956: into l_inv_quantity
957: from mtl_reservations
958: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord, inv_reservation_global.g_source_type_oe ) -- bugfix 1799874
959: and demand_source_line_id = so_line.line_id;
960:
961: -- if there is no reservation on the line that meens this line is
962: -- created for the first time and the status should be
1945: EXIT;
1946: END LOOP;
1947: l_open_flow_qty :=
1948: MRP_FLOW_SCHEDULE_UTIL.GET_FLOW_QUANTITY( p_demand_source_line => to_char(p_interface_source_line_id),
1949: p_demand_source_type => inv_reservation_global.g_source_type_oe,
1950: p_demand_source_delivery => NULL,
1951: p_use_open_quantity => 'Y');
1952:
1953:
2010: l_inv_qty := 0;
2011: select nvl(sum(reservation_quantity), 0)
2012: into l_inv_qty
2013: from mtl_reservations
2014: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord,
2015: inv_reservation_global.g_source_type_oe )
2016: and demand_source_line_id = so_line.line_id
2017: and supply_source_type_id = inv_reservation_global.g_source_type_inv;
2018:
2011: select nvl(sum(reservation_quantity), 0)
2012: into l_inv_qty
2013: from mtl_reservations
2014: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord,
2015: inv_reservation_global.g_source_type_oe )
2016: and demand_source_line_id = so_line.line_id
2017: and supply_source_type_id = inv_reservation_global.g_source_type_inv;
2018:
2019: l_po_qty := 0;
2013: from mtl_reservations
2014: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord,
2015: inv_reservation_global.g_source_type_oe )
2016: and demand_source_line_id = so_line.line_id
2017: and supply_source_type_id = inv_reservation_global.g_source_type_inv;
2018:
2019: l_po_qty := 0;
2020: select nvl(sum(reservation_quantity), 0)
2021: into l_po_qty
2019: l_po_qty := 0;
2020: select nvl(sum(reservation_quantity), 0)
2021: into l_po_qty
2022: from mtl_reservations
2023: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord,
2024: inv_reservation_global.g_source_type_oe )
2025: and demand_source_line_id = so_line.line_id
2026: and supply_source_type_id = inv_reservation_global.g_source_type_po;
2027:
2020: select nvl(sum(reservation_quantity), 0)
2021: into l_po_qty
2022: from mtl_reservations
2023: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord,
2024: inv_reservation_global.g_source_type_oe )
2025: and demand_source_line_id = so_line.line_id
2026: and supply_source_type_id = inv_reservation_global.g_source_type_po;
2027:
2028: l_req_qty := 0;
2022: from mtl_reservations
2023: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord,
2024: inv_reservation_global.g_source_type_oe )
2025: and demand_source_line_id = so_line.line_id
2026: and supply_source_type_id = inv_reservation_global.g_source_type_po;
2027:
2028: l_req_qty := 0;
2029: select nvl(sum(reservation_quantity), 0)
2030: into l_req_qty
2028: l_req_qty := 0;
2029: select nvl(sum(reservation_quantity), 0)
2030: into l_req_qty
2031: from mtl_reservations
2032: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord,
2033: inv_reservation_global.g_source_type_oe )
2034: and demand_source_line_id = so_line.line_id
2035: and supply_source_type_id = inv_reservation_global.g_source_type_req;
2036:
2029: select nvl(sum(reservation_quantity), 0)
2030: into l_req_qty
2031: from mtl_reservations
2032: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord,
2033: inv_reservation_global.g_source_type_oe )
2034: and demand_source_line_id = so_line.line_id
2035: and supply_source_type_id = inv_reservation_global.g_source_type_req;
2036:
2037: -- Check the order_quantity and the inv_rsv_qty to 'PO_RECEIVED'
2031: from mtl_reservations
2032: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord,
2033: inv_reservation_global.g_source_type_oe )
2034: and demand_source_line_id = so_line.line_id
2035: and supply_source_type_id = inv_reservation_global.g_source_type_req;
2036:
2037: -- Check the order_quantity and the inv_rsv_qty to 'PO_RECEIVED'
2038: IF so_line.ordered_quantity = nvl(l_inv_qty,0)
2039: AND nvl(so_line.ordered_quantity, 0) > 0 THEN