Since the release of BC23 SaaS, there's an issue with the OnValidate() of the Expiration Date field in the Warehouse Journal Line.
We have some custom code to fill in the Warehouse Journal at a certain moment of time (with scanner functionality), and we use a Validate() of the Expiration Date.
In BC22, there was no issue when using a 0D as Expiration Date to do this. However, in BC23, an error occurs when doing this:
/Expiration Date must not change for an item tracked by lot number./
In BC22, there was no code in the OnValidate() trigger of the /Expiration Date/ field on the Warehouse Journal Line. Now, in BC23, there is 1 line of code:
CheckLotNoTrackedExpirationDate();
Besides the fact that it's not initializing /Item Tracking Setup/ anywhere but using it, there's an other issue:
In some point of time, when you dig deeper into the next functions that are called, the following function is called:
ItemTrackingManagement.GetWhseExpirationDate(...)
This function is NOT doing/checking correct on Expiration Date. It only checks if there's an Item Ledger Entry which is Positive, and then returns TRUE, which results eventually in the error /Expiration Date must not change for an item tracked by lot number./. Since the expiration date is filled with 0D, the error should not occur (because there were NO entries with an Expiration Date, and the journal line also will have no Expiration Date).
To fix this, the code in Item Tracking Management, and also the functions ExistingExpirationDate() and WhseExistingExpirationDate() should be reviewed.
Both functions just check if there are entries (Item Ledger Entries for the first one, Warehouse Entries for the second one). For both functions, IF there are Item Ledger Entries / Warehouse Entries for the item, the /EntriesExist/ will be TRUE.
So the result will be that it exits with the first function already, and with an ExpiryDate = 0D. This will result in an error in CheckLotNoTrackedExpirationDate() in the Warehouse Journal Line:
In my opinion, there should be a little code change in GetWhseExpirationDate(), namely:
change:
if EntriesExist then
exit(true);
into:
if EntriesExist and (ExpiryDate <> 0D) then
exit(true);
In that case, there will be no exit(true), but just continuing and getting to the next code: