Catch Enter Key Press Event in Process After Input PAI Module
On ABAP program Dynpro screen to catch Enter event on the module user_command from ok_code or sy-ucomm, PF-STATUS user interface function keys should be modified as shown in this SAP tutorial.
How to Catch Enter Key Press in Process After Input PAI Module
I have a Dynpro screen number 100 with input elements and a button to filter sales orders according to provided filter criteria.
What I want to do is to catch Enter key press and execute the program as if List button is pressed.
In module status_0100 ABAP code actually in the PROCESS BEFORE OUTPUT (PBO) module, in general programmers create a user interface for buttons, menu and standard icons using SET PF_STATUS command.
MODULE status_0100 OUTPUT.
SET PF-STATUS 'MAINSTATUS'.
When you double click on MAINSTATUS and expand the Function Keys, an ABAP programmer can customize the icons and function keys as follows.
As seen in below screenshot, I used the LIST ok_code value which is assigned to the List button for F8 key and for Enter key press (not explicitly seen as ENTER but green icon )
Of course these sy-ucomm or ok_code return values are processed in PROCESS AFTER INPUT (PAI) ABAP code module as follows:
MODULE user_command_0100 INPUT.
save_ok = ok_code.
WHEN 'EXIT' OR 'BACK' OR 'CNCL'.
If you want to differantiate Enter key, F8 key and List button you can assign different values for these in the pf-status user interface settings configuration.