Purpose
Trace the grid loading

This trace is primarily intended for optimizing puposes by Synactive, but it may also help with the development of GuiXT applications. In particular, you can see how often internal grid data is reloaded, which can perhaps be reduced by using a grid layout with fewer columns.

Solution
You can activate the trace for one of the following guinet functions:

- CallVBAsync guinet.gridcontrol.gridToTable
- CallVBAsync guinet.gridcontrol.copyText
- CallVBAsync guinet.gridcontrol.loadAllRows

In the corresponding call, e.g.

CallVBasync rowcount = guinet.gridControl.GridToTable ...

add the option tracetext:=, specifying the name of a GuiXT long text variable (arbitrary) into which the trace is to be placed, e.g. "gridtrace":

CallVBasync rowcount = guinet.gridControl.GridToTable ... tracetext:="gridtrace"


In the following screen statement, you can then display the trace with

Message "&text[gridtrace]"

As the trace output is quite extensive with many grid lines, it is often better to copy the trace with

CopyText fromText="gridtrace" toFile="F:\temp\gridtrace.txt"

to a local file and then display it.

Alternative: Leave the InputScript unchanged and check the content of the long text you have specified in the GuiXT debugger after the process, e.g. text[gridtrace], In the debugger window the "..." button to the right of the value is useful for displaying the content.


Interpretation of the trace output

The parameters specified in the function call are displayed at the start of the trace:

GridControl.GridToTable Trace
Parameter tableName:mygrid
Parameter columns:aufnr,auart,ktext



The reading of the grid then begins with the total number of rows in the grid:

Reading Grid...
Grid row count: 8111


Now individual rows are read:

Load row Nr. 1
Load row Nr. 2
Load row Nr. 3
Load row Nr. 4
Load row Nr. 5



For each row number, GuiXT checks whether the row ID and the ID of the subsequent row have already been loaded. The subsequent row is necessary because SAP GUI may only load the first columns of a row at the end of a data block from the server internally. If one of the two rows is not yet loaded, it is reloaded from the server:

...
Load row Nr. 26
Load row Nr. 27
Load row Nr. 28
Returned row ids: 0000000028,
Load new grid data starting in row 28
 ...elapsed time 15ms
 ...elapsed time 46ms
 ...elapsed time 78ms
Load row Nr. 29
Load row Nr. 30

...

Approximately 78ms were required here to reload the next data block.


The number of rows loaded into the table is displayed at the end of the trace:

...
Load row Nr. 8109
Load row Nr. 8110
Load row Nr. 8111
All done: 8111 rows


If only the selected rows were requested, the last row number can be smaller than the total number of rows, otherwise it must be the same.


When "guinet.gridControl.copyText" is called, the total length of the transferred text is displayed in KB at the end:

...
Load row Nr. 8109
Load row Nr. 8110
Load row Nr. 8111
All done. Returned text size: 4,545.01 KB

Notes on performance optimization

In this example, a reload is required after approximately each 30 rows, which is due to the fact that the grid contains a large number of columns. If you specify a layout in the InputScript that only contains the three required columns (order number, order type and short text), the first reload only takes place after approximately each 160 lines. In the InputScript specify the layout name before you start the data selection:

Set F[Layout] "/TEST3"
Enter  "/8"

Here "/TEST3" is a specially created cross-user layout with exactly the three required columns. Trace output in this case:

Load row no. 162
Load row no. 163
Load row no. 164
Returned row ids: 0000000164,
Load new grid data starting in row 164
...elapsed time 15ms
Load row no. 165
Load row no. 166

The first reload occurs for row 164 instead of row 28. The loading times per block are now also considerably shorter, as SAP GUI has fewer column values to fill.

In our example (IW38, approximately 8000 rows) we measured the following total times:

Layout with all columns: 67sec
Layout containing only order number, order type and short text: 7sec

(SAP GUI 8.00 PL6, GuiXT 2024 Q1 1) 

Components
InputAssistant + Controls