Register Login

Sorting a Table Control

Updated May 18, 2018

You may need a sort routine in case the user selects a column and desires to sort on its contents. All you need is a sort icon on the applications toolbar of the screens GUI to return the OK-code of 'SORT'. You will need to copy this to the PAI of every  screen and change the name of the module, and the actual itab for this screen

MODULE SORT_screen100 INPUT.
CASE SAVE_OK_CODE.
WHEN 'SORT'.
LOOP AT T1-COLS INTO WA.
IF WA-SELECTED = 'X' .
SPLIT WA-SCREEN-NAME AT '-' INTO FILE FLD.
SORT itab BY (FLD).
ENDIF.

ENDLOOP.
ENDCASE.
ENDMODULE. " SORT_screen100 INPUT


×