cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve user id from document Hit count(KM Report)

Former Member
0 Kudos

Hi Guru,

I am trying to get the hit counts from the report who have viewed , i followed some blog in sdn and created successfully.

Now i am getting the hit counts when the documents viewed by user, But i need to get user id who has viewed the document through code.

So kindly provide me piece of code to retrieve user id who viewed the documents

Accepted Solutions (0)

Answers (1)

Answers (1)

kabil_g
Active Participant
0 Kudos

Try these link  

Former Member
0 Kudos

Hi Kabil,

Thanks for your reply, but that link shows how to do initial setup.

In trailing discussion in that mail, i found piece of code, but those piece of code is not working in 7.3

can you please provide some other link or piece of code.

Thanks,

Ragav

Former Member
0 Kudos

Hi Kabil,

I have used the following code in NWDS7.3 , but i am unable to add those piece of code to retrieve user id,

IResourceContext resourceContext = IResource.getContext();

resourceContext.getUser();

Guru's kindly help to resolve it

govardan_raj
Contributor
0 Kudos

hi  Ragavendhra,

use the below code

 

IWDClientUser wdUser = WDClientUser.getCurrentUser();

IUser user = wdUser.getSAPUser();

and for using this in componentProperties you should add

com.sap.security.api.sda

Regards

Govardan

Former Member
0 Kudos

Hi Govardan,

Thanks for the code.

I tried to add the security api to my KM portal Application by creating extlib dc, but when I add  com.sap.security.api.sda to that DC its showing deprecated and i am unable to add it.

Is there is anyway to add com.sap.security.api.sda to my KM application?

Regards,

Ragav

govardan_raj
Contributor
0 Kudos

Hi viswanathan ,

you need to create extlib dc for this , you can directly add it your km portal applicaiton it will allow you to add.

Regards

Govardan

Former Member
0 Kudos

Hi Raj,

Can you please send me sample screen shots if possible?

i have used your above code, but i am getting error on declare of catch statement

"No exception of type WDUMException can be thrown; an exception type must be a subclass of Throwable"

Regards,

Ragav.

govardan_raj
Contributor
0 Kudos


hi ragavendra ,

Im not able to share the screen shots due to security reasons ,i.e im not able to upload any kind of file from system, but i can share the code that i m  using .

select your dc, right click->development component->show in ->component properties

in the dependency tab , click on add , there you just select this component

"com.sap.security.api.sda"

------------------------------------------------------------------------------------------------------------------------------------------------

try
   {
    IWDClientUser wdUser = WDClientUser.getCurrentUser();
    IUser user = wdUser.getSAPUser();
    
    
   

    }
   catch(Exception e)
   {

    
    wdThis.handleException("Error *************, Please  try after sometime or Kindly Contact Support Desk",e);
 

}

----------------------------------------------------------------------------------------------------------------------------------------------

Regards

Govardan

Former Member
0 Kudos

Hi Raj,

Thanks for your explanation.

Your are explanation for WD project. But i am using it for normal portal project application

its KM reporting application

Regards,

Ragav

govardan_raj
Contributor
0 Kudos

hi Ragavendran

In this case you can use the below code

 

IUserContext userContext = componentRequest.getUser();

String logonUid = userContext.getLogonUid();

Regards

Govardan

Former Member
0 Kudos

Hi,

Is this for KM reporting Document hit count?

I have developed one application Document hit count KM application, this will have the event resources from there i need to get logged in user.

Who have viewed the document? and who is accessing ?

govardan_raj
Contributor
0 Kudos

hi ,

for example you use the above code in applicaton A , will give the user  who  has accessed that application,

in your case , is km accessing etc a customised application or standard one you want to trace who has edited and who has viwed ?

Regards

Govardan