Push Button in Selection-screen using ABAP

Hi The below sample code will use to create a push button on selection-screen, adding push button to a selection-screen in ABAP is the most common requirement for a ABAPer

,.

TABLES sscrfields.

*--------------------------------------------------------------*

*Selection-Screen

*--------------------------------------------------------------*

SELECTION-SCREEN:

      PUSHBUTTON /2(40) button1 USER-COMMAND but1,

      PUSHBUTTON /2(40) button2 USER-COMMAND but2.

*--------------------------------------------------------------*

*At Selection-Screen

*--------------------------------------------------------------*

AT SELECTION-SCREEN.

  CASE sscrfields.

    WHEN 'BUT1'.

      MESSAGE 'Button 1 was clicked' TYPE 'I'.

    WHEN 'BUT2'.

      MESSAGE 'Button 2 was clicked' TYPE 'I'.

  ENDCASE.

*--------------------------------------------------------------*

*Initialization

*--------------------------------------------------------------*

INITIALIZATION.

  button1 = 'Button 1'.

  button2 = 'Button 2'.

Popular posts from this blog

ALV with field catalog merge

SAP ABAP real-time Interview Questions with answers

Using GUI Upload in SAP ABAP