sapgui_set_password
| General Object Functions |
Enters a password.
int sapgui_set_password( const char *description, const char *password, const char *controlID, [args,] LAST );
| description | User entered text to aid in understanding script |
| password | User enters the password text |
| controlID | Object ID Strings |
| args | Optional Arguments |
| LAST | A marker indicating the end of the argument list. Not required if Optional Arguments are used. |
sapgui_set_password enters a password in a password text box. When the function is recorded the password text is hidden. To replay the script, edit the function and enter the password.
To record this step during logon show operations on logon windows. To record detail steps during logon clear Hide operations on logon windows: Choose Tools > Recording Options > SAPGUI > Code generation.
Return Values
This function returns LR_PASS (0) on success or LR_FAIL (1) on failure.
Parameterization
You can parameterize all string (char type) arguments.
Example
The following example uses sapgui_set_password to logon and to change the password.
sapgui_open_connection_ex(
" /SAP_CODEPAGE=1100 /FULLMENU green 00 /3",
"MyServer", "con[0]");
sapgui_select_active_connection("con[0]");sapgui_select_active_session("ses[0]");sapgui_select_active_window("wnd[0]");sapgui_set_text("User", "MyUserName", "usr/txtRSYST-BNAME", LAST );
//Enter the password on the logon window
sapgui_set_password("Password", "MyPassword", // The password
"usr/pwdRSYST-BCODE", // Control ID
BEGIN_OPTIONAL,
"AdditionalInfo=sapgui1305",
END_OPTIONAL);
//Enter the language on the logon window
sapgui_set_text("Language", "EN", "usr/txtRSYST-LANGU", LAST );
// Click "New Password" on the logon window
sapgui_press_button("New password", "tbar[1]/btn[5]", LAST );
sapgui_select_active_window("wnd[1]");// Enter the new password
sapgui_set_password("New password","MyNewPassword", "usr/pwdRSYST-NCODE",
LAST );
// Confirm the new password
sapgui_set_password("Repeat password", "MyNewPassword", "usr/pwdRSYST-NCOD2",
LAST );
// Accept with push button on new password dialog
sapgui_press_button("Transfer (Enter)", "tbar[0]/btn[0]", LAST );

