Well, the insert generally works, but some doc numbers are not inserted. So Primary key can not be an issue.
Commit work and wait didnt' solve the issue.
I generated 22 documents but only 20 document numbers got inserted into my z table.
Thanks for all of your replies !