ABAP Keyword Documentation →  ABAP − Reference →  User Dialogs → 

User Dialogs

This example demonstrates the classic user dialog - selection screen, screen, message, and list.

Source Code

REPORT demo_hello_world.

CLASS demo DEFINITION.
  PUBLIC SECTION.
    CLASS-METHODS main.
ENDCLASS.

SELECTION-SCREEN BEGIN OF SCREEN 1100.
PARAMETERS input(12) TYPE c DEFAULT 'Hello World!'.
SELECTION-SCREEN END OF SCREEN 1100.

CLASS demo IMPLEMENTATION.
  METHOD main.

* Selection Screen
    CALL SELECTION-SCREEN 1100 STARTING AT 10 10.
    IF sy-subrc <> 0.
      LEAVE PROGRAM.
    ENDIF.

* Dynpro
    CALL SCREEN 100.

* Message
    MESSAGE input TYPE 'I'.

* List
    WRITE input.

  ENDMETHOD.
ENDCLASS.

START-OF-SELECTION.
  demo=>main( ).

Description

First, an input field is created on the standard selection screen using PARAMETERS. Then, CALL SCREEN is used to call a screen that displays the value of the field. The MESSAGE statement sends the text as a message. Finally, it is written to the basic list of the program using a WRITE statement.