SAP GUI Scripting Lesson 3: Understanding the Recorded VBScript

📎 This article includes 1 downloadable practice file ↓

⏱ 2 min read

📘 SAP GUI Scripting Beginner Course · Lesson 3 of 5

In this article
  1. The object chain
  2. findById paths
  3. Common actions
  4. Where people go wrong
  5. Practice

A recording is a list of steps. Once you can read it, you can change values, add loops and run it from Excel.

The object chain

Object Is
application SAP GUI scripting engine
connection One system you’re logged into (Children(0) = first)
session One SAP window (mode)

findById paths

session.findById("wnd[0]/usr/ctxtGD-TAB") means window 0, user area, a field whose technical name is GD-TAB. The prefix shows the type: ctxt input field with F4 help, txt text field, btn button, chk checkbox, tbar toolbar.

Common actions

.text = "T001"        ' type into a field
.press                ' click a button
.sendVKey 0           ' Enter (8 = F8 Execute, 3 = F3 Back)
.selected = True      ' tick a checkbox
💡 Replace typed values with variables (InputBox, or later a cell in Excel). That turns a one-off recording into a reusable tool.

Where people go wrong

Problem Fix
“control could not be found by id” Screen differs from the recording; check layout/variant
Script runs in the wrong window Close extra sessions or pick the right Children index

Use SAP GUI scripting only where your company allows it, on a test/quality system first, and never to bypass authorisations. Examples use standard transactions and made-up data.

Practice

Run the parameterised script and try different table names on a test system.

📎 Practice files for this article

  • 📄
    Lesson 3 scriptExample script with comments; adjust transaction fields to your system. Test in a non-production client.
    ⬇ VBS · 543 B

Free to use for learning. Files with macros (.bas) are plain text — import them with Alt+F11 → File → Import File, and always test on a copy.

✨ Ask AI about this article

Stuck on a step? Ask a question and the AI answers using this article.

Free · AI can be wrong