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

ICON IN SELECTION SCREEN

Former Member
0 Likes
2,316

HI ALL,

I want to add a icon in the selection screen.

Please send the sample code.Answers will be rewarded.

thanks in advance......

HI ALL,

I want to add a icon in the selection screen.

Please send the sample code.Answers will be rewarded.

thanks in advance......

6 REPLIES 6
Read only

Former Member
0 Likes
1,448

Hello,

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

Search for the DEMO_DYNPRO_STATUS_ICONS program in your system.

Regards,

Read only

Former Member
0 Likes
1,448

where do you want the icon? on the toolbar? On the screen in the input area?

When you push this icon, do you want it to do something like.. a Push Button?

Read only

0 Likes
1,448

Yes, when I click the icon,the out put should get displayed....

Read only

0 Likes
1,448

Sandeep,

Below sample code will help to put icon in selection screen

INCLUDE: <icon>.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME.

SELECTION-SCREEN BEGIN OF LINE.

SELECTION-SCREEN COMMENT 01(20) v_text FOR FIELD p_rfc.

PARAMETERS : p_rfc LIKE rfcdes-rfcdest DEFAULT 'D10CLNT888'.

SELECTION-SCREEN COMMENT 60(04) v_icon FOR FIELD p_rfc.

SELECTION-SCREEN END OF LINE.

SELECTION-SCREEN END OF BLOCK b1.

INITIALIZATION.

v_text = 'RFC Destination'.

v_icon = '@12@'. "icon_test.

Define your comment V_ICON and during initialization fill it with values of the corresponding icon you wish to display on the selection-screen.

regards

Saravanan

Read only

0 Likes
1,448

Just as an FYI in the above code, because you used the INCLUDE <icon> statement, this line


v_icon = '@12@'. "icon_test.

can be done this way


v_icon = ICON_TEST.      "icon_test.

Safer in the even SAP changes these values.

Read only

Former Member
0 Likes
1,448

Hi Sandeep,

To add Icon on selection screen...Just do the following :

GO TO --> Text Elements --> Selection Text

Now give the reqired ICON ID before your selection text.

You will get the Icon on selection screen.

You can get the Icon ID from Type Group ICON in se11.

Reward points, if useful..

Regards,

Nitin.