Now accepting guest editorial from SAP, Oracle, Workday and ServiceNow practitioners.Pitch a guide
The Sign-Off Table

Lesson 3 of 5

Identifying controls

18 min

Listen to this lesson

0:00 / 5:20

An automated test is only as stable as the way it finds things on the screen. A recorded script addresses every field by its full ID path. That works on the day of recording and often breaks later, when a screen variant hides a field, a subscreen moves, or a table shows rows in a different order. This lesson separates stable ways of addressing controls from fragile ones.

Two ways to find a control

The first way is by ID path: ask the session for the object at a known ID such as wnd[0]/usr/ctxtVBAK-AUART. It is fast and precise. The second way is by searching: walk the children of a window or area, or search by name, and match on properties such as the control's type, its technical name or its label text. Searching is slower and needs more code, but it survives changes in the path above the control.

ApproachStrengthsWeaknessesUse for
Full ID path from recordingFast, exact, easy to readBreaks when any container in the path changesStable screens, first drafts
Relative ID from a known containerFewer parts that can changeStill depends on that containerFields inside a stable subscreen
Search by technical name and typeSurvives moved subscreens and tabsMore code; can match duplicatesFields that move between screen layouts
Search by label textReadableBreaks with language or wording changesAvoid except as last resort
Ways to address SAP GUI controls, from most to least common.
The Sign-Off Table · thesignofftable.com/academy/sap-tau-201

What makes an address fragile

  • Connection and session indexes. A path that starts with con[0]/ses[0] fails when a tester has two systems or sessions open. Attach to the right session explicitly, by checking system, client and user.
  • Subscreen and container names. Many transactions build screens from subscreens whose container names appear in the ID. A different order type, screen variant or transaction variant can change them.
  • Tab positions. Tabs can be hidden or reordered by configuration; select a tab by its name, not its position.
  • Row indexes. "Row 3 of the item table" is a fragile idea; row positions change with sorting, filters and scrolling.
  • Language-dependent text. Labels and button texts change with the logon language and with releases.
Attach to a session by checking system, client and user, never by assuming con[0]/ses[0].
The Sign-Off Table · thesignofftable.com/academy/sap-tau-201

Tables and ALV grids

Tables are where most GUI automation breaks. SAP GUI has two families. A classic table control (for example the item overview in many dynpro transactions) shows a limited number of visible rows; the cells are addressed by column and visible row, so after scrolling the same row index points to a different item. An ALV grid is a control inside a container (the ID typically passes through a custom container and a shell), and its cells are read by row number and the column's technical field name; check the API reference for your SAP GUI version for exact method names.

  1. Locate the gridFind the grid control in its container, not by a hard-coded full path when the container varies
  2. Read the row countAsk the grid how many rows it holds instead of assuming a number
  3. Search by keyLoop through rows and compare the key column, for example the material CMC-ALT-100
  4. Act on the matchSelect or read the matching row; fail clearly if no row or several rows match
The robust pattern for tables: find rows by business key, never by fixed position.
The Sign-Off Table · thesignofftable.com/academy/sap-tau-201

The same idea applies to table controls, with one extra step: they only expose visible rows, so the script must scroll and keep searching until the key is found or the table ends. Many teams wrap this in a single, well-tested helper, "find row where column X equals Y", rather than repeating it in every test.

A table control shows only visible rows, so the helper scrolls page by page until it finds the key or the table ends.
The Sign-Off Table · thesignofftable.com/academy/sap-tau-201

Keep locators in one place

The ISTQB test automation syllabus recommends the page object model: keep each screen's locators in one class or module, so that when the screen changes you update one place instead of every test. For SAP GUI, a "screen object" for VA01's initial screen holds the IDs for order type, sales organization, distribution channel and division, plus methods such as "enter sales area". Tests call those methods and never contain raw IDs.

What would you do?

A script that changes the quantity of the CMC-ALT-100 item in an order works for one-item orders but changes the wrong item when the order has five items. What is the best fix?

Key points
  • ID paths are fast but fragile; searching by technical name and type survives layout changes.
  • Avoid hard-coded connection, session, tab, container and row positions where they can vary.
  • Find table and ALV rows by business key, with row counts read from the control.
  • Keep locators in screen objects so a screen change means one fix.

Check your understanding · not graded

Lesson check

  1. 1. Why can a path starting with con[0]/ses[0] fail?

  2. 2. What is the robust way to find an item row in an ALV grid?

  3. 3. What extra step does a classic table control need when searching for a row?

  4. 4. What is the main benefit of the page or screen object model?