Handling Keyboard Actions

Use

Some keys on the keyboard have special meaning in ALV and you can assign specific functions to others:

  • F1 Function Key 
The user calls a help text for the selected column using the F1 function key.

  • F2 Function Key 
This key is always an alternative to double clicking. You determine which function is triggered when the user double clicks or presses F2. You cannot change its meaning.

  • F4 function key
With the F4 function key, users call a value list with possible entries that are possible and useful for their current situation.

Key Features

You are able to make the following settings for key settings:

Assigning Any Functions to Keys

In the tree structure, you are able to specify functions for a selection of keys and key combinations that are to be executed when the user presses these buttons.

ALV Tool

Display Type

Function available

Simple, Two-Dimensional Table

Classic ABAP List

No

Full Screen

No

In the Container

No

Hierarchical-sequential list

Classic ABAP List

No

Tree structure

Full Screen

Yes

In the Container

Yes

You proceed in two steps:

  • You specify which of the possible keys trigger the event KEYPRESS of class CL_SALV_EVENTS_TREE. You repeat this specification for every key that you wish to register for the event.

  • You specify which function will be executed when the user presses the appropriate key. To do this, register the application for the event and program the desired event handler.

You can assign the following keys and key combinations in the tree structure with the desired functions:

  • Function key F1

  • Function key F4

  • Remove

  • Enter

  • Insert

  • Control plus X

  • Control plus C

  • Control plus V

Function

Class

Method

Register the key for an event

CL_SALV_EVENTS_TREE

ADD_KEY_FOR_KEYPRESS

Delete entire list of keys that trigger the event

REMOVE_ALL_KEYS_ FOR_KEYPRESS