Skip to Content
0
Former Member
Jun 30, 2009 at 01:46 PM

FTP connection failed in background

478 Views

Hi friends,

I am using the following code to connect FTP. It is working fine in fore ground. but it fails in background.

In Job log, it is saying "Attempt to set up connection to xxx failed "!! Please suggest what is to be modify?

I ran RSFTP002 and it also fails for SAPFTPA!!

CALL FUNCTION 'HTTP_SCRAMBLE'

EXPORTING

SOURCE = v_pwd

sourcelen = v_pwd_len

key = cs_key

IMPORTING

destination = v_pwd.

  • Establish the FTP Connection

IF SY-BATCH EQ 'X '.

v_rfc_dest = 'SAPFTPA'. " background

else.

v_rfc_dest = 'SAPFTP'. " foreground

ENDIF.

CALL FUNCTION 'FTP_CONNECT'

EXPORTING

user = v_usr

password = v_pwd

host = v_host

rfc_destination = v_rfc_dest

IMPORTING

handle = v_handle

EXCEPTIONS

not_connected = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Thanks,

Sagar.