The thing I find most exciting about SAP Screen Personas is the scripting capabilities. I see so much potential there for automation, although admittedly not all of it is realisable with the current version. I hope future versions will enhance the scripting features. In this blog I want to go through one of my scripts in some detail, which I hope will give you a good idea of what can be achieved. Scripts are recorded through the personas interface and attached to a “script button”, so that pressing the button activates the script. For the developers among you, a Personas script is essentially a BDC session except that it can be enhanced to interact with Personas-specific gui elements. You’ll see this in the example below. Let’s start with my logon screen:
Notice the “Users” section. There’s a text field labelled “Username”, a “Lookup” button and a field labelled “Name”. The intention, obviously, is to type in a username and lookup the user’s real name. The script does this by calling transaction SU01 and grabbing data from it. This all happens in the background and the user isn’t aware of it at all. All you see is the real name appearing. Let’s look at the script step by step:
First we “refresh” the screen. I confess I’m not clear what’s going on here, but when you copy values from screen fields a refresh is usually required. This is one of those things you “just do”, and it will appear later in this script too. Then we copy the contents of the field called “Personas/…” into a variable called “username”. These variables can be created at will and exist just for the lifetime of the script. Next we run SU01 and paste the username we just copied into the appropriate field on the first screen of that transaction. In step 6 we press the “Display” button. We’re now at the point where the user’s name is visible in SU01.
Steps 7-9 grab the first name and last name from the screen and save them for later. Remember we need the “refresh” before copying anything from the screen. Now for the clever bit.
You can use scripting like this to bring data from multi-screen transactions together in one place. You can also use it to chain transactions together – replace the “save” button in one transaction with a script that performs the save and then automatically executes a follow-on transaction. I’m sure I’ll come up with many other uses for it as our Personas project unfolds.