where you are using this function module? if i'm correct there must be some BADI wherein you are calling this function module. i believe it would be either Doc check or change BADI. put an external break point where you are calling it and simulate the process again. Also, have you checked if this function module available in your system (in SE37 transaction).
Rgds