Application Development and Automation 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: 
Read only

status icon in module pool

Former Member
0 Likes
5,160

hi experts,

in module pool, screen elements, we have status icon.

plz some one tell me, whats the purpose of it, n its usage also. if possible give me a small example.

thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,480

Hi,

Status icon is used in screens to indicate visually about the status of the program.Before the status icon can be used ,it should be placed on the screen,it is a type of screen element.

To use the status icon we have to write some abap code and also to change icons whenever required in the program. First step is to create a variable of type ICONS-TEXT.

e.g. DATA: status TYPE ICONS-TEXT.

The name of the variable in the abap program should be same as that of in the screen.

Declaring it merely wont show anything , we have to use the function module ICON_CREATE to fill it with the required icon, generally PBO of the screen is used for this purpose. There are 3 parameters to be passed.

CALL FUNCTION 'ICON_CREATE'

EXPORTING

NAME = 'icon name'

TEXT = 'text to be displayed'

INFO = 'tooltip text'

Here name can be anything like ICON_RED_LIGHT,ICON_GREEN_LIGHT etc. Infact any icon can be shown that exists but we should adhere to SAP

recommended style guidelines

Reward if useful.

Regards,

Swetha.

hi experts,

in module pool, screen elements, we have status icon.

plz some one tell me, whats the purpose of it, n its usage also. if possible give me a small example.

thanks in advance.

4 REPLIES 4
Read only

Former Member
0 Likes
2,481

Hi,

Status icon is used in screens to indicate visually about the status of the program.Before the status icon can be used ,it should be placed on the screen,it is a type of screen element.

To use the status icon we have to write some abap code and also to change icons whenever required in the program. First step is to create a variable of type ICONS-TEXT.

e.g. DATA: status TYPE ICONS-TEXT.

The name of the variable in the abap program should be same as that of in the screen.

Declaring it merely wont show anything , we have to use the function module ICON_CREATE to fill it with the required icon, generally PBO of the screen is used for this purpose. There are 3 parameters to be passed.

CALL FUNCTION 'ICON_CREATE'

EXPORTING

NAME = 'icon name'

TEXT = 'text to be displayed'

INFO = 'tooltip text'

Here name can be anything like ICON_RED_LIGHT,ICON_GREEN_LIGHT etc. Infact any icon can be shown that exists but we should adhere to SAP

recommended style guidelines

Reward if useful.

Regards,

Swetha.

Read only

Former Member
0 Likes
2,480

Pseudocode is you can use for understanding

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.

This link may be help ful

http://help.sap.com/saphelp_nw04s/helpdata/en/59/348efa61c611d295750000e8353423/frameset.htm

Reward points..

Read only

Former Member
0 Likes
2,480

Hello,

This link may be help ful

http://help.sap.com/saphelp_nw04s/helpdata/en/59/348efa61c611d295750000e8353423/frameset.htm

and also check this....


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.
 

Read only

Former Member
0 Likes
2,480

Hi,

Status icons

Status icons are display elements that you can use to represent the state of a program graphically. In principle you can use any of the icons available in the SAP GUI but the choice should be limited to those icons specifically for this purpose.

You can only create status icons in the graphical Screen Painter. When you create one, you assign a name and a screen field to it. This screen field is known as a status field. The visible length of the screen field determines the amount of space that the icon can take up on the screen. As well as the icon itself, you can also place text in the field. The actual length (defLg) of the status field must be long enough for the internal representation of the icon, plus any text and quickinfo text that you specify. When you create the status icon in the Screen Painter, a placeholder appears on the screen. You must specify the icon itself and its text and quickinfo text in the PBO event of your ABAP program.

In order to define the icon in your ABAP program, you must create a field with the same name as the status field on the screen and the ABAP Dictionary type ICONS-TEXT. You can then fill this field with the required technical information in the PBO event. When the screen is displayed, the information is transferred to the status field and the icon appears.

To fill the field in your ABAP program, use the function module ICON_CREATE. It has the following import parameters:

· surname

The name of the required icon. These are listed in the include program , or the corresponding input help in the Screen Painter or Menu Painter.

· text

This parameter allows you to enter a text that will appear after the icon on the screen.

· info

In this parameter, you can specify a quickinfo text, which appears whenever the mouse pointer is positioned over the icon.

· add_stdinf

This flag switches the quickinfo display on or off.

The function module converts these parameters into a single string, which is returned in the export parameter result. When you assign the result parameter to the status field, it contains all the information required to display the status icon.

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

The next screen (statically defined) for screen 100 is 100. It has the following static layout:

The screen contains a status field called status_icon with a visible length of 12 and defined length 26. The status icon and the space for the text are represented by placeholders in the Screen Painter.

The screen flow logic is as follows:

PROCESS BEFORE OUTPUT.

MODULE set_icon.

PROCESS AFTER INPUT.

MODULE cancel AT EXIT-COMMAND.

MODULE change.

The dialog module set_icon passes various values to the function module ICON_CREATE, depending on the values of the fields in the program. The status field status_icon is filled with the contents of the export parameter result of the function module. The corresponding icon with its text and quickinfo is then displayed on the screen. When the user chooses Continue, the contents of the field valueare changed in the PAI, and consequently a new icon is defined in the PBO event. The following icons and texts are displayed:

Low

Middle

High

The quickinfo text is u2018Statusu2019 for all of the icons.

Regards,

Raj.