SAP Screen Personas – Understanding the script
We learnt how to add script and the script button in our flavors. Here are some explanations of the steps:
- Why we used recording?
Recording is easy way to write the scripts. Most of us are ABAPer or may not know javascript that well. Recording will help to identify the variables, record the key strokes etc – just like we do in excel macros. Obviously you can write the entire code from scratch.
2. How we can find out the variable names?
We use Inspector tool. In order to use the inspector tool, the recording should be stopped so that keystrokes are not captured.
3. Can we start/stop the recording multiple times in one script?
Yes, you can can.
4. Explanation of the syntax in the script.
session.findById("wnd[0]/usr/txtPersonas_161469896810539").text = "Hello World";
You need to know basics of Javascript. Here “wnd[0]/usr/txtPersonas_161469896810539” is the name of the element where we want to add our text. This element has several properties which we can check in the inspector tool.
Here we are interested in the property – “text”.
Since we are recording we it will automatically come. But if it is something we need to capture then we use the inspector tool again.
Hope this explanation helps a little bit. Understanding javascript can be challenging but we learn and apply our recording tool, look for patterns and try to understand the syntax.
If you like the content, please follow our LinkedIn page and share the blog with your colleagues and friends.