Tuesday, January 4, 2011
We create one SORT button in application toolbar. Highlight the column by clicking the header to find what column to sort by and press SORT button to sort table control values.

Steps to implement SORT in table control
  • Define table control. 
  • CONTROLS: TC_SPFLI TYPE TABLEVIEW USING SCREEN 100.
    
  • Define COLS table for table control column properties.
  • DATA:fld_list    LIKE tc_spfli-cols.
    DATA:wa_fld_list LIKE LINE OF fld_list.
    
  • Check whether column has been selected or not. 
  • LOOP AT tc_spfli-cols INTO wa_fld_list.
      IF wa_fld_list-selected = 'X'.
        APPEND wa_fld_list TO fld_list.
      ENDIF.
    ENDLOOP.
    
  • Sort the table with selected column. 
  • DATA: fldname(100).
    SORT fld_list BY index.
    READ TABLE fld_list INDEX 1 INTO wa_fld_list.
    fldname = wa_fld_list-screen-name+9.
    SORT it_spfli BY (fldname).
    

Demo programs
  • DEMO_DYNPRO_TABCONT_LOOP_AT
  • RSDEMO02

0 comments:

Post a Comment

Your useful comments, suggestions are appreciated.Your comments are moderated.

Followers

Contact Form

Name

Email *

Message *

Web Dynpro ABAP Book

An SAP Consultant

Follow US


Want to Contribute ?

If you are interested in writing about the new stuff you learn everyday while working, please write to the.sap.consultants@gmail.com.

Click on Contribution for more details.