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

Sorting option in WebDynPro ABAP UI Table

Hi,

I would like to know that how to implement the Sorting Option in WebDynPro UI Table Element . A code snippet will help on the same issue .

Regards

Sid

  • SAP Employee
replied

Hi Siddarth,

1. You need to assign an action (e.g. 'DO_SORT') to the UI table you want to sort.

2. Within the action 'DO_SORT' you have to get the context node of your table, the column and the current sort direction.

  lr_node = wd_context->get_child_node( <table_context_node> ).
  l_col_name = wdevent->get_string( 'COLUMN' ).
  l_sort_direction = wdevent->get_string( 'DIRECTION' ).

3. Get the context value table

  lr_node->get_static_attributes_table( IMPORTING table = <value_table> ) 

4. Now do the sorting of the context node depending on the sort direction and bind it back to the context node.

  CASE l_sort_direction.

    WHEN CL_WD_TABLE_COLUMN=>E_SORT_STATE-UP. " Ascending
      SORT <value_table> ASCENDING BY (l_col_name).
    WHEN CL_WD_TABLE_COLUMN=>E_SORT_STATE-DOWN. " Descending
      SORT <value_table> DESCENDING BY (l_col_name).
  ENDCASE.

  lr_node->bind_table( <value_table> ).  

That's it

Regards,

Ralf

Message was edited by: Armin Reichert

Points assigned

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