Return variable from SAP VBCcript back to Studio


I wrote a small script within SAP and i need the result as output back in Studio. Any idea how this can be achieved …


I prefer VBA, this makes it easy to get results back from invoke VBA activity.

I just looked in the docs: VBScript can also give back values and UiPath can take them:

1 Like


Hello Hara,
here a tiny example how to deliver the number of data table entries in TADIR table.

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

session.findById("wnd[0]").resizeWorkingPane 98,24,false
session.findById("wnd[0]/tbar[0]/okcd").text = "/nse16"
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]/usr/ctxtDATABROWSE-TABLENAME").text = "TADIR"
session.findById("wnd[0]/usr/ctxtDATABROWSE-TABLENAME").caretPosition = 5
session.findById("wnd[0]").sendVKey 0
session.findById("wnd[0]").sendVKey 31

WScript.Echo session.findById("wnd[1]/usr/txtG_DBCOUNT").Text


WScript.Echo delivers the value back to your UiPath project.

Best regards