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

dynamic icon in the table control

0 Likes
1,969

hi friends ,

I wanna to place a command with the icon changing when the status changed .Pls show me how .Thks .

hi friends ,

I wanna to place a command with the icon changing when the status changed .Pls show me how .Thks .

10 REPLIES 10
Read only

Former Member
0 Likes
1,780

Hello,

based on your criteria pass the icon name to Function Module as shown below.

I have just created an example program.

let the declaration of wa_vbrp-icon be type string.

loop at it_vbrp into wa_vbrp.

if wa_vbrp-posnr = '000020'.

v_name = 'ICON_GREEN_LIGHT'.

else.

v_name = 'ICON_YELLOW_LIGHT'.

endif.

CALL FUNCTION 'ICON_CREATE'

EXPORTING

NAME = v_name

IMPORTING

RESULT = wa_vbrp-icon

EXCEPTIONS

ICON_NOT_FOUND = 1

OUTPUTFIELD_TOO_SHORT = 2

OTHERS = 3.

modify it_vbrp from wa_vbrp index sy-tabix.

endloop.

Please note that the output parameter should be input disabled or else you will get the native format instead of the icon

Hope this helps.

Regards,

Ravi Kiran

Read only

0 Likes
1,780

I try it ,but failed .I don't know how to display the icon in the command .but i get it in text not in graphic .

Read only

0 Likes
1,780

Hi,

What do you mean by command? In table control you can make one of your column for displaying the ICON. Create a column of type Text field. Give a name to this field.

Give a name exmaple, your internal table is IT_STATUS and field name is ICON.

Loop at IT_STATUS into WA_STATUS.

if WA_STATUS-STATUS = 'X'.

WA_STATUS-ICON = 'ICON_GREEN_LIGHT'. "U can use ICON_CREATE fm also

else.

WA_STATUS-ICON = 'ICON_RED_LIGHT'.

endif.

This code should be written in PBO of the screen. The screen field should be given the name WA_STATUS-ICON.

Thanks,

Lakshmi

Edited by: Santhanalakshmi V on Dec 4, 2008 1:16 PM

Read only

0 Likes
1,780

This message was moderated.

Read only

0 Likes
1,780

As earlier told to you.

Make the field input disabled , then you would be able to see the image and not the text.

Regards,

Ravi Kiran

Read only

0 Likes
1,780

I'm afraid I couldn't undstand the way to sovle this promble ,for the field is not inputable at all .So as if it missed again .I want to diplay a command with the icon changed when the status changed .Someone told me the way using FM 'ICON_CREATE' .yes ,it seems suitable ,but when I try it ,it diplay the text on the button ,not the icon itself . I dont know whether there is somthing wrong with my declaration for the variable .

Read only

0 Likes
1,780

hI jACK

I am trying to get it .

as these text store in the table D021T and able to modify the table where the text can be modified to the ICON from PUSHBUTTON.

MODULE status_0100 OUTPUT.

  • SET PF-STATUS 'xxxxxxxx'.

  • SET TITLEBAR 'xxx'.

DATA RESULT(60).

LOOP AT SCREEN.

IF screen-name = 'BB'.

CALL FUNCTION 'ICON_CREATE'

EXPORTING

name = 'ICON_GREEN_LIGHT'

  • TEXT = ' '

  • INFO = ' '

  • ADD_STDINF = 'X'

IMPORTING

RESULT = RESULT

  • EXCEPTIONS

  • ICON_NOT_FOUND = 1

  • OUTPUTFIELD_TOO_SHORT = 2

.

UPDATE D021T SET DTXT = RESULT WHERE PROG = 'ZMTEST_99'.

MODIFY SCREEN.

endif.

ENDLOOP.

ENDMODULE. " STATUS_0100 OUTPUT

still i am trying .

I will come back to you.

Regards

Ramchander Rao.K

Read only

0 Likes
1,780

HI Ravi,

Did you get it,

Regards

Ramchander Rao.K

Read only

0 Likes
1,780

Hi

If your program displays the text (icon-name) instead of the icon,

you have to change the field-type from CHAR to STRG in the dynpro.

Best regards

Read only

Former Member
0 Likes
1,780

Hi

Use the FM ICON_CREATE

pass 'icon_green_light' to the FM you will get the icon displayed

take the help of KEY word documenation on ICON key word there is an example tooo

regards

Ramchander Rao.K

Edited by: ramchander krishnamraju on Dec 4, 2008 9:30 AM