Instead of using ActiveX controls that already exist (such as Windows standard controls or third party ActiveX components) you can build up your own ActiveX components with  VC++  or VB6 and embed them into SAP GUI as explained in the preceding tutorials. It is then necessary to install the new ActiveX component on each frontend PC e.g. via a Windows logon procedure)

With VB.NET there is an alternative that does not require an explicit installation. Instead, you can use the following approach:

In this way you can use a state of the art development environment (MS Visual Studio)  to implement highly efficient, specialized user interface components for certain tasks, and embed them seamlessly into the SAP GUI context with GuiXT Controls.

To explain the details we implement the following example.

In transaction VF03 (Display Billing Document) we add a control, implemented in VB.NET, that displays an rtf document and allows for editing, zooming, and printing:

We have added a "zoom factor" slider as an example for a locally defined user interaction:

 

Step 1: Implement the VB.NET control

In MS Visual Studio, we create a class library "s10edit.dll".   

 The user interface consists of an rtf control, a slider for the zoom factor and a checkbox "word wrap".

 

The Visual Studio properties dialog for the rtf control.

 

All methods that you want to call up via GuiXT Controls need to be defined as "Public".

 

 

Step 2: Copy your VB.NET dll into a folder of your web server (Microsoft IIS)

 

 

Step 3: Add an HTML page on your web server (any folder) that embeds your VB.NET object

Use the notation  "dllpath#Namespace.Classname" for the object's classid.

Example "embed_rtf.html":

<html>
<head></head>

<body>
 <object id="rtfdisplay" classid="activex/s10edit.dll#s10edit.rtfedit"
     width="100%" height="100%" border="0"> </object>
</body>
</html>

 

Step 4: Add your web server to the Trusted Sites list in the Internet Explorer security settings

Test: Call up the HTML page in Internet Explorer. The VB.NET control should be displayed.

 

Step 5:   Display this HTML page in your GuiXT Script using the "Control" statement

Example:

Control (1,1) (25,145) name="ie" progid="http://www.synactives10.com/s10forum/embed_rtf.html"

Test:  The VB.NET control should be displayed in SAP GUI.

.

Step 6: Define the interaction with GuiXT via VBScript or JavaScript routines

We present both versions. The GuiXT scripts and the InputScripts are identical:

GuiXT script:

del G[More Search Criteria]

Offset (6,0)
Box
(0,0) (28,146) "Invoice"
Control (1,1) (25,145) name="ie" progid="http://www.synactives10.com/s10forum/embed_rtf.html" initflag="rtfnew"

Pushbutton (26,2) "Start Word" process="rtf_word.txt" size=(2,12)
Pushbutton (26,20) "Print" process="rtf_print.txt" size=(2,12)

if V[rtfnew]

  // set some test data, read SAP data in final version
 
Set V[invoice_number] "90035629"
 
Set V[invoice_fax] "(02) 6273 4980 "
 
Set V[invoice_name] "National Library"
 
Set V[invoice_city] "Canberra"

  CopyText fromTemplate="sample.invoice.rtf" toText="ot"

  CallVbs set_rtf_content &V[ie]

endif

 

InputScript "rtf_word.txt":

// Text from rtf control to GuiXT long text "ot"
CallVbs rtf_read
"&V[rtf]"

// save to temp file and start external editor (Word)
CopyText
fromText="ot" toFile="&%[TEMP]\test.rtf"

Start "&%[TEMP]\test.rtf"

Return

 

InputScript "rtf_print.txt":

CallVbs rtf_print "&V[rtf]"

Return

 

VBScript version:

Function set_rtf_content(ie)
    
    ' wait until document is loaded
    Const READYSTATE_COMPLETE = 4
    
    Do
        guixt.DoEvents()
    LoopWhile ie.ReadyState <> READYSTATE_COMPLETE
    
    Dim r
    Set r = ie.document.getElementById("rtfdisplay")
    
    Call guixt.Set("rtf", r)
    
    Call r.set_content(guixt.getText("ot"))
EndFunction


Function rtf_print(rtf)
    Call rtf.print()
EndFunction


Function rtf_read(rtf)
    Call guixt.setText("ot", rtf.get_content()) 
EndFunction

 

 

JavaScript version:

function set_rtf_content(ie)
{    
  // wait until document is loaded
  var  READYSTATE_COMPLETE = 4;
    
    do
    {
      guixt.DoEvents();
    } while (ie.ReadyState != READYSTATE_COMPLETE);
    
    
    var r = ie.document.getElementById("rtfdisplay");
    
    // save object handle into GuiXT variable
    guixt.Set("rtf", r);
    
    // Set content
    r.set_content(guixt.getText("ot"));
    
}



function rtf_print(rtf)
{
 rtf.print();
}



function rtf_read(rtf)
{
  // Get content
  guixt.setText("ot", rtf.get_content());
}

function rtf_color(rtf)
{    
 rtf.choose_bgcolor();  
}