R/3 Program RSFTP007 has sample logic related to FTP connection from ECC in both binary and text mode... Please check it once........ This will give much idea..
And try to login to the given SFTP server directly using required tools and check whether the you have required authentication or not on the current directory.