View

Purpose With View you can display html and rtf files. In addition, the html display offers the possibility of interaction with R/3 screens (Setting field values and calling up menu functions). 

It is possible to use a template file (rtf or html) which contains GuiXT variables, e.g. field names. These variables are automatically replaced by their current value.

The View command supports the standard image formats bmp, gif and jpg just as Image does. In contrast to the Image command they are displayed in a separate scrollable screen area. 

Note that the View command is part of the component GuiXT Viewer (R/3 add-on by Synactive). It also requires Microsoft Explorer 4.0.

Example View (10.5,40.2) (20.5,80) “C:\html\menupr00.html” 

The html file C:\html\menupr00.html is displayed in the area (10.5,40.2) to (20.5,80).

Formats The following file formats are supported: 
  • rtf
  • html
  • bmp
  • gif
  • jpg
Format View (row1,column1) (row2,coloumn2) “file name”  
View (row1,column1) (row2,coloumn2) “file name” template=“template file”
View (row1,column1) (row2,coloumn2) template=“template file”

With (row1,column1) (row2,coloumn2) you specify the upper left hand and lower right hand corner; you may use decimal numbers as coordinates. The file is searched for in the current GuiXT Script directory unless you specifiy a drive letter, e.g. C:\html\file.html”.

If you specify a template file, then this file is copied into the file that you specified first, and all GUiXT variables &[....] are replaced by their current values.
If you specify only the template file (3rd View format), then GuiXT copies the template file into a temporary file, replaces the variables and displays the file.

Additional options
-floating A new window is opened for the display. It can be resized and moved about independently of the R/3 screen.
-maximize In conjunction with -floating: the window is maximized
ReturnWindow= Name of a variable that revives the internal window handle of the created view window. Please observe: This is only possible if View is used within an InputScript.
CloseWindow= Window handle from of an open view window (see ReturnWindow= option). The window is closed.

Example of an InputScript using ReturnWindow= and CloseWindow=:

Parameter CLOSE

if U[CLOSE=X]
  View  CloseWindow=”&V[viewwindow]“
  return
endif

View (6,1) (30,120) template=”form2.html” -floating   ReturnWindow=”viewwindow”
 

Data dependent views  The file name can contain variables that are replaced by their values before the file is loaded. Example: 

View (4,80) (12,120) “C:\products\img&[Materialnummer].rtf” 

If the user enters the product number 00500187, the file C:\products\img00500187.rtf is displayed. 

Interaction with the R/3 screen As usual, you can click on URLs in the html display in order to navigate to other documents in the local file system, the intranet or internet. The “Back” button can be called up via a right mouse click. 

As a particularly handy feature you can define interactions with the R/3 screen via special SAP URLs: 

  • You can put values into R/3 input fields
  • You can call up menu functions

The SAP URLs start with the string “SAP://”. You then specify the field names and field values and, if desired, a menu function. The notations is as follows: 

<A href=”SAP://field1:value1;field2:value2;field3:value3;OK:fcode”> 

Since a browser URL is not allowed to contain any blanks, you have to denote the field names without them, for example you have to write “PreviousAccountNumber:00012345″ instead of “Previous account number:00012345″

The field names are not case sensitive. 

The function code fcode can either be an internal code taken from the sceen menu, e.g. SCMP, or a transaction code as for example /NFB01 or /OMM02.  

You will find the internal menu codes as follows: Choose the desired function in the transaction menu and press F1 while the mouse cursor points to this function. Now the R/3 system displays the internal function code in a pop-up window. 

The Enter button, without any special function code, can be called up with OK at the end of the SAP URL

<A href=”SAP://field1:value1;field2:value2;field3:value3;OK”>

Starting an InputScript In conjunction with InputAssistant you can also start an InputScript. You have to add the process= attribute to the OK:fcode.

Example:

<A href=”SAP://field1:value1;field2:value2;
field3:value3;OK:fcode,process=displaymaterial.txt”>

“Using” parameters can be passed to the InputScript via the SAP-URL with the notation U[name]:value. You can also set internal GuiXT variables with V[name]:value and use this value in your InputScript or in GuiXT scripts.

Using JavaScript If your html page contains a form which has entry fields, it might make sense to use JavScript in order to pass these values to R/3. See Example 3.
Example 1 <A HREF=”SAP://OK:PR03″><IMG SRC=”advance.jpg”></A> 
Clicking on the image
advance.jpg calls up the function PR03 in R/3.
Example 2 <A HREF=”SAP://Material:00012345;Plant:0021;OK”>Screw 8x15mm</A> 
Clicking on the text
“Screw 8x15mm” completes the fields “Material” and “Plant” and then automatically activates the Enter button.
Example 3 HTML page:

<form name=”form”>
<strong>Customer</strong>
<input type=”text” size=”20″name=”Customer” value=”&amp;[::Customer]“>
<input type=”button” name=”Display” value=”Display ” onclick=”DisplayCustomer()”>
</form>

<script language=”JavaScript”><!–

function toGuiXT(string)
{window.location.replace(“SAP://” + string);}

function DisplayCustomer()
{toGuiXT(“U[Customer]:” + document.form.Customer.value + “;OK:/NVD03,process=ShowCustomerData.txt”);}

// –></script>

By clicking on the “Display” button you call up transaction VD03 with the InputScript “ShowCustomerData.txt” . You pass the cutomer number that the user entered to the InputScript with U[Customer]:…

If you use the template= option of the View command, then the last (i.e. most recently entered) value in the R/3 field “Customer” is taken as initial value in the html form.

See the detailed example in Viewer tutorial 5 Designing simplified transactions with html and Java Script.

Open documents  You can open any document with View; the document viewer is started as a separate application:

View “file name”  

This will start the same application as if the user clicked on the document in Windows Explorer.

 Examples: .doc or .pdf files. You can also start .exe or .bat files. 

Additional Options
Operation= Operation to be performed. Default operation is “Open”. The other operations depend on the document type. Often the operations  “Edit” and “Print” are defined as well. 
Parameters= For .exe and .bat files: string with parameters
Directory= Default directory
Tips
& Tricks
  • You can use the technique described in Example 1 in order to create an html form of the R/3 application menus, which is both esthetic and rapid.
  • For end user training you can create special html documents containing various test input values and explanations.
  • In combination with InputAssistant you can also display the html document by pressing a pushbutton, e.g.:

    GuiXT Script:

    Pushbutton (Toolbar) “Show documentation” Process=ActivateView.txt”

    if V[GuiXT_Show_View=X]
      
    Set V[GuiXT_Show_View]  “N”
      
    View (1,60) (20,100) “C:\GuiXT\html\docu100.html” 
    endif

    InputScript ActivateView.txt:

    Set V[GuiXT_Show_View] “X”

  • You can use the viewer component in your InputScript to display an image while your InputScript is running:

    //GuiXT Script
    View (1,1) (10,40) “pleasewait.gif” -floating returnwindow=“h_wait”
    Screen

    Enter

    // Last screen
    Screen
    View closewindow=&V[h_wait]
    Enter

Keyword View