If the recording of UI elements really does not work, I can strongly recommend using VBScripts within PAD. VBScripts need no interaction with recorded UI elements, or the use of keystrokes.
Let me give you a quick example using transaction FD03 - Customer Display.
In the following screenshot, I entered "FD03" in the command field, then confirming this with Enter.
SAP - Command field
In the next screen, we get a pop-up window where I enter a debtor number, as well as a company code, also confirming my input with Enter.
SAP - Customer Display: Initial Screen
If I record these steps with Script Recording and Playback, as shown in the screenshot below, I get a result / script that is shown beneath the screenshot (Scripting needs to be enabled, check my previous message showing how to do this). The scripts should be saved as .vbs files for instant use - try editing with Notepad to see the result of your recording.
SAP - Script recording
Result of my recorded script with explanation:
--- This first part pretty much connects to a running instance of SAP ---
If Not IsObject(application) Then
Set SapGuiAuto = GetObject("SAPGUI")
Set application = SapGuiAuto.GetScriptingEngine
End If
If Not IsObject(connection) Then
Set connection = application.Children(0)
End If
If Not IsObject(session) Then
Set session = connection.Children(0)
End If
If IsObject(WScript) Then
WScript.ConnectObject session, "on"
WScript.ConnectObject application, "on"
End If
--- This next part is where the magic happens ---
--- Be aware that counting starts with a 0 instead of a 1 - window 0 is indeed the first window ---
session.findById("wnd[0]").maximize <- the window is maximized / full screen
session.findById("wnd[0]/tbar[0]/okcd").text = "FD03" <- okcd is command fiels - text FD03 is entered
session.findById("wnd[0]").sendVKey 0 <- SAP Vkey 0 = Enter
session.findById("wnd[1]/usr/ctxtRF02D-KUNNR").text = "123456" <- in the pop-uped window, cust. nr. is added
session.findById("wnd[1]/usr/ctxtRF02D-BUKRS").text = "1234" <- the same goes for the company code
session.findById("wnd[1]/usr/ctxtRF02D-BUKRS").setFocus <- unnecessary, can be deleted
session.findById("wnd[1]/usr/ctxtRF02D-BUKRS").caretPosition = 4 <- also unnecessary, sets the current position in the text field
session.findById("wnd[1]/tbar[0]/btn[0]").press <- presses the continue button
These scripts can also used with variables in PAD. If you use a variable for a transaction, this can make your script look like
session.findById("wnd[0]/tbar[0]/okcd").text = "%Transaction%"instead of
session.findById("wnd[0]/tbar[0]/okcd").text = "FD03"Another great plus, as you might have seen in the script, is that no wait stages need to be added, since the script continues to run its script as soon as it is able.