Page tree
Skip to end of metadata
Go to start of metadata

SAP Screen Personas


SAP SCREEN PERSONAS KNOWLEDGE BASE - by Tamas Hoznek , Regina Sheynblat , Sebastian Steinhauer


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.


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.


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", "";

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 =;
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 =;
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);
else {

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", "";

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.findById("wnd[0]/tbar[0]/okcd").text = "/n";
session.utils.put("tcode", ""+tcode);
session.utils.put("flavorId", "");
session.utils.put("time.start", "";

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:

function z_personas_log_measurement.
*"*"Local Interface:

  data: lv_timestamp              type                   timestampl,
        lt_measurement_data_pairs type standard table of string,
        lt_measurement_data       type                   /personas/cl_measurement_utils=>tt_items,
        ls_measurement_data       like line of           lt_measurement_data,
        lr_context                type ref to            /personas/cl_context_dynp,
        lr_measurement_hndl       type ref to            /personas/cl_measurement_hndl.

  field-symbols: <lv_measurement_data_pair> like line of lt_measurement_data_pairs.

* Prepare measurement data.

* Check, if timestamp is provided.
  lv_timestamp = iv_timestamp.
  if iv_timestamp is initial.
    get time stamp field lv_timestamp.

* Extract required measurement data from provided string.

  "Get "Name:Value" data pairs.
  split iv_ms_data at ',' into table lt_measurement_data_pairs.

  "Save measurement data name and value from each pair into separate table.
  loop at lt_measurement_data_pairs assigning <lv_measurement_data_pair>.
    split <lv_measurement_data_pair> at ':'
     into ls_measurement_data-name ls_measurement_data-value.
    insert ls_measurement_data into table lt_measurement_data.

* Log measurement.

  create object lr_context.

  create object lr_measurement_hndl
      ir_context = lr_context.

      iv_mspnt_id         = iv_mspnt_id
      iv_timestamp        = lv_timestamp
      it_measurement_data = lt_measurement_data ).


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:

// Name information, which is required
var firstDataName   = 'currentApplication';
var secondDataName  = 'currentScreen';
var thirdDataName   = 'currentFlavor';

// Get required information
var firstDataValue  =;
var secondDataValue =;
var thirdDataValue  =;

// Combine appropriate name and information into data
var nameValueSeparator = ':';
var firstData = firstDataName.concat(nameValueSeparator, firstDataValue);
var secondData = secondDataName.concat(nameValueSeparator, secondDataValue);
var thirdData = thirdDataName.concat(nameValueSeparator, thirdDataValue);

// Combine all data into one string
var dataSeparator = ',';
var measurementData = firstData.concat(dataSeparator, secondData, dataSeparator, thirdData);

// Call RFC
var oRFC = session.createRFC("Z_PERSONAS_LOG_MEASUREMENT");
oRFC.setParameter("IV_MSPNT_ID", 'VADIMS_MSPNT');  // setting the measuring point parameter
oRFC.setParameter("IV_MS_DATA", measurementData);
oRFC.setParameter("IV_TIMESTAMP", '');  // server timestamp is used if not provided

Sample Flavor

You can download the above sample flavor here:

Related Content

Related Search Terms:

SAP Screen Personas, Analytics, log measure, SP02