PROCEDURE get_att(p_sub_inv IN VARCHAR2,p_locator_id IN NUMBER,p_lot IN VARCHAR2,x_avi_qty OUT NUMBER,x_avi_qty2 OUT NUMBER)
IS
l_available_quantity NUMBER := NULL;
l_onhand_quantity NUMBER := NULL;
l_available_onhand NUMBER := NULL;
l_available_quantity2 NUMBER := NULL;
l_onhand_quantity2 NUMBER := NULL;
l_available_onhand2 NUMBER := NULL;
l_return_status VARCHAR2(1) := NULL;
l_message_data VARCHAR2(2000) := NULL;
l_message_count NUMBER := NULL;
l_ret NUMBER := NULL;
l_rev_ctl NUMBER;
l_lot_ctl NUMBER;
l_ser_ctl NUMBER;
BEGIN
SELECT msb.revision_qty_control_code,
msb.lot_control_code,
msb.serial_number_control_code
INTO l_rev_ctl,
l_lot_ctl,
l_ser_ctl
FROM mtl_system_items_b msb
WHERE msb.inventory_item_id = :gme_batch.inventory_item_id
AND msb.organization_id = :parameter.org_id;
l_ret := inv_quantity_tree_ue.create_tree( p_organization_id => :parameter.org_id
, p_inventory_item_id => :gme_batch.inventory_item_id
, p_revision_control => l_rev_ctl
, p_lot_control => l_lot_ctl
, p_serial_control => l_ser_ctl
, p_grade_code => NULL
, p_lot_active => 2
, p_demand_header_id => :gme_batch.batch_id
, p_demand_header_type => 5
, p_tree_mode => 2
, p_negative_inv_allowed => :parameter.neg_inv_rec_code
, p_demand_source_name => null
, p_demand_source_line_id => :gme_batch.material_detail_id
, x_available_quantity => l_available_quantity
, x_onhand_quantity => l_onhand_quantity
, x_available_quantity2 => l_available_quantity2
, x_onhand_quantity2 => l_onhand_quantity2
, x_return_status => l_return_status
, x_message_count => l_message_count
, x_message_data => l_message_data);
IF l_ret = 0 or l_return_status <> 'S' then
fnd_message.set_name('INV', 'INV_USER_EXIT_ERROR2');
fnd_message.show;
RAISE form_trigger_failure;
ELSE
/*
copy(l_available_quantity,'MTL_TRX_LINE.att');
copy(l_onhand_quantity,'MTL_TRX_LINE.qoh');
copy(l_available_quantity2,'MTL_TRX_LINE.satt'); -- invConv change
copy(l_onhand_quantity2,'MTL_TRX_LINE.sqoh'); -- invConv change
*/
null;
END IF;
l_ret := INV_QUANTITY_TREE_UE.query_tree( p_organization_id => :parameter.org_id
, p_inventory_item_id => :gme_batch.inventory_item_id
, p_revision_control => l_rev_ctl
, p_lot_control => l_lot_ctl
, p_serial_control => l_ser_ctl -- invConv change
, P_demand_header_id => :gme_batch.batch_id
, P_demand_header_type => 5
, P_revision => null
, P_subinventory => p_sub_inv
, P_locator => p_locator_id
, p_transfer_subinventory => null
, p_uom_code => name_in('gme_batch.PRIMARY_UOM_CODE')
, p_lot_active => 2
, p_lot => p_lot
, P_demand_source_name => null
, P_demand_source_line_id => :gme_batch.material_detail_id
, X_available_onhand => l_available_onhand
, X_available_quantity => l_available_quantity
, X_onhand_quantity => l_onhand_quantity
, X_available_onhand2 => l_available_onhand2
, X_available_quantity2 => l_available_quantity2
, X_onhand_quantity2 => l_onhand_quantity2
, X_return_status => l_return_status
, X_message_count => l_message_count
, X_message_data => l_message_data);
IF l_ret = 0 or l_return_status <> 'S' then
fnd_message.set_name('INV', 'INV_USER_EXIT_ERROR4');
fnd_message.show;
RAISE form_trigger_failure;
END IF;
--RETURN l_available_quantity;
x_avi_qty := l_available_quantity;
x_avi_qty2 := l_available_quantity2;
EXCEPTION
WHEN OTHERS THEN
--RETURN 0;
x_avi_qty := 0;
x_avi_qty2 := 0;
END;