cancel
Showing results for 
Search instead for 
Did you mean: 

How to capute data selected by the user in a TABLEVIEW

nilesh_labde2
Participant
0 Kudos

Hi ,

I am displaying the data in tableView .

I want to caputre the information of the row, that user have selected.

For that I am using

 selectionMode    = "SINGLESELECT" . 

following is my code for Table view

 

<htmlb:tableView id                = "tbl_o_table"
                       headerText        = "Search Results"
                       headerVisible     = "true"
                       design            = "standard"
                       emptyTableText    = "No records found"
                       table             = "<%= p_itab   %>"
                       onHeaderClick    = "MyEventHeaderClick"
                       selectionMode    = "SINGLESELECT"
                       visibleRowCount   = "20"
                       sort              = "SERVER"
                       onRowSelection    = "onRowSelection"
                       width             = "100%"
                       columnDefinitions = "<%= pt_tableview %>"
                       filter            = "server" >
      </htmlb:tableView>

From above code i am able to selec the row, but how should I read the selceted data.

For example my Table view displays the Sales order number , line item no ...... etc.

I need the selected sales order number by the user, so that i can naviage to new page and i can display furhter data for depatch of sales order .

Please advice.

Thanks & Regards,

Nilesh Labde

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

this is an example of code for getting the selected line:

DATA: tableview      TYPE REF TO cl_htmlb_tableview,
      tableview_data TYPE REF TO cl_htmlb_event_tableview.


tableview ?= cl_htmlb_manager=>get_data(
                              request = runtime->server->request
                              name    = 'tableView'
                              id      = '' ).     "<-- table ID

CHECK tableview IS NOT INITIAL.
tableview_data = tableview->data.

In tableview_data->selectedrowindex you have the currently selected line and in tableview_data->PREVSELECTEDROWINDEX you get the previously selected line.

With that information you can read your table P_ITAB with READ TABLE ..... INDEX tableview_data->selectedrowindex.

nilesh_labde2
Participant
0 Kudos

Thanks

Answers (1)

Answers (1)

former_member233090
Active Contributor
0 Kudos

Hi ,

you can see the example : go to se 80 then select BSP Application ,SBSPEXT_HTMLB then select tableview.bsp , you will get some idea to be more clear for the code which you have written



DATA: tv TYPE REF TO CL_HTMLB_TABLEVIEW.
 
tv ?= cl_htmlb_manager=>get_data(
                         request = runtime->server->request
                          name    = 'tableView'
                              id      = ''tbl_o_table" ).     
 IF tv IS NOT INITIAL.
  DATA: tv_data TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.
  tv_data = tv->data.
 IF tv_data->prevSelectedRowIndex IS NOT INITIAL.
FIELD-SYMBOLS: <row> LIKE LINE OF sflight.
    READ TABLE ur tablename  INDEX tv_data->prevSelectedRowIndex ASSIGNING <row>.
    DATA value TYPE STRING.
    value = tv_data->GET_CELL_ID( row_index    =
                               tv_data->prevSelectedRowIndex
                                  column_index = '1' ).
endif.
endif,

nilesh_labde2
Participant
0 Kudos

Thanks Bhavana