
SAP ABAP/JAVA DEVELOPER TIPS
Icon display on list with description
Subhas Chandra Bose 10.14.2002
Rating: -4.60- (out of 5) Hall of fame tip of the month winner




|
Generally, the icons on a list are displayed using the ABAP 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 ABAP 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 zsuresh_icon_on_screen_field .
*********************************************************
* Author : Subhas Chandra Bose *
* Date : 14-Oct-2002 *
*********************************************************
*********************************************************
* 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
 |

|
|
 |
|
 |