SET USER-COMMAND

Basic form 11

SET USER-COMMAND f.

Effect

This statement only works with lists.

Sets the contents of the field f as USER-COMMAND and executes them immediately when the list is next displayed (i.e. the system suppresses the list display und immediately processes the event AT LINE-SELECTION, AT USER-COMMAND or, in the case of a system function code (list of reserved function codes, see AT USER-COMMAND), this system function).
The effect is exactly as if the user had entered the function in the command field and pressed ENTER. This means that the current positioning of the list (SCROLL) and the cursor (SET CURSOR) is taken into account.

Notes

You can specify SET USER-COMMAND several times in the same event.
If you set several functions one after the other with USER-COMMAND when creating a list, only the last one is effective.
If the function key ENTER in the GUI status of the relevant list itself contains a function code, this is executed rather than that specified with SET USER-COMMAND.

You can also use this key word with asynchronous RFCs ( CALL FUNCTION func STARTING NEW TASK taskname) by using the addition PERFORMING form ON END OF TASK. Here, the key word SET USER-COMMAND is used in the subroutine (see RECEIVE).

Example

Process a line selection immediately:

WRITE: 'List'...  "Create a list
SET CURSOR LINE 7.

SET USER-COMMAND 'PICK'.

The event AT LINE-SELECTION is processed immediately for list line 7.

Example

Process a function immediately:

WRITE: 'List'...  "Create a list

SET USER-COMMAND 'FUN'.

Processes the event AT USER-COMMAND immediately; the system field SY-UCOMM contains the function code FUN.

Example

Leave list immediately:

WRITE: 'List'...  "Create a list

SET USER-COMMAND 'BACK'.

The list is not displayed, but is left immediately.

Example

Create list with dialog box 'Find by...':

WRITE: 'List'...  "Create a list

SET USER-COMMAND '%SC'.

The list is displayed with the dialog box 'Find by...'.

Additional help

Programm-Driven Event Trigger