DATA: lv_mime_type TYPE string.
DATA: lv_image_bytes TYPE xstring.
TRY.
* Screenshot aufnehmen
cl_gui_frontend_services=>get_screenshot( IMPORTING
mime_type_str = lv_mime_type
image = lv_image_bytes ).
* MIME-Typ (PNG) ausgeben
WRITE: / lv_mime_type.
DATA: lv_action TYPE i.
DATA: lv_filename TYPE string.
DATA: lv_fullpath TYPE string.
DATA: lv_path TYPE string.
* Savedialog anzeigen
cl_gui_frontend_services=>file_save_dialog( EXPORTING
default_file_name = 'image.png'
default_extension = 'png'
file_filter = '(*.png)|*.png|'
CHANGING
filename = lv_filename
path = lv_path
fullpath = lv_fullpath
user_action = lv_action ).
IF lv_action EQ cl_gui_frontend_services=>action_ok.
* XSTRING -> SOLIX (RAW)
DATA(it_raw_data) = cl_bcs_convert=>xstring_to_solix( EXPORTING iv_xstring = lv_image_bytes ).
* Daten lokal speichern
cl_gui_frontend_services=>gui_download( EXPORTING
filename = lv_fullpath
filetype = 'BIN'
bin_filesize = xstrlen( lv_image_bytes )
CHANGING
data_tab = it_raw_data ).
ENDIF.
CATCH cx_root INTO DATA(e_txt).
ENDTRY.
ENDTRY.