SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow


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.

catch Enter event on ABAP Dynpro screen

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'.
 ...
ENDMODULE.
Code

When you double click on MAINSTATUS and expand the Function Keys, an ABAP programmer can customize the icons and function keys as follows.

function keys, icons and Enter key press

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 Enter key)

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.
 CLEAR ok_code.

 CASE save_ok.
  WHEN 'EXIT' OR 'BACK' OR 'CNCL'.
   LEAVE PROGRAM.
  WHEN 'LIST'.
   PERFORM getData.
  WHEN OTHERS.
 ENDCASE.

ENDMODULE.
Code

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.



SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.