Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Push button

Former Member
0 Likes
672

How to add a push button to the selection screen..?

3 REPLIES 3
Read only

Former Member
0 Likes
534

Hi,

Try this,

TABLES SSCRFIELDS.

DATA FLAG.

SELECTION-SCREEN:

BEGIN OF SCREEN 500 AS WINDOW TITLE TIT,

BEGIN OF LINE,

PUSHBUTTON 2(10) BUT1 USER-COMMAND CLI1,

PUSHBUTTON 12(10) BUT2 USER-COMMAND CLI2,

END OF LINE,

BEGIN OF LINE,

PUSHBUTTON 2(10) BUT3 USER-COMMAND CLI3,

PUSHBUTTON 12(10) BUT4 USER-COMMAND CLI4,

END OF LINE,

END OF SCREEN 500.

AT SELECTION-SCREEN.

CASE SSCRFIELDS.

WHEN 'CLI1'.

FLAG = '1'.

WHEN 'CLI2'.

FLAG = '2'.

WHEN 'CLI3'.

FLAG = '3'.

WHEN 'CLI4'.

FLAG = '4'.

ENDCASE.

START-OF-SELECTION.

TIT = 'Four Buttons'.

BUT1 = 'Button 1'.

BUT2 = 'Button 2'.

BUT3 = 'Button 3'.

BUT4 = 'Button 4'.

CALL SELECTION-SCREEN 500 STARTING AT 10 10.

CASE FLAG.

WHEN '1'.

WRITE / 'Button 1 was clicked'.

WHEN '2'.

WRITE / 'Button 2 was clicked'.

WHEN '3'.

WRITE / 'Button 3 was clicked'.

WHEN '4'.

WRITE / 'Button 4 was clicked'.

WHEN OTHERS.

WRITE / 'No Button was clicked'.

ENDCASE.

Regards,

Padmam.

Read only

Former Member
0 Likes
534

hi,

tyr this

TABLES: sscrfields.

SELECTION-SCREEN PUSHBUTTON 2(10) pbut1 USER-COMMAND chk.

AT SELECTION-SCREEN OUTPUT.

pbut1 = 'Test This'.

AT SELECTION-SCREEN.

IF sscrfields-ucomm = 'CHK'.

sscrfields-ucomm = 'ONLI'.

ENDIF.

START-OF-SELECTION.

DO 10 TIMES.

WRITE:/ sy-index.

ENDDO.

thanks & regards,

Venkatesh

Read only

Former Member
0 Likes
534

hi

To create a pushbutton on the selection screen, you use:

<b>SELECTION SCREEN PUSHBUTTON [/]<pos(len)> <push>

USER-COMMAND <ucom> [MODIF ID <key>].</b>The [/]<pos(len)> parameters and the MODIF IF addition have the same function as for the formatting options for underlines and comments.

<push> determines the pushbutton text. For <push>, you can specify a text symbol or a field name with a maximum length of eight characters. This character field must not be declared with the DATA statement, but is generated automatically with length <len>. The field must be filled before the selection screen is called.

For <ucom>, you must specify a code of up to four characters. When the user clicks the pushbutton on the selection screen, <ucom> is entered in the UCOMM of the SSCRFIELDS interface work area. You must use the TABLES statement to declare the SSCRFIELDS structure. The contents of the SSCRFIELDS-UCOMM field can be processed during the AT SELECTION-SCREENevent.

follow the code

REPORT demo_sel_screen_pushbutton.

TABLES sscrfields.

DATA flag(1) TYPE c.

SELECTION-SCREEN:

BEGIN OF SCREEN 500 AS WINDOW TITLE tit,

BEGIN OF LINE,

PUSHBUTTON 2(10) but1 USER-COMMAND cli1,

PUSHBUTTON 12(10) text-020 USER-COMMAND cli2,

END OF LINE,

BEGIN OF LINE,

PUSHBUTTON 2(10) but3 USER-COMMAND cli3,

PUSHBUTTON 12(10) text-040 USER-COMMAND cli4,

END OF LINE,

END OF SCREEN 500.

AT SELECTION-SCREEN.

CASE sscrfields.

WHEN 'CLI1'.

flag = '1'.

WHEN 'CLI2'.

flag = '2'.

WHEN 'CLI3'.

flag = '3'.

WHEN 'CLI4'.

flag = '4'.

ENDCASE.

START-OF-SELECTION.

tit = 'Four Buttons'.

but1 = 'Button 1'.

but3 = 'Button 3'.

CALL SELECTION-SCREEN 500 STARTING AT 10 10.

CASE flag.

WHEN '1'.

WRITE / 'Button 1 was clicked'.

WHEN '2'.

WRITE / 'Button 2 was clicked'.

WHEN '3'.

WRITE / 'Button 3 was clicked'.

WHEN '4'.

WRITE / 'Button 4 was clicked'.

WHEN OTHERS.

WRITE / 'No Button was clicked'.

ENDCASE.

<b>pls reward points for useful ans</b>

<i>Regards

Vivek</i>