SET USER-COMMAND fcode.
Triggers a list event with a function code specified in fcode. fcode must be a character-type data object. You can use this statement during list generation. 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:
If the corresponding event block is implemented, the value of sy-lsind is increased by one and the event block is executed.
If the SET USER-COMMAND statement is executed several times during list creation, only the last statement is valid.
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'.