Hi Amit,
You can try creating a portal component which reads the logged in user and writing it back to response, and an iView from this portal component.
Then just call /include the iView, or directly call the portal component.
Then decide what needs to be done.
Sample code:
UserFactory userfact=UMFactory.getUserFactory();
IUser user=userfact.getUserByUniqueName(request.getUser().getUserId());
String usrid=user.getUniqueName();
Please refer to the link below for more information:
https://help.sap.com/saphelp_nw74/helpdata/en/4a/112f1a2228101ee10000000a42189b/content.htm
Regards,
Ashvin