on 04-30-2007 10:39 AM
Hi everyone, i need your help, i have search in all thread and still i can't find the answer. I know how to find portal user using WDClientUser.getCurrentUser() but i can't find the R3 user. My code like this
String sessionStatus = null;
IWDClientUser user = null;
String userID = null;
// Get User ID from ESS / Portal SSO
try {
user = WDClientUser.getCurrentUser();
} catch (WDUMException e1) {
logger.traceThrowableT( Severity.ERROR, "GetSapUserId()", "Error", e1 );
isError = true;
}
if ( user == null ) {
isError = true;
}
if ( !isError ) {
Map userMap = null;
IUser iUser = user.getSAPUser();
IUserMapping userMapping = UMFactory.getUserMapping();
if ( iUser != null ) {
try {
//userID = userMapping.getR3UserName()
userID = userMapping.getR3UserName(iUser,null,false);
//userID = userMapping.getR3UserName(iUser, "UIDPW", userMap, true); --> deperecated ???
try {
// This code is intended to avoid unmapped user (e.g. using SSO)
int userIDInt = Integer.parseInt( userID );
} catch (NumberFormatException e) {
isError = true;
}
} catch (UMException e2) {
logger.traceThrowableT( Severity.ERROR, "GetSapUserId()", "Error", e2 );
isError = true;
}
In this code i have try
1. userID = userMapping.getR3UserName(iUser, "UIDPW", userMap, true);
2. userID = userMapping.getR3UserName(iUser, "SAPLOGONUSERID", userMap, true);
3. the last i using getR3UserName that using system landscape object = null
but all fail, still i'm only get portal user. Anyone can help me ? Thanks
Regards,
Satria
Dear Satria,
i try to write a WD-Java that uses the portal usermapping service as well.
I have added all the jar's to my WD-Project but running it i get an ClassNotFoundError for IUserMapping on:
IUserMapping userMapping = UMFactory.getUserMapping();
Itried a lot with SharingReference and so on, can you hepl me to get my application running ?
Thanks,
best regards André
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi satria budiman,
The 2nd parameter of the method should be system name and not logon method.
So you should write something like this:
userID = userMapping.getR3UserName(iUser, "SAP_R3", userMap, true);
'SAP_R3' is the system name in the portal.
This code will work but since this method is deprecated it is better to use:
getR3UserName(IUser user, ISystemLandscapeObject system, boolean bGenerateId)
Regards,
Omri
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Omri, thank you for your answer but
I have code like this :
userID = userMapping.getR3UserName(iUser, "SAP_R3_HUMANRESOURCES", userMap, true);
but still not work. For Maksim example i confused what parameter that must i through for e.getSystemByUniqueKey(......) and e.getSystemByAlias(....); How i get this parameter correctly ? Another problem is that wrappers.size() == 0 in my code, why this happen?
Right now, i have success get this R3 User Name, but not using Webdynpro method but using RFC Function Module USER_NAME_GET. I have test it with some user and success but i don't know if this is correct/best solution, anyone have use it before ?
I'm interested in this topic but i can't find step by step tutorial that clearly explain this, I suggest there should be someone explain this user authentication and other thing...
Thank you
Regards,
Satria
Hi,
Did you define system in your portal? (see link and snapshot)
http://help.sap.com/saphelp_ep60sp2/helpdata/en/1f/bddf3d48b05d5ae10000000a11405a/content.htm
http://img119.imageshack.us/img119/7714/portalsystemscy1.jpg ('SAP_R3' it's a name I chose it can be anything...)
The method's name is a confusing 'getR3UserName' can be used for getting R3, BW, CRM or any SAP R3 'like' system (it depends on the system alias that is provided).
Systems are used for creating transaction, iviews etc...
If you don't have portal system objects and all you need is the R3 user name than I guess using the RFC is good enough.
Omri
User | Count |
---|---|
79 | |
9 | |
9 | |
7 | |
7 | |
7 | |
6 | |
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.