1115:
1116: select sum(nvl(reservation_quantity, 0))
1117: into l_inv_quantity
1118: from mtl_reservations
1119: 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
1120: and demand_source_line_id = so_line.line_id;
1121:
1122: -- if there is no reservation on the line that meens this line is
1123: -- created for the first time and the status should be
2287: END IF;
2288:
2289: l_open_flow_qty :=
2290: MRP_FLOW_SCHEDULE_UTIL.GET_FLOW_QUANTITY( p_demand_source_line => to_char(p_interface_source_line_id),
2291: p_demand_source_type => inv_reservation_global.g_source_type_oe,
2292: p_demand_source_delivery => NULL,
2293: p_use_open_quantity => 'Y');
2294:
2295:
2395: l_inv_qty := 0;
2396: select nvl(sum(reservation_quantity), 0)
2397: into l_inv_qty
2398: from mtl_reservations
2399: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord,
2400: inv_reservation_global.g_source_type_oe )
2401: and demand_source_line_id = so_line.line_id
2402: and supply_source_type_id = inv_reservation_global.g_source_type_inv;
2403:
2396: select nvl(sum(reservation_quantity), 0)
2397: into l_inv_qty
2398: from mtl_reservations
2399: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord,
2400: inv_reservation_global.g_source_type_oe )
2401: and demand_source_line_id = so_line.line_id
2402: and supply_source_type_id = inv_reservation_global.g_source_type_inv;
2403:
2404: l_po_qty := 0;
2398: from mtl_reservations
2399: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord,
2400: inv_reservation_global.g_source_type_oe )
2401: and demand_source_line_id = so_line.line_id
2402: and supply_source_type_id = inv_reservation_global.g_source_type_inv;
2403:
2404: l_po_qty := 0;
2405: select nvl(sum(reservation_quantity), 0)
2406: into l_po_qty
2404: l_po_qty := 0;
2405: select nvl(sum(reservation_quantity), 0)
2406: into l_po_qty
2407: from mtl_reservations
2408: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord,
2409: inv_reservation_global.g_source_type_oe )
2410: and demand_source_line_id = so_line.line_id
2411: and supply_source_type_id = inv_reservation_global.g_source_type_po;
2412:
2405: select nvl(sum(reservation_quantity), 0)
2406: into l_po_qty
2407: from mtl_reservations
2408: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord,
2409: inv_reservation_global.g_source_type_oe )
2410: and demand_source_line_id = so_line.line_id
2411: and supply_source_type_id = inv_reservation_global.g_source_type_po;
2412:
2413: l_req_qty := 0;
2407: from mtl_reservations
2408: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord,
2409: inv_reservation_global.g_source_type_oe )
2410: and demand_source_line_id = so_line.line_id
2411: and supply_source_type_id = inv_reservation_global.g_source_type_po;
2412:
2413: l_req_qty := 0;
2414: select nvl(sum(reservation_quantity), 0)
2415: into l_req_qty
2413: l_req_qty := 0;
2414: select nvl(sum(reservation_quantity), 0)
2415: into l_req_qty
2416: from mtl_reservations
2417: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord,
2418: inv_reservation_global.g_source_type_oe )
2419: and demand_source_line_id = so_line.line_id
2420: and supply_source_type_id = inv_reservation_global.g_source_type_req;
2421:
2414: select nvl(sum(reservation_quantity), 0)
2415: into l_req_qty
2416: from mtl_reservations
2417: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord,
2418: inv_reservation_global.g_source_type_oe )
2419: and demand_source_line_id = so_line.line_id
2420: and supply_source_type_id = inv_reservation_global.g_source_type_req;
2421:
2422: -- Check the order_quantity and the inv_rsv_qty to 'PO_RECEIVED'
2416: from mtl_reservations
2417: where demand_source_type_id = decode (l_source_document_type_id, 10, inv_reservation_global.g_source_type_internal_ord,
2418: inv_reservation_global.g_source_type_oe )
2419: and demand_source_line_id = so_line.line_id
2420: and supply_source_type_id = inv_reservation_global.g_source_type_req;
2421:
2422: -- Check the order_quantity and the inv_rsv_qty to 'PO_RECEIVED'
2423: IF so_line.ordered_quantity = nvl(l_inv_qty,0)
2424: AND nvl(so_line.ordered_quantity, 0) > 0 THEN