I think what you are seeing is the result of different checks on status that allows this to happen.
Anytime you utilize the BAPI's for setting UD's and interfacing with external systems, you must make sure everything works right. LIMS providers usually provide all the coding to interface with SAP. But when you do this inhouse, you have to make sure all the bases are covered.
The status in the JEST table, I.e. the UD is one status. In the QALS table is another field. QALS-QSTAT35.
You should also have an entry in the QAVE table for the inspection lot once the UD is made. My guess is that you are missing this entry for the lots in question. But you have set the QSTAT35 flag in QALS.
So check those three things:
1. System Status
2. QALS-QSTAT35 value
3. QAVE table entry. (if you find an entry, make sure a UD is actually listed here)
Something in your progams are not getting everything set right. You don't mention if this is happening all the time, or just for certain inspection types, or if it was a one-time thing.
If it was a one time thing, you could have just simply hit a record lock in the during execution of the program and when the program errored out, it didn't properly rollback all the changes it attempted to make.
If its a consistent thing, than it is probably in your program logic and something is being done out of order or certain commits to the database are not being done at the right times.
Please look at the items I mentioned, find the inconsistency and get back to us. If you show the programmers the inconsistency, they may be able to quickly figure out the problem via debug if it is a consistent error.
Craig