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

Problem while placing file in FTP

Former Member
0 Likes
316

Hi Guys,

I am facing problem while placing file in FTP.

Here are the details:

Am using following function modules.

USER = 'XXXXX'.

HOST = 'XXX.XX.XX.XX'.

pwd = 'xxxx'.

*--SCRAMBLE PASSWORD

DESCRIBE FIELD PWD LENGTH DSTLEN.

CALL 'AB_RFC_X_SCRAMBLE_STRING'

ID 'SOURCE' FIELD PWD ID 'KEY' FIELD KEY

ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD PWD

ID 'DSTLEN' FIELD DSTLEN.

*--FTP CONNECT

CALL FUNCTION 'FTP_CONNECT'

EXPORTING

USER = USER

PASSWORD = pwd

  • ACCOUNT =

HOST = HOST

RFC_DESTINATION = DEST

  • GATEWAY_USER =

  • GATEWAY_PASSWORD =

  • GATEWAY_HOST =

IMPORTING

HANDLE = HDL

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.

*--FTP COMMAND

CALL FUNCTION 'FTP_COMMAND'

EXPORTING

HANDLE = HDL

COMMAND = CMD1

  • COMPRESS =

  • VERIFY =

  • IMPORTING

  • FILESIZE =

  • FILEDATE =

  • FILETIME =

TABLES

DATA = RESULT

EXCEPTIONS

TCPIP_ERROR = 1

COMMAND_ERROR = 2

DATA_ERROR = 3

OTHERS = 4

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

*--FTP DISCONNECT

CALL FUNCTION 'FTP_DISCONNECT'

EXPORTING

HANDLE = HDL.

Problem is with 'FTP_CONNECT'. Function Module is returning SY-SUBRC = 1.

Basis is able to Place file in the specified FTP location.

But through our program am facing problem.

I have also tried the function module CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

But it is returning following messages as

" Can't Execute External program(EXEC format Error)"

" External program terminated with Exit Code 1"

Thanks,

Sudhakar.

1 REPLY 1
Read only

uwe_schieferstein
Active Contributor
0 Likes
278

Hello Sudhakar

What TCP/IP connection do you use as RFC destination?

I have a report (on release 4.6c) which uses SAPFTPA for the FTP execution.

SAPFTPA executes the FTP on the application server.

You should test the FTP capapility with a simple FTP host using sample report RSFTP002.

Regards

Uwe