With GuiXT controls you can modify special SAP GUI controls by using the GUI Scripting in VB.NET, e.g. the "grid control" or "tree control". You can read and set values and customize layout supported by SAP GUI scripting. Please note: SAP GUI scripting must be activated on the server and in SAP GUI. We will use the keyword CallVBAsync instead of CallVB, meaning that we call the VB.NET function asynchronously. This is necessary because the SAP GUI windows including special controls it not built up while the GuiXT script is running, as the script can alter the layout in a way different to what the SAP standard defines. We also need
the asynchronous call
CallVBAsync in our InputScript when we access the SAP controls,
because the instructions in the Inputscript run before the SAP GUI
builds up the screen. |
||
As an example we add a pushbutton "display material" to the transaction MM60 (Material List): The user can choose a material in the "grid control" and on clicking on the new pushbutton the transaction MM03 (Display Material) for the selected material is displayed:
We use the following GuiXT script: if Q[Transaction=MM60]Pushbutton (toolbar) "Display material" process="material_display.txt" endif The InputScript "material_display.txt" calls a VB.NET function: CallVBAsync utilities.material.material_list_display_singleWe read the selected material number in the VB.NET function "material_list_display_single" and start the transaction MM03 in a new mode, whereby we call a second Inputscript:
The called InputScript "MM03_display_single.txt" displays the material master records: Parameter MATNR// initial screen of MM03 Set F[RMMG1-MATNR] "&U[MATNR]" Enter /5 // select a view Set cell[Table,0,1] "X" Enter
|