SAP Screen Personas
Create: Tamas Hoznek Nov 21, 2015 17:56
Last Update: Regina Sheynblat Feb 06, 2019 00:00
Hiding the default (active) tab in a tab strip
SAP SCREEN PERSONAS KNOWLEDGE BASE - by Tobias Queck , 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.
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:
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:
SAP Screen Personas, tab strip, hide tab