Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Dinamically display an icon on a dynpro

Former Member
0 Kudos
3,238

Hi!

I would like to display dinamically an icon on a dynpro. It depends on the difference between 2 fields, what kind of icon should appear. If the difference is higher than 20% it should be a red, 20-0 yellow, 0 green icon.

What control am I supposed to use on the screen painter and how can I put an icon to the screen?

Thank you

Tamá

1 ACCEPTED SOLUTION

Former Member
0 Kudos
540

Hi,

use function mudule

ICON_CREATE

this will create the icon ..use this after you calculation has been done for the difference

thanks

vivekanand

5 REPLIES 5

Former Member
0 Kudos
541

Hi,

use function mudule

ICON_CREATE

this will create the icon ..use this after you calculation has been done for the difference

thanks

vivekanand

Former Member
0 Kudos
540

REPORT demo_dynpro_status_icons.

DATA value TYPE i VALUE 1.

DATA: status_icon TYPE icons-text,

icon_name(20) TYPE c,

icon_text(10) TYPE c.

CALL SCREEN 100.

MODULE set_icon OUTPUT.

SET PF-STATUS 'SCREEN_100'.

CASE value.

WHEN 1.

icon_name = 'ICON_GREEN_LIGHT'.

icon_text = text-003.

WHEN 2.

icon_name = 'ICON_YELLOW_LIGHT'.

icon_text = text-002.

WHEN 3.

icon_name = 'ICON_RED_LIGHT'.

icon_text = text-001.

ENDCASE.

CALL FUNCTION 'ICON_CREATE'

EXPORTING

name = icon_name

text = icon_text

info = 'Status'

add_stdinf = 'X'

IMPORTING

result = status_icon

EXCEPTIONS

icon_not_found = 1

outputfield_too_short = 2

OTHERS = 3.

CASE sy-subrc.

WHEN 1.

MESSAGE e888(sabapdocu) WITH text-004.

WHEN 2.

MESSAGE e888(sabapdocu) WITH text-005.

WHEN 3.

MESSAGE e888(sabapdocu) WITH text-006.

ENDCASE.

ENDMODULE.

MODULE cancel INPUT.

LEAVE PROGRAM.

ENDMODULE.

MODULE change.

CASE value.

WHEN 1.

value = 2.

WHEN 2.

value = 3.

WHEN 3.

value = 1.

ENDCASE.

ENDMODULE.

Former Member
0 Kudos
540

Hi

This is my old code in order to load an incon in the dynpro:

  IF FL_BLOC = 'X'.
    V_ICON_NAME = 'ICON_LOCKED'.
    V_TEXT      = TEXT-109.
    V_INFO      = TEXT-110.
  ELSE.
    IF FL_ELAB = SPACE.
      V_ICON_NAME = 'ICON_GREEN_LIGHT'.
      V_TEXT      = TEXT-107.
      V_INFO      = TEXT-111.
    ELSE.
      V_ICON_NAME = 'ICON_RED_LIGHT'.
      V_TEXT      = TEXT-108.
      V_INFO      = TEXT-112.
    ENDIF.
  ENDIF.
  CALL FUNCTION 'ICON_CREATE'
       EXPORTING
            NAME   = V_ICON_NAME
            TEXT   = V_TEXT
            INFO   = V_INFO
       IMPORTING
            RESULT = V_ICON_TEXT.

This code is placed in a module of PBO and V_ICON_TEXT is the input field in the dynpro where the icon and a description are loaded.

For my program V_ICON_TEXT is a fields 45 char long.

Max

Former Member
0 Kudos
540

Hi Tamas,

<b>Handling Web Icons</b>

http://help.sap.com/saphelp_erp2005/helpdata/en/ec/bb08428dab5f24e10000000a1550b0/content.htm

<b>Icon display on list with description</b>

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 ...

Regards,

Kumar.

Former Member
0 Kudos
540

This message was moderated.