Handling Single and Double Clicks
Usually the user selects areas in the ALV output, by clicking - and perhaps also pressing CTRL or shift - in the ALV output.
You are also able to determine which functions will be started when the user performs the following mouse actions:
· Single click on a cell or an item of the ALV output
·
Double click
on a cell or an item of the ALV output
or alternatively
Selecting a cell or an item of the ALV output and pressing
F2

For more information on clicking options, see Displaying Interactive Elements
You are able to make the following settings for mouse actions:
· Functions for single click
· Functions for Double Click or F2
The following is valid for all of these functions:
Display type ALV Tool |
Classic ABAP list |
Full screen |
In the Container |
Simple, two-dimensional table |
Yes |
Yes |
Yes |
Hierarchical-sequential list |
Yes |
|
|
Tree structure |
|
Yes |
Yes |
So that the user not only selects the rows or the item with a single click, but also triggers a specific function, you have to ensure the following:
· The cells/items for which these functions are to be triggered have a specific Cell or Item Type:
¡ In list-like ALV outputs, the cells have the cell type HOTSPOT
¡ In tree structures the items have the item type LINK
· You have registered your application for the event LINK_CLICK (class CL_SALV_EVENTS_TABLE, CL_SALV_EVENTS_HIERSEQ or CL_SALV_EVENTS_TREE) and programmed it into a suitable event handler.
You have two options for processing the double click or F2 being pressed:
·
You register
your application for the event DOUBLE_CLICK (class CL_SALV_EVENTS_TABLE,
CL_SALV_EVENTS_HIERSEQ or CL_SALV_EVENTS_TREE)
or
· You specify the function code of the function directly that is to be executed with a double click or F2.

The DOUBLE_CLICK event returns the position (cell or item) where the user double clicked. The second option, on the other hand, does not return information about exactly where the double click occurred.
Methods
Function |
Class |
Method |
Set function code |
CL_SALV_FUNCTIONAL_SETTINGS |
SET_F2_CODE |
Get function code |
GET_F2_CODE |