This is a collection of tips and tricks, both for GuiXT scripts and for InputScripts, including sample codes that you can cut&paste into your own script. We welcome your own suggestions, in the form of solutions that you have come up with, or questions relating to particular problems. Simply send an email to tips@synactive.com.
If you have an unanswered question, our Q&A section (where you may well find the answer) is worth a visit as well. See also our Style Tips
We will test each tip before we publish it here. But please understand that we cannot guarantee that it will work in all SAP releases and for each and every transaction. If you point out a problem, we will describe it here under "Restrictions" , or perhaps we can find a better solution. Please understand that we have to exclude any warranty or liability pertaining to "Tips & Tricks".
|
40 Reading grid rows (without using SAP GUI scripting)
Many SAP grid controls offer the possibility to store the whole
content to a local file or to the Windows clipboard. We can use
this function in an InputScript in order to read the grid
content. The trick here is ...
more
|
|
39 Using "Enter" in a GuiXT script
The "Enter" command can be used in a GuiXT script. Please
note that it does not terminate the script processing, contrary to
what one might assume. In most cases it makes sense to put a "Stop script"
command ...
more
|
|
38 Using an XML web service: city from postal code
In an SAP transaction where the user is required to enter an
address (e.g. in transaction XD01), we add a button that when
clicked determines the city from the postal code via a Web
service. We use the Google Map Web Service; the technique we
describe can be used for any HTTP based XML web service. ...
more
|
|
37 Dependent dropdown lists
The content of a dropdown list sometimes depends on the value the
user has selected in another dropdown list. For example, the
user selects a country in one dropdown list and then a region in
another one. ...
more
|
|
36 Adding a browser back button to an HTML view
When you display an HTML page within the SAP GUI window using the View
command, the browser toolbar with the "Back" button is not available. It
is still possible to execute a "back" navigation step via the
right mouse menu. An alternative ...
more
|
|
35 Opening an email window with a multi-line text in an InputScript
In an InputScript you can start the user's default email program
and specify the address, title and text (and other attributes)
of a new email. ...
more
|
|
34 Debugging SAP GUI Scripting
If you use the ApplyGUIScript command to start a VB Script (SAP GUI
scripting interface), you may wish to use a debugger to step
through a complex VB script. Solution: You need a VB Script
debugger installed on your PC, for example ...
more
|
|
33 Installing a new GuiXT version "on the fly"
You can install a new GuiXT version (i.e. guixt.exe and guix.dll)
in the logon script (or another GuiXT script or InputScript)
from a central location, e.g. from the SAP Web repository. The
only disadvantage is that the user needs to ...
more
|
|
32 Displaying a progress indicator with GuiXT Viewer
If a GuiXT script or InputScript executes "Call" statements that
can take longer than 1 or 2 seconds, it is desirable to give the
user some kind of feedback during this waiting time, indicating
that the system is still working. ...
more
|
|
31 Creating a new column with larger maximum input size than visible
width
When you create a new table column with the Column command, the
size= parameter describes both the visible column width and the
maximum input size of your new column. Additional ColumnWidth or
ColumnSize commands for this column will also ...
more
|
|
30 Debugging a GuiXT script like an InputScript
For InputScripts you can use a number of debugging functions (line
by line processing, breakpoints, variable display); simply click
the "Debug" button before you execute the InputScript. ...
more
|
|
29 Displaying a pdf document as help file
With the "Viewer" component you can easily display your own help in
html format, either using the "help views" catalog in GuiXT
profile, or with the viewhelp option of the image command, e.g. ...
more
|
|
28 Displaying company-specific help in SAP GUI for HTML
In SAP GUI for Windows, the "GuiXT Viewer" component offers a
convenient way to display company-specific documentation for
individual transactions (see :"Help Views" directory in GuiXT
profile) without the need to write a script for each ...
more
|
|
27 Checking the format of a "time" value
Your InputField is defined as follows: InputField (10,10) "Time"
(10,18) size=8 name="mytime". When the user clicks a "Save" or
"Check" button, you first want ...
more
|
|
26 Display a numeric keypad
For a certain user group, you want to display a numeric keypad on
the SAP screen so that the material number can be entered
directly on a touchmonitor. ...
more
|
|
25 Using image maps
Image maps, which are popular in websites, enable users to perform
an action by clicking on a portion of the graphic ("hotspot").
With GuiXT Viewer, you can embed an image map into an SAP screen
and define separate actions for each link. ...
more
|
|
24 Choosing an icon
Pushbuttons and texts can start with an SAP icon. Each icon has a
certain 2-character id, e.g. "8G". The notation "@8G@Push"
displays the icon "8G" followed by the text "Push". Or, with an
additional quickinfo "This button...", you can ...
more
|
|
23 Changing the screen title during InputScript processing
If the processing time of an InputScript exceeds around 3-5
seconds, users tend to get impatient. It is a good idea to
indicate clearly that the system is currently carrying out a
reasonable task and that therefore no further user action is ...
more
|
|
22 Opening a mail message window
You want to display an icon in an SAP screen that allows the user
to open a mail message window with a predefined mail address.
Example: ...
more
|
|
21 Displaying dynamic internet information
When you display www pages within SAP screens (Viewer component),
you can also insert variables into the URL: either SAP field
values or your own entry fields or InputScript variables. For
example, you can display the current shipment status, ...
more
|
|
20 Reading user parameters
In the SAP system you can set user specific values for various
field types ("Parameters" in transaction SU01). In some cases it
makes sense to use these values in a GuiXT script or InputScript ...
more
|
|
19 Handling GuiXT activation in ABAP
In the SAP GUI options, the menu item "Activate GuiXT" allows the
user to activate and to deactivate GuiXT. The option can be
checked and manipulated on the application server as well, using
a desktop interface in ABAP. ...
more
|
|
18 Finding a searchhelp name
When you define your own InputField, you can refer to SAP standard
matchcode with the techname="..." parameter.
How do you get the technical field name, e.g. "MARA-IDNRA"? ... more |
|
17 Structured parameters in function calls
hen you call function modules (e.g. BAPIs) in an InputScript, you
often need to handle structured parameters, both in imported and
exported parameters. GuiXT does not support data dictionary
based symbolic fields; instead you have to use ...
more
|
|
16 Displaying a drop down menu for your own input field
For your own input fields, the "drop down menu" style is not
available. Using "local value help" you can define a value list
together with a text for each value ...
more
|
|
15 Processing multiple transactions in one script
You want to create a simple user interface for a certain task that,
in SAP standard, requires 2 or more different transactions. For
example, you implement a "Create customer" form that fits on one
screen, ...
more
|
|
14 Determine the week for a given date
or a given date you want to determine the week 1...53 and the year
corresponding to this week. The date is specified in one of the
external date formats (like dd.mm.yyyy or mm/dd/yyyy). ...
more
|
|
13 Checking a special material number layout
You created an InputField for the material number: InputField
(12,1) "Material" (12,20) size=9 name="matnr" -numerical
-required
In your InputScript, you want to check that the entered value is of format ... more |
|
12 Marking a specific table line
You want to mark a line in a table control whose position id is
known. A problem is that the position id is aligned right in the
"position" column. ...
more
|
|
11 Dynamic image position and size
Depending on the data displayed on screen, you want to use images
in order to highlight some aspects. For example, if the "Old
material number" contains a hyphen "-", you want to emphasize
the two parts. ...
more
|
|
10 Mark a column in a table
On a screen with one or more tables you want to mark a column.
Solution The command mark is not available for table columns.
Use the command ColumnHeader where you can ...
more
|
|
9 Scrolling through a table
On a screen with one or more tables you want to read all lines of
one of the tables, not just its visible part. Solution Use the
commands ...
more
|
|
8 Dynamic values in input sets
You want to offer input sets in the toolbar that enter values
automatically. Some of the values can only be determined
dynamically. ...
more
|
|
7 Improve performance and decrease net traffic
The guixt.ini file contains a command "replication Yes" and its
application makes a copy of each script in the directory ...
more
|
|
6 Date comparison: before and after
You want to compare the current date with a certain fixed date ...
more
|
|
5 Foreground display of a transaction started in alternative mode
You have created a new pushbutton that starts a transaction in
alternative mode, using the "/O..." notation. This opens a new
window, but the window is shown in the background, i.e. behind
the window with the pushbutton. It would be better to ...
more
|
|
4 Displaying additional information
You need to display in an SAP screen additional information that is
not contained in the standard SAP transaction. It would not be a
problem for you to read this information directly from the
database ...
more
|
|
3 Entering screen element names in GuiXT scripts
You want to perform this operation quickly and easily. ...
more
|
|
2 Display product images on request
You want to display product images for all products that a user
marked during order entry. The user marks several table lines
and then presses a pushbutton "Product image". ...
more
|
|
1 Reading a marked table line
You want to add a new function in a screen containing a table
control. The user marks a table line and then presses a
pushbutton that invokes an InputScript. The problem is how ...
more
|