Transaction SHD0 in the SAP system allows you to create variants of screens and transactions; see e.g. "Transaction Variant - A Step by Step Guide for Creation" for a short desciption. A screen variant can contain a GuiXT script that is automatically downloaded by GuiXT. To define a screen variant with a GuiXT script, proceed as follows.

We define a transaction variant "ZZV1" for transaction "MIRA":

 

On the screen where you set the variant attributes, click the "GuiXT" button:

 

An editor window will come up where you can enter GuiXT commands. Tip: for longer scripts, develop and test them in a local GuiXT script directory, using the GuiXT Script Editor, and then copy the script here into the screen variant. 

 

Save the transaction variant, either as a local object for testing purposes or in a package that you can transport to a productive system. The GuiXT scripts will be transported with the screen variants.

 

 

You may activate your variant as "standard variant" for transaction MIRA so that it is applied automatically when the user calls up MIRA. Alternatively - we will show this later on - you may define a new transaction code, e.g. ZZMIRA, so that you have both the standard transaction MIRA and your customized transaction ZZMIRA.

 

 When you invoke MIRA, you now see the text "Document type" that you have set in the GuiXT script:


In order to use this approach, you need a valid RFC user and password, with the necessary authorizations, in the GuiXT profile. If no valid RFC user is specified you will see an error message:

 

The RFC user needs the authorization

S_RFC: RFC_TYPE=FUGR, RFC_NAME=SHD0, ACTVT=16

for downloading the script. This is done in client 000 unless you specify "Script download via current client" in GuiXT profile.

During development the GuiXT script window should be kept "visible" (GuiXT profile) so that you can control what is going on. You see the screen variant with an automatically added comment line:

The comment line contains a time stamp that allows GuiXT to use the cached script as long as the central script in the transaction variant has not changed.

Attention: If your local script folder contains a GuiXT script, this local script will be used instead of the transaction variant script. Example:

We use the local script folder "C:\GuiXT\Scripts" and the following script:

 The screen then looks as follows:

Even if the local script is empty, but the script file exists, it overrides the screen variant script, i.e. you do not see any screen modification.

If necessary (but probably only in some rare cases), you can combine local scripts with the definition of screen variants by using  if Q[ScreenVariant=...

 

 

Instead of defining a "standard" variant for transaction MIRA, you may create a new transaction code for your variant, e.g. ZZMIRA:

 

 

De-activate the standard variant for MIRA and use ZZMIRA instead:

 

In the SAP system the "Status" screen (System->Status) will show the active variant:


To change a screen variant script use SHD0, "Change screen variant", and press the "GuiXT Script" button:

 

This brings up the editor and you may change to script or copy a new version from GuiXT Script editor:

 

Result in transaction ZZMIRA: