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

FTP_CONNECT

Former Member
0 Likes
2,171

Hello, everyone.

While activating FM HTTP_CONNECT I get an error message that my user has no authorization for the remote ftp computer althogh via cmd I'm connecting the same ftp computer successfully.

Does anyone know why ??

Here's my code:

*--> Scramble ftp password

SET EXTENDED CHECK OFF.

LV_LEN = STRLEN( FTP_PSS ).

CALL FUNCTION 'HTTP_SCRAMBLE'

EXPORTING

SOURCE = FTP_PSS

SOURCELEN = LV_LEN

KEY = '26101957'

IMPORTING

DESTINATION = FTP_PSS.

*--> Connect to FTP server

CALL FUNCTION 'FTP_CONNECT'

EXPORTING

USER = FTP_USR

PASSWORD = FTP_PSS

HOST = FTP_ADR

RFC_DESTINATION = ''SAPFTP'

IMPORTING

HANDLE = LV_HDL

EXCEPTIONS

NOT_CONNECTED.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
949

Hi,

Check out this , may be helpful to you

CALL FUNCTION 'FTP_CONNECT'

EXPORTING

user = user

password = pwd

host = host

rfc_destination = dest

IMPORTING

handle = hdl

EXCEPTIONS

not_connected = 8.

CASE sy-subrc.

WHEN 0.

WHEN OTHERS.

RAISE connection_error.

ENDCASE.

CALL FUNCTION 'FTP_COMMAND'

EXPORTING

handle = hdl

command = transfer_type

TABLES

data = data

EXCEPTIONS

command_error = 1

tcpip_error = 2

data_error = 3.

CASE sy-subrc.

WHEN 0.

WHEN 1.

RAISE command_error.

WHEN 2.

RAISE tcpip_error.

WHEN 3.

RAISE data_error.

WHEN OTHERS.

RAISE other_error.

ENDCASE.

CALL FUNCTION 'FTP_COMMAND'

EXPORTING

handle = hdl

command = ftp_command

compress = compress

verify = verify

TABLES

data = data

EXCEPTIONS

command_error = 1

tcpip_error = 2

data_error = 3.

CASE sy-subrc.

WHEN 0.

WHEN 1.

RAISE command_error.

WHEN 2.

RAISE tcpip_error.

WHEN 3.

RAISE data_error.

WHEN OTHERS.

RAISE other_error.

ENDCASE.

CALL FUNCTION 'FTP_DISCONNECT'

EXPORTING

handle = hdl.

Thanks

Aditya

Hello, everyone.

While activating FM HTTP_CONNECT I get an error message that my user has no authorization for the remote ftp computer althogh via cmd I'm connecting the same ftp computer successfully.

Does anyone know why ??

Here's my code:

*--> Scramble ftp password

SET EXTENDED CHECK OFF.

LV_LEN = STRLEN( FTP_PSS ).

CALL FUNCTION 'HTTP_SCRAMBLE'

EXPORTING

SOURCE = FTP_PSS

SOURCELEN = LV_LEN

KEY = '26101957'

IMPORTING

DESTINATION = FTP_PSS.

*--> Connect to FTP server

CALL FUNCTION 'FTP_CONNECT'

EXPORTING

USER = FTP_USR

PASSWORD = FTP_PSS

HOST = FTP_ADR

RFC_DESTINATION = ''SAPFTP'

IMPORTING

HANDLE = LV_HDL

EXCEPTIONS

NOT_CONNECTED.

5 REPLIES 5
Read only

Former Member
0 Likes
950

Hi,

Check out this , may be helpful to you

CALL FUNCTION 'FTP_CONNECT'

EXPORTING

user = user

password = pwd

host = host

rfc_destination = dest

IMPORTING

handle = hdl

EXCEPTIONS

not_connected = 8.

CASE sy-subrc.

WHEN 0.

WHEN OTHERS.

RAISE connection_error.

ENDCASE.

CALL FUNCTION 'FTP_COMMAND'

EXPORTING

handle = hdl

command = transfer_type

TABLES

data = data

EXCEPTIONS

command_error = 1

tcpip_error = 2

data_error = 3.

CASE sy-subrc.

WHEN 0.

WHEN 1.

RAISE command_error.

WHEN 2.

RAISE tcpip_error.

WHEN 3.

RAISE data_error.

WHEN OTHERS.

RAISE other_error.

ENDCASE.

CALL FUNCTION 'FTP_COMMAND'

EXPORTING

handle = hdl

command = ftp_command

compress = compress

verify = verify

TABLES

data = data

EXCEPTIONS

command_error = 1

tcpip_error = 2

data_error = 3.

CASE sy-subrc.

WHEN 0.

WHEN 1.

RAISE command_error.

WHEN 2.

RAISE tcpip_error.

WHEN 3.

RAISE data_error.

WHEN OTHERS.

RAISE other_error.

ENDCASE.

CALL FUNCTION 'FTP_DISCONNECT'

EXPORTING

handle = hdl.

Thanks

Aditya

Read only

Former Member
0 Likes
949

To connect to the other FTP server

U need to use FTP_Connect

thats the FM whts HTTP_CONNECT?

Read only

0 Likes
949

Hi Rebeka,

I have the same issue, I am able to connect through desktop/command window, but not able to connect through 'FTP_CONNECT' function module. I get a message 'User has no access authorization for computer XYZ'

Let me know if you find a solution.

Thanks,

Sudhakar

Read only

0 Likes
949

Hi,

I found out the issue, use key while you use 'HTTP_SCRAMBLE' function. If you have made a mistake in the key value, it screws up the password!

key type i value 26101957.

Good Luck.

Sudhakar

Read only

0 Likes
949

hi Sudhakar.

I have exactly that problem, but even when i use the key you gave (key type i value 26101957), I still have the same error message (mu user has no authorization).

here is my code:

CALL FUNCTION 'HTTP_SCRAMBLE'
  EXPORTING
    SOURCE            = source
    SOURCELEN         = sourcelen
    KEY               = key
 IMPORTING
   DESTINATION       = pwd
          .

CALL FUNCTION 'FTP_CONNECT'
  EXPORTING
    USER                   = user
    PASSWORD               = pwd
*   ACCOUNT                =
    HOST                   = 'server_name'
    RFC_DESTINATION        = dest
*   GATEWAY_USER           =
*   GATEWAY_PASSWORD       =
*   GATEWAY_HOST           =
 IMPORTING
   HANDLE                 = handle
* EXCEPTIONS
*   NOT_CONNECTED          = 1
*   OTHERS                 = 2

What is wrong with that?

thanks a lot for your help.

pierre