Hello team ,
My requirement is to use an enhancement to send DME file from SAP to FTP server.
I get the data in format tab_x1 TYPE STANDARD TABLE OF x_linetype1.
When I try to download in desktop using below , I get correct out put and with proper trailing spaces and format.
CALL METHOD cl_gui_frontend_services=>gui_download
EXPORTING
bin_filesize = filesize
filename = filename_string
filetype = ‘BIN’
NO_AUTH_CHECK = ‘X’
IMPORTING
filelength = after_download_length
CHANGING
data_tab = tab_x
EXCEPTIONS
file_not_found = 91
file_write_error = 92
filesize_not_allowed = 93
invalid_type = 95
no_batch = 96
OTHERS = 97.
hlp_file_exit = filename.
My requirement is to share the same file to FTP . In order to do this , I have to convert the file data tab_x1 into readable format using FM ‘SCMS_BINARY_TO_TEXT’
TYPES: BEGIN OF ty_cont,
line TYPE bapiascont,
END OF ty_cont,
DATA : lt_cont type table of ty_cont
CALL FUNCTION ‘SCMS_BINARY_TO_TEXT’
EXPORTING
input_length = lv_inlen
TABLES
binary_tab = tab_x1
text_tab = lt_cont
EXCEPTIONS
failed = 1
OTHERS = 2.
After which data is passed to FTP FM FTP_R3_TO_SERVER
CALL FUNCTION ‘FTP_R3_TO_SERVER’
EXPORTING
handle = lv_hdl
fname = lv_path
character_mode = ‘C’
TABLES
text = lt_cont
EXCEPTIONS
tcpip_error = 1
command_error = 2
data_error = 3
OTHERS = 4.
IF sy–subrc <> 0.
ENDIF.
After this I get the file my folder . But my trailing spaces are not reflected. Can anyone please help me and suggest a how to keep the trailing spaces .