Skip to end of metadata
Go to start of metadata

SAP Screen Personas

Hiding the default (active) tab in a tab strip

SAP SCREEN PERSONAS KNOWLEDGE BASE - by Tamas Hoznek , Regina Sheynblat


This article will explain the steps necessary to hide the tab that is activated as default when a screen with a tab strip is displayed


When hiding tabs in a tab strip, it is not possible to hide the tab that is currently activated by the backend transaction. Even if the tab is marked to be hidden in the flavor, if it is the one that's selected as the default by the transaction's logic, it will still show up when the screen is displayed after navigating to it. Clicking on another tab will then certainly hide the default tab, but this is not an acceptable situation because we don't want the marked tab to show at any time.

Use case

As an example, let's take the sales order transactions (for instance VA02). Our requirement is to hide the Sales tab in the item overview screen. This is the default tab when this screen is shown in the transaction, so simply marking it as hidden will not work first:

When we now run the transaction and navigate to the overview screen, the hidden tab will still be shown first, because it is the currently active tab:

Of course as soon as we switch to another tab, the sales tab will be hidden. Like, if we select the Item overview tab, the sales tab is now gone:


To make sure that the hidden Sales tab never shows up, we have to add a simple script to the screen's onLoad event. The script will check whether the to-be-hidden tab is currently active in the backend transaction, and if so, it will switch to another tab. This will cause our hiding action in the flavor to kick in and since the Sales tab is now not active anymore, the tab strip will be displayed without it, even for the first time when the screen is shown.

The selectTab script looks like the following:

if (session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW") === "wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\\01") {  

Now the end result will be like it is shown in the 3rd image above.

This works well in case of change or display transactions. However, in create transactions, we often have to deal with required fields. If they are not populated, our script will fail, since as soon as we try to switch the tab, the required field check kicks in, interrupting the script. So in those cases, we must add some additional steps to the above logic.

If we stay with the sales order example, transaction VA01 requires the sold-to and ship-to party fields. In such a situation, fill any required fields with a value that's accepted. Let's assume that the sold-to and ship-to party "1" do exist. Depending on system configuration, there may be some additional required fields - for instance, it's pretty common that the PO Number field is also required.

The script has to populate the required fields first, do the tab switching for the hiding action to take effect, then remove the temporary values from the required fields. We may want to set the focus to the desired input field once the script ran. This would look like:

session.findById("wnd[0]/usr/subSUBSCREEN_HEADER:SAPMV45A:4021/subPART-SUB:SAPMV45A:4701/ctxtKUAGV-KUNNR").text = "1";
session.findById("wnd[0]/usr/subSUBSCREEN_HEADER:SAPMV45A:4021/subPART-SUB:SAPMV45A:4701/ctxtKUWEV-KUNNR").text = "1";
session.findById("wnd[0]/usr/subSUBSCREEN_HEADER:SAPMV45A:4021/txtVBKD-BSTKD").text = "blabla"; 
if (session.findById("wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW") === "wnd[0]/usr/tabsTAXI_TABSTRIP_OVERVIEW/tabpT\\01") {     
session.findById("wnd[0]/usr/subSUBSCREEN_HEADER:SAPMV45A:4021/subPART-SUB:SAPMV45A:4701/ctxtKUAGV-KUNNR").text = "";
session.findById("wnd[0]/usr/subSUBSCREEN_HEADER:SAPMV45A:4021/subPART-SUB:SAPMV45A:4701/ctxtKUWEV-KUNNR").text = "";
session.findById("wnd[0]/usr/subSUBSCREEN_HEADER:SAPMV45A:4021/txtVBKD-BSTKD").text = "";

Related Content

Related Search Terms:

SAP Screen Personas, tab strip, hide tab

Related SAP Notes/KBAs