The following lines contain the word 'select', 'insert', 'update' or 'delete':
x_update_det_rec IN OUT NOCOPY update_detail_rec_type,
p_update_det_rec_idx IN NUMBER,
x_rem_req_qty_rec IN OUT NOCOPY rem_req_qty_rec_type,
x_unassign_det_tbl IN OUT NOCOPY wsh_util_core.id_tab_type,
x_po_line_loc_tbl IN OUT NOCOPY wsh_util_core.id_tab_type,
x_delivery_id_tab IN OUT NOCOPY wsh_util_core.id_tab_type,
x_wv_detail_tab IN OUT NOCOPY wsh_util_core.id_tab_type,
x_unassigned_lpn_id_tab IN OUT NOCOPY wsh_util_core.id_tab_type,
x_wv_recalc_del_id_tab IN OUT NOCOPY wsh_util_core.id_tab_type,
x_return_status OUT NOCOPY VARCHAR2)
IS
--{
l_child_index NUMBER;
l_del_update_req_flag VARCHAR2(1);
select wnd.delivery_id
from wsh_delivery_assignments_v wda,
wsh_new_deliveries wnd
where wda.delivery_detail_id = p_del_det_id
and wda.delivery_id = wnd.delivery_id;
select parent_delivery_detail_id
from wsh_delivery_assignments_v
where delivery_detail_id = p_delivery_detail_id;
select gross_weight,
net_weight,
volume,
NVL(wv_frozen_flag,'Y') wv_frozen_flag
from wsh_delivery_details
where delivery_detail_id = p_delivery_detail_id;
WSH_DEBUG_SV.log(l_module_name,'P_UPDATE_DET_REC_IDX',P_UPDATE_DET_REC_IDX);
WSH_DEBUG_SV.log(l_module_name,'update recs recevied quantity ',x_update_det_rec.received_qty_tab(p_update_det_rec_idx));
WSH_DEBUG_SV.log(l_module_name,'update recs record_changed_flag ',x_update_det_rec.record_changed_flag_tab(p_update_det_rec_idx));
x_update_det_rec.received_qty_tab(p_matched_detail_index) := NULL;
x_update_det_rec.received_qty2_tab(p_matched_detail_index) := NULL;
x_update_det_rec.returned_qty_tab(p_matched_detail_index) := NULL;
x_update_det_rec.returned_qty2_tab(p_matched_detail_index) := NULL;
x_update_det_rec.shipment_line_id_tab(p_matched_detail_index) := NULL;
x_update_det_rec.released_sts_tab(p_matched_detail_index) := 'X';
x_update_det_rec.received_qty_tab(p_update_det_rec_idx) := x_matched_detail_rec.received_qty_tab(p_matched_detail_index);
x_update_det_rec.requested_qty_tab(p_update_det_rec_idx) := least(x_matched_detail_rec.requested_qty_tab(p_matched_detail_index),
x_matched_detail_rec.received_qty_tab(p_matched_detail_index));
x_update_det_rec.received_qty2_tab(p_update_det_rec_idx) := x_matched_detail_rec.received_qty2_tab(p_matched_detail_index);
x_update_det_rec.requested_qty2_tab(p_update_det_rec_idx) := least(x_matched_detail_rec.requested_qty2_tab(p_matched_detail_index),
x_matched_detail_rec.received_qty2_tab(p_matched_detail_index));
x_update_det_rec.record_changed_flag_tab(p_update_det_rec_idx) := 'Y';
l_del_update_req_flag := 'Y';
x_update_det_rec.received_qty_tab(p_update_det_rec_idx) := x_matched_detail_rec.received_qty_tab(p_matched_detail_index);
x_update_det_rec.received_qty2_tab(p_update_det_rec_idx) := x_matched_detail_rec.received_qty2_tab(p_matched_detail_index);
x_update_det_rec.record_changed_flag_tab(p_update_det_rec_idx) := 'Y';
l_del_update_req_flag := 'Y';
IF nvl(l_del_update_req_flag, 'N') = 'Y' THEN
--{
IF nvl(x_update_det_rec.received_qty_tab(p_update_det_rec_idx),0) = 0 THEN
--{
x_update_det_rec.received_qty_tab(p_update_det_rec_idx) := null;
IF nvl(x_update_det_rec.received_qty2_tab(p_update_det_rec_idx),0) = 0 THEN
--{
x_update_det_rec.received_qty2_tab(p_update_det_rec_idx) := null;
x_update_det_rec.wv_changed_flag_tab(p_update_det_rec_idx) := 'Y';
x_update_det_rec.gross_weight_tab(p_update_det_rec_idx) := ROUND(l_qty_ratio*l_det_gr_weight,5);
x_update_det_rec.net_weight_tab(p_update_det_rec_idx) := ROUND(l_qty_ratio*l_det_net_weight,5);
x_update_det_rec.volume_tab(p_update_det_rec_idx) := ROUND(l_qty_ratio*l_det_volume,5);
WSH_DEBUG_SV.log(l_module_name,'At the end - update recs recevied quantity ',x_update_det_rec.received_qty_tab(p_update_det_rec_idx));
WSH_DEBUG_SV.log(l_module_name,'At the end - update recs record_changed_flag ',x_update_det_rec.record_changed_flag_tab(p_update_det_rec_idx));
x_update_det_rec IN OUT NOCOPY update_detail_rec_type,
p_update_det_rec_idx IN NUMBER,
x_rem_req_qty_rec IN OUT NOCOPY rem_req_qty_rec_type,
x_return_status OUT NOCOPY VARCHAR2)
IS
--{
l_num_errors NUMBER;
WSH_DEBUG_SV.log(l_module_name,'P_UPDATE_DET_REC_IDX',P_UPDATE_DET_REC_IDX);
x_update_det_rec.returned_qty_tab(p_update_det_rec_idx) := x_matched_detail_rec.returned_qty_tab(p_matched_detail_index);
x_update_det_rec.returned_qty2_tab(p_update_det_rec_idx) := x_matched_detail_rec.returned_qty2_tab(p_matched_detail_index);
IF (nvl(x_update_det_rec.returned_qty_tab(p_update_det_rec_idx), 0) = 0) THEN
--{
x_update_det_rec.returned_qty_tab(p_update_det_rec_idx) := null;
IF (nvl(x_update_det_rec.returned_qty2_tab(p_update_det_rec_idx), 0) = 0) THEN
--{
x_update_det_rec.returned_qty2_tab(p_update_det_rec_idx) := null;
x_update_det_rec.record_changed_flag_tab(p_update_det_rec_idx) := 'Y';
l_update_det_rec update_detail_rec_type;
l_update_det_rec_idx NUMBER := -1;
select 'N'
from wsh_delivery_assignments_v wda,
wsh_delivery_details wdd1,
wsh_delivery_details wdd2
where wda.delivery_id = p_delivery_id
and wda.delivery_detail_id = wdd1.delivery_detail_id
and wda.delivery_detail_id = wdd2.delivery_detail_id
and (wdd1.fob_code is null
or wdd2.fob_code is null
or wdd1.fob_code <> wdd2.fob_code)
and rownum =1;
select 'N'
from wsh_delivery_assignments_v wda,
wsh_delivery_details wdd1,
wsh_delivery_details wdd2
where wda.delivery_id = p_delivery_id
and wda.delivery_detail_id = wdd1.delivery_detail_id
and wda.delivery_detail_id = wdd2.delivery_detail_id
and (wdd1.freight_terms_code is null
or wdd2.freight_terms_code is null
or wdd1.freight_terms_code <> wdd2.freight_terms_code)
and rownum =1;
select wdd.freight_terms_code, wdd.fob_code
from wsh_delivery_assignments_v wda,
wsh_delivery_details wdd
where wda.delivery_id = p_delivery_id
and wda.delivery_detail_id = wdd.delivery_detail_id
and rownum =1;
select 'N'
from wsh_delivery_assignments_v
where parent_delivery_detail_id = p_del_det_id
and rownum=1;
l_delete_lpn_id_tab wsh_util_core.id_tab_type;
l_update_det_rec_idx := l_update_det_rec.del_det_id_tab.count;
g_del_cache_tbl.delete;
g_del_ext_cache_tbl.delete;
l_update_det_rec_idx := l_update_det_rec_idx + 1;
l_update_det_rec.del_det_id_tab(l_update_det_rec_idx) := p_matched_detail_rec.del_detail_id_tab(l_index);
l_update_det_rec.requested_qty_tab(l_update_det_rec_idx) := p_matched_detail_rec.requested_qty_tab(l_index);
l_update_det_rec.shipped_qty_tab(l_update_det_rec_idx) := p_matched_detail_rec.shipped_qty_tab(l_index);
l_update_det_rec.received_qty_tab(l_update_det_rec_idx) := p_matched_detail_rec.received_qty_tab(l_index);
l_update_det_rec.returned_qty_tab(l_update_det_rec_idx) := p_matched_detail_rec.returned_qty_tab(l_index);
l_update_det_rec.requested_qty2_tab(l_update_det_rec_idx) := p_matched_detail_rec.requested_qty2_tab(l_index);
l_update_det_rec.shipped_qty2_tab(l_update_det_rec_idx) := p_matched_detail_rec.shipped_qty2_tab(l_index);
l_update_det_rec.received_qty2_tab(l_update_det_rec_idx) := p_matched_detail_rec.received_qty2_tab(l_index);
l_update_det_rec.returned_qty2_tab(l_update_det_rec_idx) := p_matched_detail_rec.returned_qty2_tab(l_index);
l_update_det_rec.shipment_line_id_tab(l_update_det_rec_idx) := p_matched_detail_rec.shipment_line_id_tab(l_index);
l_update_det_rec.record_changed_flag_tab(l_update_det_rec_idx) := 'N';
l_update_det_rec.wv_changed_flag_tab(l_update_det_rec_idx) := 'N';
l_update_det_rec.net_weight_tab(l_update_det_rec_idx) := null;
l_update_det_rec.gross_weight_tab(l_update_det_rec_idx) := null;
l_update_det_rec.volume_tab(l_update_det_rec_idx) := null;
WSH_DEBUG_SV.log(l_module_name,'requested qty(' || l_update_det_rec_idx|| ')', l_update_det_rec.requested_qty_tab(l_update_det_rec_idx));
WSH_DEBUG_SV.log(l_module_name,'received qty(' || l_update_det_rec_idx|| ')', l_update_det_rec.received_qty_tab(l_update_det_rec_idx));
WSH_DEBUG_SV.log(l_module_name,'returned qty(' || l_update_det_rec_idx|| ')', l_update_det_rec.returned_qty_tab(l_update_det_rec_idx));
WSH_DEBUG_SV.log(l_module_name,'Shipped qty(' || l_update_det_rec_idx|| ')', l_update_det_rec.shipped_qty_tab(l_update_det_rec_idx));
x_update_det_rec => l_update_det_rec,
p_update_det_rec_idx => l_update_det_rec_idx,
x_rem_req_qty_rec => l_rem_req_qty_rec,
x_unassign_det_tbl => l_unassign_det_tbl,
x_po_line_loc_tbl => l_po_line_loc_tbl,
x_delivery_id_tab => l_delivery_id_tab,
x_wv_detail_tab => l_wv_detail_tab,
x_unassigned_lpn_id_tab => l_unassigned_lpn_id_tab,
x_wv_recalc_del_id_tab => l_wv_recalc_del_id_tab,
x_return_status => l_return_status);
x_update_det_rec => l_update_det_rec,
p_update_det_rec_idx => l_update_det_rec_idx,
x_rem_req_qty_rec => l_rem_req_qty_rec,
x_return_status => l_return_status);
WSH_DEBUG_SV.logmsg(l_module_name,'Before doing a bulk update');
WSH_DEBUG_SV.log(l_module_name,'received qty before the update', l_update_det_rec.received_qty_tab(1));
WSH_DEBUG_SV.log(l_module_name,'update rec count is', l_update_det_rec.received_qty_tab.count);
WSH_DEBUG_SV.log(l_module_name,'record_changed_flag', l_update_det_rec.record_changed_flag_tab(1));
WSH_DEBUG_SV.log(l_module_name,'del_detid', l_update_det_rec.del_det_id_tab(1));
WSH_DEBUG_SV.log(l_module_name,'shipped_qty_tab', l_update_det_rec.shipped_qty_tab(1));
WSH_DEBUG_SV.log(l_module_name,'shipped_qty2_tab', l_update_det_rec.shipped_qty2_tab(1));
WSH_DEBUG_SV.log(l_module_name,'received_qty_tab', l_update_det_rec.received_qty_tab(1));
WSH_DEBUG_SV.log(l_module_name,'returned_qty_tab', l_update_det_rec.returned_qty_tab(1));
WSH_DEBUG_SV.log(l_module_name,'shipment_line_id_tab', l_update_det_rec.shipment_line_id_tab(1));
WSH_DEBUG_SV.log(l_module_name,'wv_changed_flag_tab', l_update_det_rec.wv_changed_flag_tab(1));
WSH_DEBUG_SV.log(l_module_name,'net_weight_tab', l_update_det_rec.net_weight_tab(1));
WSH_DEBUG_SV.log(l_module_name,'gross_weight_tab', l_update_det_rec.gross_weight_tab(1));
WSH_DEBUG_SV.log(l_module_name,'volume_tab', l_update_det_rec.volume_tab(1));
forall i in l_update_det_rec.del_det_id_tab.first..l_update_det_rec.del_det_id_tab.last
update wsh_delivery_details
set requested_quantity = l_update_det_rec.requested_qty_tab(i),
requested_quantity2 = l_update_det_rec.requested_qty2_tab(i),
shipped_quantity = l_update_det_rec.shipped_qty_tab(i),
shipped_quantity2 = l_update_det_rec.shipped_qty2_tab(i),
received_quantity = l_update_det_rec.received_qty_tab(i),
received_quantity2 = l_update_det_rec.received_qty2_tab(i),
returned_quantity = l_update_det_rec.returned_qty_tab(i),
returned_quantity2 = l_update_det_rec.returned_qty2_tab(i),
rcv_shipment_line_id = l_update_det_rec.shipment_line_id_tab(i),
net_weight = decode(l_update_det_rec.wv_changed_flag_tab(i),
'Y',
l_update_det_rec.net_weight_tab(i),
net_weight
),
gross_weight = decode(l_update_det_rec.wv_changed_flag_tab(i),
'Y',
l_update_det_rec.gross_weight_tab(i),
gross_weight
),
volume = decode(l_update_det_rec.wv_changed_flag_tab(i),
'Y',
l_update_det_rec.volume_tab(i),
volume
),
last_update_date = sysdate,
last_updated_by = fnd_global.user_id,
last_update_login = fnd_global.user_id
where l_update_det_rec.record_changed_flag_tab(i) = 'Y'
and delivery_detail_id = l_update_det_rec.del_det_id_tab(i);
WSH_DEBUG_SV.logmsg(l_module_name,'After the bulk update');
WSH_DEBUG_SV.log(l_module_name,'Number of Records updated', SQL%ROWCOUNT);
WSH_DEBUG_SV.log(l_module_name,'Calling DBI API.Detail Count-',l_update_det_rec.del_det_id_tab.count);
WSH_INTEGRATION.DBI_Update_Detail_Log
(p_delivery_detail_id_tab => l_update_det_rec.del_det_id_tab,
p_dml_type => 'UPDATE',
x_return_status => l_dbi_rs);
IF nvl(l_lpn_empty_flag,'Y') = 'Y' THEN -- delete the lpn
--{
l_delete_lpn_id_tab(l_delete_lpn_id_tab.count + 1) := l_unassigned_lpn_id_tab(i);
IF (l_delete_lpn_id_tab.count > 0) THEN
--{
FORALL i IN l_delete_lpn_id_tab.FIRST..l_delete_lpn_id_tab.LAST
DELETE wsh_delivery_assignments_v
WHERE delivery_detail_id = l_delete_lpn_id_tab(i);
FORALL i IN l_delete_lpn_id_tab.FIRST..l_delete_lpn_id_tab.LAST
DELETE WSH_DELIVERY_DETAILS
WHERE delivery_detail_id = l_delete_lpn_id_tab(i);
p_update_flag => 'Y',
p_calc_wv_if_frozen => 'N',
x_return_status => l_return_status);
p_update_flag => 'Y',
p_calc_wv_if_frozen => 'N',
x_return_status => l_return_status);
l_update_rec update_detail_rec_type;
l_update_del_det_id NUMBER;
l_update_del_det_id_tab wsh_util_core.id_tab_type;
l_update_del_det_req_qty NUMBER;
l_update_del_det_req_qty2 NUMBER;
select delivery_detail_id,
requested_quantity,
requested_quantity2
from wsh_delivery_details
where source_line_id = p_source_line_id
and po_shipment_line_id = p_po_line_loc_id
and released_status = 'X'
and routing_req_id is null
and source_code = 'PO'
order by requested_quantity desc;
select delivery_detail_id,
requested_quantity,
requested_quantity2
from wsh_delivery_details
where source_line_id = p_source_line_id
and po_shipment_line_id = p_po_line_loc_id
and ( released_status = 'X'
or
( released_status = 'L'
and received_quantity is null
)
)
and routing_req_id is null
and source_code = 'PO'
order by requested_quantity desc,
decode (released_status,
'X',1,
'L',2);
select requested_quantity_uom
from wsh_delivery_details
where source_line_id = p_source_line_id
and source_code = 'PO'
and po_shipment_line_id = p_po_line_loc_id;
select delivery_detail_id,
requested_quantity,
requested_quantity2,
'N' record_changed_flag
from wsh_delivery_details
where source_line_id = p_source_line_id
and po_shipment_line_id = p_po_line_loc_id
and released_status in ('X', 'C', 'L')
and source_code = 'PO'
and requested_quantity > 0
order by
decode (released_status,
'X',1,
'C',2,
'L',3),
delivery_detail_id desc
for update of requested_quantity nowait;
fetch l_open_del_det_csr bulk collect into l_update_rec.del_det_id_tab,
l_update_rec.requested_qty_tab,
l_update_rec.requested_qty2_tab;
fetch l_all_del_det_csr bulk collect into l_update_rec.del_det_id_tab,
l_update_rec.requested_qty_tab,
l_update_rec.requested_qty2_tab;
WSH_DEBUG_SV.log(l_module_name,'count of update rec tables is', l_update_rec.del_det_id_tab.COUNT);
IF (l_update_rec.del_det_id_tab.COUNT < 1 ) THEN
--{
l_record_found := FALSE;
i := l_update_rec.del_det_id_tab.first;
WSH_DEBUG_SV.log(l_module_name,'Delivery Detail Id', l_update_rec.del_det_id_tab(i));
WSH_DEBUG_SV.log(l_module_name,'Delivery Detail Req Qty ', l_update_rec.requested_qty_tab(i));
WSH_DEBUG_SV.log(l_module_name,'Delivery Detail Req Qty 2', l_update_rec.requested_qty2_tab(i));
l_update_rec.record_changed_flag_tab (i) := 'N';
IF l_update_rec.requested_qty_tab(i) > abs(l_new_req_qty) THEN
--{
l_update_rec.requested_qty_tab(i) := l_update_rec.requested_qty_tab(i) + l_new_req_qty;
l_update_rec.requested_qty2_tab(i) := nvl(l_update_rec.requested_qty2_tab(i),0) +
l_new_req_qty2;
IF (l_update_rec.requested_qty2_tab(i) < 0) THEN
--{
l_update_rec.requested_qty2_tab(i) := 0;
l_update_rec.record_changed_flag_tab (i) := 'Y';
l_update_del_det_id := l_update_rec.del_det_id_tab(i);
l_update_del_det_req_qty := l_update_rec.requested_qty_tab(i);
l_update_del_det_req_qty2 := l_update_rec.requested_qty2_tab(i);
ELSE -- l_update_rec.requested_qty_tab(i) <= abs(l_new_req_qty)
--{
--
-- Debug Statements
--
IF l_debug_on THEN
WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_DELIVERY_DETAILS_PKG.LOCK_DETAIL_NO_COMPARE',WSH_DEBUG_SV.C_PROC_LEVEL);
p_delivery_detail_id => l_update_rec.del_det_id_tab(i));
WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_DELIVERY_DETAILS_PKG.DELETE_DELIVERY_DETAILS',WSH_DEBUG_SV.C_PROC_LEVEL);
wsh_delivery_details_pkg.delete_delivery_details(
p_delivery_detail_id => l_update_rec.del_det_id_tab(i),
x_return_status => l_return_status);
l_new_req_qty := l_new_req_qty + l_update_rec.requested_qty_tab(i);
IF (l_update_rec.requested_qty2_tab(i) IS NOT NULL) THEN
--{
l_new_req_qty2 := l_new_req_qty2 + l_update_rec.requested_qty2_tab(i);
WSH_DEBUG_SV.log(l_module_name,'Record Changed flag for the current record is', l_update_rec.record_changed_flag_tab(i));
i := l_update_rec.del_det_id_tab.NEXT(i);
IF NOT (l_update_rec.del_det_id_tab(i).EXISTS) THEN
--{
l_new_req_qty := 0; -- so that we can exit the loop.
WSH_DEBUG_SV.logmsg(l_module_name,'Before performing the update');
WSH_DEBUG_SV.log(l_module_name,'Delivery Detail Id is ', l_update_del_det_id);
IF l_update_del_det_id IS NOT NULL THEN
--{
IF l_debug_on THEN
WSH_DEBUG_SV.logmsg(l_module_name,'Calling program unit WSH_DELIVERY_DETAILS_PKG.LOCK_DETAIL_NO_COMPARE',WSH_DEBUG_SV.C_PROC_LEVEL);
p_delivery_detail_id => l_update_del_det_id);
update wsh_delivery_details
set requested_quantity = l_update_del_det_req_qty,
requested_quantity2 = nvl(l_update_del_det_req_qty2,requested_quantity2),
last_update_date = sysdate,
last_updated_by = fnd_global.user_id,
last_update_login = fnd_global.user_id
where delivery_detail_id = l_update_del_det_id;
WSH_DEBUG_SV.logmsg(l_module_name,'After the update');
l_update_del_det_id_tab(1) := l_update_del_det_id;
WSH_DEBUG_SV.log(l_module_name,'Calling DBI API.Detail Count-', l_update_del_det_id_tab.count);
WSH_INTEGRATION.DBI_Update_Detail_Log
(p_delivery_detail_id_tab => l_update_del_det_id_tab,
p_dml_type => 'UPDATE',
x_return_status => l_dbi_rs);
WSH_DEBUG_SV.log(l_module_name,'Need to recalculate weight and volume for del detail --- ',l_update_del_det_id);
p_detail_rows => l_update_del_det_id_tab,
p_override_flag => 'Y',
p_calc_wv_if_frozen => 'N',
x_return_status => l_return_status);
l_update_del_det_id := NULL;
l_update_rec.del_det_id_tab.delete;
l_update_rec.requested_qty_tab.delete;
l_update_rec.requested_qty2_tab.delete;
fetch l_rem_ret_qty_csr bulk collect into l_update_rec.del_det_id_tab,
l_update_rec.requested_qty_tab,
l_update_rec.requested_qty2_tab,
l_update_rec.record_changed_flag_tab;
WSH_DEBUG_SV.log(l_module_name,'Need to recalculate weight and volume for del detail --- ',l_update_del_det_id);
i := l_update_rec.del_det_id_tab.first;
WSH_DEBUG_SV.log(l_module_name,'Delivery Detail Id ('||i||')', l_update_rec.del_det_id_tab(i));
WSH_DEBUG_SV.log(l_module_name,'Delivery Detail Req Qty ('||i||')', l_update_rec.requested_qty_tab(i));
WSH_DEBUG_SV.log(l_module_name,'Delivery Detail Req Qty 2 ('||i||')', l_update_rec.requested_qty2_tab(i));
IF l_update_rec.requested_qty_tab(i) > abs(l_new_req_qty) THEN
--{
l_update_rec.requested_qty_tab(i) := l_update_rec.requested_qty_tab(i) + l_new_req_qty;
l_update_rec.record_changed_flag_tab(i) := 'Y';
l_update_rec.requested_qty2_tab(i) := nvl(l_update_rec.requested_qty2_tab(i),0) +
l_new_req_qty2;
IF (l_update_rec.requested_qty2_tab(i) < 0) THEN
--{
l_update_rec.requested_qty2_tab(i) := 0;
l_update_del_det_id := l_update_rec.del_det_id_tab(i);
l_update_del_det_req_qty := l_update_rec.requested_qty_tab(i);
l_update_del_det_req_qty2 := l_update_rec.requested_qty2_tab(i);
ELSE -- l_update_rec.requested_qty_tab(i) <= abs(l_new_req_qty)
--{
l_new_req_qty := l_new_req_qty + l_update_rec.requested_qty_tab(i);
l_update_rec.requested_qty_tab(i) := 0;
l_update_rec.record_changed_flag_tab(i) := 'Y';
IF (l_update_rec.requested_qty2_tab(i) IS NOT NULL) THEN
--{
l_new_req_qty2 := l_new_req_qty2 + l_update_rec.requested_qty2_tab(i);
l_update_rec.requested_qty2_tab(i) := 0;
i := l_update_rec.del_det_id_tab.NEXT(i);
IF ( l_update_rec.del_det_id_tab.COUNT > 0 ) THEN
--{
--
--
FORALL i IN l_update_rec.del_det_id_tab.FIRST..l_update_rec.del_det_id_tab.LAST
update wsh_delivery_details
set requested_quantity = l_update_rec.requested_qty_tab(i),
requested_quantity2 = l_update_rec.requested_qty2_tab(i),
last_update_date = sysdate,
last_updated_by = fnd_global.user_id,
last_update_login = fnd_global.user_id
where delivery_detail_id = l_update_rec.del_det_id_tab(i)
and nvl(l_update_rec.record_changed_flag_tab(i), 'N') = 'Y';
WSH_DEBUG_SV.logmsg(l_module_name,'After the bulk update');
WSH_DEBUG_SV.log(l_module_name,'Number of Records updated', SQL%ROWCOUNT);
WSH_DEBUG_SV.log(l_module_name,'Calling DBI API.Detail Count-', l_update_rec.del_det_id_tab.count);
WSH_INTEGRATION.DBI_Update_Detail_Log
(p_delivery_detail_id_tab => l_update_rec.del_det_id_tab,
p_dml_type => 'UPDATE',
x_return_status => l_dbi_rs);