I am not sure what you expect. If LT12 works well, then the error must be caused by all the methods that you mentioned: through Z program, some custom programs & Through Idocs, by avoiding including all the programs for confirmation.
And how can do you think we can tell you where the error is if we do not know the program logic of the Z programs and data submitted via Idoc?