Chapter 10 · Core Classic ABAP
Selection Screens & Events
How to let users filter data before your report runs — with PARAMETERS, SELECT-OPTIONS, and the event flow that controls it all.
You have built ALV reports. But right now, they show every row in the table. No filters, no date range, no user input. That works for a demo — but in a real SAP system, users want to choose what they see.
Every report you build from now on will start with a selection screen — the input screen that appears before the report runs. It is how users enter filter criteria, dates, and ranges. And behind every selection screen are events that control what happens when: the screen loads, the user enters data, or the user clicks Execute.
This chapter teaches you the complete selection screen toolkit. By the end, you will be able to build interactive reports that accept user input and respond dynamically.
🎯 What You Will Learn in This Chapter
- What selection screens are and why every report needs one
- How to use PARAMETERS for single-value input
- How to use SELECT-OPTIONS for range input with operators
- The complete event flow: INITIALIZATION, AT SELECTION-SCREEN, START-OF-SELECTION, END-OF-SELECTION
- How to validate user input with field-level checks
- What PBO and PAI are and when they run
- How to save selection values as a Variant
- How to create a Transaction Code to launch your report directly
📘 What is a Selection Screen?
A selection screen is the input screen that SAP automatically generates from your ABAP program before the report runs. It is where users enter filter criteria — dates, IDs, ranges — that determine what data the report returns.
You do not design the selection screen manually. Instead, you declare PARAMETERS and SELECT-OPTIONS statements in your code. SAP reads these and builds the screen automatically.
The standard selection screen (1000)
Every ABAP report has a default selection screen numbered 1000. You do not need to create it manually — it appears as soon as you declare PARAMETERS or SELECT-OPTIONS. You can also create additional custom screens (1001, 1002, etc.) for multi-step input, but that is advanced and rarely needed at the beginner level.
🔤 PARAMETERS — Single-Value Input
PARAMETERS creates a single-value input field on the selection screen. Use it when the user needs to enter exactly one value — like a specific airline code, a plant, or a date.
Basic syntax
PARAMETERS: p_carrid TYPE scarr-carrid.
START-OF-SELECTION.
SELECT * FROM scarr
INTO TABLE @DATA(lt_scarr)
WHERE carrid = @p_carrid.
LOOP AT lt_scarr INTO DATA(ls_scarr).
WRITE: / ls_scarr-carrid, ls_scarr-carrname.
ENDLOOP.
Useful PARAMETERS additions
| Addition | What It Does |
|---|---|
DEFAULT value | Sets a default value |
OBLIGATORY | User must enter a value |
AS CHECKBOX | Renders as a checkbox |
RADIOBUTTON GROUP grp | Renders as a radio button |
LOWER CASE | Allows lowercase input |
NO-DISPLAY | Field is hidden on the screen |
VISIBLE LENGTH n | Sets the display width |
Example with options
PARAMETERS:
p_carrid TYPE scarr-carrid OBLIGATORY,
p_date TYPE sy-datum DEFAULT sy-datum,
p_active AS CHECKBOX DEFAULT 'X'.
🎯 SELECT-OPTIONS — Range Input with Operators
SELECT-OPTIONS creates a range input field. Users can specify complex criteria — equal to, greater than, between, not equal, and more. This is the most powerful and most common input type in SAP reports.
Basic syntax
SELECT-OPTIONS: s_carrid FOR scarr-carrid.
START-OF-SELECTION.
SELECT * FROM scarr
INTO TABLE @DATA(lt_scarr)
WHERE carrid IN @s_carrid.
LOOP AT lt_scarr INTO DATA(ls_scarr).
WRITE: / ls_scarr-carrid, ls_scarr-carrname.
ENDLOOP.
Useful SELECT-OPTIONS additions
| Addition | Effect |
|---|---|
DEFAULT value | Pre-fill with a default range |
OBLIGATORY | At least one value required |
NO-EXTENSION | Hides the extended range button |
NO INTERVALS | Hides the Between operator |
LOWER CASE | Allows lowercase input |
NO-DISPLAY | Hides the field on screen |
VISIBLE LENGTH n | Sets the display width |
Pre-fill with a range
SELECT-OPTIONS: s_date FOR sy-datum.
INITIALIZATION.
s_date-sign = 'I'.
s_date-option = 'BT'.
s_date-low = sy-datum - 30.
s_date-high = sy-datum.
APPEND s_date.
⚡ The Event Flow — What Runs When
ABAP reports are event-driven. SAP automatically runs certain blocks of code at specific moments. Understanding this flow is the key to building correct reports.
The main events, in order
| Event | When It Runs | Typical Use |
|---|---|---|
INITIALIZATION | Before the selection screen is displayed | Set default values for parameters |
AT SELECTION-SCREEN OUTPUT | Just before the screen appears | Modify field properties (hide, disable) |
AT SELECTION-SCREEN | After the user presses Execute | Validate input, check authorizations |
AT SELECTION-SCREEN ON field | On specific field events (Enter key) | Field-level validation |
START-OF-SELECTION | After all validations pass | Main report logic — SELECT data |
END-OF-SELECTION | After all processing is done | Final summary, cleanup |
I → A → S → E — four events, always in that order.
Complete flow example
REPORT z_selection_screen_demo.
PARAMETERS: p_carrid TYPE scarr-carrid OBLIGATORY.
SELECT-OPTIONS: s_date FOR sy-datum.
" 1. Runs first — set defaults
INITIALIZATION.
s_date-low = sy-datum - 30.
s_date-high = sy-datum.
APPEND s_date.
" 2. Runs after user clicks Execute — validate
AT SELECTION-SCREEN.
IF p_carrid IS INITIAL.
MESSAGE 'Airline code is required' TYPE 'E'.
ENDIF.
" 3. Runs after validation passes — main logic
START-OF-SELECTION.
WRITE: / 'Report started for airline:', p_carrid.
✅ Validating User Input
Never trust user input. Always validate it before the report processes data. Use AT SELECTION-SCREEN for validation.
Common validation patterns
AT SELECTION-SCREEN.
" Check required field
IF p_carrid IS INITIAL.
MESSAGE 'Please enter an airline code' TYPE 'E'.
ENDIF.
" Check if value exists in database
SELECT SINGLE carrid FROM scarr
INTO @DATA(lv_check)
WHERE carrid = @p_carrid.
IF sy-subrc <> 0.
MESSAGE 'Airline code does not exist' TYPE 'E'.
ENDIF.
" Date range validation
IF s_date-low > s_date-high.
MESSAGE 'From-date cannot be after to-date' TYPE 'E'.
ENDIF.
MESSAGE ... TYPE 'E' in AT SELECTION-SCREEN, the report stops. The user stays on the selection screen and must fix the input. This is exactly what you want for validation.
🔄 PBO and PAI — Screen Flow Logic
Selection screen 1000 is technically a screen, and all screens in SAP follow a flow logic with two events: PBO (Process Before Output) and PAI (Process After Input).
| Event | Full Form | When It Runs |
|---|---|---|
| PBO | Process Before Output | Before the screen is displayed to the user |
| PAI | Process After Input | After the user submits input (presses Enter or clicks a button) |
In classic screen programming (using transaction SE51), you write PBO and PAI modules to control this flow. In ABAP reports with selection screens, you rarely write PBO/PAI directly — the events AT SELECTION-SCREEN OUTPUT and AT SELECTION-SCREEN handle the same concepts.
Mapping to selection screen events
| Screen Flow Logic | Selection Screen Equivalent |
|---|---|
| PBO | AT SELECTION-SCREEN OUTPUT |
| PAI | AT SELECTION-SCREEN |
💾 Variants — Saving Selection Screen Values
A Variant is a saved set of selection screen values. Users can save a variant once and reuse it many times — saving them from re-entering the same filter criteria every time.
How users save a variant
- Fill in the selection screen with the desired values
- Click Save (or press Ctrl+S) on the selection screen toolbar
- Give the variant a name and description
- Choose whether to make it the default
How developers manage variants
- SE38 — In the program’s attribute screen, click Variants
- SE93 — When creating a T-code, you can assign a default variant
- Programmatically — Use function modules
RS_VARIANT_CATALOGorRS_VARIANT_EXISTENCE_CHECK
🚀 Transaction Codes — Launching Your Report
Users do not want to type SE38, then enter your program name, then click Execute. They want to type a short code in the command field and hit Enter. That is what a Transaction Code (T-code) gives them.
Creating a T-code — Steps
Transaction SE93 is used to create, change, and display T-codes.
Type a name starting with Z (e.g., ZREPORT01). Click Create.
Give a short description. Choose Program and selection screen (report transaction) as the type.
Enter your program name (e.g., Z_SELECTION_SCREEN_DEMO) and screen number (usually 1000). Optionally assign a default variant.
Save the T-code. Assign it to a transport request. Now users can launch the report by typing ZREPORT01.
Z or Y prefix, then a module identifier (FI, MM, SD), then a number. Ask your team lead for the convention before creating production T-codes.
📝 Chapter Summary
- Selection screens are the input screens that appear before a report runs. They are auto-generated from
PARAMETERSandSELECT-OPTIONS. - PARAMETERS creates a single-value input field. Use it for exactly-one-value criteria.
- SELECT-OPTIONS creates a range input field with operators (EQ, BT, GT, etc.). Use it for filtering.
- The four main events run in this order: INITIALIZATION → AT SELECTION-SCREEN → START-OF-SELECTION → END-OF-SELECTION.
- AT SELECTION-SCREEN is the right place to validate user input. Use
MESSAGE ... TYPE 'E'to stop the report on invalid input. - PBO (Process Before Output) = AT SELECTION-SCREEN OUTPUT. PAI (Process After Input) = AT SELECTION-SCREEN.
- Variants let users save selection screen values for reuse.
- Transaction Codes (SE93) let users launch your report with a short code instead of navigating SE38.
🎤 Interview Questions & Answers
Selection screens and events are asked in almost every classic ABAP interview. Know these answers cold.
A selection screen in ABAP is the standard input screen that appears before a report runs. It is automatically generated from PARAMETERS and SELECT-OPTIONS statements and allows users to enter filter criteria, dates, or ranges before the report executes. Selection screens are the default way ABAP reports accept user input.
PARAMETERS creates a single-value input field on the selection screen. SELECT-OPTIONS creates a range input field with multiple operators (equal, greater than, between, etc.), allowing users to specify complex ranges. PARAMETERS is used when exactly one value is expected, while SELECT-OPTIONS is used when a range of values is needed.
The key events in an ABAP report are:
- INITIALIZATION — runs before the selection screen is displayed
- AT SELECTION-SCREEN — runs after user input, before the report processes
- START-OF-SELECTION — runs when the user clicks Execute
- END-OF-SELECTION — runs after all data processing
- AT SELECTION-SCREEN OUTPUT — runs before the selection screen is displayed, used to modify screen fields
INITIALIZATION runs before the selection screen is displayed. It is used to set default values for parameters and selection options. START-OF-SELECTION runs after the user submits the selection screen and is where the main report logic begins. You use INITIALIZATION for setup, and START-OF-SELECTION for the actual data processing.
PBO (Process Before Output) and PAI (Process After Input) are the two main flow logic events in screen programming. PBO runs before a screen is displayed, to prepare the screen for the user. PAI runs after the user submits input, to process that input. Together they control the flow of data between the user and the ABAP program.
AT SELECTION-SCREEN is an event that runs after the user enters data on the selection screen and presses Execute, but before the report’s main logic begins. It is used for input validation, authorization checks, and to trigger additional screens. It has many variants like AT SELECTION-SCREEN ON <field> for field-level validation.
A Variant is a saved set of selection screen values. Users can save a variant once and reuse it many times, saving them from re-entering the same filter criteria every time. Variants are created and managed via transaction SE38 or SE80 and can be set as the default for a report.
You create a Transaction Code (T-code) using transaction SE93. You provide a short T-code name, a description, and then link it to your ABAP report program. This allows users to run the report directly by typing the T-code in the command field, instead of navigating through SE38.
🛠 Practice Task for This Chapter
Build a complete report with a selection screen. This combines everything from Chapters 6–10.
- Create the report
Z_CARRIER_REPORT. - Add inputs: A
PARAMETERSfield for airline code (obligatory) and aSELECT-OPTIONSfor a date range. - Add INITIALIZATION: Pre-fill the date range to the last 30 days.
- Add validation: In
AT SELECTION-SCREEN, check if the airline code exists in table SCARR. If not, show an error message. - Add START-OF-SELECTION: Select matching rows from SCARR and display them in a SALV ALV report.
- Save as a Variant: Name it
DEFAULTwith a short description. - Create a T-code
ZCARRIERusing SE93 and assign the default variant.
Test: Kon Banega Crorepati?
5 questions. ₹1 Crore. Prove you understood Selection Screens & Events. No pressure — restart anytime.
Explore Our Instructor-Led SAP & IT Courses
Self-study works. But if you want guided training, real project practice, and placement support — here are the courses we offer. Book a free demo before you decide.
WhatsApp us