Logo on ABAP Selection Screen

First upload the logo into SAP system to display it on the SAP ABAP selection screen.

Split the selection screen using docking container and  use the HTML Viewer to display the logo.

TYPE-POOLS cndp.
*&---------------------------------------------------------------------*
*& Data Declaration.
*&---------------------------------------------------------------------*
DATA: docking    TYPE REF TO cl_gui_docking_container,
      htmlviewer TYPE REF TO cl_gui_html_viewer,
      picture    TYPE REF TO cl_gui_picture.

DATA url  TYPE cndp_url.
*&---------------------------------------------------------------------*
*& SELECTION SCREEN.
*&---------------------------------------------------------------------*
PARAMETERS: s_matnr TYPE mara-matnr.

*&---------------------------------------------------------------------*
*& AT SELECTION-SCREEN OUTPUT.
*&---------------------------------------------------------------------*
AT SELECTION-SCREEN OUTPUT.

  PERFORM build_htmlviewer.

  CALL METHOD picture->set_display_mode
    EXPORTING
      display_mode = cl_gui_picture=>display_mode_normal_center.


  CALL FUNCTION 'DP_PUBLISH_WWW_URL'
    EXPORTING
      objid    = 'ZLOGO'
      lifetime = cndp_lifetime_transaction
    IMPORTING
      url      = url
    EXCEPTIONS
      OTHERS   = 1.

* Load the picture.
  IF sy-subrc = 0.
    CALL METHOD picture->load_picture_from_url_async
      EXPORTING
        url = url.
  ENDIF.
*&---------------------------------------------------------------------*
*&      Form  build_htmlviewer
*&---------------------------------------------------------------------*
FORM build_htmlviewer .
  DATA: repid LIKE sy-repid.
  repid = sy-repid.

  IF docking IS INITIAL.

    CREATE OBJECT docking
      EXPORTING
        REPID                       = repid
        DYNNR                       = sy-dynnr
        SIDE                        = cl_gui_docking_container=>dock_at_top
        EXTENSION                   = 150
      EXCEPTIONS
        CNTL_ERROR                  = 1
        CNTL_SYSTEM_ERROR           = 2
        CREATE_ERROR                = 3
        LIFETIME_ERROR              = 4
        LIFETIME_DYNPRO_DYNPRO_LINK = 5
        others                      = 6.

    IF htmlviewer IS INITIAL .
      CREATE OBJECT picture
        EXPORTING
          parent             = docking .
    ENDIF .
  ENDIF .
ENDFORM.

Output

logo-sel-screen-1

We can also split the selection screen vertically and display the logo on right side of the selection screen using the side parameter of the docking container.

CREATE OBJECT docking
      EXPORTING
        REPID                       = repid
        DYNNR                       = sy-dynnr
        SIDE                        = cl_gui_docking_container=>dock_at_right
        EXTENSION                   = 500
      EXCEPTIONS
        CNTL_ERROR                  = 1
        CNTL_SYSTEM_ERROR           = 2
        CREATE_ERROR                = 3
        LIFETIME_ERROR              = 4
        LIFETIME_DYNPRO_DYNPRO_LINK = 5
        others                      = 6.

logo-sel-screen-2


1 Comment

Comments are closed.