sapdev logo background
sapdev logo sapdev logo
Comments

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



Return to Statement index



SET USER-COMMAND

Short Reference

ABAP Syntax SET USER-COMMAND fcode.

What does it do? Triggers a list event with a function code specified in fcode . fcode must be a character-type data object . You can use this statement when generating a list. After completion, but before display of the current list, the runtime environment responds as if a user action were performed in the displayed list using the function code specified in fcode .
The assignment of list events to function codes corresponds to the description under AT USER-COMMAND :
The predefined function codes of the tables listed under AT USER-COMMAND are caught by the runtime environment
The function codes "PICK" and "PFnn" trigger the events AT LINE-SELECTION or AT PFnn
all other functions trigger the event AT USER-COMMAND
If the corresponding event block is implemented, the value of
sy-lsind is increased by one and the event block is executed.
If you use multiple SET USER-COMMAND statements while creating a list, the system executes only the last one.

Latest notes: The function code "PICK" only triggers an event if the cursor is positioned on a list row.
If a function code is assigned to the " Return key in the current GUI status , this function code is used instead of the one specified in fcode .

Example ABAP Coding Program-driven creation of one basic list and two details lists, as well as the display of a search dialog box in the second details list using the predefined function code "%SC" . The
SET CURSOR statement is used to position the cursor in a list row in event block AT LINE-SELECTION to enable the "PICK" function code.
START-OF-SELECTION.
SET USER-COMMAND 'MYCOMM'.
WRITE 'Basic List'.

AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'MYCOMM'.
WRITE 'Details List from USER-COMMAND,'.
WRITE: 'SY-LSIND', sy-lsind.
SET CURSOR LINE 1.
SET USER-COMMAND 'PICK'.
ENDCASE.

AT LINE-SELECTION.
WRITE 'Details List from LINE-SELECTION,'.
WRITE: 'SY-LSIND', sy-lsind.
SET USER-COMMAND '%SC'.
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved




SET_UPDATE_TASK_LOCAL
SHIFT




comments powered by Disqus