Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Sorting in a table

Hi,

I'm doing a sorting in my table.

I want to know what is the propose of the method set_key_attribute_name of the interface IF_WD_TABLE_METHOD_HNDL ?

What parameter do I have to pass?

Thanks a lot.

replied

Hi Jorge,

This method is used to specify the name of the column based on which you want to sort the table data.

So suppose you chose to sort the data by field MEINS then the table would sort the unit of measurement column in ascending/descending. The rest of the columns wouldn't be in sorted order. Below is an extract of the same coding. Hope that this answers your question.

Regards,

Uday

(table_control is an view attribute of type CL_WD_TABLE & the reference of the table has been saved in to it in the WDDOMODIFYVIEW method)

METHOD wddomodifyview .
  DATA wd_table TYPE REF TO cl_wd_table.

  CHECK first_time = abap_true.

  wd_table ?= view->get_element( 'TABLE_ELEMENT' ).

  wd_this->table_control  ?=  wd_table->_method_handler.

  wd_this->table_control->set_key_attribute_name( 'MATNR' ).
ENDMETHOD.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question