Hi Leandro,
I don't think you can remove warehouses from items with the DTW. Locking unused warehouses will not actually remove the records from the OITW table.
Nowadays the Remote Support Platform has a task that will remove unused warehouses for you. I recommend that you use this task.
I made the same mistake in the beginning with the "auto add all warehouses" setting, and ended up writing a very simple windows application using the DI API to actually remove all unused warehouses from all of our items. So that is an alternative.
In pseudo code:
- Run a query to find all Items with unused warehouses (consider document rows if necessary).
- Loop through the items in this query
- Initiate an Item object
- sub loop through the unused warehouses for this item
- remove warehouse from item
- update item
Regards,
Johan