cancel
Showing results for 
Search instead for 
Did you mean: 

Create Dynpro to change the UME password

Former Member
0 Kudos

Hi experts,

I need to create a webdynpro with the following steps:

- View to login (two textinput with one button, the first textinput to put the username, the second textinput to put the pass, and the button to execute the login ). (This part it's clear)

The problem is in this part:

- The next view is to change the actual password, I will have three textinput ( first to put the actual password and the others to put the new password), the problem is I don't have idea how to do to it

Any idea?

Thanks in advance,

Jose Manuel

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

With your code I had a mutable exception, I've solve the problem with this code

try{

IUserFactory userfact = UMFactory.getUserFactory();

//get user id of the user to change the password

String userId = wdContext.currentLicenceUsersOutputVNElement().getUserid();

//get user object

IUser specifiedUser = userfact.getUserByLogonID(userId);

//get user maintance object

IUserMaint userMaint = userfact.getMutableUser(specifiedUser.getUniqueID());

//get user account

IUserAccount uacc = UMFactory.getUserAccountFactory().getUserAccountByLogonId(userId);

//create mutable user account

IUserAccount iuacc = UMFactory.getUserAccountFactory().getMutableUserAccount(uacc.getUniqueID());

iuacc.setPassword(wdContext.currentContextElement().getNewPassword());

iuacc.save();

iuacc.commit();

manager.reportSuccess("Password has been reset.");

}

catch (Exception e)

{

manager.reportException("error occured " + e , false);

e.printStackTrace();

}

thanks for you colaboration

Former Member
0 Kudos

Hi Jose,

Thanks for your collaborative reply...I'm not sure what you had to go through to come up with that final version of code (when I don't understand why the original version didn't work); but your version works a treat for my Portal Web Service when I ran into the same issue. Thanks.

Cheers,

Matt

Former Member
0 Kudos

Hi,

Following code will help you to start


	 IWDClientUser user1 = WDClientUser.getCurrentUser(); 
	 IUser user = user1.getSAPUser();
	 IUserAccount userAccount = user.getUserAccounts()[0];
	 userAccount.setPassword("newPassword");
	 userAccount.save();
	 userAccount.commit();

Regards

Ayyapparaj