Skip to content

Instantly share code, notes, and snippets.

@hapejot
Created May 13, 2022 15:35
Show Gist options
  • Select an option

  • Save hapejot/9521bbf0fa522d529581886b8761914e to your computer and use it in GitHub Desktop.

Select an option

Save hapejot/9521bbf0fa522d529581886b8761914e to your computer and use it in GitHub Desktop.
Creating a ZIP File from within ABAP
**Please use the pattern Z_BC_PROGRAM_HEAD to create the program head**
REPORT yrs_zip.
DATA(z) = NEW cl_abap_zip( ).
DATA(d) = cl_bcs_convert=>string_to_xstring(
iv_string = |Hallo zusammen\n| " Input data
).
z->add(
EXPORTING
name = 'test.txt' " Name (Case-Sensitive)
content = d
).
DATA(f) = z->save( ).
DATA(lt_file_tab) = cl_bcs_convert=>xstring_to_solix( iv_xstring = f ).
DATA(lv_bytecount) = xstrlen( f ).
" Save the file
cl_gui_frontend_services=>gui_download( EXPORTING bin_filesize = lv_bytecount
filename = 'C:\test.zip'
filetype = 'BIN'
CHANGING data_tab = lt_file_tab ).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment