With GuiXT you can offer the user all the fields and functions relevant to a particular process on a single screen, thus enabling him to work efficiently: he does not need any further navigation steps and does not have to find his way around complex screens.
As an example, we
implement the simplified creation of a malfunction report in Plant
Maintenance (transaction IW21): |
GuiXT screen for fast entry of a malfunction report for equipment |
Procedure
Part 1
We offer the fast entry mode as a pushbutton in the initial screen of
transaction IW21:
From fast entry, the user can switch back to the SAP standard:
GuiXT Script:
GuiXTif Q[Transaction=IW21]
if V[iw21_simple]
// Button to switch to standard
Pushbutton (toolbar) "To SAP standard notification" _
process="iw21_simple_off.txt"
// Remove standard button
del P[Notification]
// Remove existing input fields
del (0,0) (10,100)
// here then the fast entry
Title "Simple malfunction report"
else
Pushbutton (toolbar) "Simple malfunction report" _
process="iw21_simple_on.txt"
endif
endif
with
GuiXT
// iw21_simple_on.txt
Set V[iw21_simple] "X"
Return
// iw21_simple_off.txt
Set V[iw21_simple] ""
Return
Part 2 (UI of fast entry)
We implement
the required input fields with GuiXT:
// Group boxes around everything
Box (1,3) (18,100)
// Equipment
InputField (2,6) "Equipment" (2,32) size=18 _
name="iw21_equnr" -required searchHelp="EQUIR"
// Equipment text
Text (2,54) "&V[iw21_eqktx]"
// short text
InputField (4,6) "Fault description" (4,32) size=40 _
name="iw21_qmtxt" -required
// Longtext
TextBox (5,5.6) (10.5,75.6) name="iw21_longtext"
// Start of fault
// Set default, current date and time
if not V[iw21_ausvn]
Set V[iw21_ausvn] "&V[today_user]"
Set V[iw21_auztv] "&V[today_h:00]"
endif
InputField (12,6) "Fault start date" (12,24) -date _
name="iw21_ausvn"
// Fault start time
// build up time dropdown 00:00;00:15; ...
if not text[iw21_time_dropdown]
include "build_iw21_time_dropdown.txt"
endif
Text (12,36) "Time" -label size=10
DropDownList (12,46) "iw21_time_dropdown" width=10 refer="V[iw21_auztv]"
// Priority
// Default priority 2=High
if not V[iw21_priok]
Set V[iw21_priok] "2"
endif
Set text[iw21_priority_dropdown] "1=Very high;2=High;3=Medium;4=Low"
Text (14,6) "Priority" -label size=18
DropDownList (14,24) "iw21_priority_dropdown" width=20 refer="V[iw21_priok]" -noSort
Comments:
The length
specification size=18
of the equipment number can be obtained via F1 -> Technical
information -> Data element
In the same
way choose F1 -> Technical information to display the name of the search
help:
"EQUI" is a collective search help (transaction SE11). For fast entry,
instead of the collective search help, we have only selected the most
suitable "EQUIR" and specified
searchHelp="EQUIR":
DropDownList is used to enter the priority and times
The long text entry is done via TextBox
Part 3 (Function "Check")
When the user presses "Enter" or the "Check" pushbutton, the system first performs a number of plausibility checks, for example, whether a short text has been entered. Further checks are carried out by running through the IW21 transaction with the entered values on a trial basis; instead of saving the entries, the system returns to the fast entry screen. Since the same procedure is needed for "Save", we use the same InputScript for "Check" and "Save" and select the mode "Check" or "Save" by means of a parameter (InputScript for this in part 4):
GuiXT
On Enter process="iw21_simple_save.txt
using MODE = "C"
Pushbutton (16,6) "Check" size=(2,18) process="iw21_simple_save.txt"
using MODE = "C"
Pushbutton (16,31) "Save" size=(2,18) process="iw21_simple_save.txt"
using MODE = "S"
Part 4 ("Save" function)
With "Save" we start the same InputScript as with "Check". In the IW21 scripting we then press F11 at the end. The input data is reset and we return to the fast entry screen.
GuiXT
// -----------------------------------------------------
// IW21 Fast malfunction entry (check/save)
// File "iw21_simple_save.txt"
// -----------------------------------------------------
Parameter MODE // C=Check S=Save
// Plausibility checks
// Equipment specified?
if not V[iw21_equnr]
SetCursor V[iw21_equnr]
Return "E: Please enter the equipment number" -statusline
endif
// Short text specified?
if not V[iw21_qmtxt]
SetCursor V[iw21_qmtxt]
Return "E: Please enter a short text" -statusline
endif
// Date specified?
if not V[iw21_ausvn]
SetCursor V[iw21_ausvn]
Return "E: Please emter the date" -statusline
endif
// Date format correct?
CheckDate "&V[iw21_ausvn]"
if not Q[ok]
SetCursor V[iw21_ausvn]
Return "E: Please check the date -statusline"
endif
// -------------------------
// Create notification via IW21
// -------------------------
Set F[Notification type] "M2"
Enter
Screen SAPLIQS0.7200
Set F[Equipment] "&V[iw21_equnr]"
Set F[Description] "&V[iw21_qmtxt]"
Set F[Malfunct.start] "&V[iw21_ausvn]"
Set F[VIQMEL-AUZTV] "&V[iw21_auztv]"
CopyText fromText="iw21_longtext" toScreen=X[TEXT]
Enter onError=continue
// Error occurred
Message "&V[_lasterror]" -statusline
Enter "/niw21"
// End InputScript
Leave
Screen SAPLIQS0.7200
// Set equipment text
Set V[iw21_eqktx] "&F[RIWO1-EQTXT]"
// Check only? then retuen now
if U[MODE=C]
Message "S: Input data checked" -statusline
Enter "/niw21"
// End InputScript
Leave
endif
Enter "=10\TAB02" // Termine+Priorität
// Set priority
Screen SAPLIQS0.7200
Set F[Priorität] "&V[iw21_priok]"
Enter
// Change priority -> popup "Specify new dates?"
Screen SAPLSPO1.0500
Enter "=OPT1" // Yes
Screen SAPLIQS0.7200
// Save
Enter /11 onError=continue
// Error occured
Message "&V[_lasterror]" -statusline
Enter "/niw21"
// End InputScript
Leave
// now we are back on IW21 start
Screen SAPLIQS0.0100
// Sucess message
Message "S: &V[_message]" -statusline
// Reset input data
Clear V[iw21_*]
Clear text[iw21_longtext]
// Stay on malfunction entry screen
Set V[iw21_simple] "X"
// Recall transaction
Enter "/niw21"
For the sake of completeness here is the include script to build the time selection:
// Build long text with times (per quarter of an hour) for dropdown
Clear text[iw21_time_dropdown]
Set V[k] 0
label next_hour
Set V[hh] &V[k] + 100
Set V[hh] "&V[hh](2-3)"
Set V[time] "&V[hh]:00"
copytext fromString="time" toText="iw21_time_dropdown" -appendLine
Set V[time] "&V[hh]:15"
copytext fromString="time" toText="iw21_time_dropdown" -appendLine
Set V[time] "&V[hh]:30"
copytext fromString="time" toText="iw21_time_dropdown" -appendLine
Set V[time] "&V[hh]:45"
copytext fromString="time" toText="iw21_time_dropdown" -appendLine
Set V[k] &V[k] + 1
if V[k<24]
goto next_hour
endif