on 04-24-2013 8:35 PM
can any body plz suggest me how to sort a table column based on user selection? in the below code the column name which is to be sort is hord coded in the wdmodify view. but if the user wants to sort another column in this case how to write the code? Thanks in advance for reply.
method WDDOINIT .
data LO_ND_MARA type ref to IF_WD_CONTEXT_NODE.
data LO_EL_MARA type ref to IF_WD_CONTEXT_ELEMENT.
data LT_MARA type WD_THIS->ELEMENTS_MARA.
data LS_MARA type WD_THIS->ELEMENT_MARA.
* navigate from <CONTEXT> to <MARA> via lead selection
LO_ND_MARA = WD_CONTEXT->GET_CHILD_NODE( NAME = WD_THIS->WDCTX_MARA ).
SELECT MATNR MTART MATKL MEINS FROM MARA INTO CORRESPONDING FIELDS OF
TABLE LT_MARA UP TO 10 ROWS WHERE MATNR LIKE 'A%'.
* Bind Table
LO_ND_MARA->BIND_TABLE( LT_MARA ).
endmethod.
WDDOMODIFYVIEW:
method WDDOMODIFYVIEW .
data wd_table type ref to cl_wd_table.
check first_time = abap_true.
* Name of the table UI element to be provided
wd_table ?= view->get_element( 'TABLE' ).
wd_this->table_control ?= wd_table->_method_handler.
*Name of the key attribute of the context node to which the table binding is done to be provided
wd_this->table_control->set_key_attribute_name( 'MATNR' ).
endmethod.
ONACTIONON_TEST_SORT:
method ONACTIONON_TEST_SORT .
wd_this->table_control->apply_sorting( ).
endmethod.
Hi Siva,
In that case you can apply column sorting for all columns, then user can select desired column for sorting.
Just in your coding dont give any column name, you will get sorting for whole table.
remove this line from your coding.
wd_this->table_control->set_key_attribute_name( 'MATNR' ).
Also check this..
http://help.sap.com/saphelp_nw73/helpdata/en/92/63ec3a0b0e4990bcae8fe838d70b49/content.htm
Cheers,
Kris.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Siva,
Define your variables in attributes tab.
The defination of variable 'TABLE_CONTROL' is missing for which you are getting this error.
In attribute tab defind the variables like below.
So your 'TABLE_CONTROL' will be the 3rd variable.
Also check standard compoent 'WDR_TEST_TABLE' where these are maintained & also u wl get clarifiaction of all table functionalities like sorting & filtering.
Regards,
Monishankar Chatterjee
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.