1. Define Fields
Data: status_icon type icons-text.
2. Create a screen and create a "status icon" control on the screen definition. The control is named status_icon.
3. Use the icon_create function to set the icon in the output.
Call function 'icon _ create'
Exporting
Name = 'icon _ green_light'
TEXT = 'text displayed after the icons'
Info = 'hup'
Add_stdinf = 'X'
Importing
Result = status_icon
Exceptions
Icon_not_found = 1
Outputfield_too_short = 2
Others = 3.
4. Use the icon_show function to display and list sap icons.
Call function 'icon _ show 'exporting onlydisplay = 'X'
Exceptions no_object_found = 1
No_icon_selected = 2.
5. For an example of the icon, see the sap DEMO code: demo_dynpro_status_icons.
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 _ 000000 '.
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.