Duplicate Lot Numbers where F4102.SRCE (Lot Process Type) Values 1 and 2 - Case Study
Goal
What will be the possible cause of duplicate lot number for two different items where F4102.SRCE (Lot Process Type) is 1 (Lots Assigned Using Date) which sets the lot number YYYYMMDD9999?
Solution
There is no way to stop system from assigning same lot number because of the latency between the next numbering and update of lot master for Lot Process Type 1 or 2. This is due to the fact that there can be latency issue between these activities.
Possible way to reproduce this type of issue can be,
(Optional) Create two items
Set the next number for two different dates (supposing that today's date is Sept-25-2018) current next number NN (40|8) 9240002 (so in adding a lot for today's date which will be 20180940002, and there is no transaction for Sept-24-2018 for instance.) Note that F0002 can hold a single value regardless the transaction date used
Perform Inventory Adjustment or PO receipt with the transaction date (or receipt date) with Sept-25-2018 for the item-A. which assigns lot number like 201809250002. Exit the grid but do not click OK button and make it sure NN (40|8) got updated with 9240003
Open another session and enter transaction with the transaction date Sept-24-2018. In exiting the grid with item-B which assigns lot number like 201809240001 and update NN with 9240002
Open the 3rd session, and specify the transaction date using Sept-09-2018
Enter Item-A and exit row which assigns the lot number 201809250001
Enter Item-B and exit row which assigns the lot number 201809250002
Commit the transaction for all above sessions
Note that the lot number 201809250002 is used for two different items Item-A and Item-B.
This is natural for below routine, (Hook Up) xxxEditLine in exiting row ---| F4111EditLine (XT4111Z1, F4111 Edit Line) ------| AssignLotNumber (X41LOT, F0002 Get Next Lot Number) 1. Check whether jdDate (which is Transaction Date) is NULL or not. If NULL Date (which is 0 for Julian Date) then assign Today's date based on OSASE format 2. Get current next number from NN 40|8 using JDB_FetchKeyedForUpdate which is a locking API 3. Compose the lot number based on the next number 4. Update the Next Number table after adding 1 5. Search F4108 based on the lot number composed. If this number is in use, add 1 and search F4108 till it finds the lot number not in use
(Hook Up) xxxEndDoc in clicking OK button ---| F4111EndDocument (XT4111Z1, F4111 End Document) ------| LotMasterUpdate (X4108, F4108 Update Lot Mater) which inserts F4108 based on the lot number appears in the Grid
Currently, there is no way to workaround this issue when you allow user to enter various transaction dates.