SAP Screen Personas
Measuring TIME IN TRANSACTION
SAP SCREEN PERSONAS KNOWLEDGE BASE - by Tamas Hoznek , Regina Sheynblat , Sebastian Steinhauer
Purpose
In order to evaluate the impact of an SAP Screen Personas project compared to the unchanged transaction a common generic metric is time in transaction. This can be achieved by instrumenting the actual flavor, and recording the start time of the flavor, as well as the end time of the process. The difference between these values gives an easily understandable metric: time in transaction.
Limitation
Please note that this approach is due to an issue with session.utils.logMeasurement currently only supported in SAP GUI for HTML. Please check the section below on "Existing limitation with SAP GUI for Windows 7.40" for an suggested workaround.
Overview
This article will outline how the required measurements can be take and recorded. It will also outline how a simple flavor can be used to facilitate time in transaction measurements without distributing the instrumentation code across the system.
Leverage a Flavor to measure time to execute transaction.
In order to log data against a customer defined measuring point (in /personas/analytics) SAP Screen Personas 3.0 SP02 introduced a specific API. In order to log time in transaction 2 actions need to happen. First the start time and additional meta data needs to be logged to the session memory:
session.utils.put("tcode", ""+tcode); session.utils.put("flavorId", flavorId); session.utils.put("time.start", ""+Date.now());
Afterward the usual process steps in question should be executed.
Once the process steps are concluded, the end time needs to be recorded and the time logged to the backend:
var timestop = Date.now(); var timestart = session.utils.get("time.start"); var tcode = session.utils.get("tcode"); var flavorId = session.utils.get("flavorId"); var timeelapsed = timestop - timestart; var measurement = JSON.stringify({tcode : tcode, flavor : flavorId, timestart : timestart, timestop : timestop, timeelapsed : timeelapsed}); session.utils.logMeasurement("TIMEINTRANSACTION", measurement);
Measuring performance of the Original Screen
The approach outlined above is limited to performance measurements of flavors, as it leverage the SAP Screen Personas flavor itself to record the elapsed time. While convenient for these cases it does not allow to measure performance of the Original Screen. In order to facilitate such a control group the proposed solution is to develop a flavor for the SAP Access Menu transaction SMEN which will start and stop the timer, and either launch a transaction with or without a flavor. This approach allows to contain all the performance measurement code in a single transaction. However, it requires that all transactions return to SMEN on conclusion in order to record the time.
In case of a flavor the above code snipped could also be re-used in the flavor and tied to an appropriate action.
Overall the central measurement flavor should include the following sample coding to be executed on load:
var timestop = Date.now(); var timestart = session.utils.get("time.start"); var tcode = session.utils.get("tcode"); var flavorId = session.utils.get("flavorId"); if (timestart){ var timeelapsed = timestop - timestart; session.findById("wnd[0]/usr/lblPersonas_1458081934654").text = timeelapsed + "ms"; var measurement = JSON.stringify({tcode : tcode, flavor : flavorId, timestart : timestart, timestop : timestop, timeelapsed : timeelapsed}); session.utils.logMeasurement("TIMEINTRANSACTION", measurement); session.utils.put("time.start",""); } else { session.findById("wnd[0]/usr/lblPersonas_1458081934654").text="N/A" session.utils.put("time.start",""); }
A start of a transaction with a flavor can be triggered like this:
var tcode = session.findById("wnd[0]/usr/txtPersonas_1458079771239").text; var flavorId = session.findById("wnd[0]/usr/txtPersonas_1458079780883").text; session.utils.put("tcode", ""+tcode); session.utils.put("flavorId", flavorId); session.utils.put("time.start", ""+Date.now()); session.callTransaction(tcode); session.utils.changeFlavor(flavorId);
While a start of a transaction without a flavor is slightly more complex as it needs to manually for a flavor change to no flavor (Original View) before starting the timer and execution of the transaction:
var tcode = session.findById("wnd[0]/usr/txtPersonas_1458079771239").text; //force original screen session.callTransaction(tcode); session.utils.changeFlavor(""); session.findById("wnd[0]/tbar[0]/okcd").text = "/n"; session.findById("wnd[0]").sendVKey(0); session.utils.put("tcode", ""+tcode); session.utils.put("flavorId", ""); session.utils.put("time.start", ""+Date.now()); session.callTransaction(tcode);
A sample flavor including the above functionality can look like this:
Limitations of the approach and further options
This timing method is very basic, and limited to end-to-end time, measured in ms by the JS engine. It does not consider threading, client CPU or network load, processor interrupts, network effects, work process assignments, and co-habitation issues. However, these effects have empirically been observed to be minimal compared to fluctuation due to manual user interaction with the system.
Should the results of this first level of examination be inconclusive of not meeting expectations a more detailed analysis could measure number and time of request per dialog step. Specifically the number and duration of requests to /sap/bc/personas (for script execution) and /sap/bc/personas3 (images and other SAP Screen Personas specific resources) should be recorded. This should help either identify scripts that might require additional tweaking or resources that should be reduced in since.
Existing limitation with SAP GUI for Windows 7.40
Due to a mismatch between SAP GUI for Windows and SAP Screen Personas in certain configurations it can happen that session.utils.logMeasurement is not recording the measurements correctly into the measuring point. However it is possible to log the data leveraging a custom RFC.
Here is an example for such a RFC:
This RFC stores the data in the same structures and it can be accessed through standard SAP Screen Personas features. However this sample coding is provided without warranty or support by SAP.
The RFC can be called from the script as outlined here:
Sample Flavor
You can download the above sample flavor here: http://file.personas.help/uploads/145824454369731.zip
Related Content
Related Search Terms:
SAP Screen Personas, Analytics, log measure, SP02