on 09-01-2006 10:51 AM
Hi,
can somebody help me. I want at starting of a WD application. That it retreives the portal user as in input of the bapi. Is there a tutorial or can somebody explain me what code i need to use or ahat i need to do
Regards
Hi,
use the follwowing code,
String loginUser="";
IWDClientUser wdUser = WDClientUser.getCurrentUser();
IUser user = wdUser.getSAPUser();
if(user != null)
{
IUserAccount acct[] = user.getUserAccounts();
if(acct[0] != null)
{
loginUser = acct[0].getLogonUid();
}
}
add the follwing import statements,
import com.sap.security.api.IUser;
import com.sap.security.api.IUserAccount;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In that case you will need to create a value attribute and bind it to a table column. Then retrieve the user name as suggested and set it to the context through this value attribute.
If you want to execute the retrieval code in your custom controller, then create another attribute in custom controller's context and map this to the view's context.
Regards,
Satyajit.
hi,
Create one value node in the context and add one value attribute to that node.
Bind the value node to the dataSource property of the table.
and also bind the value attribute to the text property of the tableCellEditor of correspoding column.
After execution of the bapi, get the portal username from the Bapi's output node and store it into a String variable (ex: userName). Then set the value to the value attribute.
like, wdContext.current<Tablenode>Element.set<TableAttribute>(userName);
Hi,
Let's say that you are doing the username retrieval part in the custom controller. So create a value attribute say, UserName in the custom controller's context. Also create a value attribute of the same name in the view controller's context under the value node that is boind to the datasource property of the table and map the custom controller attribute to the view controller's attribute. The view context might look like:
-Root
--TableDataNode
---UserName
---... (other nodes)
---...
....
Once you have fetched the user name in the custom controller, use a code like:
wdContext.currentContextElement().setUserName(userNameStr);
Now in your view, create a table column to show the user name. Insert a textview as the cell editor and bind the
text property to, TableData.UserName.
Regards,
Satyajit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
To Retrive Loged-In user from Portal use below Code.
IWDClientUser clientUser = WDClientUser.getLoggedInClientUser();
String user = "";
if (clientUser != null) {
IUser iUser = clientUser.getSAPUser();
if (iUser != null) {
try {
IUserAccount[] acct = iUser.getUserAccounts();
if (acct[0] != null) {
user = acct[0].getLogonUid();
}
}catch (UMException umex) {
}
}
}
return user;
Regards,
Sridhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
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.