*This post is locked for comments
*This post is locked for comments
Mariano makes a good point, as does Dan and some others. I think you first need to figure out how the machine can determine which item/sites need to be deleted. Once you have that list, you can use it as a source for a mail-merge macro that can run against the selected company. You can use a combination of the Remove Transaction History utility for the target item/site and SQL for the Purchase Receipts and price change history that needs to be deleted. If you can run a year-end close on inventory, you can remove Discontinued items that have no current quantities. You said these items weren't discontinued, so nix that. You could use a macro to run through and discontinue them and then run the Year End close and delete them. I think this also will delete the item transaction history. I think you can 'automate' this, but I think you'll need several macros you could string together to accomplish it. POs can be moved to history and then the history can be deleted with IV Utilities. It's best to do all you can through the user interface. Inventory has a lot of strings tied to it, as you are discovering. I think that doing anything to nearly 400,000 records requires a lot of careful planning.
Kind regards,
Leslie
Your script assume no quantities on hand or recent activity for the item. However, that's not the problem. What do you do with item/site combinations with historical records? You can't just delete these records as you would create orphan records.
What do you call an "old site" or in other words, what constitutes a deletable item/site combination, also since the items are not discontinued, what are you planning to do with the history associated to the item/site combination.
Hi,
The same issue came up me me when I tried the same script. I saw it was because of purchase orders and receipts that were still on the system.
The historical transactions to the previous financial year could not be removed as yet.
Regards
Rosemary
We attempted this process and successfully deleted the site. However a reconcile brought back the deleted site along with all of the site-item assignments for that site. There are a number of references to this SQL process that is also outlined in "Confessions of a Dynamics GP Consultant", however there is no reference to cleaning up the IV10201 table, which is the detail table for IV10200.
Is there any reason one would not purge the IV10201 table as well? (ie: Delete from IV10201 where TRXLOCTN='site id')
This might be useful. Make sure to post all transactions and batches involving inventory before running below script. Any comments is very much welcome.
DELETE FROM IV00102 WHERE
LOCNCODE = 'site id' AND
(QTYONHND <> 0 OR
QTYONORD <> 0 OR
QTYINUSE <> 0 OR
ATYALLOC <> 0 OR
QTYBKORD <>0 OR
QTYRTRND <> 0 OR
QTYINSVC <> 0 OR
QTYDMGED <> 0 )
DELETE FROM IV10200 WHERE TRXLOCTN='site id'
UPDATE IV40700 SET
PORECEIPTBIN='',
PORETRNBIN='',
SOFULFILLMENTBIN='',
SORETURNBIN='',
BOMRCPTBIN='',
MATERIALISSUEBIN='',
MORECEIPTBIN='',
REPAIRISSUESBIN=''
WHERE LOCNCODE='site id'
Assuming no ISV's, you could run a script in SQL. I would do a backup and also test prior to doing in a live environment. It would be removing records from the IV00102 or the Quantity Master. And as Max suggested, I would make sure no qty's exist at any item/site combo.
Dan Liebl, CMA CPIM | Senior Consultant | OTT,Inc | DLiebl@OTT-inc.com
I think you can try to use GP's macro function to delete the Item/Site records. Since this involves relatively simple steps, you should be able to record a macro and then create a long macro by repeated copy and paste in the notepad. Before running the macro, You will still need to make sure there are no Quantities for the Item/Site combination. This method will be safer than using SQL Script, since there is less risk of damaging referential integrity of the data.
André Arnaud de Cal...
292,516
Super User 2025 Season 1
Martin Dráb
231,387
Most Valuable Professional
nmaenpaa
101,156