We start with a simple
example: a VB.NET function which returns the text "Hello VB!" is called.
Proceed as follows:
In Visual Studio you
create a new VB.NET project as "class library"
You implement the
following function, e.g. in a class "testclass.vb":
1
2
3
4
5
6
7
Public Function hellovb() As String
Dim returnstring As String = "Hello VB!"
Return returnstring
End Function
Copy the dll (and any
further dll's that you may need) into a suitable directory and specify the path
in GuiXT profile:
Please note: the interface class library "guinet.dll", which is contained in
the GuiXT setup, also needs to be copied to this folder
Remark concerning testing: When you call up your VB function, your dll is
loaded into SAP GUI and cannot be overwritten with a new version while SAP GUI
(process saplogon.exe) is running. To work with an updated version of your dll
you need to close all SAP GUI windows and the SAP Logon window, or terminate
saplogon.exe in Windows Task manager, and then copy the dll.
In a GuiXT Script or
InputScript you call up your VB.NET function via the command "CallVB":
CallVB
msg = utilities.testclass.hellovb
message
"&V[msg]" -statuslineThe VB.NET function
"hellovb" of class "testclass" in the class libray "utilities.dll" is executed
and the result is set into GuiXT variable V[msg].
If you don't want to receive a return value you can call up the function with
CallVB
hellovb
The SAP GUI status line now displays the string returned by your
VB.NET function: