cancel
Showing results for 
Search instead for 
Did you mean: 

Type mismatch error

MarkusKlein
Active Contributor
0 Kudos

Hello everybody,

im trying to pass the WD user to a Backend-System via RFC FM as a import parameter. Therefor i want to assign the current user to the context of the controller. the current user is of type IWDClientUser and the context attribute 'User' is of type string. Now im getting a type mismatch error at the second code line:


IWDClientUser user = WDClientUser.getCurrentUser();
...
wdContext.currentZxss_Get_Employees_InputElement().setUser(user);

Accepted Solutions (1)

Accepted Solutions (1)

MarkusKlein
Active Contributor
0 Kudos

Guess i solved it.

String userId = user.toString();

Should do it.

Former Member
0 Kudos

Markus,

I bet you are wrong

Otherwise it is very strange RFC...

Most probably this would be something like:


String param = WDClientUser
  .forceLoggedInClientUser()
    .getSAPUser()
      .getUniqueName();

to get login

or getEmail() or getUniqueID().

VS

MarkusKlein
Active Contributor
0 Kudos

Hello Valery,

what im trying to do is this. I want to determine the user calling a WD Application. Therefor im using this line.

IWDClientUser user = WDClientUser.getCurrentUser();

this user i want to assign to a import parameter of a RFC-FM. After i have done the binding of the aRFC-Model to the Controller context i need to assign the determined user to the context of the controller with this line.

wdContext.currentZxss_Get_Employees_InputElement().setUser(user);

but unfortunately the type of the user (IWDClientUser) and the type of the import parameter of the method setUser (String) do not match and i cant do a type casting.

I know i dont have to do this, as the user calling the WD Application is the one executing the RFC in the backend and i could easily use the sy-uname at the RFC to determine the user... but its a test/learning example after all

regards,

Markus

Former Member
0 Kudos

Markus,

What I mean is that RFC functions rarely accepts internal toString() presentation of Java objects

Commonly they need a login name (ocasionally e-mail or unique id)

VS

MarkusKlein
Active Contributor
0 Kudos

Hello,

yea well im still trying to figure that out Anyway, how do i determine the username of a user running a WD application as a string?

regards,

Markus

MarkusKlein
Active Contributor
0 Kudos

Yea, you were right and deserved your points

Thanx!

String user = WDClientUser.forceLoggedInClientUser().getSAPUser().getUniqueName();

Answers (0)