Purpose In a VB.NET function that has been invoked with  CallVB or  CallVBAsync you can access GuiXT script variables via the class  "guinet.guixt". This class also provides several additonal functions. e.g. SAP GUI scripting interface.

Prerequisites:

  • component "GuiXT Controls" is active
  • A reference to guinet.dll has been included in your VB.NET project

In order to use the class "guinet.guixt" it suffices to create an object of this class:

Private guixt As New guinet.guixt

GetVariable() r = guixt.GetVariable(var)

Reads a GuiXT script variable and returns its content.

Example:

Dim menu_icon_path As String
menu_icon_path = guixt.GetVariable("menu_icon_path") 
 

SetVariable() guixt.SetVariable(var,value)

Sets the value of a GuiXT script variable.

Example:

guixt.SetVariable("menu_icon_path", "C:\guixt\menu\icons") 
 

GetText() r = guixt.GetText(var)

Reads a GuiXT long text variable and returns its content.

Example:

' read menu
Dim menu
As String
menu = Split(guixt.GetText("menu"), vbCrLf)

SetText() guixt.SetText(var,value)

Sets the value of a GuiXT long text variable.

Example:

Dim lines() As String

...

guixt.settext("menu_layout", String.Join(vbCrLf, lines)) 
 

GetControl() obj = guixt.GetControl(id, [n=1])

Native interface to a special control currently displayed in the SAP GUI window. As "id" you may use the following strings:

"grid"    GridView Control
"tree"    TreeView Control
"textedit" TextEdit Control
"htmlviewer" HTML Viewer Control
"toolbar" "Tollbar Control
"splitter" Splitter Control
"picture" Picture Control
"*" any type

If several controls of the same type exist in the SAP GUI window you can use the second parameter n=1,2,3,... to identify further controls of this type.

Example:

Imports GRIDVIEWLIB
Imports SAPTOOLBARLib

...

Dim gridview As GridView = guixt.GetControl("grid")

Dim tb1 As ISAPToolBar = guixt.GetControl("toolbar", 1)
Dim tb2 As ISAPToolBar = guixt.GetControl("toolbar", 2)

Please note that the native control interface should be used for special cases only. Normally SAP GUI Scirpting is the best way of dealing with the SAP GUI controls. For further details see "Tips, Tricks and Samples" -> "Native Control Interface"
 

 

Value() r = guixt.Value(var)

Replaces all GuiXT &-variables with their values and returns the resulting string.

Example:

Dim matnr  As String
matnr = guixt.Value("&F[Material]") 

 

Input() guixt.Input(s)

The given string is interpreted by GuiXT as an input string; see the input= option of the Image command for details.

Example:

guixt.input("U[VBELN]:" & ListView.selectedItem)
guixt.input("OK:/nVA03,process=va03_enter.txt")

 

Process() guixt.Process(funcname, par1, par2, ...))

Corresponds to the GuiXT instruction Process.

From the first parameter funcname the script name "process_[funcname].txt" is formed. This script is executed, whereby the parameters of the script are occupied by the values of par1, par2,... . The string set at "Return" in the script is returned.

FilePath() guixt.FilePath(s, [cache=True])

The given string is interpreted as a relative path in the current GuiXT script folder.

  • The absolute path, including the script folder path, is returned
  • A given absolute path e.g. C:\guixt\scripts\..." is not changed.
  • If a path points to SAP Web Repository "SAPWR:..." , SAP Mime Reppository" SAPMR:...", an http server "http://..."  or ftp server "ftp://..." , a local file copy is created in GuiXT cache and the cache path of the replicated file is returned

WIth the default option cache=True external files are first looked up in cache.

Examples:

imgpath = guixt.FilePath("images\home.gif")
imgpath is set to e.g. C:\guixt\scripts1\images\home.gif"

imgpath = guixt.FilePath("http://www.synactive.com/images/s10logo_blue.gif")
imgpath is set to e.g. "C:\Users\ADMINI~1\AppData\Local\Temp\guixt\GuiXT Cache\http\www.synactive.com\images\s10logo_blue.gif"

EmbedForm() guixt.EmbedForm(ByVal f As Form, ByVal c As Object) As Boolean

Embeds an interactive Windows form into the SAP GUI window. Use the ActiveX object "Shell.Explorer" as a place holder in the SAP GUI screen.

Example:

Control (10,20) (18,80) progID="Shell.Explorer" name="d1" initFlag="d1init"

if V[d1init]
  CallVB utilities.customer.preview "&V[d1]"
endif

VB.NET:

 

Imports guinet
....

Public Sub preview(ByVal w As Object)

  ' create new form
 
Dim f As New Dialog1()

  ' embed into SAP GUI window
 
guixt.EmbedForm(f, w)

End Sub

 

 

GuiSession() guixt.GuiSession()

Returns an object of class guinet.sapguisession that you can use to execute SAP GUI scripting functions. For details see GUI Scripting in VB

Example:

guixt.GuiSession.Enter("/NFB01")

 

GuiWindow() guixt.GuiWIndow()

Returns an object of class System.Windows.Forms.NativeWindow, allowing the unique identification of the SAP mode.
 

Components GuiXT + Controls