Purpose With Include you can include a further script file.
Examples

Further examples
Include "radiobuttons_company.txt"

The file  "radiobuttons_company.txt" is searched in the current script directory. It is then interpreted in the same manner as if its content were part of the original script.

Format Include "includename"

The file  "includename" is searched. If it is not found, a syntax error message is displayed in the GuiXT script window, and the main script is continued. If it is found, first the lines of the include file are interpreted, and then the original script is continued.

You can also specify the full path, e.g.

Include "\\server12\guixt\inlcudes\r105.txt"

Files in the SAP MIME Repository or on  http/ftp servers can also be used, e.g.

Include "SAPMR:SAP/BC/BSP/SAP/GUIXT/ZGUIXT.r105.txt"

Include "http://www.synactive.com/includes/r105.txt"

A nested Include is possible up to level 10. Please note that a search is always made in the active script directory, not relatively in the directory where the parent include file is located.

Searching for include files An include file can be specified with an absolute path; in this case, it is searched only at the specified location. If no absolute path is used, GuiXT searches for the file in the same directory where the main script is located.

If the  CheckAllDirectories option is enabled in the GuiXT profile, the search is performed in all active script directories, following the same order as for the main script: from Directory4 to Directory1.

The same search order applies to nested include statements. This means that an include referenced within another include script is also searched for in the directory of the main script, not in the directory of the parent include script. When  CheckAllDirectoriesis active, the search again follows the order Directory4 … Directory1.

Using variables in include file names When you use variables in include statements, such as in:

   Include "inc.&V[company].txt"

it is important to consider the context of the script:

  • In GuiXT scripts (i.e., outside of InputScripts or functions called by process), the variable value is evaluated at runtime - the exact moment the include statement is processed.
  • In InputScripts and process functions, on the other hand, the include files are read in when the script is loaded. This means that the variable value is not used dynamically, but statically at the time of loading.

 Recommendation: Only use variables in include file names in GuiXT scripts. In InputScripts or process functions, this can lead to unexpected behavior – in such cases, GuiXT issues a warning in the trace. 

Conditional inclusion The conditional inclusion of include files also works reliably in GuiXT scripts. A typical example:

  if Q[Transaction=IW33]
       Include "IW33mainscript.txt"
   
endif
  • In GuiXT scripts, the condition is checked at runtime, and the include file is only loaded if the condition is met.
  • In InputScripts and process functions, the if condition is also evaluated at runtime, but the associated include file is read in independently when the script is loaded.

Recommendation: Use conditional includes preferably in GuiXT scripts to avoid unwanted preloading in InputScripts and process functions.

Tips & Tricks
Components GuiXT