cancel
Showing results for 
Search instead for 
Did you mean: 

SAP GUI Scripting in unresposive and cauing Crash

obaid_ullah2
Explorer
0 Kudos

We have an application that emulate the user interaction with SAP application and use SAP GUI scripting (GUI for window) from VB module to interact with SAP application and perform various operations on SAP window. The operation performed during that exercise are inputting values, search a node in tree, search a value in table, input value in a table cell, click on button, send virtual keys to sap window, interacting with context menu etc etc.. Operations that need to perform on SAP GUI are organized into 'tests" and are performed in a serial fashion. A same test (sequence of operations) can be performed any number of times on a given SAP application.

Lately, we have seen that either SAP Gui crashes or become unresponsive at random when a set of operations (test) are being performed iteratively on SAP GUI. The same test executed correctly many times but at random iteration it become completely unresponsive and hung up.

Although, SAP Gui hang up occurred at a random iteration but we've noticed that if there were two sap instances on the machine then this behavior is noticed much earlier and it is almost certain to get to this sate if an ECATT is running in another sap window but still not able to establish a particular pattern and some time same tests were executed correctly in all the above mentioned scenarios. However, when problem occurred, it usually happen just after the operations that have caused SAP GUI to do a server round trip like click on button or scrolling a table etc but still it was quite random and was unable to establish a pattern.

When SAP GUI hung up then not only it becomes completely unresponsive, but it also hung up any application they tries to interact with SAP GUI scripting object. At this point, any attempt to make any references to any scripting object or even a fresh attempt to connect to scripting object model also hung up that application. The only way out at that point is to kill SAP Gui from the task manager and once SAP Gui killed then all application that was previously hang up start to resume execution!

SAP GUI for Window 7.1 patch 7 and path 11 are being used.

Any help shall be greatly appreciated.

Accepted Solutions (0)

Answers (1)

Answers (1)

script_man
Active Contributor
0 Kudos

Hello from Germany,

If I have understood correctly, is about the problem that a recorded VB script only in the first mode can run. This problem I have with me solved as follows:

For example:

Original script:

If Not IsObject(application) Then

Set SapGuiAuto = GetObject("SAPGUI")

Set application = SapGuiAuto.GetScriptingEngine

End If

If Not IsObject(connection) Then

Set connection = application.Children(0)

End If

If Not IsObject(session) Then

Set session = connection.Children(0)

End If

If IsObject(WScript) Then

WScript.ConnectObject session, "on"

WScript.ConnectObject application, "on"

End If

session.findById("wnd[0]").maximize

session.findById("wnd[0]/usr/subSUBSCREEN...

session.findById("wnd[0]/usr/subSUBSCREEN...

New script:

If Not IsObject(application) Then

Set SapGuiAuto = GetObject("SAPGUI")

Set application = SapGuiAuto.GetScriptingEngine

End If

If Not IsObject(connection) Then

Set connection = application.Children(0)

End If

If Not IsObject(session) Then

Set session = connection.Children(0)

End If

If IsObject(WScript) Then

WScript.ConnectObject session, "on"

WScript.ConnectObject application, "on"

End If

err.clear

on error resume next

SESSION_ = 0

do

err.clear

session.findById("wnd[0]").maximize

session.findById("wnd [0]/usr/subSUBSCREEN...

if err.number = 0 or SESSION_ = 5 then exit do

SESSION_ = SESSION_ + 1

Set session = connection.Children(int(SESSION_))

loop

on error goto 0

session.findById("wnd[0]/usr/subSUBSCREEN...

There is no general solution. It is the only way to suggest how it could solve some.

Sorry for my English. I must admit, I can absolutely not.

Regards

ScriptMan

Edited by: ScriptMan on May 22, 2009 3:01 PM

Edited by: ScriptMan on May 22, 2009 3:06 PM

Edited by: ScriptMan on May 25, 2009 11:06 AM

obaid_ullah2
Explorer
0 Kudos

I'm experiencing random SAP Gui crashes during the operation when scripting was used on SAP GUI. I do have all the error handling and other support.

script_man
Active Contributor
0 Kudos

I have misunderstood it completely. Another solution I do not know than to kill SAPLOGON.EXE from the task manager.

Former Member
0 Kudos

Dear Script Man and Ullah

I'm with this problem too. We're running some reports every hour and sometimes the SAP Gui crashes without connection issues or something like that. Do you know how to solve this problem?

SAP GUI 730 Final Release with patch 7 - Windows 7 SP 1.