Skip to Content
author's profile photo Former Member
Former Member

Read User Roles From Portal into ABAP Report

I have written a report which takes users and specific roles as the input. Eg, userID :12345 and role/profile :SAP_ALL, SAP_ADMIN..etc in a table. and gives back if the user 12345 has SAP_ALL or not.

Now I have used RFCs to fetch all the roles for the user from different SAP systems which i further compare , to get the above.

What I am unable to do is fetch the portal roles .

PROBLEM : The portal roles also exist in the central system, but might not be always consistent since they get manually updated in the central system. Hence I want to directly fetch the data from the JAVA Portal.

WHAT I KNOW : I need to write a JAVA class in NW developer studio which will take the user as the input and give me all the roles/profiles for the same user as output.

How do I further pass the values to and from the Java class to my ABAP report?

I know that I need to use the UME in some way to have this work for me. But since i do not expertize in java I need guidance/steps as to how to proceed.



Edited by: Trishna Udupa on Sep 11, 2011 3:00 PM

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Sep 11, 2011 at 09:30 PM

    Dear Trishna,

    here's a code snippet from a development I once did.

    This JAVA code was used to create a Sitemap for the user.

    Ther part I'm sending you here was where the code extracted the roles for specific user.

    Hope it helps you.

    Don't bother with the classes Utilities and RecursiveTree.

    They were part of the code and you won't need them for your problem.

    		 * > we first get USER information, namely the NavigationNodes
    		 * > we then create an instance of object RecursiveTree and transfer the
    		 *   NavigationNodes found. They will be used to build the Sitemap.
    		private void getRoles() {
    			String user = utilities.request.getUser().getUniqueName();
    			java.util.Locale userLocale = utilities.request.getLocale();
    				"Method getRoles started for USER: " + user); roleFactory =
    			IUserFactory userFactory = UMFactory.getUserFactory();
    			try {
    				IUser logedInUser = userFactory.getUserByLogonID(user);
    				Iterator roles = logedInUser.getRoles(true);
    				for (Iterator groups = logedInUser.getParentGroups(true);
    					) {
    					String groupName = (String);
    					groupName = groupName.toUpperCase();
    					if (groupName.indexOf(utilities.propertyGroupName) != -1)
    				INavigationService navigationService =
    					(INavigationService) PortalRuntime
    				Hashtable environmentTable = new Hashtable();
    				com.sapportals.portal.prt.session.IUserContext userContext =
    				environmentTable.put("NavigationPrincipal", userContext);
    				environmentTable.put("User", user);
    				com.sapportals.portal.navigation.NavigationNodes rootNodes =
    				RecursiveTree tree =
    					new RecursiveTree(rootNodes, 0, userLocale);
    			} catch (UMException e1) {
    					"Method getRoles UMException: " + e1.getMessage());
    			} catch (NamingException e2) {
    					"Method getRoles NamingException: " + e2.getMessage());
    			} catch (Exception e3) {
    					"Method getRoles Exception: " + e3.getMessage());
    			utilities.writeLogMessage("Method getRoles OK for USER: " + user);

    Kindest Regards

    /Ricardo Quintas

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Trishna,

      You can create a java class in NWDS that will give you all the portal roles of a particular user and create a webservice out of it by deploying it on the Java engine. After you test your webservice, you can consume the same from an ABAP report. I have never tried this , but i guess it should work.



  • author's profile photo Former Member
    Former Member
    Posted on Sep 12, 2011 at 09:28 AM

    Dear Trishna,

    for that you will need to develop your own RFC to process that information and send the roles back to your R3.

    Kind Regards

    /Ricardo Quintas

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.