on 09-29-2006 3:43 PM
Hi,
I am using Adaptive RFC call for fetching data and displaying in a table based on user id in custom component controller's wdDoInit()method i wite the following code.
public void wdDoInit()
{
//@@begin wdDoInit()
System.err.println("With in init");
Zbapi_Employee_Bank_Details_Input input=new Zbapi_Employee_Bank_Details_Input();
wdContext.nodeZbapi_Employee_Bank_Details_Input().bind(input);
System.err.println("With in init user Id is"+WDClientUser.getLoggedInClientUser().getSAPUser().getUniqueName());
try{
input.setUserid(WDClientUser.getLoggedInClientUser().getSAPUser().getUniqueName());
wdContext.currentZbapi_Employee_Bank_Details_InputElement().modelObject().execute();
wdContext.nodeBankdetail().invalidate();
}
catch(Exception e){}
//@@end
}
System.err.println printing user id correctly.But when i am passing this user id I got ArrayIndexOutofboundException .Below code line is creating error
input.setUserid(WDClientUser.getLoggedInClientUser().getSAPUser().getUniqueName());
So how to resolve this problem
Thanks & Regards
muna
Hi Mukesh and Lohit,
My problem is not solved.
I already implement this code
String userid=WDClientUser.getLoggedInClientUser().getSAPUser().getUniqueName().toString();
input.setUserid(userid);
and later i did for avoiding blank space and using valueOf() method like below code
String userId=String.valueOf(WDClientUser.getLoggedInClientUser().getSAPUser().getUniqueName().trim());
input.setUserid(userId);
still it is showing ArrayindexOutOfBound exception.Please tell me What i will do ,Waiting for your reply.
Thanks & Regards
muna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi lohith,
I print the length of user id is 7.
Thanks & Regards
muna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi lohith,
Actually in backend my user id field size is 30 char,
and i am sending 7 charecter user id.data type of User id
in backend is SysId mentioned by SAP.Please tell me how to solve.
Thanks & Regards
sailajit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi gopi and servana,
My problem is not getting user id.I am successfully getting user id.My problem in following line of code
input.setUserid(WDClientUser.getLoggedInClientUser().getSAPUser().getUniqueName());
I already tested that the code
WDClientUser.getLoggedInClientUser().getSAPUser().getUniqueName();
sucessfully retriving user id .My problem is only below
line of code.
input.setUserid(WDClientUser.getLoggedInClientUser().getSAPUser().getUniqueName());
Thanks & Regards
muna
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this,
IWDClientUser wdUser = WDClientUser.getCurrentUser();
IUser user = wdUser.getSAPUser();
if (user!=null)
{
IUserAccount[] acct = user.getUserAccounts();
if (acct[0]!=null)
{
loginuser=acct[0].getLogonUid();
strUserid += acct[0].getLogonUid();
}
}
Assign the loginuser as a input to the BAPI
import com.sap.security.api
Regards,
Saravanan K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi
If I got your problem correctly then you are trying to send the looged in user as the input to the RFC that you are calling.
then this code might help you out to capture the logged in user
try{
//IUser user = WDClientUser.forceLoggedInClientUser().getSAPUser();
IUser user = WDClientUser.getLoggedInClientUser().getSAPUser();
IUserAccount[] acct = user.getUserAccounts();
if(acct[0] != null)
{
String strUserid = acct[0].getLogonUid();
customer=strUserid.substring(0,strUserid.indexOf("."));
//wdContext.currentContextElement().setAssoid(new String(strUserid));
if(customer.equalsIgnoreCase(customer))
wdContext.currentYOURRFC_InputElement().setCustomer(customer);
}
}catch(Exception ex)
{
ex.getMessage();
}
let me know if you require some more info.
Thanks,
kris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
24 | |
11 | |
9 | |
7 | |
6 | |
5 | |
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.