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 throw an error when we click on F8 in the Report program?

Former Member
0 Kudos

As a requirement , i need to execute the report program in the background only, so when F8 is clicked it showed raise an error.

Please help...

1 ACCEPTED SOLUTION

rahul_mb
Active Participant
0 Kudos

Hi Sindhu,

I think you can check the value of system variable SY-BATCH in the report. If it is 'X' then it means the program is ebing executed in background.

Regards.

Rahul

9 REPLIES 9

antonio_lopezs
Explorer
0 Kudos

Hi sindhurareddy,

Why don´t to code an intermediate program that only call the report in background task and generate a transaction for  that  program and control the access with roles?

Would be possible that solution?

Cheers.

Antonio.

0 Kudos

Hello Antonio,

I have to implement the code in the same report program. Can it be possible by capturing the function code of F8 in the report program?

rahul_mb
Active Participant
0 Kudos

Hi Sindhu,

I think you can check the value of system variable SY-BATCH in the report. If it is 'X' then it means the program is ebing executed in background.

Regards.

Rahul

Former Member
0 Kudos

Hello Rahul,

If i run the program in the background, will the sy-batch value be automatically updated with 'X'?

rahul_mb
Active Participant
0 Kudos

Yes Sindhu. If the program is executed in background, the value of SY-BATCH will be 'X', and if it is executed in foreground then it will be blank.

Regards,

Rahul.

0 Kudos

Exactly, you´re right Rahul. I dodn´t realize the more simple and more correct solution, check the old friend sy-*

GirieshM
Active Contributor
0 Kudos

Hi Sindhu,

In addition to Rahul comments, check SYST-CALLD. Hope it is space for foreground and 'X' for background.

With Regards,

Giriesh M

rdiger_plantiko2
Active Contributor
0 Kudos

You could simply exclude the execute button, like this:


at selection-screen output.

   perform disable_online_execution.

form disable_online_execution.

   DATA lt_excl TYPE TABLE OF sy-ucomm.

   APPEND :

     'ONLI' TO lt_excl,

     'PRIN' to lt_excl.

   CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'

        EXPORTING

             p_status  = sy-pfkey

        TABLES

             p_exclude = lt_excl.

endform.

With this code, the button "Execute" is switched off,  the menu paths "Execute" / "Execute and print" will be inactive, and the function key shortcuts to these fcodes are surpressed as well.

Better than offering a button and then shooting at the user with an error "HAHA, NOT ALLOWED!" when he presses it, is not to offer the button from the beginning.

Former Member
0 Kudos

You can use  SscrFields in the TABLES statement and then check if  SscrFields-UCOMM = 'ONLI'. If it is then the user pressed F8.

-Amit.