Task description

Solution

Sample code, images Restrictions, SAP Release, SAP GUI version, GuiXT version
32 Displaying a progress indicator with GuiXT Viewer

If a GuiXT script or InputScript executes “Call” statements that can take longer than 1 or 2 seconds, it is desirable to give the user some kind of feedback during this waiting time, indicating that the system is still working.

With GuiXT Viewer you can display a small HTML page during the execution of the Call statement(s) that shows a growing progress bar:

         Sap Guixt sample032.01 Displaying a progress indicator with GuiXT Viewer

This progress bar does not really show the percentage of the work that has already been completed, since we do not receive this information during the execution of the Call statement. It simply makes visible the fact that work is still in progress. You need to make some assumptions on the total time needed in order to choose a reasonable speed for the progress indicator. Our sample implementation assumes a maximum of 60 seconds.

If you execute numerous Calls that each require only a short time, you can design a more intelligent progress indicator with the same technique, sending the completion percentage from the GuiXT script to the HTML page with ConnectHTML statements. Our sample code (right hand side) implements the simpler approach of a progress indicator that reflects the time only.

Another situation that you might have to handle in some cases is that the Call can be very fast, so the user would only see a flickering on the screen instead of the progress indicator. You can make sure that the progress indicator is shown for at least one second by a ConnectHTML statement that executes a JavaScript function in the popup window. This function waits one second before returning if the progress indicator is still at the beginning. Since JavaScript has no real “wait” or “sleep” function, we use a “while” statement in which we continuously check the time until one second has elapsed.

The GuiXT script looks as follows: 

// Display the progress indicator popup
View (10,10) (24,80) “progressbar.html” -floating returnwindow=”hwnd_progressbar”

// Do your work
Call …

// Delay one second if necessary
ConnectHTML click=”button_Delay”

// Close the progress indicator
View closeWindow=”&[hwnd_progressbar]“

Please click on the link in the next column to get the HTML coding of a sample progress indicator page (left click to display the page, right click and “save as” to download the coding).

 

Last update: 
December 16, 2008

Sap Guixt sample Displaying a progress indicator with GuiXT Viewer  HTML page “progressbar.html”

 

 

InputAssistant and Viewer

 

 

Displaying a progress indicator with GuiXT Viewer