Hello everyone,
We found the solution. There is an SAP note for this problem. We copied sapftp.exe file from production system and FTP_SERVER_TO_R3 fm is now working!
Related notes:
1470494 - Internal Error with Function module FTP_SERVER_TO_R3
93042 - Problems with SAPFTP