cancel
Showing results for 
Search instead for 
Did you mean: 

How to find who is login Portal by using webdynpro with java

Former Member
0 Kudos

Hi Friend

One Supplier( Abc) Login into the portal . How to find it "ABC" user login into portal by using webdynpro with java

My requirement is

One Supplier login in to the portal that supper having one Vendor number ( it is fixed)

Exp: Portal user vijay login his vendor number 12345 like

Suppose u r login into the portal u have one vendor number like this

i have to desine one screen that is find PO'Status Screen, In that Screen, Meterial Group,line number,PO Status and Vendor number is avaliable.

Supplier login in to that portal he is finding some items.

this my Requirement. i m creating this screen ..How to fined user name from portal .once i have to find this user name by using webdybpro with java. I have to assine vendor number

Regards

Vijay

Accepted Solutions (1)

Accepted Solutions (1)

Abhinav_Sharma
Contributor
0 Kudos

Hello Vijay,

You can get the current logged in user by following way:

1) Open Application Properties and set the sap.authentication property to true;

2) write following code in wdDoInit of your component controller;

try {

IWDClientUser l_clntUser = WDClientUser.getCurrentUser();

wdContext.currentContextElement().setCtx_va_loggedInUser(

l_clntUser.getSAPUser().getUniqueName());

} catch (WDUMException ex) {

wdComponentAPI.getMessageManager().reportException(

ex.getMessage(),

false);

}

This way you will get the user id and you can assign the vendor number as per business logic.

Abhinav

Former Member
0 Kudos

Hi Friend,

wdContext.currentContextElement().setCtx_va_loggedInUser(l_clntUser.getSAPUser().getUniqueName());

How to get this "setCtx_va_loggedInUser(l_clntUser.getSAPUser().getUniqueName());"

After that wdContext.currentContextElement().setAttributeValue() like that can u give full explanation

starting to ending...Pls.....i need this is very importent.

Regards

Vijay

gill367
Active Contributor
0 Kudos

Hello Vijay,

You can wirte the following code to get the logged in user's ID

try {
		IWDClientUser wdClientUser = WDClientUser.getCurrentUser();
		IUser sapUser = wdClientUser.getSAPUser();
		IUserAccount[] acct = sapUser.getUserAccounts();
		String str = acct[0].getDisplayName();
		wdComponentAPI.getMessageManager().reportSuccess("user "+ str);
	} catch (WDUMException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} catch (UMException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}

You need security api for using it make sure that is present.

Thanks,

Hope this will help

Sarbjeet

Answers (0)