Yes you are right mostly this error comes due to number range or when the database is locked by Basis, Could yu please check with you Basis team
To check the number range
Check number range assignment if number range is assigned properly then additionally Goto VTTK table and check the last number of shipment then goto your number range and see the current number if that is below the last number (which you got from VTTK) then change it and rerun the program