ABAP Core
ABAP Developmentbeginner

ABAP Core Part 5: Selection Screens — PARAMETERS, SELECT-OPTIONS and Validation

Key takeaway

Build selection screens users understand: PARAMETERS, SELECT-OPTIONS and ranges, checkboxes and radio buttons, defaults, value helps and input validation in AT SELECTION-SCREEN.

Explanation

📌 KEY POINTS
✅ PARAMETERS = one value; SELECT-OPTIONS = a range table (single values, intervals, exclusions).

✅ Use SELECT-OPTIONS directly in WHERE … IN s_… — empty means "all".

✅ Validate input in AT SELECTION-SCREEN; set defaults in INITIALIZATION.

⚠️ Always check authorization for the entered values — the selection screen is user input.

━━━━━━━━━━━━━━━━━━━━
▶ WHERE WE ARE

Parts 1–4 used a single parameter. Real reports need flexible input. This part covers the classic selection screen of executable programs.

━━━━━━━━━━━━━━━━━━━━
▶ 1. PARAMETERS

PARAMETERS p_carr TYPE s_carr_id OBLIGATORY.

  • TYPE from the dictionary → field label (via Goto → Text elements → Selection texts), F4 help and checks.
  • DEFAULT, OBLIGATORY, LOWER CASE, MEMORY ID.
  • Checkbox: PARAMETERS p_test AS CHECKBOX DEFAULT 'X'.
  • Radio buttons: PARAMETERS: p_list RADIOBUTTON GROUP out DEFAULT 'X', p_alv RADIOBUTTON GROUP out.

━━━━━━━━━━━━━━━━━━━━
▶ 2. SELECT-OPTIONS AND RANGES

SELECT-OPTIONS s_fldate FOR ls_sflight-fldate.

  • Creates a range table with SIGN (I/E), OPTION (EQ, BT, CP, …), LOW, HIGH.
  • WHERE fldate IN @s_fldate — empty range = no restriction.
  • NO-EXTENSION, NO INTERVALS restrict the input style.
  • You can build ranges in code too: DATA lt_range TYPE RANGE OF s_carr_id.

━━━━━━━━━━━━━━━━━━━━
▶ 3. BLOCKS AND TEXTS

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE TEXT-001. … END OF BLOCK b1.

Maintain text symbols and selection texts — no hard-coded labels.

━━━━━━━━━━━━━━━━━━━━
▶ 4. EVENTS

  • INITIALIZATION — before the screen: defaults (e.g. date range = next 30 days).
  • AT SELECTION-SCREEN — after input: validation; MESSAGE … TYPE 'E' keeps the user on the screen with the field ready for input.
  • AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_x — custom F4 help.
  • START-OF-SELECTION — the main processing.

━━━━━━━━━━━━━━━━━━━━
▶ 5. VALIDATION AND AUTHORIZATION

  • Check existence (e.g. airline exists in SCARR).
  • AUTHORITY-CHECK for the entered organizational values — never trust input.

━━━━━━━━━━━━━━━━━━━━
▶ 6. VARIANTS

Users save frequently used inputs as variants; background jobs run reports with variants.

━━━━━━━━━━━━━━━━━━━━
▶ STEP BY STEP

  1. Build the screen in the code example (block, airline, date range, radio buttons, test checkbox).
  2. Default the date range in INITIALIZATION.
  3. Validate the airline in AT SELECTION-SCREEN.
  4. Use the ranges in the SELECT and run with different inputs, including exclusions.

✅ CHECKPOINT: your report has a validated, user-friendly selection screen.

Code example

ABAP Code
REPORT zabap_core_selscreen. TABLES sflight.                                  " needed for SELECT-OPTIONS ... FOR sflight-... * ===== Step 1: screen layout =====SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.   " 'Selection'PARAMETERS     p_carr   TYPE s_carr_id OBLIGATORY.SELECT-OPTIONS s_connid FOR sflight-connid.SELECT-OPTIONS s_fldate FOR sflight-fldate.SELECTION-SCREEN END OF BLOCK b1. SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.   " 'Output'PARAMETERS: p_list RADIOBUTTON GROUP out DEFAULT 'X',            p_alv  RADIOBUTTON GROUP out,            p_free AS CHECKBOX DEFAULT 'X'.                     " only flights with free seatsSELECTION-SCREEN END OF BLOCK b2. DATA: lt_flights TYPE STANDARD TABLE OF sflight,      ls_f       TYPE sflight,      lv_carrid  TYPE s_carr_id. * ===== Step 2: defaults =====INITIALIZATION.  s_fldate-sign   = 'I'.  s_fldate-option = 'BT'.  s_fldate-low    = sy-datum.  s_fldate-high   = sy-datum + 30.  APPEND s_fldate. * ===== Step 3: validation + authorization =====AT SELECTION-SCREEN ON p_carr.  SELECT SINGLE carrid FROM scarr INTO lv_carrid WHERE carrid = p_carr.  IF sy-subrc <> 0.    MESSAGE e001(zflight) WITH p_carr.           " 'Airline &1 does not exist'  ENDIF.  AUTHORITY-CHECK OBJECT 'S_CARRID' ID 'CARRID' FIELD p_carr ID 'ACTVT' FIELD '03'.  IF sy-subrc <> 0.    MESSAGE e002(zflight) WITH p_carr.           " 'No authorization for airline &1'  ENDIF. * ===== Step 4: use ranges directly in SQL =====START-OF-SELECTION.  SELECT * FROM sflight INTO TABLE lt_flights    WHERE carrid = p_carr      AND connid IN s_connid                     " empty range = all      AND fldate IN s_fldate.   IF p_free = 'X'.    DELETE lt_flights WHERE seatsocc >= seatsmax.  ENDIF.   IF p_list = 'X'.    LOOP AT lt_flights INTO ls_f.      WRITE: / ls_f-carrid, ls_f-connid, ls_f-fldate, ls_f-seatsocc, '/', ls_f-seatsmax.    ENDLOOP.  ELSE.    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'       " full ALV: see ALV topic      EXPORTING i_structure_name = 'SFLIGHT'      TABLES    t_outtab         = lt_flights      EXCEPTIONS OTHERS          = 1.  ENDIF. * 💡 Modern syntax (7.40+): s_fldate[] = VALUE #( ( sign = 'I' option = 'BT' low = ... ) ).

Real project scenario

A report accepted a company code as a free parameter without any check. A user from one country entered another country's company code and exported confidential margin data. The audit finding required a fix within days.
The team added AUTHORITY-CHECK in AT SELECTION-SCREEN for the entered organizational values and switched the parameter to a dictionary type with value help. They also reviewed all reports with organizational selection fields for the same gap.

Common mistakes

  • No authorization check for entered organizational values.
  • Hard-coded screen labels instead of selection texts.
  • Validating in START-OF-SELECTION, losing the chance to correct input.
  • Using PARAMETERS where users need ranges.
  • Forgetting that an empty SELECT-OPTIONS means "all".

Best practices

  • Use dictionary types for F4 help and labels.
  • Use SELECT-OPTIONS for flexible ranges; pass them directly to SQL.
  • Validate and authorize in AT SELECTION-SCREEN.
  • Set sensible defaults in INITIALIZATION.
  • Maintain selection texts and text symbols for translation.

Interview angle

Questions: "PARAMETERS vs SELECT-OPTIONS?", "Which events are used on the selection screen?", "What is the structure of a range table?"
Strong answer: PARAMETERS take one value, SELECT-OPTIONS create a range table with SIGN, OPTION, LOW, HIGH used via IN in SQL (empty = all); INITIALIZATION sets defaults, AT SELECTION-SCREEN validates (error message keeps the screen), ON VALUE-REQUEST provides F4, START-OF-SELECTION processes; always AUTHORITY-CHECK entered org values.

Practice this lesson

Quick check

1. A SELECT-OPTIONS field is left empty by the user. What happens in WHERE field IN @s_field?

2. In which event should default values for a selection screen be set?

3. Where should the entered company code be checked for authorization in a report?

Interview questions

1. A report performs heavy database selection inside AT SELECTION-SCREEN. What is the problem and what is the correct design?

Answer it in your own words first, then compare.

2. A billing report allowed all filters to stay blank and read millions of rows. How do you fix the selection screen?

Answer it in your own words first, then compare.

Practice more with Interview AI →

Reference-verified: the steps are checked against official SAP documentation and tutorials, and object and field names in the sample code are checked for consistency. The code has not been compiled or run on an SAP system by ERPClimb. Syntax marked release-dependent varies by SAP release, so check it in your own system.

More lessons in this topic

Interview questions on this topic

Related SAP topics