Using templates

You can create standard files in which variables are defined. Once created, these files can be called by the view command and the variables will then be replaced by the data you have entered in the corresponding SAP GUI screen Both HTML and RTF files are supported. The specific syntaxes are shown below:

HTML

The syntax for HTML files is as follows:

 view([1,1], [100,100], 'test.html', {"template":"temp.html"}); 
RTF

The syntax for RTF is shown below:

 view([1,1], [100,100], 'test.rtf', {"template":"temp.html"}); 

Templates can be used in the view command in order to enable objects to be dynamically changed based on the variables entered by a user. See the following example where the template file contains a list of variables which will be populated by the corresponding SAP values. To demonstrate this, please do the following:

  1. Go to the VA01 initial screen.
  2. Create a template file and save it in both RTF and HTML formats.

    The file should contain the following data:

    • Order Type: &[Order Type]
    • Sales Organization: &[VBAK-VKORG]
    • Distribution Channel: &[Distribution Channel
    • Division: &#[7,22]
  3. Open the 'SAPMV45A.E0101.sjs' script file, and enter the following code. Create the file if it does not already exist.
     view([1,1], [100,100], 'test.html', {"template":"temp.html"}); 
  4. Save the changes and refresh the SAP screen. It will now display as shown below: