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: 

Use Enter key to execute report.

Former Member
0 Kudos

I have a report that needs to be executed in background.It has a selection screen.The program should get executed when user presses 'ENTER' while he is inside the selection screen.At present,when 'ENTER' key is pressed,only validation is done.To execute we are either pressing 'F8' key or click execute button in screen.

Now how to trap the 'ENTER' key press in a report?

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Jayaprakash,

All PAI processing will depend on the Function Code that has been triggered at the 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 ).

Hope the explanation has been clear enough to drive the point home for you. Please get back to me otherwise.

Regards,

Anand Mandalika.

4 REPLIES 4

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

To my knowledge, only F8, CtrlP, F3, ShiftF3, and F12 leave selection-screen processing (i.e. the AT SELECTION-SCREEN event sequence).

But check out the following:

<b>REPORT <...>

PARAMETERS p1.

AT SELECTION-SCREEN.

IF sy-calld = ' '.

SUBMIT <...> WITH p1 = p1.

ENDIF.

START-OF-SELECTION.

BREAK-POINT.</b>

Former Member
0 Kudos

Hi Jayaprakash,

All PAI processing will depend on the Function Code that has been triggered at the 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 ).

Hope the explanation has been clear enough to drive the point home for you. Please get back to me otherwise.

Regards,

Anand Mandalika.

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

Good point ...

Former Member
0 Kudos

The solution given by Anand Mandalika is working fine.

Thanks for all who helped me.