Skip to Content
Author's profile photo Jakob Marius Kjær

Global script for showing SAPui5 table in Screen Personas

Hi all,

This is a short one, but i believe it might come in handy for many people.

Following several excellent blogs on how to copy data from tables in SAP Screen Personas and showing it in SAPUI5 . However the blogs i’ve seen so far have hardcoded the bindingproperties and the headers of the columns.

This little script can be stored centrally in the personas resource repository and executed on every table to generate a SAPUI5 table version of the data.

Look at this wiki that will show you how to load scripts from the resource repository.

Add a HTML Viewer to your flavor and next add a script.

This little snippet shows you how to use the script:

session.utils.include("000C2975DCD41ED782D4F32BBDE300C6", false);

var selectedTable = session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell");
var tableHTML1 = getTable(selectedTable);
session.findById("wnd[0]/usr/htmlViewerPersonas_148971033247974").content = tableHTML1;

Let’s go through it:

First you load the script stored centrally. Then you get the ID of the table control,

Declare a new variable (tableHTML1), this variable will contain the htmlcode for your html viewer returned from the getTable function from the global script.

Set the content of your HTML viewer to the variable you just created and you are done. Easy right 🙂

Remember that the values i use in the above snippet is for my own flavor, you need to replace the id of the table and the htmlviewer.

You can download the script from here


Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Neil Ward
      Neil Ward


      I just tried this and ran into an error, this line results in an error.

      var tableHTML1 = getTable(selectedTable);

      I notice this variable is declared in the global script, does that mean I've done something wrong setting up the global script?



      Author's profile photo Cyrus Minab
      Cyrus Minab

      Hi Neil,

      I've also encountered the same issue. I've uploaded the .Js file and incorporated in the script but when I execute the script I get the message, Error during 'onExecuteScript' event script execution. Error message: 'getTable is not defined'.

      Where you able to resolve this,

      thank you

      Author's profile photo Vishnu B
      Vishnu B

      Hi Jakob I tried this and it's working, I'm having an issue in which my flavour is loading properly in web GUI but when it comes to windows GUI I'm facing issues is it due to html viewer that we use..?