Selection Screen: PARAMETERS, SELECT-OPTIONS and Validation
Build safe selection screens with mandatory inputs, ranges and user-friendly validations.
Explanation
Selection screens are the user entry point for many ABAP reports. PARAMETERS are used for single values and SELECT-OPTIONS are used for ranges or multiple values. A good selection screen prevents wrong input before expensive database processing starts. Validation is usually done in AT SELECTION-SCREEN. In real projects, missing validation can cause full-table reads, incorrect reports or long-running background jobs. For example, a finance report without company code or fiscal year validation can accidentally scan huge accounting tables.
Code example
PARAMETERS p_vkorg TYPE vkorg OBLIGATORY.SELECT-OPTIONS s_fkdat FOR sy-datum. AT SELECTION-SCREEN. IF s_fkdat[] IS INITIAL. MESSAGE 'Billing date range is required' TYPE 'E'. ENDIF. IF s_fkdat-high - s_fkdat-low > 90. MESSAGE 'Date range cannot exceed 90 days' TYPE 'E'. ENDIF.Real project scenario
A billing report allows date range and sales organization. If both are optional, users may run the report for all billing documents. Adding mandatory filters and validation prevents performance issues.
Common mistakes
- Allowing reports to run without key filters. - Using SELECT-OPTIONS but not validating range size. - Showing technical errors instead of user-friendly messages. - Validating after database selection.
Best practices
- Make key filters mandatory. - Validate date range size. - Use clear error messages. - Protect high-volume reports from broad selection.
Interview angle
Interviewers may ask how to avoid full-table scans from reports. Selection-screen validation is one practical answer.