PROMPT Identification of the problematic records :
PROMPT Run the following script :
PROMPT Script from BUG:4286036 - DATA FIX : RESOLVE ERROR OCCURRED WHILE RELIEVING RESERVATIONS IN MTI PROMPT Note:1471606.1 DRAFT NOTE: Please Don't Use Yet - Inventory Standard Datafix Instruction: PROMPT ... Fixing Stuck transaction with 'Error occurred while relieving reservations' due to incorrect or negative availability
PROMPT Create function CHECK_ONHAND
CREATE OR REPLACE FUNCTION CHECK_ONHAND( p_Inventory_item_id NUMBER , p_Organization_id NUMBER , p_revision VARCHAR2 , p_Subinventory_code VARCHAR2 , p_locator_id NUMBER ) RETURN NUMBER IS L_api_return_status VARCHAR2(1); l_qty_oh NUMBER; l_qty_res_oh NUMBER; l_qty_res NUMBER; l_qty_sug NUMBER; l_qty_att NUMBER; l_qty_atr NUMBER; l_msg_count NUMBER; l_msg_data VARCHAR2(1000); subinventory_code VARCHAR2(13); revision VARCHAR2(100); locator_id NUMBER; is_revision_control BOOLEAN:=true; QOH NUMBER; BEGIN inv_quantity_tree_grp.clear_quantity_cache; IF p_revision IS NULL THEN revision :=NULL; is_revision_control:=false; ELSE revision := p_revision; END IF; IF p_subinventory_code IS NULL THEN subinventory_code :=NULL; locator_id :=NULL; ELSE subinventory_code:=p_subinventory_code; locator_id :=p_locator_id; END IF; IF p_locator_id IS NULL THEN locator_id :=NULL; ELSE locator_id:=p_locator_id; END IF; apps.INV_Quantity_Tree_PUB.Query_Quantities ( p_api_version_number => 1.0 , p_init_msg_lst => apps.fnd_api.g_false , x_return_status => L_api_return_status , x_msg_count => l_msg_count , x_msg_data => l_msg_data , p_organization_id => p_organization_id , p_inventory_item_id => p_inventory_item_id , p_tree_mode => apps.INV_Quantity_Tree_PUB.g_transaction_mode , p_onhand_source => NULL , p_is_revision_control=> is_revision_control , p_is_lot_control => FALSE , p_is_serial_control => FALSE , p_revision => revision , p_lot_number => NULL , p_subinventory_code => subinventory_code , p_locator_id => locator_id , x_qoh => l_qty_oh , x_rqoh => l_qty_res_oh , x_qr => l_qty_res , x_qs => l_qty_sug , x_att => l_qty_att , x_atr => l_qty_atr ); IF L_api_return_status <> fnd_api.g_ret_sts_success THEN QOH :=0; ELSE QOH:=l_qty_oh; END IF; RETURN QOH; END; /
PROMPT Create function CHECK_AVAIL
CREATE OR REPLACE FUNCTION CHECK_AVAIL( p_Inventory_item_id NUMBER , p_Organization_id NUMBER , p_revision VARCHAR2 , p_Subinventory_code VARCHAR2 , p_locator_id NUMBER ) RETURN NUMBER IS L_api_return_status VARCHAR2(1); l_qty_oh NUMBER; l_qty_res_oh NUMBER; l_qty_res NUMBER; l_qty_sug NUMBER; l_qty_att NUMBER; l_qty_atr NUMBER; l_msg_count NUMBER; l_msg_data VARCHAR2(1000); subinventory_code VARCHAR2(13); revision VARCHAR2(100); locator_id NUMBER; is_revision_control BOOLEAN:=true; QATT NUMBER; BEGIN inv_quantity_tree_grp.clear_quantity_cache; IF p_revision IS NULL THEN revision :=NULL; is_revision_control:=false; ELSE revision := p_revision; END IF; IF p_subinventory_code IS NULL THEN subinventory_code :=NULL; locator_id :=NULL; ELSE subinventory_code:=p_subinventory_code; locator_id :=p_locator_id; END IF; IF p_locator_id IS NULL THEN locator_id :=NULL; ELSE locator_id:=p_locator_id; END IF; apps.INV_Quantity_Tree_PUB.Query_Quantities ( p_api_version_number => 1.0 , p_init_msg_lst => apps.fnd_api.g_false , x_return_status => L_api_return_status , x_msg_count => l_msg_count , x_msg_data => l_msg_data , p_organization_id => p_organization_id , p_inventory_item_id => p_inventory_item_id , p_tree_mode => apps.INV_Quantity_Tree_PUB.g_transaction_mode , p_onhand_source => NULL , p_is_revision_control=> is_revision_control , p_is_lot_control => FALSE , p_is_serial_control => FALSE , p_revision => revision , p_lot_number => NULL , p_subinventory_code => subinventory_code , p_locator_id => locator_id , x_qoh => l_qty_oh , x_rqoh => l_qty_res_oh , x_qr => l_qty_res , x_qs => l_qty_sug , x_att => l_qty_att , x_atr => l_qty_atr ); IF L_api_return_status <> fnd_api.g_ret_sts_success THEN QATT :=0; ELSE QATT:=l_qty_att; END IF; RETURN QATT; END; /
PROMPT Review Data
SELECT org, item, rev, sub, lot, onhand, qty_avail, trx_quantity FROM (SELECT mti.organization_id org, mti.inventory_item_id item, mti.revision rev, mti.subinventory_code sub, mtli.lot_number lot, CHECK_ONHAND_LOT(mti.inventory_item_id, mti.organization_id,mti.revision, mti.subinventory_code,mti.locator_id,mtli.lot_number) onhand, CHECK_AVAIL_LOT(mti.inventory_item_id, mti.organization_id,mti.revision, mti.subinventory_code,mti.locator_id,mtli.lot_number) qty_avail, mtli.transaction_quantity trx_quantity FROM mtl_transactions_interface mti, mtl_transaction_lots_interface mtli WHERE mti.organization_id = &org_id GROUP BY mti.inventory_item_id, mti.organization_id, mti.revision, mti.subinventory_code, mti.locator_id, mtli.lot_number, mtli.transaction_quantity ORDER BY mti.inventory_item_id ) WHERE qty_avail < 0 ;
PROMPT For Lot lot control, use the following too.
PROMPT Create function: CHECK_ONHAND_LOT
CREATE OR REPLACE FUNCTION CHECK_ONHAND_LOT( p_Inventory_item_id NUMBER , p_Organization_id NUMBER , p_revision VARCHAR2 , p_Subinventory_code VARCHAR2 , p_locator_id NUMBER , p_lot_number VARCHAR2 ) RETURN NUMBER IS L_api_return_status VARCHAR2(1); l_qty_oh NUMBER; l_qty_res_oh NUMBER; l_qty_res NUMBER; l_qty_sug NUMBER; l_qty_att NUMBER; l_qty_atr NUMBER; l_msg_count NUMBER; l_msg_data VARCHAR2(1000); subinventory_code VARCHAR2(13); revision VARCHAR2(100); locator_id NUMBER; is_revision_control BOOLEAN:=true; QOH NUMBER; BEGIN inv_quantity_tree_grp.clear_quantity_cache; IF p_revision IS NULL THEN revision :=NULL; is_revision_control:=false; ELSE revision := p_revision; END IF; IF p_subinventory_code IS NULL THEN subinventory_code :=NULL; locator_id :=NULL; ELSE subinventory_code:=p_subinventory_code; locator_id :=p_locator_id; END IF; IF p_locator_id IS NULL THEN locator_id :=NULL; ELSE locator_id:=p_locator_id; END IF; dbms_output.put_line('Transaction Mode'); apps.INV_Quantity_Tree_PUB.Query_Quantities ( p_api_version_number => 1.0 , p_init_msg_lst => apps.fnd_api.g_false , x_return_status => L_api_return_status , x_msg_count => l_msg_count , x_msg_data => l_msg_data , p_organization_id => p_organization_id , p_inventory_item_id => p_inventory_item_id , p_tree_mode => apps.INV_Quantity_Tree_PUB.g_transaction_mode , p_onhand_source => NULL , p_is_revision_control=> is_revision_control , p_is_lot_control => TRUE , p_is_serial_control => FALSE , p_revision => revision , p_lot_number => p_lot_number , p_subinventory_code => subinventory_code , p_locator_id => locator_id , x_qoh => l_qty_oh , x_rqoh => l_qty_res_oh , x_qr => l_qty_res , x_qs => l_qty_sug , x_att => l_qty_att , x_atr => l_qty_atr ); IF L_api_return_status <> fnd_api.g_ret_sts_success THEN QOH :=0; ELSE QOH:=l_qty_oh; END IF; RETURN QOH; END; /
PROMPT Create function: CHECK_AVAIL_LOT
CREATE OR REPLACE FUNCTION CHECK_AVAIL_LOT( p_Inventory_item_id NUMBER , p_Organization_id NUMBER , p_revision VARCHAR2 , p_Subinventory_code VARCHAR2 , p_locator_id NUMBER , p_lot_number VARCHAR2 ) RETURN NUMBER IS L_api_return_status VARCHAR2(1); l_qty_oh NUMBER; l_qty_res_oh NUMBER; l_qty_res NUMBER; l_qty_sug NUMBER; l_qty_att NUMBER; l_qty_atr NUMBER; l_msg_count NUMBER; l_msg_data VARCHAR2(1000); subinventory_code VARCHAR2(13); revision VARCHAR2(100); locator_id NUMBER; is_revision_control BOOLEAN:=true; QATT NUMBER; BEGIN inv_quantity_tree_grp.clear_quantity_cache; IF p_revision IS NULL THEN revision :=NULL; is_revision_control:=false; ELSE revision := p_revision; END IF; IF p_subinventory_code IS NULL THEN subinventory_code :=NULL; locator_id :=NULL; ELSE subinventory_code:=p_subinventory_code; locator_id :=p_locator_id; END IF; IF p_locator_id IS NULL THEN locator_id :=NULL; ELSE locator_id:=p_locator_id; END IF; apps.INV_Quantity_Tree_PUB.Query_Quantities ( p_api_version_number => 1.0 , p_init_msg_lst => apps.fnd_api.g_false , x_return_status => L_api_return_status , x_msg_count => l_msg_count , x_msg_data => l_msg_data , p_organization_id => p_organization_id , p_inventory_item_id => p_inventory_item_id , p_tree_mode => apps.INV_Quantity_Tree_PUB.g_transaction_mode , p_onhand_source => NULL , p_is_revision_control=> is_revision_control , p_is_lot_control => TRUE , p_is_serial_control => FALSE , p_revision => revision , p_lot_number => p_lot_number , p_subinventory_code => subinventory_code , p_locator_id => locator_id , x_qoh => l_qty_oh , x_rqoh => l_qty_res_oh , x_qr => l_qty_res , x_qs => l_qty_sug , x_att => l_qty_att , x_atr => l_qty_atr ); IF L_api_return_status <> fnd_api.g_ret_sts_success THEN QATT :=0; ELSE QATT:=l_qty_att; END IF; RETURN QATT; END; /
PROMPT Check results
SELECT org, item_id, item_code, rev, sub, lot, onhand, qty_avail, trx_quantity FROM (SELECT mti.organization_id org, mti.inventory_item_id item_id, msi.segment1 item_code, mti.revision rev, mti.subinventory_code sub, mtli.lot_number lot, CHECK_ONHAND_LOT(mti.inventory_item_id, mti.organization_id,mti.revision, mti.subinventory_code,mti.locator_id,mtli.lot_number) onhand, CHECK_AVAIL_LOT(mti.inventory_item_id, mti.organization_id,mti.revision, mti.subinventory_code,mti.locator_id,mtli.lot_number) qty_avail, mtli.transaction_quantity trx_quantity FROM mtl_transactions_interface mti, mtl_transaction_lots_interface mtli , mtl_system_items msi WHERE mti.organization_id = &org_id AND msi.inventory_item_id=mti.inventory_item_id AND msi.organization_id =mti.organization_id GROUP BY mti.inventory_item_id, msi.segment1, mti.organization_id, mti.revision, mti.subinventory_code, mti.locator_id, mtli.lot_number, mtli.transaction_quantity ORDER BY mti.inventory_item_id ) WHERE qty_avail < 0 ;
LTE - eRan13.1 - LTE Only Suggest to Use NIC - LTE - eRan13.1 - LTE Only Suggest to Use NIC - 01.【GUL Data Collection Assistant】【Throughput】KPI DL Scanario