Add Custom button to a standard screen, where there is no Screen exit; VI02
To add a custom button in a standard screen, best way is to search for a screen exit or screen enhancement BADI.
In case both are not available for the screen, then we can do it by Enhancement implementation.
Let’s take an example so that it will be better to understand, I am taking a transaction VI02 wherein I will add a custom button in the second screen.
There is no screen exit available for the screen, here are the steps you have to follow to enhance the screen.
Find the place in a standard program where it is setting the GUI status of that screen.
Go to the Program (screen) of the screen by going to menu System –> Status.
Search for keyword “SET PF-STATUS” which sets the PF status of the screen.
Now we found the place to do a GUI enhancement. Replace the standard GUI status with Custom GUI status.
Standard GUI here is Program SAPMV54A with status A30.
Now we will copy it to Z* program and Z* status using copy status option in transaction SE41.
After copying I have added a new item under application toolbar as ML Doc with function code “MLDO”.
Next step is to create an Enhancement in the spot identified at step 1 to replace the standard GUI with the custom GUI created in above step.
Make sure to put a checkpoint on the screen number and program as this changes shouldn’t impact the other screens.
Now we created a custom button, so the next step is to find a place to execute the action for that button created.
Search in program for a keyword “fcode” or “function code” or any relevant keyword and place your breakpoints there, then start debugging to find the exact place where the execution for the button can be written.
Then write your own logic to be executed when you press on that button.
Thanks a Lot. Very Very useful Post.
thank you prakash for guidance.
this is my question and i used your guidance for question.
Thanks buddy for word to word guidance..
Thanks Buddy 🙂 Good to see that my blog was helpful to you
I've followed your guide thruout in t-code vf02 and the enhancement also gets called. For trial and POC i called the t-code me23n which gets called as it should. However while going back to vf02 from me23n, I get an error in the status bar saying "the requested function xxxx isn't available".
May be when you go back to VF02, your enhancement is being called and it couldn't find action code in the PF Status? Try it with debugging or by taking trace
I've enhaced the program J_3RF_REGINV with this algorithm. It'a amazing! Thank You!
Welcome, good to know it has been helpful 🙂
Thanks Prakash for the guidance...
Here is another doubt In my requirement I have to create the button and on clicking it I have to fetch the records from a custom table and display the records in editable records.
Could you guide me how to achieve this.
I have one more requirement, need to add Custom tab/Custom field in VI02/VI03 Transaction. Not able to find any screen exit for the same.
Anyone has any idea about similar requirement that would be helpful.