Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

how to implement the FTP_CONNECT FUNCTION?

Former Member
0 Likes
410

hello:

i would to ask one favor i am trying to send a file to FTP server but i have a problem when i try to connect to the FTP SERVER using the FTP_CONNECT FUNCTION the system send an error message like this 'this user has no permission to write', i have being looking some information of how to implement this FUNCTION? and i found that is necessary to send the user parameter in encrypted mode, i already used the DP_SCRAMBLE_STRING FUCNTION , but is still no working.

does anybody knows how to implement the FTP_CONNECT without any problems?

thanks a lot for you help.

1 REPLY 1
Read only

nitesh_jain3
Active Participant
0 Likes
350

Dear shiska,

Following is the code we have used and it is working without any problems..

<b>Password encryption</b>

data : v_password(20),

v_key type i value 26101957,

v_slen type i.

  • --- ENCRYPT PASSWORD

The password is entered by the user on the selection screen in the parameter p_pswd.

clear v_password.

set extended check off.

v_password = p_pswd.

translate v_password to lower case.

v_slen = strlen( v_password ).

call 'AB_RFC_X_SCRAMBLE_STRING'

id 'SOURCE' field v_password

id 'KEY' field v_key

id 'SCR' field 'X'

id 'DESTINATION' field v_password

id 'DSTLEN' field v_slen.

<b>FTP Connect</b>

data v_hdl type i.

call function 'FTP_CONNECT'

exporting

user = p_usrid (User id used to connect)

password = v_password

host = p_ip_add (IP of the server to be connected)

rfc_destination = p_sapftp (value is normally SAPFTP or SAPFTPA)

importing

handle = v_hdl

exceptions

not_connected = 1

others = 2.

From your msg it looks that the FTP connection is not the problem.. The problem is with the unix level permissions the user, with which you are doing the ftp, has..

This user does not have write permissions in the directory in which it is trying to write the file..

Try doing the FTP manually from the SAP Application server.. If this works then the FTP Command u r using after the FTP Connect should also work..

Cheers

Nitesh