Skip to Content

How To Export and Import Documents via Generic Object Services (GOS) and SAP GUI Scripting

The GOS supports SAP GUI Script recording, all we have to do is to disable in the SAP Logon the using of native Windows dialogs. More information here.


To try it you can use the TAC SGOSTEST (Test tool for GOS).



After that it is possible to record this activities also.

Here an example with the transaction code FB03 with an export of a PDF file from the GOS.


And now your the scripting code looks like this:

session.findById("wnd[0]/titl/shellcont/shell").pressContextButton "%GOS_TOOLBOX"
session.findById("wnd[0]/titl/shellcont/shell").selectContextMenuItem "%GOS_VIEW_ATTA"
session.findById("wnd[1]/usr/cntlCONTAINER_0100/shellcont/shell").currentCellColumn = "BITM_DESCR"
session.findById("wnd[1]/usr/cntlCONTAINER_0100/shellcont/shell").selectedRows = "0"
session.findById("wnd[1]/usr/cntlCONTAINER_0100/shellcont/shell").pressToolbarButton "%ATTA_EXPORT"
session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "This is a test.pdf"
session.findById("wnd[1]/usr/ctxtDY_FILENAME").caretPosition = 19



Here an example code for an import:

session.findById("wnd[0]/titl/shellcont/shell").pressContextButton "%GOS_TOOLBOX"
session.findById("wnd[0]/titl/shellcont/shell").selectContextMenuItem "%GOS_PCATTA_CREA"
session.findById("wnd[1]/usr/ctxtDY_PATH").text = "C:\Dummy\"
session.findById("wnd[1]/usr/ctxtDY_FILENAME").text = "This is a test.pdf"


You must be Logged on to comment or reply to a post.
  • Hello Anatoliy,

    if you record your activities via SAP GUI Scripting, you see on the right side in the status bar a litte rotating barberpole. This means that a script is running.

    In this case the GOS dialog in the Folders Management looks like this:

    If you don’t record your activities via SAP GUI Scripting, the same GOS dialog in the Folders Management looks like this:

    Do you activate the script recording if you see this dialog?
    If yes, which path resp. which activities do you use to open this dialog in Folders Management?



  • Good afternoon, Stefan!
    The script is needed to load the pdf file from the disk, the actions of the file and the file are not displayed when the script is run.


    The form of loading does not change.

    When formatting and running the script stops Folders Management.

    Can I write a script for Folders Management?

  • Hello Anatoliy,

    this is a modal dialog box, this means it blocks other applications, e.g. a running script, on the same process. It is necessary to start another independent process parallel to control this dialog box. You can find a solution here.


  • how do I automate findById(“wnd[0]/titl/shellcont/shell”).pressContextButton “%GOS_TOOLBOX”

    As I see, GuiShell doesnt contain pressContextButton method

    • Hello Emin,

      GuiShell is an abstract object whose interface is supported by all the controls. Look at the sub type of GuiShell. In your case it is GuiToolbarControl which extends GuiShell. GuiToolbarControl offers the method PressContextButton(Id As BStr) As Void. Here a tiny example script:

      $ID = Invoke-Method $session "findById" @("wnd[0]/titl/shellcont/shell")
      Invoke-Method $ID "pressContextButton" @("%GOS_TOOLBOX")

      Best regards