ABAP - Keyword Documentation →  ABAP - Reference →  SAP GUI User Dialogs →  Selection Screens →  Create Selection Screens →  SELECTION-SCREEN →  SELECTION-SCREEN - screen_elements → 

SELECTION-SCREEN - PUSHBUTTON

Quick Reference

Syntax

SELECTION-SCREEN PUSHBUTTON [/][pos|POS_LOW|POS_HIGH](len) button_text
                            USER-COMMAND fcode
                            [VISIBLE LENGTH vlen]
                            [ MODIF ID modid]
                            [ldb_additions].


Extras:

1. ... [/][pos|POS_LOW|POS_HIGH](len)

2. ... USER-COMMAND fcode

3. ... VISIBLE LENGTH vlen

Effect

This statement creates a pushbutton on the current selection screen. The text on the pushbutton is determined by the content of button_text. The rules that apply to text also apply to button_text in the addition COMMENT. The addition MODIF ID assigns the pushbutton to the modification group modid.

The additions ldb_additions can only be used in the selection include of a logical database.

Notes

Addition 1

... [/][pos|POS_LOW|POS_HIGH](len)

Effect

The position of the pushbutton must be specified using this addition. The syntax and meaning of are the same as when creating horizontal lines, although in this case len defines the length of the pushbutton in the dynpro of the selection screen. If a pushbutton extends beyond position 83 or beyond the margin of a block with a frame, it is cut off on the right.

Addition 2

... USER-COMMAND fcode

Effect

If the addition USER-COMMAND is specified, the pushbutton must be assigned a function code fcode. The function code fcode must be specified directly and can only contain a maximum of 20 characters.

To enable the pushbutton, the statement TABLES must be used to declare an interface work area of the structure SSCRFIELDS from ABAP Dictionary.

If the user selects the pushbutton on the selection screen, the runtime environment raises the event AT SELECTION-SCREEN and the function code fcode is passed to the component ucomm in the interface work area sscrfields.

Notes

Addition 3

... VISIBLE LENGTH vlen

Effect

The addition VISIBLE LENGTH defines the visible length vlen of the pushbutton and its text. The syntax and meaning of this addition are the same as when creating output fields, although a pushbutton is never displayed as shorter than the text defined for it.

Example

Defines and accesses a standalone selection screen 500 with two pushbuttons in an executable program. An icon and a tooltip are created for the second pushbutton.

TABLES sscrfields.

SELECTION-SCREEN:
  BEGIN OF SCREEN 500 AS WINDOW TITLE title,
    PUSHBUTTON 2(10)  but1 USER-COMMAND cli1,
    PUSHBUTTON 12(30) but2 USER-COMMAND cli2
                           VISIBLE LENGTH 10,
  END OF SCREEN 500.

AT SELECTION-SCREEN.
  CASE sscrfields.
    WHEN 'CLI1'.
      ...
    WHEN 'CLI2'.
      ...
  ENDCASE.

START-OF-SELECTION.
  title  = 'Push button'.
  but1 = 'Button 1'.

  CALL FUNCTION 'ICON_CREATE'
    EXPORTING
      name   = icon_information
      text   = 'Button 2'
      info   = 'My quick info'
    IMPORTING
      RESULT = but2
    EXCEPTIONS
      OTHERS = 0.

  CALL SELECTION-SCREEN '0500' STARTING AT 10 10.





Continue
Example Selection Screens, Pushbuttons