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 connection failed in background

Former Member
0 Likes
1,174

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
695

Hi

Try to check SAPFTPA and SAPFTP by trx SM59:

- SAPFTP is for Presentation server, so it can't work in background

- SAPFTPA is for Application server, so it should work in forground and background

Max

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.

1 REPLY 1
Read only

Former Member
0 Likes
696

Hi

Try to check SAPFTPA and SAPFTP by trx SM59:

- SAPFTP is for Presentation server, so it can't work in background

- SAPFTPA is for Application server, so it should work in forground and background

Max