on 06-06-2012 1:02 PM
Dear All,
I have a requirement of creating a User Search Application that fetches data from UME. I went through the below link but I am confused in what project should I creat in NWDS.
Any inputs will be of great help.
Thank you,
Regards,
Disha.
Hi Disha,
You can create Webdynpro or Portal Application (other java also possible).
Sample code(webdynpro) will look like this:
IUserFactory usrFact = UMFactory.getUserFactory();
IUserSearchFilter usrFilt = usrFact.getUserSearchFilter();
String usrPrefix = wdContext.currentContextElement().getSearchTerm();
usrFilt.setUniqueName(usrPrefix,ISearchAttribute.LIKE_OPERATOR,false);
IPublicUME_Comp.IAllUSersElement usrElement = null;
wdContext.nodeAllUSers().invalidate();
String usrName = null;
ISearchResult result = usrFact.searchUsers(usrFilt);
if (result.getState() == ISearchResult.SEARCH_RESULT_OK) {
if(result.size()>0);
while (result.hasNext()) {
usrElement = wdContext.nodeAllUSers().createAllUSersElement();
usrName = (String) result.next();
usrName = usrName.substring(usrName.lastIndexOf(":") + 1,usrName.length());
usrElement.setUsers(usrName);
wdContext.nodeAllUSers().addElement(usrElement);
}
}
You can modify the above an can use in Portal application also.
Regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Disha,
Let me explain.
we will do it in webdynpro Java. Create a local dc project and create a component.(hope you know this part)
You need all users after making a search.From this point you need 2 context variable.
1. for making search - take it as 'searchTerm'
2. for displaying the users. So the cardinality is 1:n (n number of users)
so you create a value node and make its cardinality 1:n and create a string attribute 'Users'
you can create this in component controller or in view. after making all things you can think about whats the difference in making this in view/contoller?
Next step
You need to create a GUI.one input box for search term and the out put in one table.
Using apply template option you can create two GUI elements
one input box (for 'searchTerm')
one table ( for 'Users')
and button (for execution)
For button, create one action and call above code in that method.
only this line may make you confused
IPublicUME_Comp.IAllUSersElement usrElement = null;
IPublic<Comp name>.I<node name>Element usrElement = null;
wdContext.nodeAllUSers().addElement(usrElement);
wdContext.node<node name>().addElement(usrElement);
So the flow will be like this.
You are taking the search term and executing the method. It make search and the result will put over the User attribute.
Still you are not able to follow,I can send you the more details.
But i will advice you to try it yourself and make you more confident.
If you blindly follow step by step document, your knowledge will not improve.
If you are not able to find the solution ask others and using that knowledge try to create things your self. It will make you capable to do things individually.
Let me know if anything
Regards,
Ram
Dear Ram,
Thank you so much for your help and guidance. I am very new to webdynpro and this is the 1st time creating a webdynpro application.
As per your above post I have created a Webdynpro application. I am getting stuck in creating the 2 context variables. Request you to guide with the detailed steps i.e what am I supposed to do and how, it will help me understand the procedure better.
Thank you,
Regards,
Disha.
under > webdynpro Components, you can see your component.
under that one 'component controller' will be there. Double click that select context and create
attribute like above.
then double click your component.then u will get diagram view. there just drag a line from view to controller.Then it will show the attributes . select all.
Now the same context will be available in your view.
then do the view layout and coding.
Still you find diff, let me know.
For some reference you can use this link:
http://scn.sap.com/docs/DOC-8661
Ram
Dear Ram,
Thank you very much. I could successfully run and deploy the Webdynpro application. But this application displays just the Unique Name even if I write:
"usrFilt.setDisplayName(usrPrefix,ISearchAttribute.LIKE_OPERATOR,false"
or
"usrFilt.setEmail(usrPrefix,ISearchAttribute.LIKE_OPERATOR,false"
Eventually I want to display a table of information of Users with all the information i.e FirstName, LastName, Email, etc. Could you plz suggest how to I add more columns in the table.
Will highly appreciate your help.
Note: I was getting error in the below line:
IPublicUserSearchAppComp.IAllUsersElement usrElement = null;
so I converted it as below:
IPrivateUserSearchAppCompView.IAllUsersElement usrElement = null; (This works)
Thank you,
Regards,
Disha.
Hi Disha,
If you have userid, you can get any information from userFactory.
Just make one instance of user factory and there you will get all other attributes like
firast name, last name etc..... using <userfactory>.get<property>;
eg: IUser user = userFact.getUser(userID);
user.getFirstName();
also one more thing about below one:
>IPublicUserSearchAppComp.IAllUsersElement usrElement = null;
>IPrivateUserSearchAppCompView.IAllUsersElement usrElement = null; (This works)
the first one is component controller and second one is view.
I think you have written the method in view. thats why second one works.
If you write it in controller, the first one will work.
Regards,
Ram
hi Disha,
You may like to refer to the following document.
http://scn.sap.com/docs/DOC-19552
This explains how to create a Portal user in the UME. The procedure and jar mentioned are relevant to your requirement.
Regards,
-Amol
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.