Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Trigger PAI after pressing enter key

Former Member
0 Likes
5,642

Hi all,

How to trigger the PAI event after pressing the enter key on the keyboard. i have a input field and a button on the screen. after entering the value into the field and pressing buttot will take to next screen. But if I press enter key the value is getting cleared. How to trigger the PAI event after pressing the enter key?

Thanks in advance,

Dev.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,497

Hi,

The keyboard event 'Enter' does not have a default sy-ucomm or a Function code associated with it.

So, whenever you press Enter, it triggers the PAI (sy-ucomm would be blank) and somewhere in your code the value is being refreshed. You can debug thoroughly to find where the problem is.

You can assign a Function code for Enter. Go to the GUI Status of the Screen -> Function Keys -> You will find a icon Enter (the one with the tick mark in a green circular background) -> Assign Function code like 'ENTER'.

Now in your PAI, restrict your code saying


if sy-ucomm = 'ENTER'.
 "Logic
endif.

Hi all,

How to trigger the PAI event after pressing the enter key on the keyboard. i have a input field and a button on the screen. after entering the value into the field and pressing buttot will take to next screen. But if I press enter key the value is getting cleared. How to trigger the PAI event after pressing the enter key?

Thanks in advance,

Dev.

4 REPLIES 4
Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
2,497

AFAIK PAI is triggered after you press the ENTER key. may be in the code you are clearing the values in the PAI.

BR,

SUhas

Read only

Former Member
0 Likes
2,498

Hi,

The keyboard event 'Enter' does not have a default sy-ucomm or a Function code associated with it.

So, whenever you press Enter, it triggers the PAI (sy-ucomm would be blank) and somewhere in your code the value is being refreshed. You can debug thoroughly to find where the problem is.

You can assign a Function code for Enter. Go to the GUI Status of the Screen -> Function Keys -> You will find a icon Enter (the one with the tick mark in a green circular background) -> Assign Function code like 'ENTER'.

Now in your PAI, restrict your code saying


if sy-ucomm = 'ENTER'.
 "Logic
endif.

Read only

0 Likes
2,497

Great Dude. You have done it.

Read only

0 Likes
2,497

FYI...

DATA ok_code LIKE sy-ucomm.

DATA save_ok LIKE ok_code.

........

........

MODULE user_command_1000 INPUT.

save_ok = ok_code.

CLEAR ok_code.

CASE save_ok.

WHEN 'ENTER'.

........

........

ENDCASE.

ENDMODULE.

Now if you enter something in your I/O field and press enter then data wont get cleared.