Code: Alles auswählen.
lt_rawdata = cl_bcs_convert=>xstring_to_solix( iv_xstring = s_xdata ).
DATA(li_bytecount) = xstrlen( s_xdata ).
cl_gui_frontend_services=>gui_download(
EXPORTING bin_filesize = li_bytecount
filename = s_path
filetype = 'BIN'
confirm_overwrite = abap_true
CHANGING
data_tab = lt_rawdata
Code: Alles auswählen.
CASE mv_open_mode. (in meinem Fall mc_binary, habe aber alle ausprobiert)
WHEN mc_non_unicode.
OPEN DATASET pv_filename FOR OUTPUT IN TEXT MODE
ENCODING NON-UNICODE IGNORING CONVERSION ERRORS.
WHEN mc_unicode.
OPEN DATASET pv_filename FOR OUTPUT IN TEXT MODE
ENCODING UTF-8 IGNORING CONVERSION ERRORS.
WHEN mc_binary.
OPEN DATASET pv_filename FOR OUTPUT IN BINARY MODE.
ENDCASE.
Folgende Benutzer bedankten sich beim Autor black_adept für den Beitrag:
Romaniac
Code: Alles auswählen.
METHOD ifs_dataset_transfer.
TRY.
IF pv_length IS INITIAL.
TRANSFER pv_line TO pv_filename. ---> wird ausgeführt
ELSE.
TRANSFER pv_line TO pv_filename LENGTH pv_length.
ENDIF.
CATCH cx_sy_file_io.
* Error while writing into file
RAISE e_transfer_error.
CATCH cx_sy_codepage_converter_init.
* Conversion of codepage not supported
RAISE e_transfer_error.
CATCH cx_sy_conversion_codepage.
* Internal conversion error
RAISE e_transfer_error.
CATCH cx_sy_file_authority.
* No authority to open file
RAISE e_transfer_error.
CATCH cx_sy_file_open_mode.
* File is not open
RAISE e_transfer_error.
ENDTRY.
ENDMETHOD.
Code: Alles auswählen.
cl_output->t_rawdata = cl_bcs_convert=>xstring_to_solix( iv_xstring = cl_output->xdata ).
cl_output->bytecount = xstrlen( cl_output->xdata ).
METHOD download_backend.
DATA: bytes_remain TYPE i.
FIELD-SYMBOLS: <rawdata> LIKE LINE OF t_rawdata.
OPEN DATASET p_backfn FOR OUTPUT IN BINARY MODE.
CHECK sy-subrc = 0.
bytes_remain = bytecount.
LOOP AT t_rawdata ASSIGNING <rawdata>.
AT LAST.
CHECK bytes_remain >= 0.
TRANSFER <rawdata> TO p_backfn LENGTH bytes_remain.
EXIT.
ENDAT.
TRANSFER <rawdata> TO p_backfn.
SUBTRACT 255 FROM bytes_remain. " Solix has length 255
ENDLOOP.
CLOSE DATASET p_backfn.
Folgende Benutzer bedankten sich beim Autor a-dead-trousers für den Beitrag:
Romaniac