Hi Claudio,
as far as I know there is no method to calculate the
sum of a column in the tableview, but you can do this
easily by yourself. Just loop over the entries of your
internal table and add them.
It is possible to render the text of the tableview cells
by using the html_bee. Let me show this in more detail:
<code>
*<b>Layout</b>
<htmlb:tableView id = "tvX"
table = "<%= t %>"
headerText = "some text"
headerVisible = "true"
design = "alternating"
fillUpEmptyRows = "true"
iterator = "<%=application->get_iterator( )%>" />
</code>
This is a tableview where the iterator will be created inside by a method of the application class.
For writing the iterator there are three interesting parts. The parts are (a) how to instantiate the iterator,
(b) how to define the iterator, and (c) the implementation.
For the instantiation, the best way is to use a local class inside the application class. So using se80, load the application class, and implement the "get_iterator( )" method. The typical source code will be:
method GET_ITERATOR. " returning iterator TYPE REF TO IF_HTMLB_TABLEVIEW_ITERATOR
CREATE OBJECT iterator TYPE CL_MY_ITERATOR.
endmethod.
For the iterator class definition, select the application class in se80. Ultra important: you must double click in the left pane on the class root node, and see in the left page, all the methods of the class. Press the "Type" button ("Typen" in DE). This is the place where local definitions can be made. The source code is:
class CL_MY_ITERATOR definition.
public section.
interfaces IF_HTMLB_TABLEVIEW_ITERATOR.
endclass.
For the implementation of the iterator class, you have to first go to the root node of the class in the left pane, and double click there. Then select the "Implementation" button ("Impl" in DE). There the code is
<code>
class CL_MY_ITERATOR implementation.
method IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS.
endmethod.
method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_ROW_START.
endmethod.
method IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START.
data: html_bee type ref to cl_bsp_bee_html.
data: col_value type string.
<row> is a structure of table
field-symbols: <row> type any, <col> type any.
conventional logic to extract column value
assign p_row_data_ref->* to <row>.
assign component p_column_key of structure <row> to <col>.
col_value = <col>.
create object html_bee.
set HTML code you want...add() can have up to 10 params for concatenation
html_bee->add( html = '<em>'
html1 = col_value
html2 = '</em>' ).
p_replacement_bee = html_bee.
endmethod.
endclass.
</code>
In this special case we only need the method for the cell rendering.
I've tried it and all entries in the tableview were rendered emphasized.
Hoping this helps and gives you a hint for manipulating cell entries.
Rainer
Add a comment