Skip to Content
0
Apr 24, 2018 at 04:59 AM

How to update SAP EP IUserAccount SecurityPolicy UME users

272 Views

Hi,

The below is our current code, which is running successfully to create new test users with

SecurityPolicy to default .

IUserMaint newUser = userfact.newUser(PortalID);
newUser.setFirstName(Firstname);
newUser.setLastName(Lastname);
newUser.setEmail(EmailID);
Locale PortalLang = new Locale("en");
newUser.setLocale(PortalLang);
newUser.save();
newUser.commit();
IUserAccount useracc = UMFactory.getUserAccountFactory().newUserAccount(PortalID,
newUser.getUniqueID());
useracc.setPassword(NewUserPWD);
useracc.save();
useracc.commit();


Now we a have new scenario that while creating new users we need to update the user type to Technical User (Security Policy).

I don't see that property or method is not available to use in the code(setSecurityPolicy

(com.sap.security.api.*))

Have referred the below link but the below method is not available to use.

https://archive.sap.com/discussions/thread/1876052#


Eg.

IUserAccount userAccount = accountFactory.getMutableUserAccount(<UNIQUE ID OF USER>);

userAccount.setSecurityPolicy("<SECURITY POLICY>"); //In my case I'm changing it to technical

userAccount.save();

userAccount.commit();

Please help to suggest, how we can update the user type to Technical User using the code.

What are the other ways of achieving this scenario.

Thanks, SMSVikasK