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
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP MM SD Consultant
Contact : serkurumsal@yandex.com
Social Plugin