The following lines contain the word 'select', 'insert', 'update' or 'delete':
l_updated_quantity NUMBER;
l_updated_quantity2 NUMBER; -- 04/20/2001 OPM
oe_debug_pub.add( 'Planning to update shipped qty with secondary qty with qty: '||l_quantity ) ;
l_updated_quantity := l_quantity;
l_updated_quantity2 := l_quantity2; -- 04/20/2001 OPM
l_updated_quantity := l_line_tbl(1).shipped_quantity + l_quantity;
l_updated_quantity2 := l_line_tbl(1).shipped_quantity2 + l_quantity2; -- 04/20/2001 OPM
IF (l_updated_quantity >
l_line_tbl(1).ordered_quantity + l_tolerance_above) THEN
FND_MESSAGE.Set_Name('ONT', 'OE_RETURN_INVALID_RCVD_QTY');
IF (l_updated_quantity <
l_line_tbl(1).ordered_quantity - l_tolerance_below) then
IF l_debug_level > 0 THEN
oe_debug_pub.add( 'UNDER RETURN:'||TO_CHAR ( l_quantity ) ||'<'||TO_CHAR ( L_LINE_TBL ( 1 ) .ORDERED_QUANTITY+L_TOLERANCE_BELOW ) , 1 ) ;
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
SELECT MAX(transaction_date)
INTO l_line_tbl(1).actual_shipment_date
FROM rcv_transactions
WHERE transaction_type = 'RECEIVE'
AND oe_order_line_id = l_line_tbl(1).line_id;
l_updated_quantity := l_quantity;
l_updated_quantity2 := l_quantity2; -- 04/20/2001 OPM
l_updated_quantity := l_line_tbl(1).fulfilled_quantity + l_quantity;
l_updated_quantity2 := l_line_tbl(1).fulfilled_quantity2 + l_quantity2; -- 04/20/2001 OPM
IF (l_line_tbl(1).shipped_quantity < l_updated_quantity ) THEN
FND_MESSAGE.Set_Name('ONT', 'OE_RETURN_INVALID_DLVR_QTY');
l_line_tbl(1).fulfilled_quantity := l_updated_quantity;
l_line_tbl(1).fulfilled_quantity2 := l_updated_quantity2; -- 04/20/2001 OPM
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
IF (l_line_tbl(1).shipped_quantity = l_updated_quantity) THEN
b_complete_inspection := TRUE;
l_updated_quantity := l_line_tbl(1).shipped_quantity - l_quantity;
l_updated_quantity2 := l_line_tbl(1).shipped_quantity2 - l_quantity2; -- 04/20/2001 OPM
l_line_tbl(1).shipped_quantity2 := l_updated_quantity2;
l_line_tbl(1).shipped_quantity := l_updated_quantity;
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
l_updated_quantity := l_line_tbl(1).shipped_quantity + l_quantity;
l_updated_quantity2 := l_line_tbl(1).shipped_quantity2 +
l_quantity2; -- 04/20/2001 OPM
IF l_updated_quantity <=
(l_line_tbl(1).ordered_quantity + l_tolerance_above) THEN
IF l_debug_level > 0 THEN
oe_debug_pub.add('Change is within tolerance' ) ;
l_line_tbl(1).shipped_quantity := l_updated_quantity;
l_line_tbl(1).shipped_quantity2 := l_updated_quantity2; -- 04/20/2001 OPM
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
l_updated_quantity := l_line_tbl(1).shipped_quantity + l_quantity;
l_line_tbl(1).shipped_quantity := l_updated_quantity;
l_updated_quantity2 := l_line_tbl(1).shipped_quantity2 + l_quantity2; -- 04/20/2001 OPM
l_line_tbl(1).shipped_quantity := l_updated_quantity;
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
oe_debug_pub.add('No Open Line: l_updated QTY is '
||l_updated_quantity);
IF ( l_updated_quantity not between
(l_line_tbl(1).ordered_quantity - l_tolerance_below) and
(l_line_tbl(1).ordered_quantity + l_tolerance_above)) OR
( l_updated_quantity = 0 ) THEN
-- split line if the l_updated_quantity is > 0.
IF l_updated_quantity > 0 THEN
l_open_line_rec.db_flag := FND_API.G_FALSE;
l_line_tbl(1).ordered_quantity := l_updated_quantity;
l_line_tbl(1).ordered_quantity2 := l_updated_quantity2;
ELSIF l_updated_quantity = 0 THEN
-- Take the received line back to AWAITING_RETURN
IF l_debug_level > 0 THEN
oe_debug_pub.add('Take the line back to AWAITING_RETURN' );
END IF; -- IF l_updated_quantity not between
IF l_updated_quantity > 0 THEN
-- Correct the quantity on original line
l_line_tbl(1).ordered_quantity := l_updated_quantity;
l_line_tbl(1).ordered_quantity2 := l_updated_quantity2;
l_updated_quantity := l_open_line_rec.ordered_quantity -
l_quantity;
l_open_line_rec.ordered_quantity := l_updated_quantity;
l_updated_quantity2 := l_open_line_rec.ordered_quantity2 -
l_quantity2; -- 04/20/2001 OPM
l_open_line_rec.ordered_quantity2 := l_updated_quantity2;
l_open_line_rec.operation := OE_GLOBALS.G_OPR_UPDATE;
ELSIF l_updated_quantity = 0 THEN
-- Take the received line back to AWAITING_RETURN
IF l_debug_level > 0 THEN
oe_debug_pub.add('Taking the line back to AWAITING_RETURN');
l_updated_quantity := l_quantity;
l_updated_quantity2 := l_quantity2; -- 04/20/2001 OPM
l_updated_quantity := l_line_tbl(1).fulfilled_quantity + l_quantity;
l_updated_quantity2 := l_line_tbl(1).fulfilled_quantity2 + l_quantity2; -- 04/20/2001 OPM
IF (l_line_tbl(1).shipped_quantity < l_updated_quantity ) THEN
FND_MESSAGE.Set_Name('ONT', 'OE_RETURN_INVALID_DLVR_QTY');
l_line_tbl(1).fulfilled_quantity := l_updated_quantity;
l_line_tbl(1).fulfilled_quantity2 := l_updated_quantity2; -- 04/20/2001 OPM
l_line_tbl(1).fulfilled_quantity := l_updated_quantity;
l_line_tbl(1).fulfilled_quantity2 := l_updated_quantity2;
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
l_updated_quantity := l_line_tbl(1).shipped_quantity - l_quantity;
l_updated_quantity2 := l_line_tbl(1).shipped_quantity2 - l_quantity2; -- 04/20/2001 OPM
l_line_tbl(1).shipped_quantity2 := l_updated_quantity2;
l_line_tbl(1).shipped_quantity := l_updated_quantity;
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
l_updated_quantity := l_line_tbl(1).fulfilled_quantity - l_quantity;
l_line_tbl(1).fulfilled_quantity := l_updated_quantity;
l_updated_quantity2 := l_line_tbl(1).fulfilled_quantity2 - l_quantity2; -- 04/20/2001 OPM
l_line_tbl(1).fulfilled_quantity2 := l_updated_quantity2;
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
l_updated_quantity := l_line_tbl(1).fulfilled_quantity + l_quantity;
l_line_tbl(1).fulfilled_quantity := l_updated_quantity;
l_updated_quantity2 := l_line_tbl(1).fulfilled_quantity2 + l_quantity2; -- 04/20/2001 OPM
l_line_tbl(1).fulfilled_quantity2 := l_updated_quantity2;
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
l_updated_quantity := l_quantity;
l_updated_quantity2 := l_quantity2; -- 04/20/2001 OPM
l_updated_quantity := l_line_tbl(1).shipped_quantity + l_quantity;
l_updated_quantity2 := l_line_tbl(1).shipped_quantity2 + l_quantity2; -- 04/20/2001 OPM
IF (l_updated_quantity >
l_line_tbl(1).ordered_quantity + l_tolerance_above) THEN
FND_MESSAGE.Set_Name('ONT', 'OE_RETURN_INVALID_RCVD_QTY');
IF (l_updated_quantity <
l_line_tbl(1).ordered_quantity - l_tolerance_below) then
IF l_debug_level > 0 THEN
oe_debug_pub.add( 'UNDER RETURN:'||TO_CHAR ( l_quantity ) ||'<'||TO_CHAR ( L_LINE_TBL ( 1 ) .ORDERED_QUANTITY+L_TOLERANCE_BELOW ) , 1 ) ;
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
l_line_tbl(1).operation := OE_GLOBALS.G_OPR_UPDATE;
SELECT MAX(transaction_date)
INTO l_line_tbl(1).actual_shipment_date
FROM rcv_transactions
WHERE transaction_type = 'UNORDERED'
AND oe_order_line_id = l_line_tbl(1).line_id;
OE_Order_WF_Util.Update_Flow_Status_Code
(p_line_id => to_number(l_item_key),
p_flow_status_code => 'AWAITING_RETURN_DISPOSITION',
x_return_status => l_return_status
);
OE_Order_WF_Util.Update_Flow_Status_Code
(p_line_id => to_number(l_item_key),
p_flow_status_code => 'RETURNED',
x_return_status => l_return_status
);
OE_Order_WF_Util.Update_Flow_Status_Code
(p_line_id => to_number(l_item_key),
p_flow_status_code => 'AWAITING_RETURN',
x_return_status => l_return_status
);
SELECT l.line_id
INTO l_open_line_id
FROM oe_order_lines l,
wf_item_activity_statuses wf,
wf_process_activities wpa
WHERE l.open_flag = 'Y'
and wpa.activity_item_type='OEOL'
and wpa.activity_name='RMA_WAIT_FOR_RECEIVING'
and wf.item_type='OEOL'
and wf.process_activity=wpa.instance_id
and wf.activity_status='NOTIFIED'
-- and l.line_id=to_number(wf.item_key)
and to_char(l.line_id) = wf.item_key --FP bug#5758850
and l.line_set_id = p_line_rec.line_set_id
and l.shipped_quantity is null
and l.line_id<>p_line_rec.line_id
and rownum = 1;
SELECT open_flag,
invoice_interface_status_code,
ordered_quantity,
shipped_quantity,
line_set_id
INTO l_open_flag,
l_inv_interface_status_code,
l_ordered_quantity,
l_shipped_quantity,
l_line_set_id
FROM OE_ORDER_LINES_ALL
WHERE line_id = p_rma_line_id;
select l.ordered_quantity
into x_quantity
from oe_order_lines_all l,
wf_item_activity_statuses wf,
wf_process_activities wpa
where l.open_flag = 'Y'
and wpa.activity_item_type='OEOL'
and wpa.activity_name='RMA_WAIT_FOR_RECEIVING'
and wf.item_type='OEOL'
and wf.process_activity=wpa.instance_id
and wf.activity_status='NOTIFIED'
-- and l.line_id=to_number(wf.item_key)
and to_char(l.line_id) = wf.item_key -- FP bug#5758850
and l.line_set_id = l_line_set_id
and l.shipped_quantity is null and l.line_id<>p_RMA_line_id;
Select SHIP_TOLERANCE_BELOW, SHIP_TOLERANCE_ABOVE
into x_Under_Return_Tolerance,x_Over_Return_Tolerance
from oe_order_lines_all
Where line_id = p_RMA_Line_ID;