cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Filtered table data in Table UI element

former_member183917
Active Contributor
0 Kudos

Hi All,

I have added Filter in Table UI element and able to filter the data. Also i have a button "Select All" (Toolbar button)

One of the columns in table is check box . If i enable filter and selecting check box for 5 rows.

Then if i click on "Select All" only the filtered rows needs to be selected.

Inside this "Select All" action, how can i get the filtered table data.

Appreciate responses. Thank you

PS: Referred blog for creating Filter in Table UI element

Regards

Vinoth

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Vinoth,

For your requriement you have to add your own logic. Say create one more attribute of type char1 in table context node and call it as Record type. After filtering records, if user has selected 5 check boxes means edited 5 rows, while editing check box, on event handler of check box, mark the record type as 'U'. So,if user edits 5 rows, all the 5 records will have new field Record_type as 'U'. U for updated.

so,clicking on select all button,filter from the table so that you can get only this 5 records,

Delete lt_table where record_type ne 'U'.

Hope this is helpful for you.

Regards,

Ravikiran.K

former_member183917
Active Contributor
0 Kudos

Hi Ravi,

Thanks for reply. As mentioned, i have "Select All" button on top of table. First i will filter the table data (lets say filtered 5 rows from 10 rows).

Then if i click "Select All" button, inside this action method i need to get the filtered table data and i can mark the record (filtered table data) with some indicator.

Regards,

Vinoth

Former Member
0 Kudos

Hi Vinoth,

You can do this way. When user clicks on Select All button, first you read the filterd value from the table. Suppose user has filtered on the First column, then  get the First columns filter value . you can get by reading the Filter node.

Example : user has entered

firstcolumn = *c*

Select Records by quering on DB table using where condition on the first column, by converting c to Capital C and replace * with % and then you will get the filtered values.

select *

from Dbtable

into lt_table

where first_column like '%C%;.

lt_table will have filtered values.

Note : where clause of select query varies based on the filter value entered on the table columns. In above example user has entered on only first column, if it is entered for two columns filtered include the two fields in where clause.

Regards,

Ravikiran.K

former_member183917
Active Contributor
0 Kudos

Thanks Ravi. Now able to get filter data.

Also not able to find method GET_TABLE_DATA in my system.

Regards

Vinoth

Former Member
0 Kudos

welcome Vinoth. 

Regards,

Ravikiran.K

Answers (1)

Answers (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Vinoth,

You can read the filtered table data by using method GET_TABLE_DATA( ) of method handler

Please write the below code in the event handler of "SELECT_ALL" action


  DATA lt_data TYPE wdr_table_row_data_tab.
  DATA ls_data LIKE LINE OF lt_data.

"get filtered table data
lt_data = wd_this->go_method_handler->get_table_data( ).

  LOOP AT lt_data INTO ls_data.


*    ls_data-context_element->get_static_attributes(
*      IMPORTING
*        static_attributes = "?
*    ).

" To select the row

ls_data-context_element->set_selected( flag = abap_true ).


  ENDLOOP.

Hope this resolves your issue.

Regards,

Rama

Message was edited by: Ramakrishnappa Gangappa

Former Member
0 Kudos

Hi Ramakrishnappa,

what is the type ref of the attribute go_method_handler .

is it the type to IF_WD_TABLE_METHOD_HNDL.  or IF_WD_VIEW_ELEMENT_METHOD_HNDL.

Neither of the interfaces has the method  GET_TABLE_DATA.

could you please clarify this.

Regards,

Ravikiran.K

ramakrishnappa
Active Contributor
0 Kudos

Hi Ravi,

The attribute wd_this->go_method_handler is of type ref to IF_WD_TABLE_METHOD_HNDL.

This method is available from NW 7.31 system. Hope your system is not meeting this release.

Regards,

Rama

Former Member
0 Kudos

Hi Rama,

I am using more advanced Release. still it is missing may be i have to check with Basis.

Regards,

Ravikiran.K

ramakrishnappa
Active Contributor
0 Kudos

Hi Ravi,

It looks weird. I am using SAP_BASIS  & SAP_ABAP 731 SP 07.

Regards,

Rama

former_member183917
Active Contributor
0 Kudos

Thanks for reply Rama but not able to find method GET_TABLE_DATA in my system.

Regards

Vinoth