Sei sulla pagina 1di 16

IBM Global Services

2005 IBM Corporation The AT USER-COMMAND Event


and Menu Painter | 4.04
March-2005
The AT USER-COMMAND Event and Menu Painter
IBM Global Services
2005 IBM Corporation 2 March-2005 The AT USER-COMMAND Event and Menu Painter | 4.04
Objectives
The participants will be able to:
Apply the AT USER-COMMAND syntax.
Use the Graphical User Interface.
Use the SY-UCOMM system field.

IBM Global Services
2005 IBM Corporation 3 March-2005 The AT USER-COMMAND Event and Menu Painter | 4.04
Graphical User Interface (GUI)
Titlebar Menubar
Standard
Toolbar
Application
Toolbar
IBM Global Services
2005 IBM Corporation 4 March-2005 The AT USER-COMMAND Event and Menu Painter | 4.04
Menu Painter
Menu Painter
Creates Function Codes
Function Key
Assignments
Standard
Toolbar
Application
Toolbar
Menubar
IBM Global Services
2005 IBM Corporation 5 March-2005 The AT USER-COMMAND Event and Menu Painter | 4.04
GUI Status
The GUI Status (Graphical User Interface Status)
Programmer Defined Buttons and Menus :
In this sample GUI Status, the programmer decided to
create a DOCUMENTS button, and a LIST menu.
IBM Global Services
2005 IBM Corporation 6 March-2005 The AT USER-COMMAND Event and Menu Painter | 4.04
GUI Title
The GUI Title (Graphical User Interface Title)
Programmer defined titlebar
IBM Global Services
2005 IBM Corporation 7 March-2005 The AT USER-COMMAND Event and Menu Painter | 4.04
ABAP Code
The ABAP code
TABLES: LFA1.

START-OF-SELECTION.
SET PF-STATUS TEST1.
SELECT * FROM LFA1.
WRITE: / LFA1-LIFNR, 30 LFA1-NAME1.
ENDSELECT.

AT USER-COMMAND.
CASE SY-UCOMM.
WHEN RUNX.
SET PF-STATUS TEST2.
SET TITLEBAR TB2.
WHEN RUNY.
. . . .
ENDCASE.
SELECT *
SY-SUBRC
CHECK
IBM Global Services
2005 IBM Corporation 8 March-2005 The AT USER-COMMAND Event and Menu Painter | 4.04
Activating the AT USER-COMMAND Event
3rd. Behind the scenes, the ABAP processor reacts and triggers the AT
USER-COMMAND event.
1st. The user clicks on a button that the programmer created on the
GUI Status.
2nd. The system detects that RUNY has been assigned as the function
code behind this button.
IBM Global Services
2005 IBM Corporation 9 March-2005 The AT USER-COMMAND Event and Menu Painter | 4.04
The AT USER-COMMAND Event
*--begin of AT USER-COMMAND event--------------------------------
AT USER-COMMAND.
WRITE: / The user just clicked on a pushbutton, selected,
/ a menu path, or pressed a function key.
*--end of AT USER-COMMAND event-----------------------------------

Do not write this code, we will learn the
complete syntax momentarily.

A New
ABAP
Event
SYNTAX: AT USER-COMMAND.
IBM Global Services
2005 IBM Corporation 10 March-2005 The AT USER-COMMAND Event and Menu Painter | 4.04
3rd.
Behind the scenes, the ABAP processor reacts
and triggers the AT USER-COMMAND event.
1st.
The user clicks on a button
that the programmer created
on the GUI Status.
2nd.
The SY-UCOMM
system field is
updated with the
four byte tag RUNY
A New
ABAP
System Field
SYSTEM FIELD: SY-UCOMM
The SY-UCOMM System Field
IBM Global Services
2005 IBM Corporation 11 March-2005 The AT USER-COMMAND Event and Menu Painter | 4.04
*--BEGIN OF AT USER-COMMAND EVENT MODULE.--------------

AT USER-COMMAND.
CASE SY-UCOMM.
WHEN RUNX.
WRITE: / The user just pressed button X.

WHEN RUNY.
WRITE: / The user just pressed button Y.
ENDCASE.

*--END OF AT USER-COMMAND EVENT MODULE.----------------
Using AT USER-COMMAND with the SY-UCOMM System
Field
Must be in
all caps and
single quotes
IBM Global Services
2005 IBM Corporation 12 March-2005 The AT USER-COMMAND Event and Menu Painter | 4.04
Two programmer defined buttons,
BUTTON X, and BUTTON Y.
This is what our first interactive report, that utilises a GUI status, will look like.
A programmer defined a menu
containing two menu items,
(menu Item X, and menu
Item Y), will duplicate the
functionality of our buttons.
Interactive Report that Utilizes a GUI Status
IBM Global Services
2005 IBM Corporation 13 March-2005 The AT USER-COMMAND Event and Menu Painter | 4.04
Demonstration
Use of AT USER-COMMAND event, system field SY-UCOMM and creation and
usage of GUI components.
Create a program generating a basic list and create different kind of detail lists
from the basic list depending on User Interaction.

IBM Global Services
2005 IBM Corporation 14 March-2005 The AT USER-COMMAND Event and Menu Painter | 4.04
Practice
Use of AT USER-COMMAND event, system field SY-UCOMM and creation and
usage of GUI components.
Create a program generating a basic list and create different kind of detail lists
from the basic list depending on User Interaction.
IBM Global Services
2005 IBM Corporation 15 March-2005 The AT USER-COMMAND Event and Menu Painter | 4.04
Summary
System assigns a default GUI status to all report programs.
GUI status for a program is created through Menu Painter transaction SE41.
GUI for a program contains the following :
Function Key Assignment
Standard Toolbar
Application Toolbar
Menubar
Titlebar
Three components of interactive reporting are :
GUI status
GUI Title
ABAP Code
AT USER-COMMAND event is triggered when the user clicks on a pushbutton or
selects a menu item. Which button has been clicked or which Menu item has
been selected is determined by the system field SY-UCOMM.
IBM Global Services
2005 IBM Corporation 16 March-2005 The AT USER-COMMAND Event and Menu Painter | 4.04
Questions
What are the components of a GUI ?
What can be managed through the GUI status ?
How will you manage the title of your list ?
Which event is used to recognize the user action on the list ?
How do the programmer recognize which pushbutton has been clicked or which
Menu item has been selected ?

Potrebbero piacerti anche