on 03-10-2008 1:29 PM
Hi Gurus,
How to get the current user who logged into portal.
I have a webdynpro requirement where in which I have to get the current user id who loggedinto portal which will be the input parameter of the BAPI(adaptive RFC model) which will return me employee number of the particular user.
Can anyone send me the code to retrive the user id through webdynpro application..........
Pts will be rewarded for useful inputs......
Thanks in Advance,
Dharani
Hi,
IWDClientUser user = WDClientUser.getLoggedInClientUser();
Regards,
Murtuza
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Murtuza,
I have to pass this user id to bapi which will return me employee number associated to this user.
How to do that?
I guess I have to put your code(IWDClientUser user = WDClientUser.getLoggedInClientUser();)
before I call the bapi(whic will return the employee number).
and please tell me how to set this value as a input parameter to the bapi.
Thanks in Advance,
Dharani
Hi Dharani,
For that, you need to add a JAR file.
To do this:
1) Right click on your project
2) Choose properties
3) Choose Java Build Path
4) Click on 'Add variable'
5) ECLIPSE_HOME
6) Click on 'extend'
7) Open plugins
😎 Choose com.sap.security_2.0.0 > lib > com.sap.security.api.jar
9) Click OK
10) Now right-click in your code and do "organize imports"
This should solve your issue about "IUser cannot be resolved or is not a type"
Kind regards
Allan
Another remark;
The webdynpro application user will be 'J2EE_GUEST' by default, so to avoid this, you need to setup the login.
How to proceed:
1) Double click on the application
2) Go to tab 'application properties'
3) Choose 'New'
4) Select 'pre-defined'
5) Click 'Browse' and select 'authentication'
6) Set value to 'true'
Reward points when helpful
[The smiley saved your two points ;-]
Kind regards
Allan
Edited by: Armin Reichert on Apr 26, 2008 7:12 PM
Hi Dharani,
No problem
I did this by coding this:
try{
IWDClientUser user = WDClientUser.getCurrentUser();
String userName = user.getSAPUser().getUniqueName();
wdComponentAPI.getMessageManager().reportWarning("userName = " + userName);
}
catch(Exception ex){
ex.printStackTrace();
wdComponentAPI.getMessageManager().reportException("in View " + ex.toString(), false);
Kind regards
Allan
Hi Dharani,
Using UMEfactory u can do that...
1. create one input field,
2. create one attribute called Uid
3. assign Uid attribute to the input field
4. type the following code in Doinit() method
String uid = wdContext.currentContextElement().getUid();
try {
IUser user = UMFactory.getUserFactory().
getUserByLogonID(uid);
String userName = user.getDisplayName();
} catch (UMException ex) {
e.toString();
}*/
5. after that go to Portal create one iview assign to particular user. then u get into the user details...
thats it
Regards,
P.Manivannan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Manivannan,
I shouldn't create UI element in the view since its a standard business workpackge.
I have just get the current user logged into portal and pass that information as a input to the BAPI(which I imported using adaptive RFC model).
so that I will get the employee number as a output from the bapi.......
Hope you understood my requirement.......
Kindly help if you got a clue........
Thanks in Advance,
Dharani
Hi ,
Use this code,
IUser user = UMFactory.getUserFactory().
String userName = user.getDisplayName();
String email = user.getEmail();
String Description = user.getJobTitle();
String name = user.getName();
String UniqueID = user.getUniqueID();
String UniqueName = user.getUniqueName();
Regards,
P.Manivannan
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.