Skip to Content
0
Jan 24, 2023 at 12:31 PM

Getting Data Error while calling FM FTP_R3_TO_SERVER

69 Views

Hello experts,

I am getting exception code data error while calling FM: FTP_R3_TO_SERVER, below is the piece of code.

Could you please let me know what is wrong with the code ?

FORM download_xml.
IF d_xml IS NOT INITIAL.
slen = strlen( pswd ).
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
source = pswd
sourcelen = slen
key = key
IMPORTING
destination = pswd.

CALL FUNCTION 'FTP_CONNECT'
EXPORTING
user = user
password = pswd
host = host
rfc_destination = dest
IMPORTING
handle = lv_handle
EXCEPTIONS
not_connected = 1
OTHERS = 2.

CONCATENATE wa_edidc-docnum '.xml'
INTO lv_command.

CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
handle = lv_handle
fname = lv_command
character_mode = 'X'
TABLES
text = gt_data_tab
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
IF sy-subrc <> 0.
RAISE data_error.
ENDIF.

CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
handle = lv_handle.

CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = dest
EXCEPTIONS
destination_not_open = 1
OTHERS = 2.
ENDIF.
ENDFORM. "download_xml