0

I want to automate a transaction on SAP using the playback script. I record a transaction and then export it under excellent all while remaining on SAP, it works perfectly. (this is the Microsoft Excel icon, Ctrl+Shift+F7), this is an icon with an Excel sheet and a green cross on it.

When I open my script and execute it, the script itself works, the export works but there is no data when it existed when I did the transaction by hand. I don't see why.

This happens in SAP GUI.

  If Not IsObject(App) Then
  Set SapGuiAuto = GetObject("SAPGUI")
    Set App = SapGuiAuto.GetScriptingEngine
   End If
  If Not IsObject(Connection) Then
  Set Connection = App.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 App, "on"
     End If
    session.findById("wnd[0]").maximize
     session.findById("wnd[0]/tbar[0]/okcd").Text = "S_ALR_87012284"
       .......
      session.findById("wnd[0]/usr/cntlGRID1/shellcont/
        shell/shellcont[1]/shell[1]").setDocument 1, ""

When I look at the excel sheet on SAP, I see that "/" and the sheet is called "~SAP{7BD014FE-F4CF-49DA-AAD5-FD"

Yet when I do it by hand, I see all my data.

Sandra Rossi
  • 11,934
  • 5
  • 22
  • 48
XDSSIOP
  • 91
  • 3
  • 11

1 Answers1

0

Please deactivate the last command and it should work again.

 ...
 session.findById("wnd[0]").maximize
 session.findById("wnd[0]/tbar[0]/okcd").Text = "S_ALR_87012284"
 ...
 'session.findById("wnd[0]/usr/cntlGRID1/shellcont/
    shell/shellcont[1]/shell[1]").setDocument 1, ""

Regards, ScriptMan

ScriptMan
  • 1,580
  • 1
  • 9
  • 9
  • Thank you for your answer, it's better than before but I still have the excel sheet without data. – XDSSIOP May 20 '19 at 12:09
  • If you do not see any data, it can hardly be better. My test script ends as follows: session.findById("wnd[0]/tbar[1]/btn[8]").press session.findById("wnd[0]/tbar[1]/btn[43]").press 'session.findById("wnd[0]/usr/cntlGRID1/shellcont/shell/shellcont[1]/shell[1]").setDocument 1,"" and I can see everything. – ScriptMan May 20 '19 at 12:40