cancel
Showing results for 
Search instead for 
Did you mean: 

How to get R3 user from Portal user? (User Mapping)

former_member182374
Active Contributor
0 Kudos

Hello all,

I have a problem getting the R3 user from the Portal user.

The portal user is: ocohen

The R3 user is 12345.

I used "user mapping" to map the "ocohen" (portal username) to the "12345" (r3 username).

I tried using this code for getting the R3 username:

IWDClientUser clientUser = WDClientUser.forceLoggedInClientUser();

com.sap.security.api.IUser sapUser = clientUser.getSAPUser();

IUserMapping userMapping = UMFactory.getUserMapping();

Map map=null;

try {

//UIDPW

//SAPLOGONTICKET

String name =userMapping.getR3UserName (sapUser,"SAPLOGONTICKET",map,true);

wdComponentAPI.getMessageManager().reportSuccess("R3 name "+name);

}

catch (UMException e) {

wdComponentAPI.getMessageManager().reportSuccess(e.toString());

}

After running the program, the variable "name" equals to "ocohen" instead of "12345"

Thanks, Omri

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Hello Omri,

from https://media.sdn.sap.com/javadocs/NW04/SP9/ume/com/sap/security/api/umap/IUserMapping.html#getR3Use..., java.lang.String, java.util.Map, boolean)

<i>

public java.lang.String getR3UserName(IUser pri, java.lang.String sysid, java.util.Map sysAttrBag, boolean bGenerateId) throws UMException

...

sysid - system identifier...</i>

So, you have to pass your R/3 system ID to get mapped user name. SAPLOGONTICKET is logon method of system, not a system ID.

Best regards, Maksim Rashchynski.

former_member182374
Active Contributor
0 Kudos

Thanks, It solved the problem.

It's the system id and not system method.

Answers (1)

Answers (1)

htammen
Active Contributor
0 Kudos

Hi Omri,

I think the return value of the getR3UserName ist correct. If you use SAPLOGONTICKET for authentication this requires that username in frontend (Web Dynpro) and backend (R/3) are identical.

With the ticket the username that authenticated against the frontend system and a certificate are transmitted to the backend system, but no password.

The backend system trusts the frontend system and tries to login the transmitted user id without checking the password, because this has already been done by the frontend system.

If usernames are different you have to use a R/3 reference system. But in this reference system the username must again be the same as in the frontend as far as I know.

So, whatever you do you will get "ocohen" back as long as you work with SAPLOGONTICKET.

Regards

Helmut