Skip to Content
0
Former Member
Jul 10, 2007 at 08:46 AM

Image Column in Tableview

24 Views

Hi all,

here's the thing: I'm trying to add an image column to a tableview but it doesn't work (there's no error, but the image doesn't appear). I've tried it with an iterator.

Page Layout:

<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design           = "design2003"
               controlRendering = "SAP" >
  <htmlb:document>
    <htmlb:documentHead>
    </htmlb:documentHead>
    <htmlb:documentBody>
      <htmlb:form>
        <htmlb:tableView id            = "tableview_scarr"
                         table         = "<%= pa_tab_scarr %>"
                         headerText    = "Table SCARR"
                         headerVisible = "TRUE"
                         iterator      = "<%= application %>" >
        </htmlb:tableView>
        <%
  IF page->messages->num_messages( ) > 0.
        %>
        Error
        <%
  ENDIF.
        %>
      </htmlb:form>
    </htmlb:documentBody>
  </htmlb:document>
</htmlb:content>

OnInitialization:

SELECT * FROM scarr INTO TABLE pa_tab_scarr.

My application class is my iterator. It implements GET_COLUMN_DEFINITIONS:

METHOD if_htmlb_tableview_iterator~get_column_definitions.
  DATA tv_column TYPE tableviewcontrol.

  tv_column-columnname          = 'SHOW_ICON'.
  tv_column-title               = 'SHOW_ICON'.
  tv_column-encode = 'X'.
  tv_column-width               = '100'.
  APPEND tv_column TO p_column_definitions.

  CLEAR tv_column.
  tv_column-columnname          = 'CARRID'.
  tv_column-width               = '100'.
  APPEND tv_column TO p_column_definitions.

ENDMETHOD.

...and it implements RENDER_CELL_START:

METHOD if_htmlb_tableview_iterator~render_cell_start.
  CASE p_column_key.
    WHEN 'SHOW_ICON'.
      DATA col_image TYPE REF TO cl_htmlb_image.
      CREATE OBJECT col_image.
      col_image->src = "@2N@".
      col_image->width = '16'.
      col_image->height = '14'.

      p_replacement_bee = col_image.
  ENDCASE.
ENDMETHOD.

I've checked the SICF, but all services concerning icons are activated. This is my first Iterator so i'm not sure if i've forgotten something. Why the image is not shown?

Regards

Mark-André