Some times it might be a requirement that some report only to be executed in the background not in the fore ground so at that time we need to disable the F8 button and some menu options from the standard selection-screen pf status . The below post will help to achieve this.
Step1. Create a report program and put a break-point in the initialization event so that we will get to know what is the standard pf status is used. Execute it.
Step2. In the debugger from the sy-pfkey we get to know that ‘%_00’ is the pf status used.
Step3. Here are the menu options available in the standard selection screen with application toll bar and function key buttons. Some times it might be require for some report program that needs to be executed only in the background mode not in foreground, so at that time we need to disable the execute button from the selection-screen.
Step4. Now here the next question is how we will get to know the program associated with the pf status ‘%_00’ so that we will get to know the function code of each menu options. Here we have a option that activate the debugger and click each button and note down the sy-ucomm value of each option. But it might be time consuming. Another approach if we somehow get to know the program in which the pf status %_00 is defined then from SE41 transaction we can easily collect all the function codes of the pf status menu and buttons.
To facilitate this we have a table PSMPTEXTS which stores all the needed information.
Step5. Provide obj_code as ‘%_00’ and execute.
Step6. Here are the list of programs in which the pf status %_00 is defined . Let’s not the first program name and open in SE41 menu painter.
Step7. Click on Display option.
Step8. Here are the list of function codes .
Step9. Change the program according to our need and fill the internal table of type RSEXFCODE with all the codes that has to be disabled from the selection-screen and call the FM and pass the details. Execute it.
Step10. Here all the options are available as before because our disable code is under the event at selection-screen output . If you want to disable all the options after pressing F8 then the same code can be put together under initialization event.
Step11. Now Provide Value as X & hit enter key.
Step12. Now the F8 button disappears and also…
… the menu options are disabled.