on 2020 May 17 11:05 PM
While sending .xls file to ftp server, when opening excel file, giving error file and the extension of document name (test.xls) doesn't match. The file could be corrupt or unsafe. Unless you trust its source, don't open it. Do you want to open any way.
While clicking on yes its getting display, but here in my case it should prompt for any message it should simply open the excel sheet without any prompting.
Request clarification before answering.
Please try this one
First you have to convert data to xstring, then xstring to binary.
After that send the BIN data.
Below are necessary FM to do it. It worked for me!
* Convert table text to xstring
CALL FUNCTION 'SCMS_TEXT_TO_XSTRING'
EXPORTING
ENCODING = '4110'
IMPORTING
BUFFER = LW_XSTRING
TABLES
TEXT_TAB = IT_DATA
EXCEPTIONS
FAILED = 1 OTHERS = 2.
IF SY-SUBRC <> 0. ENDIF.
* Convert xstring to binary
CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
EXPORTING
BUFFER = LW_XSTRING
IMPORTING
OUTPUT_LENGTH = LW_BIN_LEN
TABLES
BINARY_TAB = LT_TRANSFER.
* Set passive on
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = LW_HANDLE
COMMAND = 'set passive on'
TABLES
DATA = LT_RESULT
EXCEPTIONS TCPIP_ERROR = 1 COMMAND_ERROR = 2 DATA_ERROR = 3.
IF SY-SUBRC <> 0. ENDIF.
* Set bin mode
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = LW_HANDLE COMMAND = 'bin'
TABLES
DATA = LT_RESULT
EXCEPTIONS TCPIP_ERROR = 1 COMMAND_ERROR = 2 DATA_ERROR = 3.
IF SY-SUBRC <> 0.
ENDIF.
* Send file to FTP server
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
HANDLE = LW_HANDLE
FNAME = LW_FTP_PATH
BLOB_LENGTH = LW_BIN_LEN
TABLES
BLOB = LT_TRANSFER
EXCEPTIONS TCPIP_ERROR = 1 COMMAND_ERROR = 2 DATA_ERROR = 3 OTHERS = 4.
IF SY-SUBRC <> 0. . ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
72 | |
21 | |
9 | |
7 | |
6 | |
6 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.