To Sort Table Maintenance Before Display.
Go to SE11 and enter table name(eg. ZTEST) ->Display
Click UTILITIES menu->Table Maintenance Generator
Click on ENVIRONMENT menu->Modification->Maintenance screens->Double click on record in the popup.
Write one MODULE SORT_EXTRACT (in PBO of the maintenance view screen) to sort exactly before Table Control loop statement(LOOP AT EXTRACT WITH CONTROL)
Write the below piece of code at SORT_EXTRACT to sort Table Maintenance.