Purpose In a .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 additional functions. e.g. SAP GUI scripting interface.

Prerequisites:

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

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

private guinet.guixt guixt = new guinet.guixt();
GetVariable() r = guixt.GetVariable(var)

Reads a GuiXT script variable and returns its content.

Example:

string menu_icon_path;
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
string[] menu = guixt.GetText("menu").Split(
    new string[]{"\r\n"}, StringSplitOptions.None);
SetText() guixt.SetText(var,value)

Sets the value of a GuiXT long text variable.

Example:

string[] lines;
...
guixt.SetText("menu_layout", String.Join("\r\n", 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" Toolbar 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:

using GRIDVIEWLIB;
using SAPTOOLBARLib;
...
GridView gridview = (GridView)guixt.GetControl("grid");
ISAPToolBar tb1 = (ISAPToolBar)guixt.GetControl("toolbar", 1);
ISAPToolBar tb2 = (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:

string matnr;
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 MIME Repository "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"

var url = "http://www.synactive.com/images/" +
          "s10logo_blue.gif";
imgpath = guixt.FilePath(url);
// 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:

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

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

 

using guinet;
....

public void preview(object w)
{
    // create new form
    Dialog1 f = new Dialog1();

    // embed into SAP GUI window
    guixt.EmbedForm(f, w);
}

 

 

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 .NET

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