Easily download files with ABAP using the following code.

      
    data(lv_text) = |This is text file content.|.
    data(lv_textx) = cl_bcs_convert=>string_to_xstring( lv_text ).
    data(lt_solid_tabx) = cl_bcs_convert=>xstring_to_solix( iv_xstring  = lv_textx ).
    data(lv_length) = xstrlen( lv_textx ).
    data(lv_filename) = |textfile.txt|.
    cl_gui_frontend_services=>gui_download( 
        exporting 
          bin_filesize = lv_length          
          filename     = lv_filename               
          filetype     = 'BIN'       
        changing 
          data_tab     = lt_solid_tabx  
        exceptions 
          others       = 1 ).
      
    

This code is for downloading a text as a .txt file. For example, if you have an Excel file as an xstring, you can proceed by ignoring the string to xstring part.

GUI Upload