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: 

FTP command in background job

Former Member
878

hi all,

I am using a program which sends file via FTP. When I run it in foreground it works fine. But in background it gives error i.e. 'Invalid FTP Handle'.

I am using the following function modules for FTP:

1. 'FTP_CONNECT'

2. 'FTP_R3_TO_SERVER'

3. 'FTP_DISCONNECT'

4. 'RFC_CONNECTION_CLOSE' (destination SAPFTP)

Please advise. Thanks.

Regards,

FS

7 REPLIES 7

Former Member
570

Solved!

I had to use the RFC destination 'SAPFTPA' for FTP connection as this runs on application server not foreground as required by background job.

0 Kudos
570

Hi,

kindly provide the details to use SAPFTPA RFC

am facing the same problem while firing the job in Nested IP

act immediately

Thanks

0 Kudos
570

HI,

am using SAPFTPA, but still the problem persist

kindly suggest

0 Kudos
570

Try this code :

CALL FUNCTION 'HTTP_SCRAMBLE'

EXPORTING

SOURCE = p_pass

sourcelen = l_dstlen

key = l_key

IMPORTING

destination = p_pass.

CALL FUNCTION 'FTP_CONNECT'

EXPORTING

user = p_user

password = p_pass

host = p_host

rfc_destination = 'SAPFTPA'

IMPORTING

handle = l_hdl

EXCEPTIONS

not_connected = 1

OTHERS = 2.

CALL FUNCTION 'FTP_COMMAND'

EXPORTING

handle = l_hdl

command = 'cd XXXR' "This is the remote location not the local location

compress = 'N'

TABLES

data = lt_data

EXCEPTIONS

command_error = 1

tcpip_error = 2.

CALL FUNCTION 'FTP_COMMAND'

EXPORTING

handle = l_hdl

command = l_cmd "l_cmd contains put <filename>

compress = 'N'

TABLES

data = lt_data

EXCEPTIONS

command_error = 1

tcpip_error = 2.

CALL FUNCTION 'FTP_DISCONNECT'

EXPORTING

handle = l_hdl.

Ajain
Explorer
0 Kudos
480

Can you please share the solution for this background job failure error - Invalid FTP handle

0 Kudos
464

AFAIK 'former member' are no longer active, post your own question or search again.

 

Ajain
Explorer
0 Kudos
409

Hello Raymond, the solution in the link is not working for background job program.