on 12-13-2006 11:34 AM
hello everybody,
I wante to populate a values to a dropdownlist box in an iterator( tableView)
but I got no data !!
<u><i>Ps: I read data from table SFLIGHT.
SELECT * FROM SFLIGHT INTO TABLE itab.</i></u>
<u><b>This is the code:</b></u>
<b>METHOD if_htmlb_tableview_iterator~render_cell_start .</b>
WHEN 'CURRENCY'.
IF p_edit_mode IS NOT INITIAL.
p_replacement_bee = CL_HTMLB_DROPDOWNLISTBOX=>FACTORY(
id = p_cell_id
selection = m_row_ref->CURRENCY
table = me->m_currencies_ref
nameOfKeyColumn = 'NAME'
nameOfValueColumn = 'VALUE' ).
ENDIF.
endmethod.
Thanks in Advance.
Regards.
dav.
you read the data into an itab.
now declare a instance/public attirbute in the iterator class a table type
now create a constructor method in the iterator class with import parameter for this table type
and while creating theinstance of iterator in BSP
do this
create object iterator type ycl_tv_iterator
exporting
col_def = pers_tab .
now you can referencethis itab within your methods initerator class to get data
Regards
Raja
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks for your replying!
in my Application i don't used a seperate Iterator class!!
I'v just implement the <u>Iterator Interface</u> into my Controller Class and than I redefine The 3 Methods:
IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS.
IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_ROW_START.
IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START
I define also Attribute 'M_CURRENCIES_REF' in my controller Class.
M_CURRENCIES_REF <b>Type ref to</b> TIHTTPNVP.
can you please explane me exactelly, what may have do??
Thanks.
Devid,
You can NOT use your Application class & Iterator class as same. YOu need to create a separate Iterator class separately lets say "ZCL_ITR" and then you need to Pass the Instance of your application class to Iterator class COnstructor so that Iterator class can retrieve the data from Application class.
Here are the Steps. Its working example. I tested it. Let me know if you have any issue.
<b>Note:</b> For testing purppose i used my own variable,but as your need change it.
<b>1. Create the following variables in ZCL_PROJECT(Application Class</b>)
ITAB Instance Attribute Public Type FLIGHTTAB
CONNIDS Instance Attribute Public Type FLIGHTTAB
APPL Instance Attribute Public Type Ref To ZCL_PROJECT
<b>2. Create the Iterator ZCL_ITR & Implement the Interface -</b>
IF_HTMLB_TABLEVIEW_ITERATOR
<b>3. Create the Class Parameters:</b>
APPL Instance Attribute Public Type Ref To ZCL_PROJECT
<b>4. Create the Method: CONSTRUCTOR and with Method Parameter in the Iterator Class</b>
APPL_CONS Type Ref To ZCL_PROJECT
method CONSTRUCTOR.
me->appl = appl_cons.
endmethod.
<b>5. Iterator Code as follows:</b>
method IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS.
CLEAR p_column_definitions.
CLEAR p_overwrites.
DATA: tv_column TYPE TABLEVIEWCONTROL.
tv_column-COLUMNNAME = 'FLDATE'.
tv_column-edit = 'X'.
tv_column-sort = 'X'.
tv_column-TITLE = 'Flight Date'.
tv_column-WIDTH = '100'.
APPEND tv_column TO p_column_definitions.
CLEAR tv_column.
tv_column-edit = 'X'.
tv_column-COLUMNNAME = 'CONNID'.
tv_column-TITLE = 'Conn.ID'.
tv_column-WIDTH = '70'.
tv_column-HORIZONTALALIGNMENT = 'center'.
APPEND tv_column TO p_column_definitions.
endmethod.
METHOD IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START.
DATA:
DD TYPE REF TO CL_HTMLB_DROPDOWNLISTBOX,
I_PHAS1_REF TYPE REF TO DATA.
GET REFERENCE OF APPL->ITAB INTO I_PHAS1_REF.
CASE P_TABLEVIEW_ID.
WHEN 'fligts'.
CASE P_COLUMN_KEY.
WHEN 'CONNID'.
P_REPLACEMENT_BEE = CL_HTMLB_DROPDOWNLISTBOX=>FACTORY( ID = P_CELL_ID
* onclick = l_event
TABLE = I_PHAS1_REF
NAMEOFKEYCOLUMN = 'CONNID'
NAMEOFVALUECOLUMN = 'CONNID'
TOOLTIP = 'My Drop Down' ).
ENDCASE.
ENDCASE.
ENDMETHOD.
<b>6. Layout Code:</b>
<%@page language="abap"%>
<%@extension name="htmlb" prefix="htmlb"%>
<htmlb:content design="design2003">
<htmlb:page title = "Test ">
<htmlb:form>
<%
data TV_ITERATOR Type Ref To zcl_itr.
data iterator type ref to IF_HTMLB_TABLEVIEW_ITERATOR.
create object tv_iterator exporting appl_cons = application.
iterator = tv_iterator.
%>
<htmlb:tableView id = "fligts"
headerText = "Flight"
width = "100"
headerVisible = "true"
design = "alternating"
visibleRowCount = "10"
fillUpEmptyRows = "true"
showNoMatchText = "true"
filter = "server"
sort = "server"
onHeaderClick = "MyEventHeaderClick"
table = "<%= APPLICATION->itab %>"
iterator = "<%= ITERATOR %>" />
</htmlb:form>
</htmlb:page>
</htmlb:content>
<b>7. OnInitialization:</b>
SELECT * FROM sflight into TABLE application->itab.
Raja T
>You can NOT use your Application class & Iterator class as same.
Actually this is not true. From a technical standpoint you can use any class instance as long as the class implements the IF_HTMLB_TABLEVIEW_ITERATOR interface. There is no reason why you can't just add this interface to an application class or model class definition and reuse the object instance. I have done this before with model classes. This can be useful if you need additional data from elsewhere in your application for the interator logic.
Of course this is what is technically possible. You might well make a design decision that says that it is a good idea to separate your objects types and always have a separate class for the interator.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.