cancel
Showing results for 
Search instead for 
Did you mean: 

Icon in table

0 Kudos

Hi, I have a question regarding icons in a table ui element.

I would like to show the user different icons depending some conditions and it's almost working.

I have added a status field binded to a field of lengh char255 of type image in the table to display the icon.

For the context node I am using a supply function to fill the table. In order to get the correct values for the entries I am using the function ICON_CREATE depending the conditons for each row in the table. In debugging mode I can see the correct icons are set in the status field.

But when rendering the table, the status field is not filled with an icon, but with an empty icon field, a red cross. Anyone that understands how to correct the problem?

Thank you and regards Lena

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi Ricardo, It did not help to change the attribute to ICON_D or STRING, I just tried.

Former Member
0 Kudos

You may want to try using

  ls_status-ikon  = '~Icon/RedLed'.

There is no need to use ICON_CREATE FM.

Answers (4)

Answers (4)

0 Kudos

Hi!

Thanks a lot for your replies.

I still have the problem though.

I use a supply function where I fill the table with values.

The code looks like below.

A function is called to the get the values for lt_table. ANd then:

lv_green_icon  = 'ICON_GREEN_LIGHT'.

lv_red_icon  = 'ICON_RED_LIGHT'.



  CALL FUNCTION 'ICON_CREATE'

          EXPORTING

            NAME           = lv_green_icon

         IMPORTING

           RESULT          = lv_green.

  CALL FUNCTION 'ICON_CREATE'

          EXPORTING

            NAME           = lv_red_icon

         IMPORTING

           RESULT          = lv_red.



** e.g. call a model function

  LOOP AT lt_table INTO ls_table.


    CASE ls_table-status.

      WHEN 'APPROVED'.

    ls_status-ikon = lv_green. "'@08@'.

    WHEN OTHERS.

      ls_status-ikon = lv_red.

  ENDCASE.

APPEND ls_statusTO lt_status

ENDLOOP.

lo_nd_table->bind_table( new_items = lt_status set_initial_elements = abap_true ).

The table ui element column for status of type IMAGE  is bound to a context node table with a attribute of type scstring.

I debugging mode I can see that correct values are filled in table lt_table. But at screen I get an empty status field showing an image with a white square with a red cross inside.

Anyone having an idea?

thank you and regards Lena

RicardoRomero_1
Active Contributor
0 Kudos

Hi,

Change the type of your attribute to ICON_D or STRING.

former_member199126
Participant
0 Kudos

hi.

If you are using a structure to assign to the node types, the component type of that for the icon should be of scstring.

later you can directly assing the icon name to that node attribure which will display the icon.

Ex code:

  ls_display-status = 'ICON_YELLOW_LIGHT'.

append ls_display to lt_display.

This lt_display should bi bound to the node.

Regards,

Karthik .

RicardoRomero_1
Active Contributor
0 Kudos

Hi Lena,

Include the following sentence at the beginning of your method:

TYPE-POOLS: icon.

And then pass the name of the icon to your field. You can see the icons names through transaction ICON.


Regards,

Former Member
0 Kudos

Hi Lena,

while creating table you have to create Image Ui element to your column....

Pls see below screen... Then u can see photo..

and select column select the image and bind the attribute to source property.....

attribute type TOAURI-URI

Regards,

Regards,

Venkat