on 09-02-2015 6:03 AM
Hi,
I am applying filtering for a normal Web Dynpro table (without using any ALV) using apply_filter(). The filter values come up as drop down values at the column header level. Filtering is working as expected.
I have a requirement where in I need to first filter the table by selecting a value from the filter values drop down & then select the filtered rows and move them to another table.
I need to know how to read only the filtered records after filtering has been applied? At the moment I get all the records bound to the context, but I need only the filtered records.
Request your suggestions.
Regards,
Shilpa B V
Hi,
You can use get_table_data( ) method IF_WD_TABLE_METHOD_HNDL to get the filtered data.
below code snippet:
DATA: lt_filtered_row TYPE WDR_TABLE_ROW_DATA_TAB.
wd_this->table_method_hndl->get_table_data( IMPORTING row_datas = lt_filtered_row ). " table_method_hndl is the attribute of type if_wd_table_method_hndl
If you are on lower netweaver version where get_table_data( ) method is not available, refer the following blog.
hope this helps,
Regards,
Kiran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kiran,
Thanks for your inputs!
I am able to get the filtered data now. Pasting the sample code below.
METHOD onactionfilter.
DATA: l_nd_table_data TYPE REF TO if_wd_context_node, “Node bound to the table
l_el_table_data TYPE REF TO if_wd_context_element,”Element of node
lw_table_data TYPE wd_this->element_table_data,”workarea
lt_filtered_table TYPE wdr_table_row_data_tab,”filtered elements
lw_filtered_row LIKE LINE OF lt_filtered_row, “filtered element
lt_table_data_filtered TYPE wd_this->elements_table_data,”filtered data
wd_this->g_table_hndl->apply_filter( set_is_filtered_at_column = abap_true ). “Apply filtering
********** Get the filtered data into a separate internal table **********
wd_this->g_table_hndl>get_table_data( RECEIVING table_data = lt_filtered_table ).
LOOP AT lt_filtered_table INTO lw_filtered_row.
l_el_table_data = lw_filtered_row-context_element.
l_el_table_data->get_static_attributes(
IMPORTING
static_attributes = lw_table_data
).
APPEND lw_table_data TO lt_table_data_filtered.
ENDLOOP.
……….
……….
……….
ENDMETHOD .
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.