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

 

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply