Skip to Content
Author's profile photo Thanga Prakash Thanga Raj

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.

/wp-content/uploads/2015/07/1_745553.jpg

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


/wp-content/uploads/2015/07/2_745554.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”.

/wp-content/uploads/2015/07/3_745555.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.

/wp-content/uploads/2015/07/4_745559.jpg

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

/wp-content/uploads/2015/07/5_745560.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.

/wp-content/uploads/2015/07/6_745561.jpg

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

Assigned Tags

      10 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Sourav Das
      Sourav Das

      Thanks a Lot. Very Very useful Post.

      Author's profile photo madjid khanevadegi
      madjid khanevadegi

      hi

      thank  you prakash for  guidance.

      this is my question and i used your guidance for question.

      https://answers.sap.com/questions/706484/position-on-shipment-cost-item.html

       

       

       

      Author's profile photo kelly Leona
      kelly Leona

      Thanks buddy for word to word guidance..

       

      Author's profile photo Thanga Prakash Thanga Raj
      Thanga Prakash Thanga Raj
      Blog Post Author

      Thanks Buddy 🙂 Good to see that my blog was helpful to you

      Author's profile photo ANUJ KAITHWAS
      ANUJ KAITHWAS

      Hi.

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

       

      Any idea?

      Author's profile photo Thanga Prakash Thanga Raj
      Thanga Prakash Thanga Raj
      Blog Post Author

      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

      Author's profile photo Vladimir Kirov
      Vladimir Kirov

      I've enhaced the program J_3RF_REGINV with this algorithm. It'a amazing! Thank You!

      Author's profile photo Thanga Prakash Thanga Raj
      Thanga Prakash Thanga Raj
      Blog Post Author

      Welcome, good to know it has been helpful 🙂

      Author's profile photo Jallipalli Sai Narayana
      Jallipalli Sai Narayana

      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.

      Author's profile photo Mitwa Garach
      Mitwa Garach

      Thanks Prakash..

      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.