For particular InputScripts
we know that they can take a while to finish the process. It is then
desirable to give the user some kind of feedback during this waiting
time, indicating that the system is still working.
Solution
Implement a suitable "Please wait" HTML page
Display the HTML page during the InputScript processing
via Control
Keep the popup window informed about the current step and the
percentage of work already done
Video
HTML "processing.html"
HTML
JavaScript to communicate between HTML page and
InputScript JavaScript
InputScript (relevant parts)
GuiXT
Enter "/niw37n"
// display processing popup
Control (5,20) (30,126) _
progID="file://processing.html" _
title="Loading notifications, please wait..." _
name="processingPopup" _
-floating
// use "ConnectHTML" to pass the GuiXT object to JavaScript
ConnectHTML name="processingPopup"
// indicator variable to stop the InputScript
Clear V[stopProcessing]
Screen RI_ORDER_OPERATION_LIST.1000
Title "Loading notifications, please wait..."
// set parameters
Set F[Period] ...
Set F[Period to] ...
...
CallJS stopProcessing = set_step_info _
"&V[processingPopup]" "Selecting notifications"
// stopped by user ?
if V[stopProcessing]
goto stop
endif
Enter "/8"
// Grid control
Screen SAPLSLVC_FULLSCREEN.0500
Title "Loading notifications, please wait..."
CallJS stopProcessing = set_step_info _
"&V[processingPopup]" "Reading notifications"
// stopped by user ?
if V[stopProcessing]
goto stop
endif
// load all notifications into grid
GetGridValues -prepare
// select all notifications
Enter "/5"
Screen SAPLSLVC_FULLSCREEN.0500
Title "Loading notifications, please wait..."
// grid values into GUiXT variables
GetGridValues selectedCells="notification" selectedrowCount="rv"
// process all notifications
Set V[k] 1
label next_step
if V[notification.&V[k].2]
// calculate percentage
Set V[percentage] &V[k] * 100
Set V[percentage] &V[percentage] / &V[rv] decimals=0
// processing message with new percentage
Set V[stepInfo1] "&V[k]: &V[notification.&V[k].2] "
Set V[stepInfo2] "&V[notification.&V[k].4] &V[notification.&V[k].5]"
CallJS stopProcessing = set_step_info _
"&V[processingPopup]" _
"&V[stepInfo1]&V[stepInfo2]" _
"&V[percentage]"
// stopped by user ?
if V[stopProcessing]
goto stop
endif
// do something with notification
// ....
// next one
Set V[k] &V[k] + 1
goto next_step
endif
CloseControl name="processingPopup"
Message "S: Processing complete" -statusline
Enter "/N"
Leave
label stop
CloseControl name="processingPopup"
Message "E: Processing stopped by user" -statusline
Enter "/N"
Leave