SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow


SAP Screen Personas Navigation using Website, Transaction and Script Buttons

Navigation on SAP Screen Personas flavors can be managed using website button, transaction button or script button according to the requirements of the SAP Personas developer. In this Personas tutorial, I want to share my experience and conclusion on choosing the script button as the most versatile control for navigation between Personas flavors.

I want to show how navigation between SAP Personas flavors can be handled using different types of button controls like Transaction Button, Website Button and Script Button.

navigate between SAP Personas flavors using transaction, script and website buttons


Transaction Button

Place transaction button on flavor layout.
Double click on transaction button on edit mode
Provide a descriptive label which will be displayed for users on flavor in Label textbox
Enter the transaction code of the SAP screen which you want to navigate your users in Code textbox

SAP Personas flavor Transaction Button control

For example, if you want to provide a navigation to sales order entry screen, you can use transaction code VA01 for example.

Unfortunately, I experienced a few problems with using transaction button on my Personas flavors.
Although the navigation to target SAP transaction code screen is perfect as I want, the target flavor was not the correct flavor. Although in Personas editor menu, I could see the modified flavor is selected, the displayed flavor belongs to the default flavor.

wrong Personas flavor when transaction button is used

What I meant is that, the above screen is not the correct flavor although the active flavor is correct. This might be a bug on my installed SAP Screen Personas pack but I had to continue to solve the issue quickly. Because of this reason I decided to try website button for navigation.


Website Button

Add a website button on flavor
Double click on website button to configura navigation properties.
In Label textbox, enter a description which will be the anchor text of the link-button control
In URL textbox, enter the target URL address of the website address or the flavor deeplink.

SAP Screen Personas Website button

The issue with the website button is it opens the web URL in a new tab.
Unfortunately this was not the navigation that I imagine for my SAP Screen Personas solution.
I checked the scripting features and properties of the website button to see if I can find a property to set the target screen for navigation.

Since the deep URL includes the Flavor Id and it works successfully, the problem I faced with transaction button did not repeat with website button.

Personas flavor website button to open new page

Launching the URL in a new screen (browser tab) lead me to try the script button for navigation.


Script Button

Add Script button on SAP Screen Personas flavor
Double click on script button to configure
Enter a descriptive text in Label for users

SAP Personas Script Button control

SAP Personas developers can edit scripting features of script button using the Script Editor.

SAP Screen Personas flavor script editor

Create a new script and copy following codes by replacing appropriate control id values from your flavor.

javascript codes for script button for Personas flavor navigation

The first line where flavorID Javascript variable is declared, stores the target transaction's desired flavor id value.
session.utils.changeFlavor() method enables developers to change the Personas flavor after target transaction is displayed.

The second code line places the target transaction code into command field (transaction code box) which has the Personas flavor control id "wnd[0]/tbar[0]/okcd"
With sendVKey() method, we simulate pressing Enter icon which navigates to provided SAP transaction code behind.

var flavorID = "3F60DBC8FFC81ED693B19DB506D140A3";
session.findById("wnd[0]/tbar[0]/okcd").text = "/n/Kodyaz/SOM_TR_D2C03";
session.findById("wnd[0]").sendVKey(0);
session.utils.changeFlavor(flavorID);
Code

Personas developers can find the flavor id for target flavor using the Deep Link Dialog screen of that flavor or using SAP Screen Personas Administration transaction /PERSONAS/ADMIN.

After the script creation is completed on the Script Editor, attach the script to the onClick event of the script button.

SAP Personas flavor script events for onClick event

Of course this navigation can not be applied for web URL addresses but only for SAP transaction screens with different codes.

This advantages that I experienced with Website button or Transaction button did not apply this time when I try Script button for navigating among SAP Personas flavors. So I preferred to use Script button for navigation from a dashboard type main screen flavor to other sub transaction flavors in my SAP Screen Personas project.



SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.