cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying an image in a cell of a table

Former Member
0 Kudos

Hi,

Is it possible to display an image in the table cell? If yes please let me know.

Thanks

Raghavendra

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

yes it is possible to display image in table cell.

create a cell of property image and bind it.

Yogesh N

Former Member
0 Kudos

Yes it is possible check below code.

method get_flight_details .
  data:
    node_search  type ref to if_wd_context_node,
    elem_search  type ref to if_wd_context_element,
    stru_search  type if_componentcontroller=>element_search,
    node_flights type ref to if_wd_context_node,
    it_flights type if_componentcontroller=>elements_flights,
    wa_flights type if_componentcontroller=>element_flights.

* navigate from <CONTEXT> to <SEARCH> via lead selection
  node_search = wd_context->get_child_node( name =
if_componentcontroller=>wdctx_search ).

* get element via lead selection
  elem_search = node_search->get_element(  ).

* get all declared attributes
  elem_search->get_static_attributes(
    importing
      static_attributes = stru_search ).

* Navigate from <CONTEXT> to <FLIGHTS> via lead selection
  node_flights = wd_context->get_child_node( name = 'FLIGHTS' ).
  if stru_search is not initial.
  select * from sflight
  into corresponding fields of table it_flights
  where carrid = stru_search-carrid and
        connid = stru_search-connid.
  endif.
  loop at it_flights into wa_flights.
   wa_flights-status = 'ICON_RED_LIGHT'.
   modify it_flights from wa_flights transporting status.
  endloop.

  node_flights->bind_table(
      new_items            = it_flights
*      SET_INITIAL_ELEMENTS = ABAP_TRUE
*      INDEX                = INDEX
         ).
endmethod.

method WDDOINIT .

*ALV Component usage
DATA: l_ref_cmp_usage TYPE REF TO if_wd_component_usage.

l_ref_cmp_usage =   wd_this->wd_cpuse_alv( ).
IF l_ref_cmp_usage->has_active_component( ) IS INITIAL.
  l_ref_cmp_usage->create_component( ).
ENDIF.

*Call Get_model() of Interface Controller to set changes to the output
*table

DATA: l_ref_interfacecontroller TYPE REF TO iwci_salv_wd_table .
l_ref_interfacecontroller =   wd_this->wd_cpifc_alv( ).
  DATA:
    l_value TYPE REF TO cl_salv_wd_config_table.

  l_value = l_ref_interfacecontroller->get_model(
  ).

* Set visible rows
  l_value->IF_SALV_WD_TABLE_SETTINGS~SET_VISIBLE_ROW_COUNT( '7' ).

* Set Image to the table
data:l_column type ref to cl_salv_wd_column,
     l_image type ref to cl_salv_wd_uie_image,
     value1 type string.

l_column = l_value->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'SEATSOCC' ).
create object l_image.

l_image->set_source_fieldname( value = 'STATUS' ).
l_column->set_cell_editor( value = l_image ).

enmethod.

also check this Article

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/wdabap/main

thanks

Suman

Edited by: suman kumar chinnam on Aug 25, 2008 11:07 AM

Former Member
0 Kudos

Hi,

I need to display the image rather than an icon and i need to display it on the table control not on ALV.

Thanks

Raghavendra

Former Member
0 Kudos

hi,

you can use MIME object to display image in your table control

Yogesh N

Edited by: Yogesh N on Aug 25, 2008 5:52 AM

Former Member
0 Kudos

Please follow below steps...

1.Right click on component ->MIME Object->Import

now import required image of type bmp or any

2.Right click on Table UI Element then select insert table column.

3.Right click on new column->insert cell editor

now a pop up comes, enter name and select UI Element Image from drop down.

4.Go to properties of Image

press F4 in source and select image from MIME.

it will insert image into table.

Thanks

Suman