Application Development 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: 

How to use enter key for select option

I have created a select option and a push button, when i click on the push button then according to the value in the select option the output appears, but this is not a convinent option.

Instead of the push button how can i use the enter key from keyboard to activate the usercommand and give the output?

1 ACCEPTED SOLUTION

The ENTER key has no function code, whereas the "Execute" button has the function code 'ONLI'. SO what can be done is, when the user hits the ENTER key, we can programmatically set the function code to 'ONLI'. I shall give you a very small peice of code to illustrate my point

tables sscrfields.

parameters p_vblen like vbak-vbeln obligatory.

at selection-screen.

if sscrfields-ucomm eq space.

sscrfields-ucomm = 'ONLI'.

endif.

start-of-selection.

write p_vblen.

The above code will trigger the report output on hitting the ENTER key at the selection screen.

What you only have to note here is that unlike with screen processing, in selection-screen processing, the function code will be made available in the field UCOMM of the structure SSCRFIELDS. However, you will have to declare this structure in your program ( using the TABLES statement as shown above ).

7 REPLIES 7

Sandra_Rossi
Active Contributor
0 Kudos

I don't understand the question. The ENTER key runs the code in the event block AT SELECTION-SCREEN (PAI) and if there's no error message sent explicitly, it runs the code in the event block AT SELECTION-SCREEN OUTPUT and the selection screen is refreshed.

IN
Contributor

Hello,

Not an usual request, but if I have understood what are you trying to accomplish, you should try something like this:

  • Type /H in command bar + enter and go in debug mode
  • Check the value of sy-ucomm
  • Do your code accordingly

Regards,

Igor

0 Kudos

Hi Sandra,

All I want is to use 'enter' button instead of the push button i created for the select option , in my selection screen

The ENTER key has no function code, whereas the "Execute" button has the function code 'ONLI'. SO what can be done is, when the user hits the ENTER key, we can programmatically set the function code to 'ONLI'. I shall give you a very small peice of code to illustrate my point

tables sscrfields.

parameters p_vblen like vbak-vbeln obligatory.

at selection-screen.

if sscrfields-ucomm eq space.

sscrfields-ucomm = 'ONLI'.

endif.

start-of-selection.

write p_vblen.

The above code will trigger the report output on hitting the ENTER key at the selection screen.

What you only have to note here is that unlike with screen processing, in selection-screen processing, the function code will be made available in the field UCOMM of the structure SSCRFIELDS. However, you will have to declare this structure in your program ( using the TABLES statement as shown above ).

Sandra_Rossi
Active Contributor

So, did I answer your question? (you put your code in the event block AT SELECTION-SCREEN and it's done) Does the code proposed rPatel suits you?

Thankyou everyone, i just have to write 'space' instead of the constant i used for user command.(in my case i have a button 'go' and i created a constant 'GO' for sscrfields-ucomm)

Sandra_Rossi
Active Contributor

tarunp241 I think your comment helped am3en99 a lot, can you convert it into an answer please?