Skip to end of metadata
Go to start of metadata


Adding custom tab to the transaction vf01/vf02/vf03 item detail screen.

Vf02 transaction:

  <img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image1.jpg" width="631" height="258" border="0" alt="image" />

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image2.JPG" width="580" height="217" border="0" alt="image" />

  • On analysis of the requirement we found that there is sap provided custom tab in the  tab strip (program name - SAPMV60A)  screen 6002. which is having the function code 'PFCU'. So if we can populate the custom tab there we can fulfill the requirement.

 <img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image4.JPG" width="573" height="235" border="0" alt="image" />

    

  • In order to fulfill the requirement we need a custom subscreen with some custom fields in that screen.
Steps for creating the custom fields  and adding them to the custom subscreen.
  1. Creating the zfields
  • Create the zfields to the table vbrp, By appending the structure

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image5.JPG" width="576" height="157" border="0" alt="image" />

    <img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image6.JPG" width="576" height="157" border="0" alt="image" />

  • Then give a name to the structure for example 'zzcustom_fields'.And give the field name which you want to append to the table.

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image7.JPG" width="583" height="261" border="0" alt="image" />

  • Note: the added fields should follow the naming convention that they should start with 'zzxxxxx'.
  • Save and activate. 

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image8.JPG" width="575" height="92" border="0" alt="image" />

    2.   Creating the screen and adding the zfields

  •      create the screen using the transaction se51

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image9.JPG" width="538" height="181" border="0" alt="image" />

  • Get the field from the dictionary which is used to be added on the screen

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image10.JPG" width="606" height="77" border="0" alt="image" />

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image11.JPG" width="579" height="293" border="0" alt="image" />

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image12.JPG" width="595" height="286" border="0" alt="image" />

  • Save and activate the screen.
  • Go to se80 and give the program name (SAPMV60A)  of the vf01 transaction. In that go to screen -> 6002.
  • In the layout of 6002 we found the custom tab which has the function code 'PFCU'

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image13.JPG" width="610" height="240" border="0" alt="image" />

  • In the 'MODULE PBO_6002' the subroutine PBO_6002_TABSTRIP_POS specifies the position of the tab.

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image14.JPG" width="517" height="98" border="0" alt="image" />

  • In order to activate the custom tab for this requirement which is having the function code 'PFCU'. The module CUST_ITEM_ACTIVATE needs to be executed.

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image15.JPG" width="624" height="135" border="0" alt="image" />

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image16.JPG" width="640" height="349" border="0" alt="image" />

  • This module is not being executed since the 'Active' is not equal to 'X'.
  • For this subroutine to be executed we need to write an enhancement, we have enhancement spots at the begin/end of the subroutine.

         3. Steps to write the code in the enhancement spots.

  • First to find the enhancement spots click on the spiral icon in the menu bar, and next click on the edit -> enhancement operations -> show implicit enhancement options.

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image17.JPG" width="307" height="138" border="0" alt="image" />

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image18.JPG" width="550" height="365" border="0" alt="image" />

  • After clicking the 'show implicit enhancement options' we get some yellow color line at the begin and end of the subroutine. Where we can add the code to enhance.

Start of the enhancement spot

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image19.JPG" width="518" height="115" border="0" alt="image" />

End of the enhancement spot

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image20.JPG" width="551" height="100" border="0" alt="image" />

  • To create the enhancement spot . place the cursor on the yellow color line and click on the edit > enhancement operations > create.

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image21.JPG" width="556" height="376" border="0" alt="image" />

  • click on the create enhancement implementation

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image22.JPG" width="426" height="135" border="0" alt="image" />

  • Give some name to the  enhancement implementation.

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image23.JPG" width="491" height="142" border="0" alt="image" />

  • click enter and save in a package.
  • after that select your implementation and then continue.

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image24.JPG" width="596" height="226" border="0" alt="image" />

  •  In between the enhancement and Endenhancement statements we have to write the code.

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image25.JPG" width="515" height="122" border="0" alt="image" />

  • insert your code as below.

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image26.JPG" width="341" height="206" border="0" alt="image" />

  • activate the enhancement and check in the vf01/vf02/vf03 you can find the custom tab with the custom fields.

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image27.JPG" width="596" height="109" border="0" alt="image" />

  •  the Data automatically populates to the database table when the data is entered into the zfields. But where as in display mode it is changeable for it to be made disable a sample is code is added in the PBO of the screen which was designed before.
  • The screen in vf03 before which is in changeable mode.

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image27.JPG" width="596" height="109" border="0" alt="image" />

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image28.JPG" width="604" height="302" border="0" alt="image" />

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image29.JPG" width="570" height="286" border="0" alt="image" />

  • After adding the code the screen is as follows in vf03 transaction.

<img src="https://weblogs.sdn.sap.com/weblogs/images/251922482/image30.JPG" width="683" height="79" border="0" alt="image" />

Which is in display mode

  • No labels

2 Comments

  1. Unknown User (plq40yu)

    I did as the blog mentioned,but the Data didn't *automatically populates to the database table when the data is entered into the zfields.*I think there maybe some other exit to get data from zprogram.Could any one tell me how to do that?

     Any one who can do me the favour,pls send a mail to before45@hotmail.com  . TKS!

  2. do i have to switch on OI0_SERVICE to be able to use enhancement spot pbo_6002_tabstrip_pos_01?