On one of my recent SRM projects I had a requirement wherein a specific portal role was to be assigned to a portal user based on an action performed on one of the standard SRM webdynpro screen. The assigned role was also to be removed based on another action. Probably there could be some help available on SDN, but I was unable to find it. So thought of sharing this. Hope it helps some…..

SAP has provided a service wrapper interface /sapsrm/if_spml_srvc_wrapper with methods that help carry out operations on a portal user ID. I have shown below how a user can be assigned a specific portal role, y’all can try other methods available to create a portal user, delete one, delete roles and so on…


To assign a portal role we need to get the unique ID of the role which your portal administrator could provide you.

CONSTANTS:

*RFC Destination of portal in SM59

        lc_rfcdest        TYPE rfcdest VALUE ‘PORTAL’,    

*Portal user ID              

        lc_portal_user TYPE xubname VALUE ‘TEST_USER’,         

*Unique ID of the portal role

        lc_portal_role TYPE txt255 VALUE ‘ROLE.PCD_ROLE_PERSISTENCE.EIuf/fYAf+G39przMn+8lcKhzII=’.

DATA:

       lo_spml_wrpr   TYPE REF TO /sapsrm/if_spml_srvc_wrapper,

       lt_ep_roles    TYPE /sapsrm/t_ep_roles,

       ls_ep_roles    TYPE /sapsrm/s_ep_roles.

lo_spml_wrpr = /sapsrm/cl_spml_wrpr_factory=>get_spml_wrapper( lc_rfcdest ).

ls_ep_rolesuniqueid = lc_portal_role.

APPEND ls_ep_roles TO lt_ep_roles.

TRY.

     lo_spml_wrpr->add_role_ume_user(

       EXPORTING

         iv_logon_id = lc_portal_user

         it_roles       = lt_ep_roles   ).

   CATCH /sapsrm/cx_spml_connection.

     “Exception handling here

   CATCH /sapsrm/cx_spml_service.

     “Exception handling here

ENDTRY.



Best regards

Vipin Varghese

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Oliver Bär

    Hi, thank you for this blog.

    I have a question: is it possible to change the password for an UME-User from an ABAP-System. I found an Interface called “IF_SPML_SERVICE” with the function “CHANGE_IDENTITY”, but there is no documentation available for this function.

    Can anyone help?

    Best regards.

    Oliver

    (0) 

Leave a Reply