Example: sapgui_set_password
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 );