Hello,
We are discontinuing a part and replacing it with another. The part is used in multiple BOMs. We’ve a number of production orders in Created status that need to be changed.
Let us say the old part number is Item1 and the new part number is Item2.
First Approach:
I tried updating the part number using X++ and got the error “Item identification cannot be changed when inventory transactions have been generated.” The production order is in Created status. So, there shouldn’t be any inventory transactions, right?
while select prodBom
where prodBom.ItemId == itemIdOld
&& prodBom.ProdId == “PROD1234”
{
prodBom.ItemId = itemIdNew;
prodBom.UnitId = unitIdNew;
prodBom.update();
}
Second approach:
I retrieved the old part number, copied the buffer to a new buffer, zeroed out the RecId, and tried to insert the new buffer. I got this error
“Cannot create a record in Production BOM (ProdBOM). Production: PROD1234, Item2. The record already exists.”
while select prodBom
where prodBom.ItemId == itemIdOld
&& prodBom.ProdId == “PROD01234”
{
prodBomNew.clear();
prodBomNew.data(prodBom);
prodBomNew.RecId = 0;
prodBomNew.ItemId = itemIdNew;
prodBomNew.UnitId = unitIdNew;
prodBomNew.insert();
}
Is there a way to mass change all the ProdBom records?
Thanks.