Skip to Content

Microsoft Windows 7 is in business now. With Windows 7 we get the PowerShell, the new command-line shell and scripting language. You find a lot of information about Windows PowerShell here:

So far so good, here is an example, how to use SAP GUI Scripting inside Windows PowerShell. It opens the transaction code SE16 and view the table USR01. The scripting code comes direct from the SAP GUI Scripting Recorder. Only the double quotes must change to `” and the EOL to `n.


  $VB = New-Object -COMObject MSScriptControl.ScriptControl
$Cmd = @"
Set SapGuiAuto = GetObject(`"SAPGUI`")`n
Set application = SapGuiAuto.GetScriptingEngine`n
Set connection = application.Children(0)`n
Set session = connection.Children(0)`n
session.findById(`"wnd[0]/tbar[0]/okcd`").text = `"/nse16`"`n
session.findById(`"wnd[0]/usr/ctxtDATABROWSE-TABLENAME`").text = `"USR01`"`n
  $VB.Language = "VBScript"
  $VB.AllowUI = $TRUE

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply