Logon

When running load tests it is recommended that you use a different SAP user for each virtual user. This can be managed by creating users with user names that have sequence numbers appended to them, for example SAPUSER1-SAPUSER99.

In scripts, it is then possible to customize the username parameter of SapGuiLogon in the following way:
SapGuiLogon("SAPUSER" + string(GetUserId()), "PASSWORD", "000", "");

By default SapGuiLogon enters passed parameters to corresponding text fields on the logon screen and then presses the Enter key.

When you attempt to login a user who is already logged in, SAP opens a dialog that tells you that the user is already logged in. Three options are then offered for proceeding:
  • Continue and cancel other logged in users
  • Continue and do not cancel other logged in users
  • Do not log in the new user
By default SapGuiLogon chooses the second option: logging into the system without canceling other sessions of the same user. Changing the option SAPGUI_OPT_LOGON_BEHAVIOR with SapGuiSetOption allows you to customize this behavior:
SapGuiSetOption(SAPGUI_OPT_LOGON_BEHAVIOR, nValue)
Where nValue can be one of 4 values:
0 Do not Handle Multi-Logon automatically

This means that the dialog will not handled automatically; it will be treated as a normal new window. You can then handle the window manually.

1 No multiple Logon

This means that the option Do not logon is selected.

2 Multiple Logon (default)

This means that the option Continue and do not cancel other logged on users is selected.

3 Logon-Kill other sessions

This means that the option Continue and cancel other logged on users is selected.