The following lines contain the word 'select', 'insert', 'update' or 'delete':
SELECT sum(reservation_quantity - detailed_quantity)
INTO l_quantity_reserved
FROM mtl_reservations
WHERE demand_source_line_id = p_demand_line_id
AND inventory_item_id = p_inventory_item_id
AND organization_id = p_org_id
AND nvl(staged_flag,'N') <> 'Y'
AND demand_source_line_detail IS NULL;
UPDATE mtl_material_transactions_temp
SET wms_task_status = 1
WHERE move_order_header_id = p_header_id;
UPDATE mtl_material_transactions_temp
SET wms_task_status = 1
WHERE transaction_temp_id IN
( SELECT DISTINCT mmtt2.parent_line_id
FROM mtl_material_transactions_temp mmtt2
WHERE move_order_header_id = p_header_id
AND parent_line_id IS NOT NULL
);
SELECT move_order_typE
FROM mtl_txn_request_headers mtrh, mtl_txn_request_lines mtrl
WHERE mtrl.header_id = mtrh.header_id
AND mtrl.line_id = p_mo_line_id;
SELECT inventory_item_id,
organization_id,
requested_quantity,
requested_quantity_uom,
requested_quantity_uom2,
requested_quantity2, --MUOM Fulfillment Project
ship_tolerance_above,
ship_tolerance_below,
source_header_id,
source_line_set_id,
source_code,
source_line_id
FROM wsh_delivery_details
WHERE move_order_line_id = p_mo_line_id;
l_update_rsv_rec inv_reservation_global.mtl_reservation_rec_type;
SELECT reservation_id, serial_number
FROM mtl_serial_numbers msn
WHERE reservation_id = rsv_id
AND current_status = 3
AND NOT EXISTS (Select serial_number
From mtl_serial_numbers_temp msnt
Where msn.serial_number between msnt.fm_serial_number and nvl(msnt.to_serial_number,msnt.fm_serial_number)
and (msn.group_mark_id = msnt.transaction_temp_id
OR msn.group_mark_id = msnt.group_header_id
)
); -- Bug 8618236
SELECT sum(primary_reservation_quantity)
, sum(secondary_reservation_quantity)
INTO g_item_non_inv_rsv(p_mo_line_rec.inventory_item_id)
, g_item_sec_non_inv_rsv(p_mo_line_rec.inventory_item_id)
FROM mtl_reservations
WHERE organization_id = p_mo_line_rec.organization_id
AND inventory_item_id = p_mo_line_rec.inventory_item_id
AND supply_source_type_id <> INV_Reservation_GLOBAL.g_source_type_inv
AND demand_source_line_detail IS NULL;
SELECT nvl(sum(primary_reservation_quantity),0)
, nvl(sum(secondary_reservation_quantity),0)
INTO l_non_inv_reservations_qty
, l_non_inv_sec_reservation_qty
FROM mtl_reservations
WHERE demand_source_line_id = p_demand_info.oe_line_id
AND organization_id = p_mo_line_rec.organization_id
AND inventory_item_id = p_mo_line_rec.inventory_item_id
AND demand_source_type_id = p_demand_source_type
AND supply_source_type_id <> INV_Reservation_GLOBAL.g_source_type_inv
AND demand_source_line_detail IS NULL;
l_update_rsv_rec := l_qry_rsv_rec;
l_update_rsv_rec.primary_reservation_quantity := l_update_rsv_rec.primary_reservation_quantity + l_quantity_to_reserve;
l_update_rsv_rec.reservation_quantity := NULL; -- Force update of reserved qty
print_debug('update reservation', 'Inv_Pick_Release_PVT.Process_Reservations');
inv_reservation_pub.update_reservation(
p_api_version_number => 1.0
, p_init_msg_lst => fnd_api.g_false
, x_return_status => l_api_return_status
, x_msg_count => x_msg_count
, x_msg_data => x_msg_data
, p_original_rsv_rec => l_qry_rsv_rec
, p_to_rsv_rec => l_update_rsv_rec
, p_original_serial_number => l_dummy_sn
, p_to_serial_number => l_dummy_sn
, p_validation_flag => fnd_api.g_true
);
print_debug('error in update reservation', 'Inv_Pick_Release_PVT.Process_Reservations');
l_qry_rsv_rec_by_id.reservation_id := l_update_rsv_rec.reservation_id;
inv_quantity_tree_pub.update_quantities(
p_api_version_number => 1.0
, p_init_msg_lst => fnd_api.g_false
, x_return_status => l_api_return_status
, x_msg_count => x_msg_count
, x_msg_data => x_msg_data
, p_organization_id => p_mo_line_rec.organization_id
, p_inventory_item_id => p_mo_line_rec.inventory_item_id
, p_tree_mode => inv_quantity_tree_pub.g_reservation_mode
, p_is_revision_control => l_is_revision_control
, p_is_lot_control => l_is_lot_control
, p_is_serial_control => l_is_serial_control
, p_demand_source_type_id => p_demand_source_type
, p_demand_source_header_id => p_mso_line_id
, p_demand_source_line_id => p_demand_info.oe_line_id
, p_demand_source_name => p_demand_source_name
, p_revision => NULL
, p_lot_number => NULL
, p_lot_expiration_date => l_exp_date
, p_subinventory_code => NULL
, p_locator_id => NULL
, p_primary_quantity => l_quantity_to_reserve
, p_secondary_quantity => l_sec_quantity_to_reserve -- Bug 7377744
, p_quantity_type => inv_quantity_tree_pub.g_qr_same_demand
, x_qoh => l_qty_on_hand
, x_rqoh => l_qty_res_on_hand
, x_qr => l_qty_res
, x_qs => l_qty_sug
, x_att => l_qty_att
, x_atr => l_qty_available_to_reserve
, p_grade_code => l_grade_code
, x_sqoh => l_sec_qty_on_hand
, x_srqoh => l_sec_qty_res_on_hand
, x_sqr => l_sec_qty_res
, x_sqs => l_sec_qty_sug
, x_satt => l_sec_qty_att
, x_satr => l_sec_qty_available_to_reserve
);
UPDATE mtl_reservations
SET primary_reservation_quantity = l_new_prim_rsv_quantity
,reservation_quantity = l_new_rsv_quantity
,secondary_reservation_quantity = l_new_sec_rsv_quantity
WHERE reservation_id = l_org_wide_res_id;
inv_rsv_synch.for_update(
p_reservation_id => l_org_wide_res_id
, x_return_status => l_api_return_status
, x_msg_count => x_msg_count
, x_msg_data => x_msg_data);
print_debug('Error from inv_rsv_synch.for_update', 'Inv_Pick_Release_PVT.Process_Reservations');
print_debug('Unexp. error from inv_rsv_synch.for_update', 'Inv_Pick_Release_PVT.Process_Reservations');
l_update_rsv_rec.reservation_id := NULL; -- cannot know
l_update_rsv_rec.requirement_date := SYSDATE;
l_update_rsv_rec.organization_id := p_mo_line_rec.organization_id;
l_update_rsv_rec.inventory_item_id :=p_mo_line_rec.inventory_item_id;
l_update_rsv_rec.demand_source_type_id := p_demand_source_type;
l_update_rsv_rec.demand_source_name := p_demand_source_name;
l_update_rsv_rec.demand_source_header_id := p_mso_line_id;
l_update_rsv_rec.demand_source_line_id := p_demand_info.oe_line_id;
l_update_rsv_rec.demand_source_delivery := NULL;
l_update_rsv_rec.primary_uom_code := l_primary_uom;
l_update_rsv_rec.secondary_uom_code := l_secondary_uom;
l_update_rsv_rec.primary_uom_id := NULL;
l_update_rsv_rec.secondary_uom_id := NULL;
l_update_rsv_rec.reservation_uom_code := NULL;
l_update_rsv_rec.reservation_uom_id := NULL;
l_update_rsv_rec.reservation_quantity := NULL;
l_update_rsv_rec.primary_reservation_quantity := l_quantity_to_reserve;
l_update_rsv_rec.secondary_reservation_quantity := l_sec_quantity_to_reserve;
l_update_rsv_rec.autodetail_group_id := NULL;
l_update_rsv_rec.external_source_code := NULL;
l_update_rsv_rec.external_source_line_id := NULL;
l_update_rsv_rec.supply_source_type_id := inv_reservation_global.g_source_type_inv;
l_update_rsv_rec.supply_source_header_id := NULL;
l_update_rsv_rec.supply_source_line_id := NULL;
l_update_rsv_rec.supply_source_name := NULL;
l_update_rsv_rec.supply_source_line_detail := NULL;
l_update_rsv_rec.revision := NULL;
l_update_rsv_rec.subinventory_code := NULL;
l_update_rsv_rec.subinventory_id := NULL;
l_update_rsv_rec.locator_id := NULL;
l_update_rsv_rec.lot_number := NULL;
l_update_rsv_rec.lot_number_id := NULL;
l_update_rsv_rec.pick_slip_number := NULL;
l_update_rsv_rec.lpn_id := NULL;
l_update_rsv_rec.attribute_category := NULL;
l_update_rsv_rec.attribute1 := NULL;
l_update_rsv_rec.attribute2 := NULL;
l_update_rsv_rec.attribute3 := NULL;
l_update_rsv_rec.attribute4 := NULL;
l_update_rsv_rec.attribute5 := NULL;
l_update_rsv_rec.attribute6 := NULL;
l_update_rsv_rec.attribute7 := NULL;
l_update_rsv_rec.attribute8 := NULL;
l_update_rsv_rec.attribute9 := NULL;
l_update_rsv_rec.attribute10 := NULL;
l_update_rsv_rec.attribute11 := NULL;
l_update_rsv_rec.attribute12 := NULL;
l_update_rsv_rec.attribute13 := NULL;
l_update_rsv_rec.attribute14 := NULL;
l_update_rsv_rec.attribute15 := NULL;
l_update_rsv_rec.ship_ready_flag := 2;
l_update_rsv_rec.detailed_quantity := 0;
l_update_rsv_rec.reservation_uom_code := p_mo_line_rec.uom_code;
IF l_update_rsv_rec.reservation_uom_code = l_primary_uom THEN
l_update_rsv_rec.reservation_quantity := l_quantity_to_reserve;
l_update_rsv_rec.reservation_quantity := l_qty_to_detail_unconv;
IF l_update_rsv_rec.reservation_uom_code = l_primary_uom THEN
l_update_rsv_rec.reservation_quantity := l_quantity_to_reserve;
ELSIF l_update_rsv_rec.reservation_uom_code = l_secondary_uom THEN
l_update_rsv_rec.reservation_quantity := l_sec_quantity_to_reserve;
l_update_rsv_rec.reservation_quantity := inv_convert.inv_um_convert(item_id=> l_update_rsv_rec.inventory_item_id
, lot_number => l_update_rsv_rec.lot_number
, organization_id => l_update_rsv_rec.organization_id
, PRECISION => NULL -- use default precision
, from_quantity => l_quantity_to_reserve
, from_unit => l_primary_uom
, to_unit => l_update_rsv_rec.reservation_uom_code
, from_name => NULL -- from uom name
, to_name => NULL -- to uom name
);
IF l_update_rsv_rec.reservation_quantity = -99999 THEN
-- conversion failed
fnd_message.set_name('INV', 'CAN-NOT-CONVERT-TO-PRIMARY-UOM');
, p_rsv_rec => l_update_rsv_rec
, p_serial_number => l_dummy_sn
, x_serial_number => l_dummy_sn
, p_partial_reservation_flag => fnd_api.g_true
, p_force_reservation_flag => fnd_api.g_false
, p_validation_flag => 'Q'
, x_quantity_reserved => l_qty_succ_reserved
, x_reservation_id => l_org_wide_res_id
, p_over_reservation_flag => 2 -- Bug 5365200 Passing p_over_reservation_flag to allow reservation of demand for overpicking case
);
l_rsv_serials.DELETE;
SELECT subinventory_code
INTO l_default_subinventory
FROM mtl_item_sub_defaults
WHERE inventory_item_id = p_mo_line_rec.inventory_item_id
AND organization_id = p_mo_line_rec.organization_id
AND default_type = 1;
SELECT locator_id
INTO l_default_locator_id
FROM mtl_item_loc_defaults
WHERE inventory_item_id = p_mo_line_rec.inventory_item_id
AND organization_id = p_mo_line_rec.organization_id
AND subinventory_code = l_default_subinventory
AND default_type = 1;
SELECT revision_sort
INTO l_revision_rule
FROM mtl_inv_picking_rules
WHERE wms_rule_id = l_rule_id;
l_base_stmt := 'SELECT mir.revision FROM mtl_item_revisions mir '
||' WHERE mir.organization_id = :org_id '
||' AND mir.inventory_item_id = :item_id '
||' AND mir.effectivity_date <= SYSDATE '
||l_order_by;
l_stmt := 'SELECT revision FROM ('||l_base_stmt
||' ) where rownum=1 ';
print_debug('Calling WSH_Interface.Update_Shipping_Attributes',
'Inv_Pick_Release_PVT.Process_Unreservable_Items');
wsh_interface.update_shipping_attributes(
p_source_code => 'INV'
, p_changed_attributes => l_shipping_attr
, x_return_status => l_return_status
);
print_debug('after update shipping attributes',
'Inv_Pick_Release_Pvt.Process_Unreservable_Items');
print_debug('return error from update shipping attributes',
'Inv_Pick_Release_Pvt.Process_Unreservable_Items');
print_debug('return error from update shipping attributes',
'Inv_Pick_Release_Pvt.Process_Unreservable_Items');
print_debug('update move order line',
'Inv_pick_release_pvt.process_unreservable_items');
UPDATE mtl_txn_request_lines
SET quantity_detailed = p_mo_line_rec.quantity,
quantity_delivered = p_mo_line_rec.quantity,
pick_slip_number = l_pick_slip_number,
pick_slip_date = sysdate,
line_status = 5,
status_date =sysdate -- BUG 6932648
WHERE line_id = p_mo_line_rec.line_id;
SELECT *
INTO l_locator
FROM mtl_item_locations
WHERE inventory_location_id = p_to_locator_id
AND organization_id = p_mo_line_rec.organization_id
AND subinventory_code = l_to_subinventory;
print_debug('after select l_locator', 'Inv_Pick_Release_PVT.Process_Prj_Dynamic_Locator');
SELECT *
INTO l_org
FROM mtl_parameters
WHERE organization_id = p_mo_line_rec.organization_id;
print_debug('after select organization', 'Inv_Pick_Release_PVT.Process_Prj_Dynamic_Locator');
SELECT *
INTO l_sub
FROM mtl_secondary_inventories
WHERE secondary_inventory_name = p_mo_line_rec.to_subinventory_code
AND organization_id = p_mo_line_rec.organization_id;
UPDATE mtl_txn_request_lines
SET to_locator_id = l_new_to_locator_id
WHERE line_id = p_mo_line_rec.line_id;
End If; -- update mtrl
SELECT transaction_temp_id
, subinventory_code
, locator_id
, transfer_subinventory
, project_id
, task_id
, transfer_to_location
, revision
FROM mtl_material_transactions_temp
WHERE move_order_line_id = p_mo_line_id
AND pick_slip_number IS NULL;
SELECT *
INTO l_demand_info
FROM wsh_inv_delivery_details_v
WHERE move_order_line_id = p_mo_line_rec.line_id
AND move_order_line_id IS NOT NULL
AND released_status = 'S';
SELECT /*+index (WDD WSH_DELIVERY_DETAILS_N7)*/
wdd.source_header_id oe_header_id,
wts.stop_id trip_stop_id,
wdd.source_line_id oe_line_id,
wda.delivery_id shipping_delivery_id,
wdd.customer_id customer_id,
NULL, --ra.customer number
wdd.ship_to_location_id ship_to_location,
wdd.ship_from_location_id ship_from_location,
wdd.shipment_priority_code shipment_priority_code,
NULL, --ol.shipment_number shipment_number,
wdd.ship_method_code freight_code,
wdd.move_order_line_id move_order_line_id,
wdd.released_status,
wdd.delivery_detail_id
INTO l_demand_info
FROM wsh_delivery_details wdd, wsh_delivery_assignments_v wda,
wsh_new_deliveries wnd, wsh_delivery_legs wlg, wsh_trip_stops wts
WHERE wnd.delivery_id(+) = wda.delivery_id
AND wlg.delivery_id(+) = wnd.delivery_id
AND wts.stop_id(+) = wlg.pick_up_stop_id
AND NVL(wlg.sequence_number,-1) =
(SELECT NVL(min(g.sequence_number),-1)
FROM wsh_delivery_legs g
WHERE g.delivery_id(+) = wnd.delivery_id )
AND wdd.delivery_detail_id = wda.delivery_detail_id
AND wdd.move_order_line_id = p_mo_line_rec.line_id
AND wdd.move_order_line_Id IS NOT NULL
--AND nvl(wdd.shipment_direction,'O') in ( 'O' , 'IO')
AND wdd.released_status = 'S';
SELECT /*+index (WDD WSH_DELIVERY_DETAILS_N7)*/
wdd.source_header_id oe_header_id,
wdd.source_line_id oe_line_id
INTO l_demand_info.oe_header_id, l_demand_info.oe_line_id
FROM wsh_delivery_details wdd
WHERE wdd.move_order_line_id = p_mo_line_rec.line_id;
SELECT document_set_id
INTO l_report_set_id
FROM wsh_picking_batches
WHERE NAME = l_request_number;
fnd_msg_pub.delete_msg();
SELECT NVL(SUM(primary_quantity), 0)
,NVL(sum(transaction_quantity),0)
,NVL(sum(secondary_transaction_quantity),0)
,COUNT(*)
INTO l_quantity_detailed
,l_quantity_detailed_conv
,l_sec_quantity_detailed
,l_num_detail_recs
FROM mtl_material_transactions_temp
WHERE move_order_line_id = p_mo_line_rec.line_id;
UPDATE MTL_TXN_REQUEST_LINES
SET quantity_detailed = NVL(p_mo_line_rec.quantity_delivered,0),
secondary_quantity_detailed = NVL(p_mo_line_rec.secondary_quantity_delivered,0),
txn_source_id = l_mso_header_id,
txn_source_line_id = l_demand_info.oe_line_id,
pick_slip_date = sysdate
WHERE line_id = p_mo_line_rec.line_id;
/*update unsuggested qty as already org level rsv already created*/
IF (l_demand_rsvs_ordered.COUNT > 0 AND l_rsv_qty_available > 0) THEN
l_index := l_demand_rsvs_ordered.LAST;
print_debug('Delete org level reservation', 'Inv_Pick_Release_PVT.Process_Reservations');
inv_reservation_pvt.delete_reservation(
p_api_version_number => 1.0
,p_init_msg_lst => fnd_api.g_false
,x_return_status => l_api_return_status
,x_msg_count => x_msg_count
,x_msg_data => x_msg_data
,p_rsv_rec => l_demand_rsvs_ordered(l_index)
,p_original_serial_number => l_dummy_sn
,p_validation_flag => fnd_api.g_true
);
print_debug('return error from delete_reservation', 'Inv_Pick_Release_Pvt.Process_Line');
print_debug('return unexpected error from delete_reservation','Inv_Pick_Release_Pvt.Process_Line');
inv_quantity_tree_pub.update_quantities(
p_api_version_number => 1.0
, p_init_msg_lst => fnd_api.g_false
, x_return_status => l_api_return_status
, x_msg_count => x_msg_count
, x_msg_data => x_msg_data
, p_organization_id => p_mo_line_rec.organization_id
, p_inventory_item_id => p_mo_line_rec.inventory_item_id
, p_tree_mode => inv_quantity_tree_pub.g_reservation_mode
, p_is_revision_control => l_is_revision_control
, p_is_lot_control => l_is_lot_control
, p_is_serial_control => l_is_serial_control
, p_demand_source_type_id => l_demand_source_type
, p_demand_source_header_id => l_mso_header_id
, p_demand_source_line_id => l_demand_info.oe_line_id
, p_demand_source_name => NULL
, p_revision => NULL
, p_lot_number => NULL
, p_lot_expiration_date => l_exp_date
, p_subinventory_code => NULL
, p_locator_id => NULL
, p_primary_quantity => -(l_rsv_qty_available)
, p_secondary_quantity => -(l_rsv_qty2_available) -- Bug 7377744
, p_quantity_type => inv_quantity_tree_pub.g_qr_same_demand
, x_qoh => l_qty_on_hand
, x_rqoh => l_qty_res_on_hand
, x_qr => l_qty_res
, x_qs => l_qty_sug
, x_att => l_qty_att
, x_atr => l_qty_available_to_reserve
, p_grade_code => p_mo_line_rec.grade_code
, x_sqoh => l_sec_qty_on_hand
, x_srqoh => l_sec_qty_res_on_hand
, x_sqr => l_sec_qty_res
, x_sqs => l_sec_qty_sug
, x_satt => l_sec_qty_att
, x_satr => l_sec_qty_available_to_reserve
);
print_debug('Error from update quantity tree',
'Inv_Pick_Release_PVT.Process_Line');
UPDATE mtl_reservations
SET primary_reservation_quantity = l_new_prim_rsv_quantity
,reservation_quantity = l_new_rsv_quantity
,secondary_reservation_quantity = l_new_sec_rsv_quantity -- Bug 6989438
WHERE reservation_id = l_reservation_id;
inv_rsv_synch.for_update(
p_reservation_id => l_reservation_id
, x_return_status => l_api_return_status
, x_msg_count => x_msg_count
, x_msg_data => x_msg_data);
print_debug('Error from inv_rsv_synch.for_update','Inv_Pick_Release_PVT.Process_Reservations');
print_debug('Unexp. error from inv_rsv_synch.for_update','Inv_Pick_Release_PVT.Process_Reservations');
/*update unsuggested qty as already org level rsv already created*/
END IF; --num recs = 0
SELECT NVL(SUM(ABS(primary_quantity)), 0),
NVL(SUM(ABS(secondary_transaction_quantity)), 0) -- Pushkar
INTO l_reservation_detailed_qty,
l_rsv_detailed_qty2
FROM mtl_material_transactions_temp
WHERE organization_id = p_mo_line_rec.organization_id
AND reservation_id = l_demand_rsvs_ordered(l_res_ordered_index).reservation_id;
UPDATE mtl_reservations
SET primary_reservation_quantity = l_new_prim_rsv_quantity
,reservation_quantity = l_new_rsv_quantity
WHERE reservation_id = l_demand_rsvs_ordered(l_res_ordered_index).reservation_id;*/
inv_reservation_pub.update_reservation(
p_api_version_number => 1.0
, p_init_msg_lst => fnd_api.g_false
, x_return_status => l_api_return_status
, x_msg_count => l_count
, x_msg_data => l_message
, p_original_rsv_rec => l_original_rsv_record
, p_to_rsv_rec => l_to_rsv_record
, p_original_serial_number => l_dummy_sn
, p_to_serial_number => l_dummy_sn
, p_validation_flag => fnd_api.g_true
);
print_debug('error in update reservation', 'Inv_Pick_Release_PVT.Process_Reservations');
/* inv_rsv_synch.for_update(
p_reservation_id => l_demand_rsvs_ordered(l_res_ordered_index).reservation_id
, x_return_status => l_api_return_status
, x_msg_count => x_msg_count
, x_msg_data => x_msg_data);
print_debug('Error from inv_rsv_synch.for_update','Inv_Pick_Release_PVT.Process_Line');
print_debug('Unexp. error from inv_rsv_synch.for_update','Inv_Pick_Release_PVT.Process_Line');
UPDATE MTL_TXN_REQUEST_LINES
SET quantity_detailed = l_quantity_detailed_conv,
secondary_quantity_detailed = l_sec_quantity_detailed,
txn_source_id = l_mso_header_id,
txn_source_line_id = l_demand_info.oe_line_id,
pick_slip_date = sysdate
WHERE line_id = p_mo_line_rec.line_id;
SELECT NVL(SUM(ABS(primary_quantity)), 0)
, NVL(SUM(ABS(secondary_transaction_quantity)), 0)
INTO l_reservation_detailed_qty
, l_rsv_detailed_qty2
FROM mtl_material_transactions_temp
WHERE organization_id = p_mo_line_rec.organization_id
AND reservation_id = l_reservation_id;
inv_quantity_tree_pub.update_quantities(
p_api_version_number => 1.0
, p_init_msg_lst => fnd_api.g_false
, x_return_status => l_api_return_status
, x_msg_count => x_msg_count
, x_msg_data => x_msg_data
, p_organization_id => p_mo_line_rec.organization_id
, p_inventory_item_id => p_mo_line_rec.inventory_item_id
, p_tree_mode => inv_quantity_tree_pub.g_reservation_mode
, p_is_revision_control => l_is_revision_control
, p_is_lot_control => l_is_lot_control
, p_is_serial_control => l_is_serial_control
, p_demand_source_type_id => l_demand_source_type
, p_demand_source_header_id => l_mso_header_id
, p_demand_source_line_id => l_demand_info.oe_line_id
, p_demand_source_name => NULL
, p_revision => l_demand_rsvs_ordered(l_res_ordered_index).revision
, p_lot_number => l_demand_rsvs_ordered(l_res_ordered_index).lot_number
, p_lot_expiration_date => l_exp_date
, p_subinventory_code => l_demand_rsvs_ordered(l_res_ordered_index).subinventory_code
, p_locator_id => l_demand_rsvs_ordered(l_res_ordered_index).locator_id
, p_primary_quantity => -(l_reservation_detailed_qty - l_prev_rsv_detailed_qty)
, p_secondary_quantity => -(l_rsv_detailed_qty2 - l_prev_rsv_detailed_qty2) /* Bug 7377744 */
, p_lpn_id => l_demand_rsvs_ordered(l_res_ordered_index).lpn_id /* Bug 7229711 */
, p_quantity_type => inv_quantity_tree_pub.g_qr_same_demand
, x_qoh => l_qty_on_hand
, x_rqoh => l_qty_res_on_hand
, x_qr => l_qty_res
, x_qs => l_qty_sug
, x_att => l_qty_att
, x_atr => l_qty_available_to_reserve
/* Added following secondary qty related section for Bug 7377744 */
, p_grade_code => p_mo_line_rec.grade_code
, x_sqoh => l_sec_qty_on_hand
, x_srqoh => l_sec_qty_res_on_hand
, x_sqr => l_sec_qty_res
, x_sqs => l_sec_qty_sug
, x_satt => l_sec_qty_att
, x_satr => l_sec_qty_available_to_reserve
);
print_debug('Error from update quantity tree', 'Inv_Pick_Release_PVT.Process_Line');
print_debug('update reservation with quantity_detailed', 'Inv_Pick_Release_PVT.Process_Line');
UPDATE mtl_reservations
SET reservation_quantity = greatest(reservation_quantity, l_rsv_detailed_qty_conv) -- Bug Fix 5624514
, primary_reservation_quantity = greatest(primary_reservation_quantity, l_reservation_detailed_qty)
, secondary_reservation_quantity = greatest(secondary_reservation_quantity, l_rsv_detailed_qty2)
, detailed_quantity = l_reservation_detailed_qty
, secondary_detailed_quantity = l_rsv_detailed_qty2
WHERE reservation_id = l_reservation_id;
UPDATE mtl_material_transactions_temp
SET pick_slip_number = l_pick_slip_number
, transaction_source_id = l_mso_header_id
, trx_source_line_id = l_demand_info.oe_line_id
, demand_source_header_id = l_mso_header_id
, demand_source_line = l_demand_info.oe_line_id
, transfer_to_location = l_dest_locator_id
WHERE transaction_temp_id = l_mold_temp_id;
SELECT document_set_id
INTO l_report_set_id
FROM wsh_picking_batches
WHERE NAME = l_request_number;
select quantity_detailed
, secondary_quantity_detailed
into l_quantity_detailed
, l_sec_quantity_detailed
from mtl_txn_request_lines
WHERE line_id = p_mo_line_rec.line_id;
print_debug('2nd after select sec Quantity_detailed is '|| l_sec_quantity_detailed, 'Inv_Pick_Release_PVT.Process_Line');