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 command in background job

Former Member
1,944

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

Hi,

kindly provide the details to use SAPFTPA RFC

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

act immediately

Thanks

7 REPLIES 7
Read only

Former Member
1,636

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.

Read only

0 Likes
1,636

Hi,

kindly provide the details to use SAPFTPA RFC

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

act immediately

Thanks

Read only

0 Likes
1,636

HI,

am using SAPFTPA, but still the problem persist

kindly suggest

Read only

0 Likes
1,636

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.

Read only

Ajain
Explorer
0 Likes
1,546

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

Read only

0 Likes
1,530

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

 

Read only

Ajain
Explorer
0 Likes
1,475

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