Icon Display on list with Description

Submitted by Chandra Bose

Generally, the icons on a list are displayed using the ABAPTM statement WRITE <symbol-name> AS ICON. But these icons do not have any description on their own. It might be difficult for the end user to understand the significance of that particular icon. So for that, we can make use of the function module ICON_CREATE. This function module can be used to display the icons similar to the above ABAPTM statement. But in this case, we will get the description of the icon(s), when we move the cursor over that icon.
This program was written in v. 4.6c

Code

REPORT z_icon_on_screen_field .

*********************************************************
* The icons on the list can be displayed using the      *
* statement WRITE <symbol-name> AS ICON           *
* but when we display the icons using the               *
* function module ICON_CREATE, we can get the           *
* description of the icon on moving the cursor          *
* over the icon                                         *
*********************************************************

* This program illustrates the differences between using
* the above two mentioned methods.......................

INCLUDE <icon>.

* declaring the work variables..........................................
DATA :
  icon_result  TYPE icons-text,
  icon_name(20) TYPE c,
  icon_text(20) TYPE c,
  icon_info LIKE icont-quickinfo.

* to display the user name with an icon...
WRITE : 'Using the statement WRITE <symbol-name> AS ICON'.
WRITE :/ icon_employee AS ICON, sy-uname.
SKIP.

WRITE :/ 'Using the function module ICON_CREATE'.

icon_name = 'ICON_EMPLOYEE'.
icon_text =  sy-uname.
icon_info = 'Employee Name'.

PERFORM iconcreation.
CONDENSE icon_result.
WRITE :/ icon_result.

*&---------------------------------------------------------------------*
*&      Form  iconcreation
*&---------------------------------------------------------------------*
* This subroutine is used to create the icons with the text
*----------------------------------------------------------------------*

FORM iconcreation.

  CALL FUNCTION 'ICON_CREATE'
       EXPORTING
            name                  = icon_name
            text                  = icon_text
            info                  = icon_info
            add_stdinf            = ' '
       IMPORTING
            result                = icon_result
       EXCEPTIONS
            icon_not_found        = 1
            outputfield_too_short = 2
            OTHERS                = 3.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

ENDFORM.                    " iconcreation

 

Please send us your feedback/suggestions at webmaster@SAPTechnical.COM 

HomeContribute About Us Privacy Terms Of Use • Disclaimer • SafeCompanies: Advertise on SAPTechnical.COM | Post JobContact Us  

Graphic Design by Round the Bend Wizards

footer image footer image