Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
PeterSpielvogel
Product and Topic Expert
Product and Topic Expert

One powerful feature in SAP Screen Personas 2.0 was the ability to create a script (sequence of keyboard and other actions) and attach it to a text field. After the user filled in the field, he or she could activate the script by hitting the Enter key.

We saw customers use this feature in two ways:

  1. Launch transactions: start different processes based on different input fields
  2. Form processing: validate input before triggering the next steps in a process

Scenario 1 was easy to implement in SAP Screen Personas 2.0 because you could assign a script directly to the enter event of a specific field.

Scenario 2 was cumbersome in SAP Screen Personas 2.0 because you had to assign the same script to all possible UI actions. Once you created your script button, you would need to manually attach it to every input field (using an onEnter event) and every button (using the onClick event). If you missed one field or button, the validation would not occur for that control.

onBeforeRefresh replaces onEnter

To make both scenarios easier to solve in SAP Screen Personas 3.0, we have removed the onEnter event for specific fields and introduced the onBeforeRefresh event for screen. The event is fired BEFORE a request is sent to the backend that is triggered by ANY user interaction on the screen.

Launching transactions with the Enter key

Since SAP Screen Personas 3.0 is built into Web GUI, and the Enter key generates an action attached to the screen and not a specific field, we could not provide an On-Enter event. But, there is a way to replicate the On-Enter functionality in SAP Screen Personas 3.0.

Replicating scenario 1 in SAP Screen Personas 3.0 follows three basic steps.

  1. Write your script(s) that you want attached to a text field
  2. Use the script below to trap the Enter key
  3. Attach the “On-Enter” script to the onBeforeRefesh screen event

In this example, I will use two simple scripts to which I will attach the On-Enter functionality.

“LOOKUP” takes an input from the SMEN screen and goes to transaction VA03 to retrieve the value of a sales order and displays it on the SMEN screen.

I have attached this to the Check Sales Order Button

“JUMP” takes an input from the SMEN screen and jumps directly to the main screen in VA03, bypassing the initial screen in that transaction.

This is attached to the Check Sales Order button.

The On-Enter functionality comes from a script called ON_ENTER_SETUP that is attached to the onBeforeRefresh event.

The following is a generic form of the script. You can copy this into the script window of SAP Screen Personas 3.0 and replace the TEXT_INPUT_BOX_N_ID and BUTTON_N_ID with the values you can find on your own screen using the Inspector tool that is built into the script editor.

// ignore event if not onEnter

if (triggerType !== source.EVENT_ENTER) return;

if (focused && focused.id === 'TEXT_INPUT_BOX_1_ID’){

     session.findById("BUTTON_1_ID").press();

}

if (focused && focused.id === 'TEXT_INPUT_BOX_2_ID’){

     session.findById("BUTTON_2_ID").press();

}

Now, when I enter a number into my Lookup Sales Order button and hit enter, the system brings back the values from VA03 with no additional keystrokes.

Form processing

With SAP Screen Personas 3.0, you can simply validate input data on the screen. If the input is valid, don’t do anything, if something is wrong, you could open a popup with more information or show/hide on screen information using sticky notes or labels. This provides the added benefit of suppressing the unnecessary request to the backend by returning any value, e.g. return true.

This is just one of many ways you can boost user productivity by personalizing screens to meet their specific needs.

For more information, please read one of our knowledge base articles.

http://wiki.scn.sap.com/wiki/display/Img/Scripting%3A+onBeforeRefresh+-+Running+your+scripts+on+scre...

http://wiki.scn.sap.com/wiki/display/Img/Available+Events+for+Scripting

For the SAP Screen Personas product team, peter.spielvogel.

4 Comments