Here was another fun task I wanted my new ABAP Web Dynpro to be able to add an icon in a dynamic table column. Again, I expected this to be easy… well, not as much as I figured, so I thought it might be something you could use. (and I’m looking for some fun things to write about).
*** again, start with getting the reference to the table, and then getting all the columns
l_table ?= view->get_element( ID = ‘TB_XXX’ ).
lt_cols = l_table->get_columns( ).
LOOP AT lt_cols into wa_cols.
*** in this example, I want column DOC_ICON to show an icon, rather than text.
IF lv_col_fld = ‘DOC_ICON’.
*** for the correct column, you need to assign an image, rather than the standard text. In this ***example, I just needed to tell it what to bind for the value (remember, I had this value already,
***so I just need to assign the correct context node.
lv_image = cl_wd_image=>new_image( bind_source = ‘XXX.DOC_ICON’ ).
*** this is the magic. Telling it what cell editor to use what sets it as text vs. an Image.
Wa_cols->set_table_cell_editor( LV_IMAGE ).
ENDIF.
ENDLOOP.
And that’s the magic… Hope this can make your life easier… Because like the catchphrase goes, I learn things the hard way, so you don’t have to.
As always, thanks for reading and don't forget to check out our SAP Service Management Products at my other company JaveLLin Solutions,Mike
DATA TYPES????????????????????????
can you be more specific on what you are looking for?
Thanks,
Mike
hello,
I have to display image in each cell based on that cell value( value need to be replaced by icon/image).
i have created dynamic table and dynamic node and created table from node. using
create_c_table_from_node.
all table column are of type string and has some value for example.
in a table has 2 column and 2 row.
first column first cell has value ‘op’, so when there is op it need to be replace by green trafic icon.
and first column second cell has ‘cl’ so it need to be replace by red trafic icon.
similar to second column’s cell.
how to change cell of type text view to image type at run time deepend on value of that cell and display icon?