Launch Transaction Code using SAP Personas Script Button
In a SAP Screen Personas solution ABAP developer can use Script button to display a SAP transaction code screen by using ShortLink Maintenance or Push button actions. SAP Personas programmers can call transaction codes behind when a button is pressed on the screen. The Personas users will not know which transaction is called and will not have to memorize SAP tcodes.
There are three methods that I use to call SAP transaction using SAP Personas script button. Let's not check these methods in this SAP Personas tutorial.
Execute Transaction Code using Script Button
First method to call SAP transaction code is to enter the transaction code in command field which is changed into a hidden field and then simulate Enter action by using Push button on Enter button which is also hidden.
Let's see how developers can manage this on a SAP flavor.
First add a script button on the SAP Personas flavor. Double click to edit its properties and define each step.
As the first step of the script button, add Enter Value action for the command field.
The entered text will be the "/n" plus the SAP transaction code.
As you see below, for the Enter Value action to display sales order document, I entered "/nVA03"
Second step is the Push action for the Enter button.
We need a Refresh Screen action as a third action within the script button. Because in the last step I want to change to a pre-selected flavor.
The fourth and the last step is used to set the flavor which will be displayed on user's screen.
I used Switch Flavor action where I provided the name of the target flavor. This enables the developer ensure that the user will be displayed with the SAP Personas flavor designed and developed for him/her according to own requirements.
Summary of the steps for displaying a SAP Transaction Code screen using Script Button
Above Script Button is used for sales order display transaction code VA03. The Personas user is now running a custom flavor other than the Basic View. By pressing the script button, the user is redirected to an other transaction VA03, with preselected VA03 flavor named "D2C"
As you can see in below screenshot, " ses[0]/wnd[0]/tbar[0]/okcd " is the identity of the command field.
And the Enter button properties can be seen below. " ses[0]/wnd[0]/tbar[0]/btn[0] " is the ID of the Enter button.
Create ShortLink to Execute Transaction Code with Selected Flavor
SAP Personas developers can create a URL address using the SAP Screen Personas Administration transaction /PERSOS/ADMIN_UI tcode ShortLink Maintenance tool. The ShortLink Maintenance tool enables developers to get a URL link for a given transaction code and preselected Personas flavor. Then using Script Button Launch Website action, the selected transaction can be easily displayed in front of the user with selected flavor active.
SAP Screen Personas Script Button to display ShortLink created for ABAP transaction code and Personas flavor
Choose " ses[0] " and then select " Launch Website " action with created shortlink given as parameter. Please read the following section for how to create shortlink in SAP
How to Create ShortLink using SAP Personas Administration Transaction
In order to create a shortlink for a transaction code which identifies the URL address on that SAP system for a given tcode with selected flavor, SAP Personas developers can use /PERSOS/ADMIN_UI SAP Screen Personas Administration tool.
Execute tcode /n/PERSOS/ADMIN_UI
Then drilldown the menu " > General Actions > ShortLink Maintenance "
On Create ShortLink screen, enter the transaction code and select target SAP system.
Choose one from the Personas flavors defined for the target transaction code.
When all three entries are completed, press Get ShortLink button to let the system generate web URL for the configured screen.
How to create shortlink using SAP Personas Administration tcode
Here is a sample URL format where the tcode and flavor is in link parameter, system is passed in a second URL parameter
http://sap01k0d.kodyaz.com:8002/sap/bc/bsp/persos/mainapp/index.html?link=935B7E55EE704957E10000000A8076A0&sap-client=060
Launch ShortLink URL using SAP Personas Script Button
After the short link is created, Personas programmers can use it in a Script Button Launch Website action or in a Script Button Calculate in Javascript action in window.open() Javascript command.
Please refer to Launch Web URL using SAP Personas Script Button Personas tutorial if you want to use shortlink URL address in Calculate Javascript action using the window.open() command.