SetSelectionRange() is used to select or unselect a range of rows in a multi-row selection mode:
CALL dlg.SetSelectionRange ("screen_array", start_index, end_index, selection)
The method needs four arguments.
start_index and end_index arguments specify the first and the last row of the range to be selected. The indexes values should fall within the possible range of the array indexes.
-1 specified as the end_index value indicates that the rows should be selected from the start_index to the end of the list.
The selection argument specifies whether the defined range is selected or deselected. Value 1 means that the rows will be selected, 0 will make them deselected.
There is some specifics about using variables with ui.Dialog methods.
You can learn about them here.