Module 8: Selection Screens & Reports
Selection screens are used to collect user input before executing ABAP reports.
Reports form the backbone of classic ABAP applications and are still widely used in productive systems.
1. PARAMETERS & SELECT-OPTIONS
1.1 PARAMETERS
PARAMETERS is used to define single-value input fields.
PARAMETERS p_carrid TYPE spfli-carrid.
With default value:
PARAMETERS p_year TYPE i DEFAULT 2025.
With mandatory input:
PARAMETERS p_name TYPE string OBLIGATORY.
Use meaningful parameter names and restrict data types using DDIC references wherever possible.
1.2 SELECT-OPTIONS
SELECT-OPTIONS allows range-based input (single values, ranges, exclusions).
SELECT-OPTIONS s_carrid FOR spfli-carrid.
Internally, a select-option creates a structure with:
-
SIGN
-
OPTION
-
LOW
-
HIGH
Use SELECT-OPTIONS when:
-
Multiple values are required
-
Ranges are required
-
Exclusions are required
2. Selection-Screen Events
Selection screens are event-driven, just like ABAP programs.
2.1 INITIALIZATION
Executed when the selection screen is first displayed.
INITIALIZATION.
p_year = sy-datum+0(4).
2.2 AT SELECTION-SCREEN
Triggered during input validation.
AT SELECTION-SCREEN.
IF p_year < 2000.
MESSAGE 'Year must be >= 2000' TYPE 'E'.
ENDIF.
2.3 AT SELECTION-SCREEN ON <field>*
Triggered for a specific field.
AT SELECTION-SCREEN ON p_year.
IF p_year > sy-datum+0(4).
MESSAGE 'Future year not allowed' TYPE 'E'.
ENDIF.
Always validate user input at selection-screen level, not inside business logic.
3. Dynamic Selection Screen Modification
Dynamic modification allows enabling, disabling, or hiding fields at runtime.
3.1 Using AT SELECTION-SCREEN OUTPUT
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-name = 'P_YEAR'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
Common Use Cases
-
Hide fields based on user role
-
Disable fields conditionally
-
Change required input dynamically
Dynamic screen modification uses classic techniques and is still valid in 7.5, but should be kept simple and minimal.
4. Reports in ABAP
4.1 Classical Reports
Classical reports display output using WRITE.
WRITE: / 'Flight Data Report'.
Characteristics
-
List-based output
-
Minimal interaction
-
Legacy style
Classical reports should not be used for new developments.
4.2 Interactive Reports
Interactive reports respond to user actions like clicking or selecting.
AT LINE-SELECTION.
WRITE 'Line selected'.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'DETAIL'.
WRITE 'Details requested'.
ENDCASE.
Characteristics
-
Multiple list levels
-
Basic interactivity
-
Heavy use of system fields
Interactive reports are frequently asked in interviews due to their legacy importance.
- Modern Reporting Recommendation (7.5+)
For new developments, prefer:
-
ALV (SALV / OO ALV)
-
CDS-based reporting
-
Fiori / UI5 frontends
6. Classical vs Interactive Reports
| Aspect | Classical | Interactive |
|---|---|---|
| User Interaction | No | Limited |
| Events | Few | Many |
| Output | Simple list | Drill-down |
| Usage Today | Rare | Maintenance only |
7. Common Beginner Mistakes
-
Writing business logic in report events
-
Overusing global variables
-
Poor input validation
-
Using WRITE instead of ALV
-
Complex dynamic screen logic
8. Summary
-
PARAMETERS → single input
-
SELECT-OPTIONS → ranges and multiple values
-
Selection screens are event-driven
-
Dynamic screen modification is possible
-
Classical & Interactive reports are legacy
-
Modern ABAP prefers ALV and CDS-based reporting
9. Practice Exercises
-Create a report with PARAMETERS and SELECT-OPTIONS.
-
Validate input using selection-screen events.
-
Disable a field dynamically.
-
Convert a classical report into ALV.
10. What’s Next?
➡️ Module 9: ABAP Debugging & Runtime Analysis
Understanding selection screens is crucial for maintaining legacy reports and passing interviews.