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.

1.jpg

Search for keyword “SET PF-STATUS” which sets the PF status of the screen.


2.jpg

 

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”.

3.jpg

 

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.

 

4.jpg

 

Make sure to put a checkpoint on the screen number and program as this changes shouldn’t impact the other screens.

 

5.jpg

 

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.

 

6.jpg

Then write your own logic to be executed when you press on that button.