cancel
Showing results for 
Search instead for 
Did you mean: 

creating Portal users

Former Member
0 Kudos

Hiii,

Iam creating portal users in the web dynpro.I had taken Grid layout.I written code like this.

public void onActionCreateUser(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionCreateUser(ServerEvent)

String user = wdContext.currentContextElement().getUser();

String lastName = wdContext.currentContextElement().getLastName();

String firstName = wdContext.currentContextElement().getFirstName();

String email = wdContext.currentContextElement().getEmail();

IUserFactory userFact = UMFactory.getUserFactory();

try {

IUserMaint userMaint = userFact.newUser(user);

userMaint.setLastName(lastName);

userMaint.setFirstName(firstName);

userMaint.setEmail(email);

userMaint.commit();

wdComponentAPI.getMessageManager().reportSuccess("User Created "+user);

} catch (UMException e) {

wdComponentAPI.getMessageManager().reportException(e.getMessage(),false);

e.printStackTrace();

}

//@@end

}

In the output iam getting

-


: Vijay

-


: Vijay

-


:Tivari

-


: email address giving

Label is not displaying in the output (.that is the left part).But iam able to create the users.

Name

First Name

Last Name

Email

These things have to be shown in the output.

Please provide the solution for this.

Accepted Solutions (0)

Answers (9)

Answers (9)

Former Member
0 Kudos

thanks

Former Member
0 Kudos

Hi,

Also check if in the property of the label you have replaced the <> of Text property with your label text.

Regards,

Rajat

Former Member
0 Kudos

Hi Sushma,

Since you are getting :Vijay (only colon)not the name of the label.

Then the Visible and enabled properties are alright. the only thing that you might have missed is providing the value for Text property of Label.

please check it once as this is the only problem i can see.

regards

Narendra Singh

Former Member
0 Kudos

Hi Sushma,

I missed out few important things in my earlier response:

1) The display of label has nothing to do with the code.

2) The code is working fine if the user is getting created.

3) The enabled property is to be set true for both the individual labels and top level.

Regards.

Rajat

Former Member
0 Kudos

Hi Sushma,

First of all check in the layout that the property ColSpan is 2.

Then enabled property of the label should be set true.

Hope it helps.

Regards.

Rajat

former_member192434
Active Contributor
0 Kudos

Hi

Enable the label property.

thanks

Former Member
0 Kudos

Hi Sushma,

just check whether the Proper binding of context with UI Element is done or not.and also Check the Cardinality is 0..n and selected is 0..n or not.

regards

vishal

Former Member
0 Kudos

Hi

Iam creating portal users in the web dynpro. Iam getting error in the code

_Error : The method setPassword(String) is undefined for the type IUserMaint*_ *

Will anyone help me to sort this issue.

Please reply the necessary code.

public void onActionCreateUser(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionCreateUser(ServerEvent)

String user = wdContext.currentUserDataElement().getUser();

String password = wdContext.currentUserDataElement().getPassword();

String lastName = wdContext.currentUserDataElement().getLastName();

String firstName = wdContext.currentUserDataElement().getFirstName();

String email = wdContext.currentUserDataElement().getEmail();

IUserFactory userFact = UMFactory.getUserFactory();

try

{

IUserMaint userMaint = userFact.newUser(user);

{code}userMaint.setPassword(password);

userMaint.setLastName(lastName);

userMaint.setFirstName(firstName);

userMaint.setEmail(email);

userMaint.commit();

wdComponentAPI.getMessageManager().reportSuccess("User Created "+user);

}

catch (UMException e)

{

wdComponentAPI.getMessageManager().reportException(e.getMessage(),false);

e.printStackTrace();

}

//@@end

}

Regards

Sushma

Former Member
0 Kudos

Hi,

You need to use IUserAccount Interface

IUserAccount: This interface is used to get and set user account data for instances passwords, roles and group membership.

Below is sample code try to edit it as per your requirement

IUserAccount userAcc = null;

try {

userAcc = UMFactory.getUserAccountFactory().newUserAccount( u201Cmiltongu201D,

epUser.getUniqueID());

userAcc.setPassword( u201Cmilton@123u201D );

userAcc.save();

userAcc.commit();

} catch (Exception e)

{

System.out.println(e.toString());

return;

}

// In your above code just comment your setPassword line and paste the above code after your code line

userMaint.commit();

Regards

Raghu

Former Member
0 Kudos

Hi Sushma,

Please go through this Blog. It gives you the step-by-step procedure to create a portal user using Web Dynpro for Java,

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/60b1f682-5a6c-2b10-539c-a4e7d6af...

Regards

Kishan

Former Member
0 Kudos

Hi,

Your code is nothing to do with your label visibility. Check Enable property of the label, cardinality of node etc.,

Regards

Raghu