cancel
Showing results for 
Search instead for 
Did you mean: 

Scripting not working since upgrade to Windows 7

Former Member
0 Kudos

A few days ago my pc was upgraded to Windows 7, since then however I can no longer use any scripts.

Sap version: SAP 720

When doubleclicking on a script or dragging a script onto SAP nothing happens at all.

When starting a script using for example the GuiXT code 'Image (Toolbar) img Start=Script' I immediately receive the following error:

This script (see below) should return the total number of rows in a grid and the number of rows selected.

The error always points to the line where GetObject("SAPGUI") is located, also in other transactions.

Apart from this I also don't have the 'Script development tools' anymore, which is apparently due to the missing of the windows agent. Is there a solution apart from installing this?

Can somebody help me resolve this?

The script

Dim rows
Dim aw

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
set session = application.ActiveSession


On error resume next
Set GRID1 = session.FindById("wnd[0]/usr/cntlCONTAINER/shellcont/shell")
Set GRID1 = session.FindById("wnd[0]/usr/cntlGRID1/shellcont/shell")

GRID1.setCurrentCell -1,""
selection = GRID1.SelectedRows

'Bereken aantal geselecteerde rijen
Dim selected
selected = 0
If selection<>"" Then
Dim start_pos, current_pos, reeks_pos, range, aantalKommas
'selection="1,3,5-10,12,15,20,21"
'selection="1,4,5"
'Initialize
start_pos = 1
range = 0
aantalKommas = 0
Do
  current_pos = instr(start_pos , selection , "," , 1)  '2
  'msgbox "Current: " & current_pos
  If current_pos<>0 Then
   aantalKommas = aantalKommas + 1
   'msgbox aantalKommas,,"Aantal komma's"
  End If
  reeks_pos = instr(start_pos , selection , "-" , 1)   '6
  'msgbox "Reeks: " & reeks_pos
  If current_pos>reeks_pos And reeks_pos<>0 Then
   under = Mid(selection,start_pos,(reeks_pos-start_pos))
   upper = Mid(selection,reeks_pos+1,(current_pos-reeks_pos))
   range = upper-under+range
   'msgbox "Under: " & under & chr(13) & "Upper: " & upper & chr(13) & "Range: " & range
  Else
   If current_pos = 0 and reeks_pos <> 0 Then
    under = Mid(selection,start_pos,(reeks_pos-start_pos))
    upper = Mid(selection,reeks_pos+1,len(selection))
    range = upper-under+range
   End If
  End If
  start_pos = current_pos + 1
Loop While instr(start_pos , selection , "," , 1)<>0 Or instr(start_pos , selection , "_" , 1)<>0
'Msgbox aantalKommas+1+range,,"Aantal rijen"
selected = aantalKommas+1+range
End If

'Aantal rijen
rows = GRID1.RowCount
Msgbox "Totaal: " & rows & chr(13) & "Geselecteerd: " & selected, ,"Aantal Rijen"

Accepted Solutions (1)

Accepted Solutions (1)

stefan_schnell
Active Contributor
0 Kudos

Hello Tim Van Wynsberge,

I don't know the exact solution, but maybe a hint: You are running a remote script on your local client. Could it be that your firewall is blocking the access, because you have a remote access to your client?

You have a few ways to use the Scripting Development Tools:

  1. Look here: http://scn.sap.com/thread/2006892
  2. If this solution doesn*t work, start your SAP logon in Windows XP compatibility mode, after installing the agents.
  3. Also you can use the Scripting Tracker as alternative, look here: http://scn.sap.com/docs/DOC-32728

Hope it helps. Let us know.

Cheers

Stefan

Former Member
0 Kudos

Hello Stefan,

I do not think it is firewall related as the script is indeed started but always fails on the same line of code ie. Set SapGuiAuto = GetObject("SAPGUI").

Concerning the scripting wizard. I tried the Scripting Tracker, however it does not do anything. I believe that this is caused by the same issue I have with my other scripts which are not able to connect to the sapgui object.

Thanks,

Tim

Former Member
0 Kudos

I tried using the scripting tracker but run in some issues.

First it asks for a password, which I don't have as we use single sign-on.

Secondly a message is shown at the bottom: "SAP ROT entry not create".

So possibly scripting is activated but not installed?

stefan_schnell
Active Contributor
0 Kudos

Hello Tim,

Scripting Tracker doesn't need a password. Can you upload an image of the requester please.

If the message SAP ROT entry not create is shown, that means that the SAP Logon is not executed or it is not possible to create the object SAPROTWr.SapROTWrapper. Please check your installation of the SAP GUI for Windows.

You can check the first steps with the following VBScript. The SAP Logon must be executed.

  Set SAPROTWrapper = CreateObject("SapROTWr.SapROTWrapper")

  If IsObject(SAPROTWrapper) Then

    Set ROTSAPGUI = SAPROTWrapper.GetROTEntry("SAPGUI")

    If IsObject(ROTSAPGUI) Then

      MsgBox "All seems to be okay"

    Else

      MsgBox "Not possible to get ROT entry SAPGUI"

    End If

  Else

    MsgBox "Not possible to create SAPROTWrapper object"

  End If

If the script doesn't work, it seems to be a failure at your local SAP GUI for Windows installation.

Let us know the results.

Cheers

Stefan

Former Member
0 Kudos

After a long period I was able to look into this again...

I have made some minor (but important) progress since then.

As mentioned earlier we use single sign-on, and I got the error in the first post when starting a script.

Apart from my usable/main SAP session, I now started the SAP Logon Pad application manually.

This opens a login screen for SAP which I cannot use (I do not know the password used).

However when this screen is active I can start the scripts using my guixt-image-button, but they do not connect with my active session and do not execute as they should: they run as if you would run them without SAP.

If I adapt the script for use without set session = application.ActiveSession, to the standard connection 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

Then I can use the script only if I drop it on the active window, not by doubleclicking or using the guixt image buttons.

The TrackerLite application only connects/finds the window that was started by the SAP Logon Pad, it does not find my active SAP windows.

So in other words: Scripting works BUT...

How can I make the scripting work on my active sessions (without having to always drop scripts on my session)?

Former Member
0 Kudos

Finally found the complete solution...

All it was, was a tiny setting called 'StartLogonPad' hidden in the registry.

On my PC it was set to '0'.

Changing it to '1' and starting a new SAP session had the desired effect: the logon pad was started alongside the new session and scripts now attach correctly!

stefan_schnell
Active Contributor
0 Kudos

Hello Tim,

thanks for posting your solution.

Cheers

Stefan


Former Member
0 Kudos

I somehow made an error when posting the solution last time...

The registry key is 'StartSaplogon', it is found under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\SAP\SAPGUI.

This key has to be set to 1 to make the SAP Logon Pad start with a SAP session.

0 Kudos

Hello Tim,


I faced the same issue you posted on SAP community (http://scn.sap.com/thread/3301231). The scripts I have recorded just run from excel vba or if I drop them into SAP screen. I am using 32bit system. I was wondering if you could give me any idea of what I could do to run it by just double clicking over it?

Appreciate your help.

Thank you!

Former Member
0 Kudos

Can you tell what does happen when you doubleclick on it?

If it is the error above, then for me it was the Logon Pad that did not start together with my SAP GUI session (as we use single-sign on, so no real need for the logon pad and it was disabled because of that).

I was able to solve it by adapting the registry key mentioned above via regedit  (Based on note 552646). By setting it to 1, the logon pad then starts even when I use SSO and I am able to doubleclick on my scripts to start them.

Answers (0)