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
883

Hello everyone i am testing a ftp_connect FM. In that i am providing the following information

User <-------ftp user name (say XYZ)

password <---FTp password

Host<---Ftp server name (say ftp-server)

rfcdest as SAPFTP.

But the function module is raising a error as:

XYZ has no access authorization for computer ftp-server.

What i am doing wrong? I have the autorization to access that ftp, it opens if i directly type in browser. Is anything wrong with user and password..

Regards

6 REPLIES 6
Read only

Former Member
0 Likes
699

HI,

REPORT ZFTPSAP LINE-SIZE 132.

DATA: BEGIN OF MTAB_DATA OCCURS 0,
LINE(132) TYPE C,
END OF MTAB_DATA.

DATA: MC_PASSWORD(20) TYPE C,
MI_KEY TYPE I VALUE 26101957,
MI_PWD_LEN TYPE I,
MI_HANDLE TYPE I.

START-OF-SELECTION.

*-- Your SAP-UNIX FTP password (case sensitive)
MC_PASSWORD = 'password'.

DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.

*-- FTP_CONNECT requires an encrypted password to work
CALL 'AB_RFC_X_SCRAMBLE_STRING'
     ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY
     ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD
     ID 'DSTLEN' FIELD MI_PWD_LEN.

CALL FUNCTION 'FTP_CONNECT'
     EXPORTING
*-- Your SAP-UNIX FTP user name (case sensitive)
       USER            = 'userid'
       PASSWORD        = MC_PASSWORD
*-- Your SAP-UNIX server host name (case sensitive)
       HOST            = 'unix-host'
       RFC_DESTINATION = 'SAPFTP'
     IMPORTING
       HANDLE          = MI_HANDLE
     EXCEPTIONS
       NOT_CONNECTED   = 1
       OTHERS          = 2.

CHECK SY-SUBRC = 0.

CALL FUNCTION 'FTP_COMMAND'
     EXPORTING
       HANDLE = MI_HANDLE
       COMMAND = 'dir'
     TABLES
       DATA = MTAB_DATA
     EXCEPTIONS
       TCPIP_ERROR = 1

       COMMAND_ERROR = 2
       DATA_ERROR = 3
       OTHERS = 4.

IF SY-SUBRC = 0.
  LOOP AT MTAB_DATA.
    WRITE: / MTAB_DATA.
  ENDLOOP.
ELSE.
* do some error checking.
  WRITE: / 'Error in FTP Command'.
ENDIF.

CALL FUNCTION 'FTP_DISCONNECT'
     EXPORTING
       HANDLE = MI_HANDLE
     EXCEPTIONS
       OTHERS = 1.   

Regards

Sudheer

Read only

0 Likes
699

Does it mean it only works for UNIX system?

Regards

Read only

Former Member
0 Likes
699

Some more info.

I tested the conncetion using rsftp002 program....its working fine. But it throws above said error whn i try to test ftp_connect function module. Do i need to make any changes to SAPFTP rfc. I am using a local ftp server.

Regards

Read only

Former Member
0 Likes
699

Self

Read only

Former Member
0 Likes
699

Hi Rahul,

Were you able to resolve this error?

Regards,

Dinesh

Read only

Former Member
0 Likes
699

Hi Kesi,

How did you resolved this issue. I am getting the same error XYZ has no access authorization for computer ftp-server.

Any help would be greatly appreciated.

Cheers

Jon