2008 Oct 21 10:26 AM
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
2008 Oct 21 10:37 AM
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.
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.
2008 Oct 21 10:37 AM
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.
2008 Oct 21 10:39 AM
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
2008 Oct 21 10:50 AM
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
2008 Oct 21 11:51 AM
Hello Everyone,
Thanks for your valuable reply.
Thanks & regards,
Ranjith nambiar
2008 Oct 21 2:03 PM
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
2008 Oct 22 9:35 AM
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.
2009 Feb 23 9:12 AM
| User | Count |
|---|---|
| 6 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |