Selection Screens & Events

ABAP Selection Screens & Events: Complete Beginner Guide 2026 | ABAP Zero to Hero
ABAP Zero to Hero

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.

Chapter 10 of 20 18 min read Part 2: Core ABAP 8 Interview Q&A

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.

The mindset shift Up to now, your reports displayed data. From here forward, your reports will interact with the user — accepting criteria, validating input, and adapting to what the user needs.

🎯 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.

Analogy Think of the selection screen as a search form on a shopping website. You type “blue shoes, size 10” and click Search. The selection screen does the same thing for your ABAP report — you type filter criteria, click Execute, and the report returns matching data.

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

AdditionWhat It Does
DEFAULT valueSets a default value
OBLIGATORYUser must enter a value
AS CHECKBOXRenders as a checkbox
RADIOBUTTON GROUP grpRenders as a radio button
LOWER CASEAllows lowercase input
NO-DISPLAYField is hidden on the screen
VISIBLE LENGTH nSets 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.
Why SELECT-OPTIONS wins A single SELECT-OPTIONS field replaces what would otherwise be multiple PARAMETERS and complex WHERE-clause logic. It is the standard for filtering reports in SAP.

Useful SELECT-OPTIONS additions

AdditionEffect
DEFAULT valuePre-fill with a default range
OBLIGATORYAt least one value required
NO-EXTENSIONHides the extended range button
NO INTERVALSHides the Between operator
LOWER CASEAllows lowercase input
NO-DISPLAYHides the field on screen
VISIBLE LENGTH nSets 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

EventWhen It RunsTypical Use
INITIALIZATIONBefore the selection screen is displayedSet default values for parameters
AT SELECTION-SCREEN OUTPUTJust before the screen appearsModify field properties (hide, disable)
AT SELECTION-SCREENAfter the user presses ExecuteValidate input, check authorizations
AT SELECTION-SCREEN ON fieldOn specific field events (Enter key)Field-level validation
START-OF-SELECTIONAfter all validations passMain report logic — SELECT data
END-OF-SELECTIONAfter all processing is doneFinal summary, cleanup
Memory trick Initialization → Screen displays → User enters data → AT SELECTION-SCREEN (validate) → START-OF-SELECTION (process) → END-OF-SELECTION (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’ behavior When you use 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).

EventFull FormWhen It Runs
PBOProcess Before OutputBefore the screen is displayed to the user
PAIProcess After InputAfter 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 LogicSelection Screen Equivalent
PBOAT SELECTION-SCREEN OUTPUT
PAIAT SELECTION-SCREEN
Interview tip “What is PBO and PAI?” is a standard interview question. Answer: “PBO (Process Before Output) runs before a screen is displayed. PAI (Process After Input) runs after the user submits input. Together they control the flow of data between the user and the ABAP program.”

💾 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

  1. Fill in the selection screen with the desired values
  2. Click Save (or press Ctrl+S) on the selection screen toolbar
  3. Give the variant a name and description
  4. 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_CATALOG or RS_VARIANT_EXISTENCE_CHECK
Why variants matter In production systems, users run the same report every day with the same criteria. Variants make this a one-click operation. Reports without variants quickly become disliked.

🚀 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

1 Open SE93

Transaction SE93 is used to create, change, and display T-codes.

2 Enter T-code name

Type a name starting with Z (e.g., ZREPORT01). Click Create.

3 Enter description and type

Give a short description. Choose Program and selection screen (report transaction) as the type.

4 Enter program name and screen

Enter your program name (e.g., Z_SELECTION_SCREEN_DEMO) and screen number (usually 1000). Optionally assign a default variant.

5 Save with a transport request

Save the T-code. Assign it to a transport request. Now users can launch the report by typing ZREPORT01.

Naming convention In real projects, T-codes follow a naming standard — often 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 PARAMETERS and SELECT-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.

1 What is a selection screen in ABAP?

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.

2 What is the difference between PARAMETERS and SELECT-OPTIONS?

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.

3 What are the different events in an ABAP program?

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
4 What is the difference between INITIALIZATION and START-OF-SELECTION?

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.

5 What is PBO and PAI?

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.

6 What is AT SELECTION-SCREEN and when is it triggered?

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.

7 What is a Variant in ABAP?

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.

8 How do you create a Transaction Code for an ABAP 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.

  1. Create the report Z_CARRIER_REPORT.
  2. Add inputs: A PARAMETERS field for airline code (obligatory) and a SELECT-OPTIONS for a date range.
  3. Add INITIALIZATION: Pre-fill the date range to the last 30 days.
  4. Add validation: In AT SELECTION-SCREEN, check if the airline code exists in table SCARR. If not, show an error message.
  5. Add START-OF-SELECTION: Select matching rows from SCARR and display them in a SALV ALV report.
  6. Save as a Variant: Name it DEFAULT with a short description.
  7. Create a T-code ZCARRIER using SE93 and assign the default variant.
Why this matters This exercise covers selection screens, events, validation, ALV, variants, and T-codes — the exact combination used in every real SAP report. If you can build this, you can build any report.
🎯 Chapter 10 Challenge

Test: Kon Banega Crorepati?

5 questions. ₹1 Crore. Prove you understood Selection Screens & Events. No pressure — restart anytime.

₹1,000 ₹10,000 ₹1,00,000 ₹10,00,000 ₹1 Crore
Question 1 of 5
Score: 0
Q1
🏆
You Did It!
0/5Correct Answers
You won ₹0
➡️ Next Chapter

➡️ Next Chapter

You can now build interactive reports. In Chapter 11, you will learn Debugging & Error Handling — how to find and fix bugs in your code, and how to handle errors gracefully when things go wrong.

Chapter 11 Debugging & Error Handling →
Want to Learn Faster?

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 WhatsApp us
Call Now Button