Friday, 29 December 2017

Add extra tabs to the standard transaction for sales and access them through menu bar

Introduction:


This post will clearly explain you how to add extra tabs in sales order or standard transactions and display the tab name as the menu item in order to access them through menu bar.

In this post let us see how to add additional tabs in sales order header through BADI.

Implementation of BADI:


1. First go to transaction SE18 and give the Enhancement spot name as BADI_SD_SALES_BASIC and click on display button.

2. Next right click on BADI_SLS_HEAD_SCR_CUS and create BADI implementation as in the below screen.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorials and Materials, SAP ABAP

3. Then a pop up will be displayed to enter enhancement implementation name, give a name and meaningful description as in the below screen.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorials and Materials, SAP ABAP

4. Then upon clicking paper icon button to create implementation, another popup will be displayed to create BADI implementation.

Give a badi name with meaningful description and give new implementing class name and click ‘OK’ button.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorials and Materials, SAP ABAP

5. Next below screen will be displayed. Then activate the implementing class and enhancement.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorials and Materials, SAP ABAP

6. After activating, the BADI implementation will be appeared as in below screen

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorials and Materials, SAP ABAP

7. Then in the method ‘ACTIVATE_TAB_PAGE’ of implementing class, write the code as in the below screen.

Pass  tab name  to the field   ‘head_caption’, pass the module program name to the field ‘head_program’ and to the field ‘head_dynpro’, pass the screen number of module program. This will display the screen of module program in the new tab of order header.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorials and Materials, SAP ABAP

8. With this new tab will be displayed beside ‘Additional data B’ tab in the order header.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorials and Materials, SAP ABAP

Displaying the tab name in the menu bar:

In order to go to the new tab through menu bar like as we do it for other existing tabs, we have to display the tab name as menu item. So, with this menu item we can directly access the new tab.

1. At first open the menu painter transaction se14,and give the program name as ‘SAPMV45B’ and select status radio button and give status as ‘U’, then click on change button.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorials and Materials, SAP ABAP

2.  Next expand menu bar, double click on Go to->Header->Additional Functions, add a new function code example ‘ZTAB’ with tab name ‘New tab’.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorials and Materials, SAP ABAP

3. Then right click on the function code and click on activate to activate the function code. Now save the status and activate it.

4. Now if you go to the transaction and see, in the menu bar in Go to->Header->Additional Functions, you can see the new tab name you have added.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorials and Materials, SAP ABAP

Linking the menu item to the tab sub screen:

Now after displaying the tab name as menu item in the menu bar, we have to link it with the function code in order to go to the tab sub screen through menu bar.

1. For this go to the transaction VFBS, and give program name as ‘SAPMV45B’ and choose first radio button ‘Function codes’ and click  on change button.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorials and Materials, SAP ABAP

2. Next click on new entries and add new function code ‘ZTAB’ for three transaction types Add (H), Change (V) and Display (A) and save the data.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorials and Materials, SAP ABAP

3. Next choose radio button ‘paths between processing locations’ and maintain an entry as below.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorials and Materials, SAP ABAP

4.Next choose radio button processing locations and add new function code ‘ZTAB’ with screen number 4002, and screen module1 as ‘4012’(Header sub screen) and screen module2 as ‘4323’ (Tab sub screen) and save the data.

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorials and Materials, SAP ABAP

SAP ABAP Development, SAP ABAP Guides, SAP ABAP Tutorials and Materials, SAP ABAP

Screen 4323 is the sub screen container for badi ‘BADI_SLS_HEAD_SCR_CUS’.

5. Finally in the standard include 

‘MV45AF0F_FCODE_BEARBEITEN’, create an implicit enhancement and write the logic to check if fcode equals to ‘ZTAB’ ( “new function code) then assign the fcode with standard function code ‘K_CUS_BADI_1’ (function code of header tab) and activate the enhancement. This code links new menu item to the new tab added in the header .

With this you can go to your newly added tab through the menu bar of the standard transaction. Similarly you can follow the same approach for other standard transactions also.

No comments:

Post a Comment