DECLARE
l_item_tbl_typ ego_item_pub.item_tbl_type;
x_item_tbl_typ ego_item_pub.item_tbl_type;
x_return_status VARCHAR2(100);
x_msg_count NUMBER;
x_message_list error_handler.error_tbl_type;
-- User Variables: Update for your environment ~~!
l_resp_appl_id NUMBER := 401; --FND_PROFILE.VALUE ('RESP_APPL_ID');
l_resp_id NUMBER := 20634; --FND_PROFILE.VALUE ('RESP_ID');
l_user_id NUMBER := -1; --26406 --FND_PROFILE.VALUE ('USER_ID');
BEGIN
fnd_global.apps_initialize(user_id => l_user_id, resp_id => l_resp_id, resp_appl_id => l_resp_appl_id);
--Calling Enable Item as Lot Control procedure--
FOR i IN (
SELECT
msib.inventory_item_id,
msib.organization_id,
msib.segment1,
msib.lot_control_code,
msib.lot_split_enabled,
msib.lot_merge_enabled,
msib.lot_divisible_flag
FROM
mtl_system_items_b msib
WHERE
msib.organization_id = 85
AND msib.segment1 = '320672'
AND msib.last_update_date >= sysdate - 10
ORDER BY
msib.last_update_date DESC
) LOOP
BEGIN
l_item_tbl_typ(1).transaction_type := ego_item_pub.g_ttype_update;
l_item_tbl_typ(1).inventory_item_id := i.inventory_item_id;
l_item_tbl_typ(1).organization_id := i.organization_id;
l_item_tbl_typ(1).lot_control_code := 2;
l_item_tbl_typ(1).lot_split_enabled := 'Y';
l_item_tbl_typ(1).lot_merge_enabled := 'Y';
-- l_item_tbl_typ(1).auto_lot_alpha_prefix := 'L';
-- l_item_tbl_typ(1).start_auto_lot_number := 1;
ego_item_pub.process_items(p_api_version => 1.0, p_init_msg_list => fnd_api.g_false,
p_commit => fnd_api.g_true,
p_item_tbl => l_item_tbl_typ,
x_item_tbl => x_item_tbl_typ,
p_role_grant_tbl => ego_item_pub.g_miss_role_grant_tbl,
x_return_status => x_return_status,
x_msg_count => x_msg_count);
dbms_output.put_line('x_return_status : ' || x_return_status);
error_handler.get_message_list(x_message_list);
FOR i IN 1..x_message_list.count LOOP
dbms_output.put_line(x_message_list(i).message_text);
END LOOP;
COMMIT;
END xxtlm_enable_item_lot;
END LOOP;
END;