Functions that worked OK in 7.6 may give this error in 7.8 :
SAP DBTech JDBC: [-9407]: System error: unexpected error
when used in a SELECT statement.
7.8 appears to be less forgiving about assigning values to the input parameters within the function: in my case, I was tweaking an input parameter. I resolved the problem by defining a new local variable and using that for assignment within the function.