Skip to Content

New SAP GUI theme Belize

SAP GUI 7.50 comes with a new “Fiori visual theme” for S/4HANA 1610 AKA “Fiori 2.0 visual theme for classical applications (Belize)”, which looks like this:

See also SAP notes:

  • 2365556 – Availability of the Fiori 2.0 visual theme for classical applications (theme “Belize”) in SAP GUI for HTML, SAP GUI for Java and SAP GUI for Windows
  • 2417687 – New features in SAP GUI for Windows 7.50

This new Belize theme introduces new icons.

The new Belize icons looks awesome / brillant / beautiful on a 24″ OLED monitor with HDR color profile.

It is very annoying to compare a new icon with a icon from an older theme by opening two sessions to two different systems. It’s even more painful to compare to more than one theme, because you have to restart the SAP GUI after changing the SAP GUI theme.

What, if you could compare icon by icon for all available SAP GUI themes?

Looks nice ?

The simple idea behind is to

  • Logon to SAP system with different SAP GUI theme
  • Run a report, that output all icons
  • Do a screenshot
  • Generate a CSS on screenshot with CSS Image Sprites
  • Generate a HTML page
  • Automate all this with ABAP code

The result looks like this.

Report ZSDN_SHOWICON_JAMBOREE

The report ZSDN_SHOWICON_JAMBOREE detects the current SAP GUI theme, shows it in “Current theme” and set the parameters based on two 22″ monitor setup with 1920×1080 under Windows 10.

Explanation of the parameters

Parameter Description 
(o) Export theme icons and CSS Creates a screenshot (Blue Crystal.png), a CSS file (Blue Crystal.css) and a html file (Blue Crystal Theme.html) for the current theme
(o) Export list icons Creates html file with list icons exported from the mime repository. Looks the same on all themes/systems.
 (o) Generate index.html  Creates a index.html file, which shows all icons together, which were already created in work directory
 Work directory Path to work directory to save generated files
 Icons per row Defines, how many icons will be output per row
Left Start point of the icons in screenshot
Top Start point of the icons in screenshot
Width Width of an icon plus space to the next icon
Height Height of an icon plus space to the next icon
Background Background filename
CSS CSS filename

Explanation of toolbar

Icon  Description 
   Execute the report
   Open the work directory in file explorer
   Open the single theme html page in browser
   Open the index.html in browser

Step by step description

  1. Start SAP Logon, option SAP GUI options and set your Theme like SAP Signature, Enjoy, Streamline, Tradeshow, Classic, Corbu, Blue Crystal, Belize (requires Blue Crystal with [X] Accept SAP Fiori Visual Theme and Logon to S/4HANA System)
  2. Restart SAP Logon
  3. Logon to SAP System
  4. Start report ZSDN_SHOWICON_JAMBOREE
  5. Report ZSDN_SHOWICON_JAMBOREE should determine your current theme by reading registry entries
  6. Execute report ZSDN_SHOWICON_JAMBOREE with (o) Export theme icons and CSS
  7. Double click on line  to save the screenshot.
  8. Check generated single html file (Blue Crystal Theme.html) by pressing button in toolbar to open file in browser.
    This should looks like this:

    If not, you have to adjust the parameter Left, Top, Width, Height.
    The parameter Left, Top is expected like this:

    The parameter Height, Width is expected like this:
  9. If the the single theme page looks perfect, you are done and can move on and repeat step 1-9 with next theme.
  10. Execute report ZSDN_SHOWICON_JAMBOREE one time with (o) Export list icons
  11. Execute report ZSDN_SHOWICON_JAMBOREE one time with (o) Generate index.html

Enjoy the SHOWICON Jamboree.

Tipps

  • You must enlarge the SAP GUI window for Belize theme over two monitors to cover all icons in one screenshot. The Belize theme does not use the whole width of the screen and even need more space between icons.

Source code

*&---------------------------------------------------------------------*
*& Report  ZSDN_SHOWICON_JAMBOREE
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT zsdn_showicon_jamboree.

CLASS lcl_flow_logic DEFINITION.

  PUBLIC SECTION.

    TYPES:
      yc_theme TYPE c LENGTH 3.

    CONSTANTS:
      c_action_1               TYPE i VALUE 1,
      c_action_2               TYPE i VALUE 2,
      c_action_3               TYPE i VALUE 3,
      c_action_4               TYPE i VALUE 4,
      c_ok_code_theme          TYPE sy-ucomm VALUE 'THEME',
      c_ok_code_screenshot     TYPE sy-ucomm VALUE 'SCREENSHOT',
      c_theme_internal         TYPE yc_theme VALUE 'INT',
      c_theme_signature        TYPE yc_theme VALUE '001',
      c_theme_enjoy            TYPE yc_theme VALUE '002',
      c_theme_system_dependent TYPE yc_theme VALUE '004',
      c_theme_streamline       TYPE yc_theme VALUE '008',
      c_theme_tradeshow        TYPE yc_theme VALUE '016',
      c_theme_classic          TYPE yc_theme VALUE '032',
      c_theme_corbu            TYPE yc_theme VALUE '064',
      c_theme_blue_crystal     TYPE yc_theme VALUE '128',
      c_theme_belize           TYPE yc_theme VALUE '256',
      c_thtxt_internal         TYPE string VALUE 'listicons',
      c_thtxt_signature        TYPE string VALUE 'SAP Signature',
      c_thtxt_enjoy            TYPE string VALUE 'Enjoy',
      c_thtxt_system_dependent TYPE string VALUE 'System dependent',
      c_thtxt_streamline       TYPE string VALUE 'Streamline',
      c_thtxt_tradeshow        TYPE string VALUE 'Tradeshow',
      c_thtxt_classic          TYPE string VALUE 'Classic',
      c_thtxt_corbu            TYPE string VALUE 'Corbu',
      c_thtxt_blue_crystal     TYPE string VALUE 'Blue Crystal',
      c_thtxt_belize           TYPE string VALUE 'Belize',
      c_theme                  TYPE string VALUE 'Theme',
      c_thtxt                  TYPE string VALUE ' Theme',
      c_extension_css          TYPE string VALUE '.css',
      c_extension_gif          TYPE string VALUE '.gif',
      c_extension_htm          TYPE string VALUE '.html',
      c_extension_png          TYPE string VALUE '.png',
      c_extension_zip          TYPE string VALUE '.zip',
      c_index                  TYPE string VALUE 'index'.

    TYPES:
      BEGIN OF ys_param,
        callback    TYPE sy-repid,
        ok_code     TYPE sy-ucomm,
        action      TYPE i,
        workdir     TYPE string,
        theme       TYPE yc_theme,
        theme_text  TYPE string,
        screen_size TYPE i,
        left        TYPE i,
        top         TYPE i,
        width       TYPE i,
        height      TYPE i,
*        horizontal  TYPE i,
*        vertical    TYPE i,
        background  TYPE string,
        css         TYPE string,
        css_prefix  TYPE string,
      END OF ys_param,
      BEGIN OF ys_icon_column,
        theme      TYPE yc_theme,
        theme_text TYPE string,
        background TYPE string,
        css        TYPE string,
        css_prefix TYPE string,
      END OF ys_icon_column,
      yt_icon_column TYPE TABLE OF ys_icon_column,
      BEGIN OF ys_hide,
        icon    TYPE icon-name,
        message TYPE string,
        ok_code TYPE sy-ucomm,
      END OF ys_hide.

    DATA:
      mc_theme TYPE string,
      ms_param TYPE ys_param.

    CLASS-METHODS:
      get_text IMPORTING ic_id          TYPE clike
               RETURNING VALUE(ec_text) TYPE string.

    METHODS:
      constructor,
      ev_initialization CHANGING cs_sscrfields TYPE sscrfields,
      ev_at_selection_screen,
      ev_start_of_selection,
      ev_at_line_selection IMPORTING ic_ok_code TYPE sy-ucomm.

  PRIVATE SECTION.


    TYPES:
      BEGIN OF ys_icon.
            INCLUDE TYPE icon.
    TYPES:
      shorttext TYPE iconshort,
      quickinfo TYPE iconquick,
      olength   TYPE string,
      bidi      TYPE icon_bidi,
      listicon  TYPE string,
      css_id    TYPE string,
      END OF ys_icon,
      yt_icon TYPE TABLE OF ys_icon.

    METHODS:
      set_default CHANGING cs_param TYPE ys_param,
      write_background IMPORTING is_param TYPE ys_param,
      write_css IMPORTING is_param TYPE ys_param,
      write_webpage IMPORTING ic_filename    TYPE string
                              it_icon_column TYPE yt_icon_column,
      write_list_icons IMPORTING is_param TYPE ys_param,

      read_icon EXPORTING et_icon  TYPE yt_icon,
      take_screenshot,
      convert_format IMPORTING ic_src_mimetype TYPE string
                               ic_trg_mimetype TYPE string
                     CHANGING  cx_data         TYPE xstring,
      download  IMPORTING ix_data     TYPE xstring
                          ic_filename TYPE string,
      write_px IMPORTING ii_int           TYPE i
               RETURNING VALUE(ec_result) TYPE string.

ENDCLASS.

CLASS lcl_flow_logic IMPLEMENTATION.

  METHOD get_text.

    DATA:
      lc_id TYPE string.

    lc_id = ic_id.
    CASE lc_id.
      WHEN 'B_ACT'.
        ec_text = 'Choose your action'.
      WHEN 'P_THM'.
        ec_text = 'Current theme'.
      WHEN 'P_ACT1'.
        ec_text = 'Export theme icons and CSS'.
      WHEN 'P_ACT2'.
        ec_text = 'Export list icons'.
      WHEN 'P_ACT3'.
        ec_text = 'Generate index.html'.
      WHEN 'P_DIR'.
        ec_text = 'Work directory'.
      WHEN 'P_COL'.
        ec_text = 'Icons per row'.
      WHEN 'P_LEF'.
        ec_text = 'Left'.
      WHEN 'P_TOP'.
        ec_text = 'Top'.
      WHEN 'P_WID'.
        ec_text = 'Width'.
      WHEN 'P_HEI'.
        ec_text = 'Height'.
      WHEN 'P_HOR'.
        ec_text = 'Horizonal'.
      WHEN 'P_VER'.
        ec_text = 'Vertical'.
      WHEN 'P_BGD'.
        ec_text = 'Background'.
      WHEN 'P_CSS'.
        ec_text = 'CSS'.
      WHEN c_theme_internal.
        ec_text = c_thtxt_internal.
      WHEN c_theme_signature.
        ec_text = c_thtxt_signature && c_thtxt.
      WHEN c_theme_enjoy.
        ec_text = c_thtxt_enjoy && c_thtxt.
      WHEN c_theme_system_dependent.
        ec_text = c_thtxt_system_dependent && c_thtxt.
      WHEN c_theme_streamline.
        ec_text = c_thtxt_streamline && c_thtxt.
      WHEN c_theme_tradeshow.
        ec_text = c_thtxt_tradeshow && c_thtxt.
      WHEN c_theme_classic.
        ec_text = c_thtxt_classic && c_thtxt.
      WHEN c_theme_corbu.
        ec_text = c_thtxt_corbu && c_thtxt.
      WHEN c_theme_blue_crystal.
        ec_text = c_thtxt_blue_crystal && c_thtxt.
      WHEN c_theme_belize.
        ec_text = c_thtxt_belize && c_thtxt.
    ENDCASE.

  ENDMETHOD.

  METHOD constructor.

    DATA:
      li_selectedtheme    TYPE i,
      li_acceptfioritheme TYPE i,
      lt_comp             TYPE TABLE OF spam_cvers,
      ln_theme            TYPE n LENGTH 3.

    CALL METHOD cl_gui_frontend_services=>registry_get_dword_value
      EXPORTING
        root      = cl_gui_frontend_services=>hkey_current_user
        key       = 'Software\SAP\General\Appearance'
        value     = 'SelectedTheme'
      IMPORTING
        reg_value = li_selectedtheme
      EXCEPTIONS
        OTHERS    = 0.

    CALL METHOD cl_gui_frontend_services=>registry_get_dword_value
      EXPORTING
        root      = cl_gui_frontend_services=>hkey_current_user
        key       = 'Software\SAP\General\Appearance'
        value     = 'AcceptFioriTheme'
      IMPORTING
        reg_value = li_acceptfioritheme
      EXCEPTIONS
        OTHERS    = 0.
    cl_gui_cfw=>flush( ).

    CALL FUNCTION 'OCS_GET_INSTALLED_COMPS'
      TABLES
        tt_comptab = lt_comp
      EXCEPTIONS
        OTHERS     = 0.
    LOOP AT lt_comp TRANSPORTING NO FIELDS WHERE component EQ 'S4CORE'.
      IF li_acceptfioritheme EQ 1.
*       S/4HANA with [X] Accept SAP Fiori visual theme -> Belize Theme
        li_selectedtheme = c_theme_belize.
      ENDIF.
    ENDLOOP.

    ln_theme = li_selectedtheme.
    ms_param-theme = ln_theme.
    set_default( CHANGING cs_param = ms_param ).

    CALL METHOD cl_gui_frontend_services=>get_sapgui_workdir
      CHANGING
        sapworkdir = ms_param-workdir
      EXCEPTIONS
        OTHERS     = 1.

    IF sy-subrc EQ 0.
      ms_param-workdir = ms_param-workdir && '\'.
    ELSE.
      ms_param-workdir = 'c:\temp\'.
    ENDIF.

  ENDMETHOD.

  METHOD ev_initialization.

    DATA:
      ls_button TYPE smp_dyntxt.

*   Add button
    ls_button-text = ''.
    ls_button-icon_id = icon_open_folder.
    ls_button-icon_text = 'Open Work directory'.
    ls_button-quickinfo = 'Open Work directory'.
    ls_button-path = ''.
    cs_sscrfields-functxt_01 = ls_button.

*   Add button
    ls_button-text = ''.
    ls_button-icon_id = icon_document.
    ls_button-icon_text = ms_param-theme_text && c_extension_htm.
    ls_button-quickinfo = ms_param-theme_text && c_extension_htm.
    ls_button-path = ''.
    cs_sscrfields-functxt_02 = ls_button.

*   Add button
    ls_button-text = ''.
    ls_button-icon_id = icon_document.
    ls_button-icon_text = c_index && c_extension_htm.
    ls_button-quickinfo = c_index && c_extension_htm.
    ls_button-path = ''.
    cs_sscrfields-functxt_03 = ls_button.

  ENDMETHOD.

  METHOD ev_at_selection_screen.

    DATA:
      lc_application TYPE string.

    CASE ms_param-ok_code.
      WHEN 'FC01'.
        lc_application = 'explorer.exe'.
        CALL METHOD cl_gui_frontend_services=>execute
          EXPORTING
            application = lc_application
            parameter   = ms_param-workdir
          EXCEPTIONS
            OTHERS      = 1.
      WHEN 'FC02'.
        lc_application = ms_param-workdir && ms_param-theme_text && c_extension_htm.
        CALL METHOD cl_gui_frontend_services=>execute
          EXPORTING
            application = lc_application
            parameter   = ms_param-workdir
          EXCEPTIONS
            OTHERS      = 1.
      WHEN 'FC03'.
        lc_application = ms_param-workdir && c_index && c_extension_htm.
        CALL METHOD cl_gui_frontend_services=>execute
          EXPORTING
            application = lc_application
            parameter   = ms_param-workdir
          EXCEPTIONS
            OTHERS      = 1.
    ENDCASE.

  ENDMETHOD.

  METHOD ev_start_of_selection.

    DATA:
      lt_icon_column TYPE yt_icon_column,
      ls_icon_column TYPE ys_icon_column,
      lt_directory   TYPE TABLE OF file_info,
      ls_directory   TYPE file_info,
      li_count       TYPE i,
      ls_param       TYPE ys_param.

    CASE ms_param-action.
      WHEN c_action_1.
        ls_icon_column-theme = ms_param-theme.
        ls_icon_column-theme_text = ms_param-theme_text.
        ls_icon_column-background = ms_param-background.
        ls_icon_column-css        = ms_param-css.
        ls_icon_column-css_prefix = ms_param-css_prefix.
        APPEND ls_icon_column TO lt_icon_column.
        CALL METHOD write_css( ms_param ).
        CALL METHOD write_webpage(
            ic_filename    = ms_param-workdir && ms_param-theme_text && c_extension_htm
            it_icon_column = lt_icon_column ).
        CALL METHOD write_background( ms_param ).
        LEAVE TO LIST-PROCESSING.

      WHEN c_action_2.
        CALL METHOD write_list_icons( ms_param ).
        WRITE: / 'Open Work directroy and extract ', c_thtxt_internal && c_extension_zip.
        LEAVE TO LIST-PROCESSING.

      WHEN c_action_3.
        CALL METHOD cl_gui_frontend_services=>directory_list_files
          EXPORTING
            directory  = ms_param-workdir
          CHANGING
            file_table = lt_directory
            count      = li_count
          EXCEPTIONS
            OTHERS     = 0.
        LOOP AT lt_directory INTO ls_directory.
          CLEAR ls_param.
          IF ls_directory-isdir EQ 0 AND
             ls_directory-filename CS c_extension_png.
            REPLACE c_extension_png IN ls_directory-filename WITH ''.
            CASE ls_directory-filename.
              WHEN c_thtxt_signature.
                ls_param-theme = c_theme_signature.
              WHEN c_thtxt_enjoy.
                ls_param-theme = c_theme_enjoy.
              WHEN c_thtxt_system_dependent.
                ls_param-theme = c_theme_system_dependent.
              WHEN c_thtxt_streamline.
                ls_param-theme = c_theme_streamline.
              WHEN c_thtxt_tradeshow.
                ls_param-theme = c_theme_tradeshow.
              WHEN c_thtxt_classic.
                ls_param-theme = c_theme_classic.
              WHEN c_thtxt_corbu.
                ls_param-theme = c_theme_corbu.
              WHEN c_thtxt_blue_crystal.
                ls_param-theme = c_theme_blue_crystal.
              WHEN c_thtxt_belize.
                ls_param-theme = c_theme_belize.
            ENDCASE.
          ELSEIF ls_directory-isdir EQ 1 AND
                 ls_directory-filename CS c_thtxt_internal.
            ls_param-theme = c_theme_internal.
          ENDIF.
          IF NOT ls_param-theme IS INITIAL.
            set_default( CHANGING cs_param = ls_param ).
            ls_icon_column-theme = ls_param-theme.
            ls_icon_column-theme_text = ls_param-theme_text.
            ls_icon_column-background = ls_param-background.
            ls_icon_column-css        = ls_param-css.
            ls_icon_column-css_prefix = ls_param-css_prefix.
            APPEND ls_icon_column TO lt_icon_column.
          ENDIF.
        ENDLOOP.
        SORT lt_icon_column BY theme.
        CALL METHOD write_webpage(
            ic_filename    = ms_param-workdir && c_index && c_extension_htm
            it_icon_column = lt_icon_column ).

    ENDCASE.



  ENDMETHOD.

  METHOD ev_at_line_selection.

    CASE ic_ok_code.

      WHEN c_ok_code_screenshot.
        CALL METHOD take_screenshot.

    ENDCASE.

  ENDMETHOD.

  METHOD set_default.

    cs_param-screen_size = 60.
    cs_param-width       = 28.
    cs_param-height      = 32.
    cs_param-css_prefix = 'icon_th' && cs_param-theme.
    cs_param-theme_text = get_text( cs_param-theme ).

    CASE cs_param-theme.

      WHEN c_theme_internal.

      WHEN c_theme_signature.
        cs_param-left        = 61.
        cs_param-top         = 219.
        cs_param-background = c_thtxt_signature && c_extension_png.
        cs_param-css        = c_thtxt_signature && c_extension_css.

      WHEN c_theme_enjoy.
        cs_param-left        = 47.
        cs_param-top         = 203.
        cs_param-background = c_thtxt_enjoy && c_extension_png.
        cs_param-css        = c_thtxt_enjoy && c_extension_css.

      WHEN c_theme_system_dependent.

      WHEN c_theme_streamline.
        cs_param-left        = 47.
        cs_param-top         = 203.
        cs_param-background = c_thtxt_streamline && c_extension_png.
        cs_param-css        = c_thtxt_streamline && c_extension_css.

      WHEN c_theme_tradeshow.
        cs_param-left        = 47.
        cs_param-top         = 203.
        cs_param-background = c_thtxt_tradeshow && c_extension_png.
        cs_param-css        = c_thtxt_tradeshow && c_extension_css.

      WHEN c_theme_classic.
        cs_param-left        = 49.
        cs_param-top         = 186.
        cs_param-background = c_thtxt_classic && c_extension_png.
        cs_param-css        = c_thtxt_classic && c_extension_css.

      WHEN c_theme_corbu.
        cs_param-left        = 61.
        cs_param-top         = 219.
        cs_param-background = c_thtxt_corbu && c_extension_png.
        cs_param-css        = c_thtxt_corbu && c_extension_css.

      WHEN c_theme_blue_crystal.
        cs_param-left        = 50.
        cs_param-top         = 209.
        cs_param-background = c_thtxt_blue_crystal && c_extension_png.
        cs_param-css        = c_thtxt_blue_crystal && c_extension_css.

      WHEN c_theme_belize.
        cs_param-screen_size = 90. " two monitor setup
        cs_param-width       = 32.
        cs_param-height      = 52.
        cs_param-left        = 52.
        cs_param-top         = 247.
        cs_param-background = c_thtxt_belize && c_extension_png.
        cs_param-css        = c_thtxt_belize && c_extension_css.

    ENDCASE.

  ENDMETHOD.

  METHOD write_background.

    DATA:
      ls_hide   TYPE ys_hide,
      lt_icon   TYPE yt_icon,
      ls_icon   TYPE ys_icon,
      li_column TYPE i,
      li_at     TYPE i,
      li_from   TYPE i,
      li_to     TYPE i.

*   Get icon list
    CALL METHOD read_icon
      IMPORTING
        et_icon = lt_icon.

*   Head line
    ls_hide-icon = icon_information.
    CONCATENATE 'Double-click here to save screenshot as'
                is_param-background
           INTO ls_hide-message SEPARATED BY space.
    ls_hide-ok_code = c_ok_code_screenshot.
    PERFORM hide IN PROGRAM (is_param-callback)
                      USING ls_hide.
    ULINE.

*   Write icons
    li_at = 2.
    li_column = 0.
    LOOP AT lt_icon INTO ls_icon.

      li_at = li_at + 4.

      WRITE AT li_at ls_icon-id AS ICON.

      ADD 1 TO li_column.
      IF li_column GT is_param-screen_size.
        li_at = 2.
        li_column = 0.
        WRITE: /.
      ENDIF.

    ENDLOOP.

  ENDMETHOD.

  METHOD write_css.

    DATA:
      li_row        TYPE i,
      li_column     TYPE i,
      li_no         TYPE i,
      lt_icon       TYPE yt_icon,
      ls_icon       TYPE ys_icon,
      lc_filename   TYPE string,
      lc_width      TYPE string,
      lc_height     TYPE string,
      lc_background TYPE string,
      lc_left       TYPE string,
      lc_top        TYPE string,
      li_left       TYPE i,
      li_top        TYPE i,
      lc_css        TYPE string,
      lc_class      TYPE string,
      lx_css        TYPE xstring.

    CALL METHOD read_icon
      IMPORTING
        et_icon = lt_icon.

    CONCATENATE '"' is_param-background '"'
           INTO lc_background.
    lc_width = write_px( is_param-width ).
    lc_height = write_px( is_param-height ).
    CONCATENATE 'i.' is_param-css_prefix INTO lc_class.

    CONCATENATE lc_css
                lc_class '{'
                'background: url(' lc_background ');'
                'width: ' lc_width ';'
                'height: ' lc_height ';'
                'overflow: hidden;'
                'display: inline-block;'
                '}'
                cl_abap_char_utilities=>cr_lf
           INTO lc_css SEPARATED BY space.

    li_row = 0.
    li_top = -1 * ( is_param-top ).
    li_left = -1 * ( is_param-left ) + is_param-width.
    LOOP AT lt_icon INTO ls_icon.

      CONCATENATE 'i.' is_param-css_prefix ls_icon-css_id INTO lc_class.

      li_left = li_left - is_param-width.

      lc_left = write_px( li_left ).
      lc_top = write_px( li_top ).
      CONCATENATE lc_css
                  lc_class '{'
                  'background-position:' lc_left lc_top ';'
                  '}'
                  cl_abap_char_utilities=>cr_lf
                  INTO lc_css SEPARATED BY space.

      ADD 1 TO li_column.
      IF li_column GT is_param-screen_size.
        ADD 1 TO li_row.
        li_column = 0.
        li_top = li_top - is_param-height.
        li_left = -1 * ( is_param-left ) + is_param-width.
      ENDIF.

    ENDLOOP.

    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
      EXPORTING
        text     = lc_css
        encoding = '4110'
      IMPORTING
        buffer   = lx_css
      EXCEPTIONS
        failed   = 1
        OTHERS   = 2.

    CONCATENATE is_param-workdir is_param-css
           INTO lc_filename.
    CALL METHOD download
      EXPORTING
        ix_data     = lx_css
        ic_filename = lc_filename.

  ENDMETHOD.

  METHOD write_webpage.

    DATA:
      ls_icon_column TYPE ys_icon_column,
      lt_icon        TYPE yt_icon,
      ls_icon        TYPE ys_icon,
      lc_html        TYPE string,
      lc_class       TYPE string,
      lx_html        TYPE xstring.

    CALL METHOD read_icon
      IMPORTING
        et_icon = lt_icon.

    CONCATENATE lc_html
                '<html>'
                '<head>'
                '<title>SHOWICON Jamboree</title>'
                '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'
           INTO lc_html.
    LOOP AT it_icon_column INTO ls_icon_column.
      CONCATENATE lc_html
                  '<link rel="stylesheet" href="' ls_icon_column-css '">'
                  INTO lc_html.
    ENDLOOP.

    CONCATENATE lc_html
                '<style>'
                'table { border-collapse: collapse; table-layout: fixed; }'
                'table, th, td { font-family: monospace; border: 1px solid black; }'
                'th.ico { vertical-align: middle; }'
                'td.icot { text-align: left; }'
                'td.icon { text-align: center; }'
                'th.rotate { height: 200px; transform: rotate(-90.0deg); text-vertical: bottom; }'
                '</style>'
                '</head>'
                '<body>'
                '<table>'
                '<thead>'
                '<tr>'
           INTO lc_html.

    LOOP AT it_icon_column INTO ls_icon_column.
      CONCATENATE lc_html
                  '<th class="rotate">' ls_icon_column-theme_text '</th>'
             INTO lc_html.
    ENDLOOP.

    CONCATENATE lc_html
                '<th class="rotate">Icon name</th>'
                '<th class="rotate">Comment</th>'
                '<th class="rotate">Lngth</th>'
                '<th class="rotate">Printab.</th>'
                '<th class="rotate">internal</th>'
                '<th class="rotate">B</th>'
                '</tr>'
                '</thead>'
                '<tbody>'
           INTO lc_html.

    LOOP AT lt_icon INTO ls_icon.

      CONCATENATE lc_html
                  '<tr>'
             INTO lc_html.

      LOOP AT it_icon_column INTO ls_icon_column.
        CASE ls_icon_column-theme.
          WHEN c_theme_internal.
            CONCATENATE lc_html
                        '<td class="icon"><img alt="list" src="' ls_icon-listicon '" /></td>'
                   INTO lc_html.
          WHEN OTHERS.
            lc_class = ls_icon_column-css_prefix && ls_icon-css_id.
            CONCATENATE ls_icon_column-css_prefix lc_class INTO lc_class SEPARATED BY space.
            CONCATENATE lc_html
                        '<td class="icon"><i class="' lc_class '"></i></td>'
                   INTO lc_html.
        ENDCASE.
      ENDLOOP.

      CONCATENATE lc_html
                  '<td class="icot">' ls_icon-name '</td>'
                  '<td class="icot">' ls_icon-quickinfo '</td>'
                  '<td class="icon">' ls_icon-olength '</td>'
                  '<td class="icon">' ls_icon-id+1(2) '</td>'
                  '<td class="icon">' ls_icon-internal+1(6) '</td>'
                  '<td class="icon">' ls_icon-bidi '</td>'
                  '</tr>'
             INTO lc_html.
*      EXIT.
    ENDLOOP.

    CONCATENATE lc_html
                '</tbody>'
                '</table>'
                '</body>'
                '</html>'
           INTO lc_html.

    CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
      EXPORTING
        text     = lc_html
        encoding = '4110'
      IMPORTING
        buffer   = lx_html
      EXCEPTIONS
        failed   = 1
        OTHERS   = 2.

*    CONCATENATE is_param-workdir 'index.html'
*           INTO lc_filename.
    CALL METHOD download
      EXPORTING
        ix_data     = lx_html
        ic_filename = ic_filename.

  ENDMETHOD.

  METHOD write_list_icons.

    DATA:
      lo_mapi     TYPE REF TO if_mr_api,
      lt_icon     TYPE yt_icon,
      ls_icon     TYPE ys_icon,
      lx_icon     TYPE xstring,
      lc_icon_url TYPE string,
      lc_id       TYPE string,
      lo_zip      TYPE REF TO cl_abap_zip,
      lc_name     TYPE string,
      lx_zip      TYPE xstring,
      li_total    TYPE i.

    CREATE OBJECT lo_zip.
    lo_mapi = cl_mime_repository_api=>if_mr_api~get_api( ).

    CALL METHOD read_icon
      IMPORTING
        et_icon = lt_icon.

    li_total = lines( lt_icon ).
    LOOP AT lt_icon INTO ls_icon.

      CALL FUNCTION 'PROGRESS_INDICATOR'
        EXPORTING
          i_text               = 'Export'
          i_processed          = sy-tabix
          i_total              = li_total
          i_output_immediately = 'X'.

      lc_id = ls_icon-name.
      lc_icon_url = cl_bsp_mimes=>sap_icon( id = lc_id ).

      CALL METHOD lo_mapi->get
        EXPORTING
          i_url             = lc_icon_url
          i_check_authority = abap_false
        IMPORTING
          e_content         = lx_icon
        EXCEPTIONS
          OTHERS            = 1.
      IF sy-subrc EQ 0.
        CONCATENATE 's_' ls_icon-internal+1(6) c_extension_gif
               INTO lc_name.
        TRANSLATE lc_name TO LOWER CASE.
        CALL METHOD lo_zip->add
          EXPORTING
            name    = lc_name
            content = lx_icon.
      ENDIF.

    ENDLOOP.

    lx_zip = lo_zip->save( ).
    CONCATENATE is_param-workdir c_thtxt_internal c_extension_zip
           INTO lc_name.
    CALL METHOD download
      EXPORTING
        ix_data     = lx_zip
        ic_filename = lc_name.

  ENDMETHOD.

  METHOD read_icon.

    DATA:
      lt_icont TYPE TABLE OF icont,
      ls_icont TYPE icont,
      ls_icon  TYPE ys_icon.

    FIELD-SYMBOLS:
      <ls_icon> TYPE ys_icon.

    SELECT * FROM icon INTO CORRESPONDING FIELDS OF TABLE et_icon.
    SORT et_icon BY id.

    SELECT * FROM icont INTO TABLE lt_icont WHERE langu EQ 'E'.
    SORT lt_icont BY id.

    LOOP AT et_icon ASSIGNING <ls_icon>.

      READ TABLE lt_icont INTO ls_icont WITH KEY id = <ls_icon>-id.
      IF sy-subrc EQ 0.
        <ls_icon>-shorttext = ls_icont-shorttext.
        <ls_icon>-quickinfo = ls_icont-quickinfo.
      ENDIF.

      CALL FUNCTION 'NLS_BIDI_ICON'
        EXPORTING
          id4    = <ls_icon>-id
        IMPORTING
          bidi   = <ls_icon>-bidi
        EXCEPTIONS
          OTHERS = 0.

      CONCATENATE c_thtxt_internal '/s_' <ls_icon>-internal+1(6) c_extension_gif
             INTO <ls_icon>-listicon.
      TRANSLATE <ls_icon>-listicon TO LOWER CASE.

      <ls_icon>-olength = <ls_icon>-oleng.
      <ls_icon>-css_id = 'id' && <ls_icon>-id+1(2).

    ENDLOOP.

    READ TABLE et_icon INTO ls_icon WITH KEY id = icon_message_critical.
    IF sy-subrc EQ 0.
      DELETE et_icon INDEX sy-tabix.
      INSERT ls_icon INTO et_icon INDEX 1.
    ENDIF.

  ENDMETHOD.

  METHOD take_screenshot.

    DATA:
      lc_mime_type TYPE string,
      lx_image     TYPE xstring,
      lc_filename  TYPE string.

    CALL METHOD cl_gui_frontend_services=>get_screenshot
      IMPORTING
        mime_type_str = lc_mime_type
        image         = lx_image
      EXCEPTIONS
        OTHERS        = 1.
    CHECK sy-subrc EQ 0.

    IF lc_mime_type NE 'image/png'.
      CALL METHOD convert_format
        EXPORTING
          ic_src_mimetype = lc_mime_type
          ic_trg_mimetype = 'image/png'
        CHANGING
          cx_data         = lx_image.
    ENDIF.

    CONCATENATE ms_param-workdir ms_param-background
           INTO lc_filename.
    CALL METHOD download
      EXPORTING
        ix_data     = lx_image
        ic_filename = lc_filename.

  ENDMETHOD.

  METHOD convert_format.

    DATA:
      li_filesize  TYPE i,
      lo_converter TYPE REF TO cl_igs_image_converter,
      lt_blob      TYPE w3mimetabtype,
      li_blob_size TYPE  w3param-cont_len,
      li_number    TYPE i,
      lc_message   TYPE string,
      li_count     TYPE i,
      lc_blob_type TYPE w3param-cont_type,
      li_index     TYPE i.

    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer        = cx_data
      IMPORTING
        output_length = li_filesize
      TABLES
        binary_tab    = lt_blob.

    CREATE OBJECT lo_converter.

    li_blob_size = li_filesize.
    CALL METHOD lo_converter->set_image
      EXPORTING
        blob      = lt_blob
        blob_size = li_blob_size.

    lo_converter->input = ic_src_mimetype.
    lo_converter->output = ic_trg_mimetype.

    CALL METHOD lo_converter->execute
      EXCEPTIONS
        communication_error = 1
        internal_error      = 2
        external_error      = 3.

    CALL METHOD lo_converter->get_error
      IMPORTING
        number  = li_number
        message = lc_message.

    li_count = lo_converter->get_image_count( ).

    DO li_count TIMES.
      CLEAR:
        lt_blob,
        li_blob_size,
        lc_blob_type.

      ADD 1 TO li_index.
      CALL METHOD lo_converter->get_image
        EXPORTING
          index     = li_index
        IMPORTING
          blob      = lt_blob
          blob_size = li_blob_size
          blob_type = lc_blob_type.

      CLEAR:
        cx_data.

      li_filesize = li_blob_size.
      CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
        EXPORTING
          input_length = li_filesize
        IMPORTING
          buffer       = cx_data
        TABLES
          binary_tab   = lt_blob
        EXCEPTIONS
          failed       = 1
          OTHERS       = 2.

    ENDDO.

  ENDMETHOD.

  METHOD download.

    DATA:
      lt_data     TYPE TABLE OF tbl1024,
      li_filesize TYPE i.

    CALL FUNCTION 'SCMS_XSTRING_TO_BINARY'
      EXPORTING
        buffer        = ix_data
      IMPORTING
        output_length = li_filesize
      TABLES
        binary_tab    = lt_data.

    CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
        bin_filesize            = li_filesize
        filename                = ic_filename
        filetype                = 'BIN'
      CHANGING
        data_tab                = lt_data
      EXCEPTIONS
        file_write_error        = 1
        no_batch                = 2
        gui_refuse_filetransfer = 3
        invalid_type            = 4
        no_authority            = 5
        unknown_error           = 6
        header_not_allowed      = 7
        separator_not_allowed   = 8
        filesize_not_allowed    = 9
        header_too_long         = 10
        dp_error_create         = 11
        dp_error_send           = 12
        dp_error_write          = 13
        unknown_dp_error        = 14
        access_denied           = 15
        dp_out_of_memory        = 16
        disk_full               = 17
        dp_timeout              = 18
        file_not_found          = 19
        dataprovider_exception  = 20
        control_flush_error     = 21
        not_supported_by_gui    = 22
        error_no_gui            = 23
        OTHERS                  = 24.

  ENDMETHOD.

  METHOD write_px.

    ec_result = ii_int.

    IF ii_int LT 0.
      SHIFT ec_result RIGHT DELETING TRAILING '-'.
      SHIFT ec_result LEFT DELETING LEADING ' '.
      CONCATENATE '-' ec_result INTO ec_result.
    ELSE.
      SHIFT ec_result LEFT DELETING LEADING ' '.
    ENDIF.

    CONCATENATE ec_result 'px' INTO ec_result.
    CONDENSE ec_result NO-GAPS.

  ENDMETHOD.

ENDCLASS.

TABLES:
  sscrfields.

DATA:
  go_fl   TYPE REF TO lcl_flow_logic,
  gc_hide TYPE sy-ucomm.

SELECTION-SCREEN FUNCTION KEY 1.
SELECTION-SCREEN FUNCTION KEY 2.
SELECTION-SCREEN FUNCTION KEY 3.

PARAMETERS:
  p_thm TYPE string LOWER CASE MODIF ID thm.

SELECTION-SCREEN BEGIN OF BLOCK act WITH FRAME.
PARAMETERS:
  p_act1 TYPE abap_bool RADIOBUTTON GROUP act USER-COMMAND action,
  p_act2 TYPE abap_bool RADIOBUTTON GROUP act,
  p_act3 TYPE abap_bool RADIOBUTTON GROUP act.
PARAMETERS:
  p_dir TYPE string LOWER CASE.
SELECTION-SCREEN END OF BLOCK act.

SELECTION-SCREEN BEGIN OF BLOCK css WITH FRAME.
PARAMETERS:
  p_col TYPE i,
  p_lef TYPE i,
  p_top TYPE i,
  p_wid TYPE i,
  p_hei TYPE i,
  p_bgd TYPE string LOWER CASE,
  p_css TYPE string LOWER CASE.
SELECTION-SCREEN END OF BLOCK css.

LOAD-OF-PROGRAM.
  CREATE OBJECT go_fl.
  PERFORM move_back.

INITIALIZATION.
  PERFORM localization.
  PERFORM move.
  go_fl->ev_initialization( CHANGING cs_sscrfields = sscrfields ).
  PERFORM move_back.

AT SELECTION-SCREEN.
  PERFORM move.
  go_fl->ev_at_selection_screen( ).
  PERFORM move_back.

START-OF-SELECTION.
  PERFORM move.
  go_fl->ev_start_of_selection( ).
  PERFORM move_back.

AT LINE-SELECTION.
  go_fl->ev_at_line_selection( gc_hide ).

FORM localization.

  DATA:
    li_blk     TYPE i,
    lc_caption TYPE string.

  FIELD-SYMBOLS:
    <lc_text> TYPE any.

  DEFINE _localization_settext.
    ASSIGN (&1) TO <lc_text>.
    CHECK sy-subrc EQ 0.
    <lc_text> = lcl_flow_logic=>get_text( &2 ).
  END-OF-DEFINITION.

  LOOP AT SCREEN.
    CASE screen-group3.
      WHEN 'BLK'.
        ADD 1 TO li_blk.
        CASE li_blk.
          WHEN 1.
            _localization_settext screen-name 'B_ACT'.
        ENDCASE.
      WHEN 'PAR'.
        lc_caption = '%_' && screen-name && '_%_APP_%-TEXT'.
        _localization_settext lc_caption screen-name.
    ENDCASE.

  ENDLOOP.

ENDFORM.

FORM move.
  go_fl->ms_param-callback = sy-repid.
  go_fl->ms_param-ok_code = sy-ucomm.
  CASE abap_true.
    WHEN p_act1.
      go_fl->ms_param-action = go_fl->c_action_1.
    WHEN p_act2.
      go_fl->ms_param-action = go_fl->c_action_2.
    WHEN p_act3.
      go_fl->ms_param-action = go_fl->c_action_3.
  ENDCASE.
  go_fl->ms_param-workdir = p_dir.
  go_fl->ms_param-screen_size = p_col.
  go_fl->ms_param-left       = p_lef.
  go_fl->ms_param-top        = p_top.
  go_fl->ms_param-width      = p_wid.
  go_fl->ms_param-height     = p_hei.
  go_fl->ms_param-background = p_bgd.
  go_fl->ms_param-css        = p_css.
*  go_fl->ms_param-css_prefix = p_csp.
ENDFORM.

FORM move_back.
  sy-ucomm = go_fl->ms_param-ok_code.
  p_thm = go_fl->ms_param-theme_text.
  CLEAR: p_act1,p_act2,p_act3.
  CASE go_fl->ms_param-action.
    WHEN go_fl->c_action_1.
      p_act1 = abap_true.
    WHEN go_fl->c_action_2.
      p_act2 = abap_true.
    WHEN go_fl->c_action_3.
      p_act3 = abap_true.
  ENDCASE.
  p_dir = go_fl->ms_param-workdir.
  p_col = go_fl->ms_param-screen_size.
  p_lef = go_fl->ms_param-left.
  p_top = go_fl->ms_param-top.
  p_wid = go_fl->ms_param-width.
  p_hei = go_fl->ms_param-height.
  p_bgd = go_fl->ms_param-background.
  p_css = go_fl->ms_param-css.
*  p_csp = go_fl->ms_param-css_prefix.
ENDFORM.

FORM hide USING is_hide TYPE lcl_flow_logic=>ys_hide.
  WRITE: /(4) is_hide-icon AS ICON,
           is_hide-message.
  gc_hide = is_hide-ok_code.
  HIDE gc_hide.
ENDFORM.
To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply