Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  User Dialogs →  Screens →  Dynpro Fields →  Screen Fields - Examples 

Screens, Processing Input and Output Fields

The example shows how to process screen fields local in the program.

Other versions: 7.31 | 7.40 | 7.54

Source Code

PROGRAM demo_dynpro_input_output.

DATA: input  TYPE i,
      output TYPE i,
      radio1(1) TYPE c, radio2(1) TYPE c, radio3(1) TYPE c,
      box1(1) TYPE c, box2(1) TYPE c, box3(1) TYPE c.

CALL SCREEN 100.

MODULE init_screen_100 OUTPUT.
  SET PF-STATUS 'SCREEN_100'.
  CLEAR input.
  radio1 = 'X'.
  CLEAR: radio2, radio3.
ENDMODULE.

MODULE user_command_0100 INPUT.
  IF sy-ucomm = 'CANCEL'.
    LEAVE PROGRAM.
  ENDIF.
  output = input.
  box1 = radio1.
  box2 = radio2.
  box3 = radio3.
ENDMODULE.

Description

The static next screen number of screen 100 is 100. The screen fields of output, box1, box2, and box3 have been defined as not ready for input in Screen Painter. The length of input is specified so that the user can enter a nine-digit integer without thousands separators. However, the display in the output field contains up to two thousands separators. If the length of input had remained 11 digits, a runtime error could occur if users do not set thousand separators. The user entries in the input fields are passed to the ABAP program in the PAI event triggered by ENTER and then assigned to the output fields in the dialog module user_command_100. The next time the screen appears, the screen fields contain the appropriate values. The input fields are set in the dialog module init_screen_100 in the event PBO.