You can enhance our InputScript from Tutorial 1 in various ways, using additional user interface elements. |
As a first example, let’s offer two pushbuttons instead of one, allowing the user to display the material list for two different plants. Since we want to work with the same InputScript, we define a parameter PLANT. The first pushbutton then starts the InputScript for Plant “1000″ (London), and the second one for plant “3000″ (Stockholm). In the InputScript, the notation “&U[PLANT]” refers to the parameter value.
// GuiXT Script Pushbutton (3,16) “Stockholm” “/NSA38″ process=”matlist1.txt” size=(2,10) // InputScript “matlist1.txt” // Materials List |
Instead of defining several pushbuttons, you can also work with radiobuttons and a single pushbutton. In the following example, we start transaction VA01 (order entry) for different order types.
// GuiXT Script Pushbutton (6,16) “Create order” “/NVA01″ Process=”startva01.txt” “size=2″ // InputScript “startva01.txt” Set F[Sales organization] “1000″ Enter Here we did not use parameter passing; instead we worked with the global variable V[VA01_Ordertype]. If you prefer to start transaction VA01 in alternative mode using the command “/OVA01″ instead of “/NVA01″, this is no longer possible, since each SAP session has its own set of InputScript variables. You then have to pass the order type as parameter: // GuiXT Script Pushbutton (6,16) “Create order”
// InputScript “startva01.txt” Screen SAPMV45A.0101
Set F[Sales organization] “1000″ Enter
|
Input fields can be defined in the same way as radiobuttons. Each input field (command “Inputfield”) refers to exactly one GuiXT variable: the value of the variable is shown in the input field, and the value that a user entered in the field updates the variable value. In the following example, the user can display the availability of a material in three plants. We use an SAP BAPI for calculating the quantity.
The material number can be entered directly or via SAP matchcode.
The three quantities are displayed.
For wrong material numbers, we display an error message. // GuiXT Script InputField (1,1) “Material” (1,16) name=”AV_Material” size=18 techname=”MARA-MATNR” -uppercase Text (3,2) “London” Text (4,2) “Stockholm” Text (5,2) “Vienna” Pushbutton (7,2) “Show availability” Process=”availability.txt” size=(1,32) // InputScript “availability.txt” // Read available quantity // 3 decimals places in quantity // Message + redisplay screen |