SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → User Dialogs → Screens → Screen and Screen Elements → Screen Elements - Examples →Screens, Status Icons
This example illustrates status icons on screens.
Source Code
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(sabapdemos) WITH text-004.
WHEN 2.
MESSAGE e888(sabapdemos) WITH text-005.
WHEN 3.
MESSAGE e888(sabapdemos) 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.
Description
The static next screen number of screen 100 is 100. It is a status field named status_icon created with a visible length of 16 and a defined length of 26. The status icon and the space for a text are indicated by symbols in the Screen Painter. The screen flow logic is as follows:
Depending on the value field local in the program, the dialog module set_icon passes different values to the function module ICON_CREATE. The status field status_icon is filled with its export parameter result. This displays the corresponding icon including the text and quick info on the screen. If the Continue button is chosen, the field value is changed at PAI so that a different icon is defined at PBO.