Skip to Content
Author's profile photo Stefan Schnell

SAP GUI Scripting: Make Invisible Information Visible with DumpState

Many classes of the SAP GUI Scripting offers the method DumpState. DumpState delivers a hierarchy of collections with detailed information about the state of an object. Here an example how to make this information visible, with different scripting languages.


DumpState delivers the following OpCodes with the names and values of an object:

  • GPR = Get Property and Return value
  • MR = Method and Return value
  • GP = Get Property
  • M = Method

The parameter InnerObject may be used to secify for which internal object the data should be dumped. The most complex components supports this parameter. In the most cases it is an empty string.


The first source is in PowerShell. It shows from the transaction code SESSION_MANAGER the DumpState of the GuiCustomControl IMAGE_CONTAINER. The recursive function Dump loops over the collection and write all information to the console.



  #-Sub Dump---------------------------------------------------------
  Function Dump($Collection) {

    ForEach($Item In $Collection) {
      If ( $Item -IsNot [System.__ComObject] ) {
        Write-Host $Item
      } Else {
        Dump $Item

  #-Sub Main---------------------------------------------------------
  Function Main() {
    $SapGuiAuto = Get-Object( , "SAPGUI")
    If ($SapGuiAuto -IsNot [System.__ComObject]) {

    $Application = Invoke-Method $SapGuiAuto "GetScriptingEngine"
    If ($Application -IsNot [System.__ComObject]) {

    $Control = Invoke-Method $Application "findById" `

    #-With the method DumpState we get the collection----------------
    $Collection = Invoke-Method $Control "DumpState" @("")

    #-With the recursive function we get the information-------------
    Dump $Collection





Here the result in the PowerShell ISE:


Now as second source the same example in VBScript:


  Option Explicit

  Dim OutText

  Sub Dump(collection) '------------------------------------------------

    Dim i

    For i = 0 To collection.Count() - 1
      If IsObject(collection.ElementAt(CLng(i))) Then
        Dump collection.ElementAt(CLng(i))
        OutText = OutText & collection.ElementAt(CLng(i)) & vbCrLf
      End If

  End Sub

  Sub Main() '----------------------------------------------------------

    Dim SapGuiAuto, application, control, collection

    If Not IsObject(application) Then
      Set SapGuiAuto = GetObject("SAPGUI")
      Set application = SapGuiAuto.GetScriptingEngine
    End If

    Set control = application.findById("/app/con[0]/ses[0]/wnd[0]" & _

    Set collection = control.DumpState("")

    Dump collection

    MsgBox OutText

  End Sub




Here the result:


Or you can use Scripting Tracker, that is of course much more comfortable.


Also you can use the VBA debugger, but this is, if you don’t work with the VBA-IDE, not an efficient alternative.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.