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

At selection screen

Former Member
0 Likes
814

Hello Everyone,

The following snippet mentioned below as been taken from a book

but doesn't work

Program :

selection-screen pushbutton 10(20) text-001 user-command engl.

selection-screen pushbutton 50(20) text-002 user-command germ.

at selection-screen.

at user-command.

case sy-ucomm.

when 'engl'.

lang-engl = 'Y'.

write:/ 'English'.

when 'germ'.

lang-german = 'Y'.

write:/ 'German'.

endcase.

when the push button is pressed it doesn't triggers the user command and also doesn't write the contents as per the case selected.

Does anybody has a better code or a sample to explain this better

ie AT USER-COMMAND.

Regards,

Ranjith Nambiar

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
773

Hi Nambiar,

At user-command is a list event for interactive list, so for selection screen you can proceesd liker this:

selection-screen pushbutton 10(20) text-001 user-command engl.
selection-screen pushbutton 50(20) text-002 user-command germ.

at selection-screen.
*at user-command.
case sy-ucomm.

when 'ENGL'.
Message 'English' type 'I'.
when 'GERM'.
Message 'German' type 'I'.
endcase.

With luck,

Pritam.

7 REPLIES 7
Read only

Former Member
0 Likes
774

Hi Nambiar,

At user-command is a list event for interactive list, so for selection screen you can proceesd liker this:

selection-screen pushbutton 10(20) text-001 user-command engl.
selection-screen pushbutton 50(20) text-002 user-command germ.

at selection-screen.
*at user-command.
case sy-ucomm.

when 'ENGL'.
Message 'English' type 'I'.
when 'GERM'.
Message 'German' type 'I'.
endcase.

With luck,

Pritam.

Read only

Former Member
0 Likes
773

Which book was this example given in ?

In ABAP editor write AT USER-COMMAND and press F1. You can see an example given for AT USER-COMMAND

regards,

Advait

Read only

Former Member
0 Likes
773

Hi,

one thing keep in yor mind in in single cotations( 'engl' IT'S a worg. 'ENGL' ) we have to keep in CAPITAL LETTERS only

thanks & Regrds

swamy

Read only

Former Member
0 Likes
773

Hello Everyone,

Thanks for your valuable reply.

Thanks & regards,

Ranjith nambiar

Read only

Former Member
0 Likes
773

Hi,

You cant use At User Command in the events which are used on Selection screen as At User Command event is a List Event.

It means you can use At User-Command event on the output screen of the report (Same as we use At Line Selection Event) but you cant use it on the selection screen itself.

Regards,

Syed

Read only

Former Member
0 Likes
773

Try this

it may solve u r problem

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.

MESSAGE i888(sabapdocu) WITH text-001 sscrfields-ucomm.

CASE sscrfields-ucomm.

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.

Read only

Former Member
0 Likes
773

answered.