Hello again,
You have hopefully read my blog:Using heatmaps in Screen Personas part 1
This blog will give you the how on how to get the heatmaps working in Screen Personas
Alright let's get started. I created a little recipe list for what we need:
I have already posted the needed scripts on github and you can also download a zip file with the backend content.
Use lars.hvam's great tool AbapGit
to upload it.If you want to do it manually, then we need the following:
Z-table to store the click coordinates

Function module to capture click coordinates. Remember to RFC enable it.
Function Module to fetch the click coordinates. Remember to RFC enable it.
Now go to the /personas/admin
transaction and select the FM whitelist

And add the function modules.

NB: If you want to use this for WDA, then you need to add them with that framework as well.
Now we are done for the backend, easy right?Go to the webgui and access the transaction you want to track.
Create a flavor and go to the scripting engine.Create a new script and paste the following code
Now enable this script on the onload event in screen personas

Now create another flavor to visualize the heatmaps.In this flavor go to the scripting engine once more and add the following code
- // First capture the program name and screen number
- var progname = session._private.props()._parent.children[0].children[0].properties.ScreenProgram.toString();
- var screenNo = session._private.props()._parent.children[0].children[0].properties.ScreenNumber.toString();
- // Generate the RFC that we are going to call to get all the coordinates for the heatmap
- var rfc = session.createRFC("ZFM_HEATMAPS_GEN");
- rfc.setParameter("IV_PROGNAME", progname);
- rfc.setParameter("IV_SCREEN", screenNo);
- rfc.requestResults(JSON.stringify(["ET_COORDINATES"]));
- rfc.send();
- var coordinates = JSON.parse(rfc.getResult("ET_COORDINATES"));
- //Fetch the heatmap
- $.getScript("https://rawgit.com/pa7/heatmap.js/master/build/heatmap.js").done(function() {
- // minimal heatmap instance configuration
- var heatmapInstance = h337.create({
- // only container is required, the rest will be defaults
- container: document.getElementById("webguiPage0")
- });
- //The points are our click coordinates
- var points = [];
- $.map(coordinates, function(el) {
- var point = {
- x: el.X,
- y: el.Y,
- value: 10
- };
- points.push(point);
- });
- var max = points.lentgh;
- var data = {
- max: max,
- data: points
- };
- heatmapInstance.setData(data);
- });
Now go to edit mode and create a script button and add add the script to it.

And now the hard work is done!
All you need now is to add the capturing flavor to your users and then start recording their movements in the GUI.