Created
May 13, 2022 15:35
-
-
Save hapejot/9521bbf0fa522d529581886b8761914e to your computer and use it in GitHub Desktop.
Creating a ZIP File from within ABAP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| **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