Purpose You want to embed your own Windows Forms applications in the SAP screen and react to keystrokes there, especially those that are normally handled by the SAP GUI. In this example we show how you can allow the user to switch between individual inputfields using the Tab key, just like on the SAP screen.
|
Solution
First, create a Windows Forms application in the usual way. Please specify the .NET framework version 4.x as target framework here. Then define the tab index in the application, i.e. the order in which the elements can be selected with the tab key. You can test this straight away, but the Tab key does not work in the usual way if you embed the application in the SAP GUI, because the SAP GUI intercepts these commands and does not forward them directly to the control. However, we can insert event handlers for all elements used and then check whether the Tab key has been pressed. If this is the case, we call the SelectNextControl() function, which sets the focus to the next element. This function also has a direction parameter that you can set to backwards or false if the user has pressed Shift + Tab. VB.NET
Unfortunately, Windows plays a system sound at this point. We can suppress this by suppressing further event handling with the following code:
|
Script for creating an order:
In this example, we want to create an order directly from the embedded control. Therefore, when you click on the corresponding button, several GuiXT variables are filled and an InputScript is started: VB.NET
|
GuiXT Script: GuiXT
|
InputScript "create_simple_order.txt":
GuiXT
|
Download: Download the .NET project with source-code: simple_form_dotnet.zip |
Components InputAssistant + Controls |