on 05-12-2006 6:19 AM
Hi I am experiencing problem in capturing the contents of the selected row in the tableview. My Code looks like as follows:
<b>Layout</b>
<%@page language="abap" %>
<%@extension name="htmlb" prefix="htmlb" %>
<htmlb:content design="design2003" >
<%-- <%@include file="head.htm" %> --%>
<htmlb:page title="Company Code Search " >
<htmlb:form>
<htmlb:label for = "l_CCODE"
text = "Field"
tooltip = "User ID"
required = "X"
width = "100px"
design = "EMPHASIZED" />
<htmlb:dropdownListBox id = "ddname">
<htmlb:listBoxItem key = "li_bukrs"
value = "Company Code" />
<htmlb:listBoxItem key = "li_butxt"
value = "Company Code Description" />
</htmlb:dropdownListBox>
<htmlb:inputField id = "i_search"
value = "Search term" />
<htmlb:button id = "b_search"
text = "Search"
tooltip = "click here to start the search"
onClick = "onInputProcessing(select)" />
<br>
<htmlb:tableView id = "tv_tabid"
table = "<%= gt_t001 %>"
design = "STANDARD"
designMode = "HTMLB"
allRowsEditable = "TRUE"
tableLayout = "AUTO"
width = "75%"
visibleFirstRow = "1"
visibleRowCount = "10"
headerVisible = "TRUE"
headerText = "Company Code Selection Table"
onRowSelection = "onInputProcessing(select)"
selectionMode = "SINGLESELECT"
selectedRowKey = "wa-BUKRS"
navigationMode = "BYPAGE"
footerVisible = "TRUE" >
<htmlb:tableViewColumn columnName="BUKRS"
title= "Company Code">
</htmlb:tableViewColumn>
<htmlb:tableViewColumn columnName="BUTXT"
title= "Description">
</htmlb:tableViewColumn>
</htmlb:tableView>
</htmlb:form>
</htmlb:page>
</htmlb:content>
<b>OnInputProcessing</b>
event = cl_htmlb_manager=>get_event( request ).
CASE event->id.
WHEN 'b_search'.
DATA: l_ccode TYPE REF TO cl_htmlb_inputfield.
DATA: l_id TYPE REF TO cl_htmlb_dropdownlistbox.
l_ccode ?= cl_htmlb_manager=>get_data( request = runtime->server->request
name = 'inputField'
id = 'i_search' ).
l_id ?= cl_htmlb_manager=>get_data( request = runtime->server->request
name = 'dropdownListBox'
id = 'ddname' ).
ls_listvalue = l_id->selection.
IF NOT l_ccode->value IS INITIAL.
IF ls_listvalue = 'li_bukrs'.
ls_name = l_ccode->value.
ENDIF.
* Read Data into internal table by search term
Select * from T001 into table gt_t001 where bukrs = ls_name.
ENDIF.
WHEN 'tv_tabid'.
DATA: tv_table TYPE REF TO cl_htmlb_tableview.
DATA: table_event TYPE REF TO cl_htmlb_event_tableview.
DATA: selectedrowindex TYPE i.
tv_table ?= cl_htmlb_manager=>get_data( request = runtime->server->request
name = 'tableView'
id = 'tv_tabid' ).
IF tv_table IS NOT INITIAL.
table_event = tv_table->data.
selectedrowindex = table_event->selectedrowindex.
* Read Table gt_t001 into Work Area and Pass the selected value through Navigator
READ TABLE gt_t001 INTO wa_t001 INDEX selectedrowindex.
navigation->set_parameter( name = 'nv_bukrs' value = 'samp').
navigation->goto_page( 'FormRequest.bsp' ).
ENDIF.
ENDCASE.
When I selected a row in the tableview, I am getting the selectedrow Index (selectedrowindex = table_event->selectedrowindex.). But the Values in the table gt_t001 are disapperiaring to read the contents by selectedrowindex.
Is there a way of capturing the contents of selected row or if I am doing any wrong in loosing the data from internal table.
Please help.
Hi all,
Thanks For your affort. I solved this problem myself. I was not using keycolumn in the table view. After I use the keycolumn I am getting the value into tv_data->SELECTEDROWKEY from selected row.
Thanks again.
-Gireesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gireesh,
Have you tried what i have explained, you will get the solution since i have worked on such a requirement.
Regards,
Azaz Ali.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gireesh,
I will give you a sample code which i have practiced for the same reqirement...
Oninputprocessing:
if event->name = 'tableView' and event->event_type = 'rowSelection'.
data : data2 type ref to cl_htmlb_tableview.
DATA: tv_data TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.
data2 ?= cl_htmlb_manager=>get_data(
request = request
name = 'tableView'
id = 'tview' ).
clear tv_data.
if not data2 is initial.
tv_data = data2->data.
clear wa1.
read table it_mara3 into wa1 index tv_data->row_index.
if sy-subrc = 0.
v_matnr1 = wa1-matnr.
call method navigation->set_parameter
exporting
name = 'v_matnr1'
value = v_matnr1.
navigation->goto_page( 'third.htm' ).
endif.
endif.
endif.
where wa1 is a workarea declared as page attribute.
and every thing is correct in layout except one thing that i have added one more attribute to the tableview that is...
onNavigate="onMyNavigation"
ADD THE CODE WHAT EVER REQUIRED BY SEEING THE EXAMPLE GIVEN...YOU WILL GET THE SOLUTION.
Regards,
Azaz Ali.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Replace this
READ TABLE gt_t001 INTO wa_t001 INDEX selectedrowindex.
by
<b>
READ TABLE gt_t001 INDEX selectedrowindex
ASSIGNING <row>.
</b>where <row> is a field symbol of the type of your itab work area.
Do this changes and revert back.
Hope this helps,
Regards,
Ravikiran.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravikiran,
The Problem is here after I come back from row selection from Tableview, the data in Internal table gt_t001 is refreshing. If I have the data I am able to read the row what I selected based on Selectedrow value from Tableview event.
Any Idea why I am loosing data in my Internal table?.
Thanks,
Gireesh Nagalla
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.