The following lines contain the word 'select', 'insert', 'update' or 'delete':
g_old_resource_id NUMBER; -- variable containing old resource_id; populated in Pre_Update hook
PROCEDURE Insert_MTL_trans_lot_num(
p_resource_id NUMBER,
p_transaction_id NUMBER,
p_inventory_item_id NUMBER,
p_organization_id NUMBER
)
IS
CURSOR c_transaction_lot_number(
b_transaction_id NUMBER,
b_inventory_item_id NUMBER,
b_organization_id NUMBER
) IS
SELECT TRANSACTION_ID, LOT_NUMBER
FROM MTL_TRANSACTION_LOT_NUMBERS
WHERE TRANSACTION_ID = b_transaction_id
AND INVENTORY_ITEM_ID = b_inventory_item_id
AND ORGANIZATION_ID = b_organization_id;
, v_message => 'Entering Insert_MTL_trans_lot_num'
, v_level_id => JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_FULL);
, v_message => 'Insert_MTL_trans_lot_num could not find lot number transactions for transaction :' || p_transaction_id ||
' , ' || p_inventory_item_id || ' for resource id ' || p_resource_id
, v_level_id => JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_MEDIUM);
, v_message => 'Inserting ACC record :' || p_transaction_id || ' , ' || p_inventory_item_id ||
' for resource id ' || p_resource_id
, v_level_id => JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_FULL);
/*** Call common package to insert record into ACC table ***/
JTM_HOOK_UTIL_PKG.Insert_Acc
( p_publication_item_names => g_publication_item_name
,p_acc_table_name => g_acc_table_name
,p_resource_id => p_resource_id
,p_pk1_name => g_pk1_name
,p_pk1_num_value => r_transaction_lot_number.TRANSACTION_ID
,p_pk2_name => g_pk2_name
,p_pk2_char_value => r_transaction_lot_number.LOT_NUMBER
);
END Insert_MTL_trans_lot_num;
PROCEDURE Update_MTL_trans_lot_num(
p_resource_id NUMBER,
p_transaction_id NUMBER,
p_inventory_item_id NUMBER,
p_organization_id NUMBER
)
IS
CURSOR c_transaction_lot_number(
b_transaction_id NUMBER,
b_inventory_item_id NUMBER,
b_organization_id NUMBER
) IS
SELECT TRANSACTION_ID, LOT_NUMBER
FROM MTL_TRANSACTION_LOT_NUMBERS
WHERE TRANSACTION_ID = b_transaction_id
AND INVENTORY_ITEM_ID = b_inventory_item_id
AND ORGANIZATION_ID = b_organization_id;
, v_message => 'Entering Update_MTL_trans_lot_num'
, v_level_id => JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_FULL);
, v_message => 'Update_MTL_trans_lot_num could not find lot number transactions for transaction :' || p_transaction_id ||
' , ' || p_inventory_item_id || ' for resource id ' || p_resource_id
, v_level_id => JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_MEDIUM);
, v_message => 'Update ACC record :' || p_transaction_id || ' , ' || p_inventory_item_id ||
' for resource id ' || p_resource_id
, v_level_id => JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_FULL);
/*** Call common package to insert record into ACC table ***/
l_acc_id := JTM_HOOK_UTIL_PKG.Get_Acc_Id
( P_ACC_TABLE_NAME => g_acc_table_name
,p_pk1_name => g_pk1_name
,p_pk1_num_value => r_transaction_lot_number.TRANSACTION_ID
,p_pk2_name => g_pk2_name
,p_pk2_char_value => r_transaction_lot_number.LOT_NUMBER
,P_RESOURCE_ID => p_resource_id);
/*** Record is not yet in ACC tables. Insert has to be done ***/
JTM_HOOK_UTIL_PKG.Insert_Acc
( p_publication_item_names => g_publication_item_name
,p_acc_table_name => g_acc_table_name
,p_pk1_name => g_pk1_name
,p_pk1_num_value => r_transaction_lot_number.TRANSACTION_ID
,p_pk2_name => g_pk2_name
,p_pk2_char_value => r_transaction_lot_number.LOT_NUMBER
,p_resource_id => p_resource_id
);
/*** Record is already in ACC. Only an update is required for re-sending ***/
JTM_HOOK_UTIL_PKG.Update_Acc
( p_publication_item_names => g_publication_item_name
,p_acc_table_name => g_acc_table_name
,p_resource_id => p_resource_id
,p_access_id => l_acc_id
);
, v_message => 'Leaving Update_MTL_trans_lot_num'
, v_level_id => JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_FULL);
END Update_MTL_trans_lot_num;
PROCEDURE Delete_MTL_trans_lot_num(
p_resource_id NUMBER,
p_transaction_id NUMBER,
p_inventory_item_id NUMBER,
p_organization_id NUMBER
)
IS
CURSOR c_transaction_lot_number(
b_transaction_id NUMBER,
b_inventory_item_id NUMBER,
b_organization_id NUMBER
) IS
SELECT TRANSACTION_ID, LOT_NUMBER
FROM MTL_TRANSACTION_LOT_NUMBERS
WHERE TRANSACTION_ID = b_transaction_id
AND INVENTORY_ITEM_ID = b_inventory_item_id
AND ORGANIZATION_ID = b_organization_id;
, v_message => 'Entering Delete_MTL_trans_lot_num'
, v_level_id => JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_FULL);
, v_message => 'Delete_MTL_trans_lot_num could not find lot number transactions for transaction :' || p_transaction_id ||
' , ' || p_inventory_item_id || ' for resource id ' || p_resource_id
, v_level_id => JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_MEDIUM);
/*** Call common package to insert record into ACC table ***/
JTM_HOOK_UTIL_PKG.Delete_Acc
( p_publication_item_names => g_publication_item_name
,p_acc_table_name => g_acc_table_name
,p_resource_id => p_resource_id
,p_pk1_name => g_pk1_name
,p_pk1_num_value => r_transaction_lot_number.TRANSACTION_ID
,p_pk2_name => g_pk2_name
,p_pk2_char_value => r_transaction_lot_number.LOT_NUMBER
);
END Delete_MTL_trans_lot_num;
/*Delete all records for non-existing user ( e.g user was deleted )*/
PROCEDURE DELETE_ALL_ACC_RECORDS( p_resource_id IN NUMBER
, x_return_status OUT NOCOPY VARCHAR2 )
IS
BEGIN
/*** get debug level ***/
g_debug_level := JTM_HOOK_UTIL_PKG.Get_Debug_Level;
, 'Entering DELETE_ALL_ACC_RECORDS'
, JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_FULL
);
DELETE JTM_MTL_TRANS_LOT_NUM_ACC
WHERE RESOURCE_ID = p_resource_id;
, 'Leaving DELETE_ALL_ACC_RECORDS'
, JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_FULL
);
, v_message => 'Caught exception in DELETE_ALL_ACC_RECORDS hook:' || fnd_global.local_chr(10) || sqlerrm
, v_level_id => JTM_HOOK_UTIL_PKG.G_DEBUG_LEVEL_ERROR);
END DELETE_ALL_ACC_RECORDS;