The below example shows how to catch the key on press event in ABAP.
There event is famous in VB/JAVA/.Net world , but not available in ABAP .
But there is a work around to get the same results in ABAP like JAVA/VB/.Net
Currently no help available in SAP SDN, So thought of adding the solution I found
I had a requirement to search for a data match in system using a complex logic as user starts typing the name of a person.
The technique is to use the option of proposal search for input fields in Search helps along with search help exit
Step 1 : In SE11, display any search help in the system and go to definition tab and make sure an option called proposal search for input fields is available If this option is available then you can proceed to step 2 . If this option is not available then your system is in a older version and my solution
will not work
Step 2 : Attach a custom search help to the Screen field where key press event needs to be captured
Step 3 : Set the proposal search for input fields option checked in search help, It is a check box
Step 4 : Create a search help exit function module and add to the custom search help
Step 5 : Activate screen and serach help
Step 6 : From now Callcontrol-step = ‘DISP’ section in the search help exit function module will get called every time you press a key in the screen field
Step 7 : This is effectively same as on key press event , you can write any logic in the callcontrol-step = ‘DISP’ block of search help exit function to control the list based on what user is typing. shlp_tab-SELOPT table will contain the current data from Screen field
This will be very help full to deal with auto completion of user data input based on complex selection logic and will speed up efficiency of user .