sapdev logo background
sapdev logo sapdev logo
Comments

ABAP AT USER-COMMAND Statement syntax, information and example SAP source code



Return to Statement index



AT USER-COMMAND

Short Reference

ABAP Syntax AT USER-COMMAND.

What does it do? This statement defines an event block whose event is triggered by the ABAP runtime environment if, when a screen is displayed, a function with a self-defined function code is chosen.

Latest notes: Self-defined function codes are all those that include character combinations, except for the following:
The function codes "PICK" and "PFnn" ( "nn" stands for 01 to 24) do not trigger the event AT USER-COMMAND , but the events AT LINE-SELECTION and AT PFnn instead.
All function codes that start with the character "%" are interpreted as system functions and do not trigger the event AT USER-COMMAND . The system functions for lists are listed in the following table 1.
The function codes in the following table 2, likewise, do not trigger the event AT USER-COMMAND , but are handled by the list processor.

Table 1
Function Code Function
%CTX Calls a context menu
%EX Exit
%PC Save to file
%PRI Spool
%SC Search for ...
%SC+ Find Next
%SL Save in Office
%ST Save in report tree

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 Saves list lines in a text file named "abap.lst" in standard character format 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 back n lines
PL+ Scroll to last line of the page
PL+n Scroll forward n lines
PNOP No effect
PP- Scroll back one page
PP-n Scroll back n pages
PP+ Scroll forward one page
PP+n Scroll forward n pages
PPn Scroll to beginning of page n
PRI, PRINT Spool
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
PS+ Scroll one column to the right
PS+n Scroll n columns to the right
PSn Scroll to column n
PZn Scroll to line n
RW Cancel settings

Example ABAP Coding This program works with a self-defined GUI status MYLIST. The function associated there with the function code MY_SELECTION triggers the event AT USER-COMMAND when the list is displayed and also creates details lists.
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.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




AT_SELECTION-SCREEN_EVENTS
AUTHORITY-CHECK




comments powered by Disqus