cancel
Showing results for 
Search instead for 
Did you mean: 

Hiding table in webdynpro java

former_member227184
Active Participant
0 Kudos

Hello Experts,

We have created a webdynrpo java application. The view of that application consist of many tables. Now we have a requirement where in I have to show/hide tables according to the user who logged in to the portal.

Suppose if a manager is logging into the portal then he should be able to see all the tables of that application and on the other hand if an employee is logging in then few tables has to be hidden.

Can anybody let me know how to achieve this. What settings i have to make to get this requirement get going.

Thanks

Vamshi

Accepted Solutions (0)

Answers (3)

Answers (3)

vijay_kumar49
Active Contributor
0 Kudos

Please add the com.sap.security.api.jar to your Project and write the following piece of Code to retrieve the User Name and User Id.

That above API is available in this path is  @ C:\Program Files\SAP\IDE\IDE70\eclipse\plugins\com.sap.security_2.0.0\lib


try

    {

IUser user = WDClientUser.getCurrentUser().getSAPUser();

//wdComponentAPI.getMessageManager().reportSuccess("User::"+user);

if(user.isMemberOfGroup("GRUP.PRIVATE_DATASOURCE.un:SCW_COATS_MTR_UG",true))

{

// GRUP.PRIVATE_DATASOURCE.un:SCW_COATS_MTR_UG---- This is Group Unique ID

wdContext.currentContextElement().setSelectTable_visible(WDVisibility.VISIBLE);        

}else

{

wdContext.currentContextElement().setSelectTable_visible(WDVisibility.NONE); 

}

    catch(Exception ex)

    {

    ex.printStackTrace();

    }

How to add Jar file into NWDS

Right click on project->properties->java build path->libraries tab->Add External JARs->eclipse folder->plugins folder->select jar file

Please refer this document

roman_loshevsky
Active Participant
0 Kudos

Hi,

Try this solution:

Let's assume that all managers assign to the same company_manager Portal role.

In your WD Java application you can get logged-in user WDClientUser.getCurrentUser()

and check if the user assigned to this company_manager and act accordantly (hide or show tables in the view)

BR,
Roman.

junwu
Active Contributor
0 Kudos

you can use ume permission, google how to use it