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

pushbutton in screen

Former Member
0 Likes
827

i have 4 pushbuttons in the screen how would i know which one i click?

thanks.

donna

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
792

Field SY-UCOMM ( Or Ok_CODE defined in screen ) will have the value of fcode assigned to the pushbutton in the PAI of screen

Cheers

6 REPLIES 6
Read only

Former Member
0 Likes
792

in pustbutton u can set user command.

based on the user command u hv to identify the button clicked

SELECTION-SCREEN PUSHBUTTON /10(20) CHARLX USER-COMMAND ABCD.

SELECTION-SCREEN PUSHBUTTON /10(20) CHARLY USER-COMMAND BCDE. ...

INITIALIZATION.

MOVE 'My text1' TO CHARLX.

MOVE 'My text2' TO CHARLY.

...

AT SELECTION-SCREEN.

case SSCRFIELDS-UCOMM.

when 'ABCD'.

...

when 'BCDE'.

...

ENDIF.

regards

gv

Message was edited by: Venkat

Read only

0 Likes
792

do u have sample code for that?

thanks

Read only

Former Member
0 Likes
793

Field SY-UCOMM ( Or Ok_CODE defined in screen ) will have the value of fcode assigned to the pushbutton in the PAI of screen

Cheers

Read only

0 Likes
792

go thru this demo pgm

DEMO_SEL_SCREEN_PUSHBUTTON

DEMO_DYNPRO_PUSH_BUTTON

regards

gv

Read only

andreas_mann3
Active Contributor
0 Likes
792

Hi Donna,

look sample-program <b>DEMO_SEL_SCREEN_PUSHBUTTON</b>

-> Venkat was some seconds faster !

regards Andreas

Read only

guillaume-hrc
Active Contributor
0 Likes
792

If you set, let's say 'PB01' as a User-command for your button, you can handle a click with a code like the following:

AT SELECTION-SCREEN.
  CASE sy-ucomm.
    WHEN 'PB01'.
*____Do some stuff here...
  ENDCASE.

In the latest versions, you have also the special statement :

SELECTION-SCREEN FUNCTION KEY 1.

to create a 'function key'. A click on the auto-generated button on the tool bar will then trigger the user-command FC01