1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
DATA: gv_mime_type TYPE string, gv_image TYPE xstring, gt_tabimg TYPE STANDARD TABLE OF x, gv_path TYPE string, gv_full_path TYPE string, gv_useraction TYPE i, gv_name TYPE string. cl_gui_frontend_services=>get_screenshot( IMPORTING mime_type_str = gv_mime_type image = gv_image EXCEPTIONS access_denied = 1 cntl_error = 2 error_no_gui = 3 not_supported_by_gui = 4 OTHERS = 5 ). IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. cl_gui_frontend_services=>file_save_dialog( EXPORTING window_title = 'Сохранить изображение' default_extension = 'png' default_file_name = 'screenshot' prompt_on_overwrite = 'X' CHANGING path = gv_path filename = gv_name fullpath = gv_full_path user_action = gv_useraction EXCEPTIONS cntl_error = 1 error_no_gui = 2 not_supported_by_gui = 3 invalid_default_file_name = 4 OTHERS = 5 ). IF sy-subrc <> 0. MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4. ENDIF. IF gv_useraction = cl_gui_frontend_services=>action_ok. CALL FUNCTION 'SCMS_XSTRING_TO_BINARY' EXPORTING buffer = gv_image TABLES binary_tab = gt_tabimg. cl_gui_frontend_services=>gui_download( EXPORTING filename = gv_full_path filetype = 'BIN' CHANGING data_tab = gt_tabimg EXCEPTIONS OTHERS = 99 ). ENDIF. |
Источник http://abap-blog.ru/osnovy-abap/sdelat-snimok-ekrana/