on 01-06-2011 2:27 PM
Hi Experts
In my portal application i need to pass the username of the person who is logged in and pass the same from the portal code to the backend and update it in the table.
IWDClientUser wdclientuser = WDClientUser.getCurrentUser();
if (wdclientuser != null) {
com.sap.security.api.IUser iUser = wdclientuser.getSAPUser();
if (iUser != null) {
IUserAccount[] accounts = iUser.getUserAccounts();
if (accounts[0] != null) {
userID = accounts[0].getLogonUid();
}
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks to all. My query has been resolved.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rizwana,
i have the similar issue to, how your problem got solved send me do u refered any document or pdf.
it will be useful me in solving the issue
my issue is
when ever a portal user logs in, it should validate the user to which region it belongs to and we have external user and internal user by checking in the table, table contains the filelds user, region,client ...
Thanks in advance
Thanks&Regards
charan
Using this piece of code i get the login ID of the user who is currently logged in but i also want it to be updated in the backend table. I have created a value attribute for the same and i am setting the same in the custom controller using its setter method but after this it is throwing an "array out of bound exception -1" although i have added an extra parameter for the execute method in the custom controller. I have also done the model binding for this custom controller value attribute.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rizwana,
you can set the userid to RFC input attribute throw following way.
Map RFC node from component controller to view and set the value to particular RFC attribue by using the setter method of attribute if ur writing the code to getting userid in VIew. see the following example code.
if (accounts[0] != null)
{
userID = accounts[0].getLogonUid();
wdContext.current<RFCNodeName>Element.set<AttributeName>(userID);
}
if you are writing the code to getting userid in component controller declare the userID variable in begin others section and set the RFC input attribute by using setter method before the modelobject().ececute() line of code.
wdContext.current<RFCNodeName>Element.set<AttributeName>(userID);
Revert back if you have any queries.
Thanks & Regards,
Bhargava.
IWDClientUser clientUser = WDClientUser.getCurrentUser();
IUser User = clientUser.getSAPUser();
if (User != null)
{
try
{
IUserAccount[] acct = User.getUserAccounts();
if(acct[0] != null)
{
userID = acct[0].getLogonUid();
}
}
catch(UMException e)
{
//Raise some error msg according to your scenario.
}
}
Also try to make this as a common method and call this whenever you required, so that in future projects also you dont want to write the same code again and again.
Revert for any queries.
Regards
Nizamudeen SM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.