AT USER-COMMAND
AT USER-COMMAND.
Effect 作用
This statement defines an event block whose event is triggered by the ABAP runtime environment if, during the display of a screen list, a function with a self-defined function code was chosen.
这个语句定义了一个如果在屏幕列表显示期间选择了具有自定义的功能码的函数就会被ABAP运行环境触发事件块。
Note
Self-defined function codes are all those that include character combinations, except for the following:
自定义的功能码是所有那些包含字符的组合,除了以下部分:
- The function codes PICK and PF## ("##" stands for 01 to 24) do not cause the event AT USER-COMMAND, but the events AT LINE-SELECTION and AT PF##.
功能码PICK和PF##(‘##’代码01到24)触发事件AT USER-COMMAND,但是能触发AT LINE-SELECTION 和 AT PF##。
- All function codes that start with the character "%" are interpreted as system functions and do not cause the event AT USER-COMMAND. The system functions for lists are listed in the following table 1.
所有的以字符%开始的功能码被看作是系统函数并且不会触发AT USER-COMMAND事件。系统函数列表被表在如下的表1中。
- The function codes in the following table 2, likewise, do not cause the event AT USER-COMMAND, but are handled by the list processor.
表2中的功能码,同样地也不会触发AT USER-COMMAND事件,但是被列表处理器使用。
Table 1 表1
Function code |
Function |
功能码 |
函数 |
%CTX |
Call a context menu |
%CTX |
显示右键菜单 |
%EX |
Exit |
%EX |
退出 |
%PC |
Save to file |
%PC |
保存文件 |
%PRI |
|
%PRI |
打印 |
%SC |
Search for ... |
%SC |
查找 |
%SC+ |
Find next |
%SC+ |
查找下一个 |
%SL |
Search in office |
%SL |
在office中查找 |
%ST |
Save to report tree |
%ST |
保存到报表树 |
|
|
Table 2
Function code |
Function |
BACK |
Back 返回 |
P- |
Scroll to previous page 返回到上一页 |
P-- |
Scroll to first page 跳转到第一页 |
P+ |
Scroll to next page 跳转到下一页 |
P++ |
Scroll to last page 跳转到最后一页 |
PFILE name |
Store list lines in a text file named abap.lst in standard character representation in the standard directory of the application server. If a name is entered using name, this is converted to lowercase letters and used as the file name. |
PL- |
Scroll to first line of the page 跳转到当前页的第一行 |
PL-n |
Scroll n lines back 返回N行 |
PL+ |
Scroll to last line of the page 跳转到当前页的最后一行 |
PL+n |
Scroll n lines up 向上跳转N行 |
PNOP |
No effect 没有作用 |
PP- |
Scroll back one page 返回一页 |
PP-n |
Scroll n pages back 返回N页 |
PP+ |
Scroll one page forward 向前跳转一页 |
PP+n |
Scroll n pages forwad 向前跳转N页 |
PPn |
Scroll to beginning of page n 跳转到第N页的开始 |
PRI, PRINT |
Print 打印 |
PS-- |
Scroll to first column 跳转到第一列 |
PS++ |
Scroll to last column 跳转到最后一列 |
PS- |
Scroll one column to the left 向左跳转一列 |
PS-n |
Scroll n columns to the left 向左跳转N列 |
PS+ |
Scroll one column to the right 向右跳转一列 |
PS+n |
Scroll n columns to the right 向右跳转N列 |
PSn |
Scroll to column n 跳转到第N列 |
PZn |
Scroll to line n 跳转到第N行 |
RW |
Cancel 取消 |
Example 例子
This program works with a self-defined GUI status MYLIST. The function that is linked there with the function code MY_SELECTION causes the event AT USER-COMMAND during list display and also creates details lists.
这个程序需要一个自定义的GUI状态MYLIST。连接到那的具有功能码MY_SELECTION的函数触发AT USER-COMMAND事件在列表显示期间并且创建列表明细。
REPORT demo_at_user_command.
START-OF-SELECTION.
SET PF-STATUS 'MYLIST'.
WRITE 'List line'.
AT USER-COMMAND.
IF sy-lsind = 20.
SET PF-STATUS 'MYLIST' EXCLUDING 'MY_SELECTION'.
ENDIF.
CASE sy-ucomm.
WHEN 'MY_SELECTION'.
WRITE: / 'You worked on list', sy-listi,
/ 'You are on list', sy-lsind.
...
ENDCASE.