Ask a Question

SAP environment

New Contributor

SAP environment

Hey there,

im trying to use testcomplete in the SAP environment but it is not working for me.

Some fields couldn’t be detected via OCR or normal testing.

I tried the image-based testing but that’s not perfect for me because the “pictures” could change and then I have to start the recording from beginning.

So I tried to use the SAP scripting.

But there I got two new Problems.

  1. I’m scripting in javascript and SAP scripting is in vbscript.

I have to use javascript because some expressions only work in javascript.

  1. How can I run the SAP scripting from Testcomplete?

I don’t get this simple script working…



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







session.findById("wnd[0]/usr/tabsTABSTRIP_600/tabpBUT1/ssubAREA_FOR_601:SAPMKAUF:0601/subAREA1:SAPMKAUF:0315/ctxtCOAS-KOSTV").caretPosition = 4




Thanks for your help!

Community Hero


Have you tried to enable '*' option for MSAA in your project? Does it provide better recognition of the problematic controls?


I have to use javascript because some expressions only work in javascript.

Can you provide an example? All scripting languages are more or less the same and provide similar functionality.


  /Alex [Community Hero]
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
SmartBear Alumni (Retired)

Thanks Alex!


@RKU_AVO have you tried what Alex is suggesting?

Sonya Mihaljova
Community and Education Specialist

Showing results for 
Search instead for 
Did you mean: