Any program / Tcode to remove duplicate roles from a user

Question: Hi all,

Have anybody faced this problem of duplicate role assignment to a user.

We are working on 46C and worplace with CUA in place. We are finding that we have a large number of users who have been assigned duplicate roles (a specific role more than once).

Is there any program/ TCode to execute to delete these duplicate roles of the users and cleanup the user buffers.

Any / All replies will be apreciated.

Regards
Delhiwala

Answer:
I beleive there is a report in 4.7 that does this, but you can install a function module and configure PFCG, SU01 and PFUD to perform this for you. The function module are:
FUNCTION Z_SEC_ASSIGN_AG_CLEANUP_SINGLE.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  IMPORTING
*"     REFERENCE(ACTIVITY_GROUP) LIKE  AGR_DEFINE-AGR_NAME
*"----------------------------------------------------------------------
tables agr_users.

delete from agr_users where agr_name = ACTIVITY_GROUP and
                            to_dat LT sy-datum.

ENDFUNCTION.

and
FUNCTION Z_SEC_ASSIGN_AG_CLEANUP.
*"----------------------------------------------------------------------
*"*"Local interface:
*"  TABLES
*"      ACTIVITY_GROUPS STRUCTURE  STR_AGRS
*"----------------------------------------------------------------------
  field-symbols: <fbname> like usr02-bname.
  delete ACTIVITY_GROUPS where to_dat lt sy-datum.
  assign ('(SAPLSUU4)G_USER_AGR_ACTIVITYGR-BNAME') to <fbname>.
  if sy-subrc = 0.
    delete from agr_users where uname = <fbname> and
                                to_dat lt sy-datum.
  endif.
ENDFUNCTION.
You configure the call in SSM_CUST entry
Z_USERS_TRANSFER = FUNCTION Z_SEC_ASSIGN_AG_CLEANUP
and
Z_SINGLE_USERPROF = Z_SEC_ASSIGN_AG_CLEANUP_SINGLE
Z_EXIT_USERS_SAVE = Z_SEC_ASSIGN_AG_CLEANUP_SINGLE

Answer:
You may alternatively run program PRGN_COMPRESS_TIMES
It removes duplictate role assignments to user ids and also deletes expired assignments.

Unfortunately, I do not see this program in R/3 systems. So if your CUA is hosted on a R/3 you may not have it. I am working on getting a custom development for it run in R/3. If any of you come across a better solution please do let us know. For the time being, PRGN_COMPRESS_TIMES is a good option.

Cheers !

Answer:
I tried the option given by Ashu but I could not find this program in R/3 System. any other Help.

I am trying to get a ABAPer create the solution given by John. John Can you put some light on how to implement the solution. I have created the two function modules as mentioned in your solution. I am not clear what to do after that.

You have given asked "You configure the call in SSM_CUST entry
Z_USERS_TRANSFER = FUNCTION Z_SEC_ASSIGN_AG_CLEANUP
and
Z_SINGLE_USERPROF = Z_SEC_ASSIGN_AG_CLEANUP_SINGLE
Z_EXIT_USERS_SAVE = Z_SEC_ASSIGN_AG_CLEANUP_SINGLE

I am not clear what to do here. Please advice and give some more light on this. Appreciate your valuable inputs

Regards
Delhiwala

Answer:
SM30 enter table SSM_CUST
Maintian. on a new line
Enter Z_USERS_TRANSFER in the first blank field, enter Z_SEC_ASSIGN_AG_CLEANUP in the corresponding second field.
new line
enter Z_SINGLE_USERPROF in the first blank field, enter Z_SEC_ASSIGN_AG_CLEANUP_SINGLE in the corresponding second field.
new line
enter
Z_EXIT_USERS_SAVE in the first blank field, enter Z_SEC_ASSIGN_AG_CLEANUP_SINGLE in the corresponding second field.
SAVE.

The function module willthen run when you save a user.
You may have to modify the code if a role has two different statr dates and the same end-date.
Copyright ?2007 - 2008 www.jt77.com