11-08-2013 8:36 AM
Hello Experts,
My requirement is through ABAP Code i want to extract the Role assigned to a User and chnage its Expiry date by system date.
Could anyone let me know the BAPI for this?
I have found one BAPI through which we can able to check the roles "BAPI_USER_GET_DETAIL", but found nothing through which we can change expiry date of the role assigned to the user.
Please suggest some solution for this.
Thanks.
11-08-2013 9:57 AM
Check below Steps..
OR
Fetch All Respective Role Name from 'AGR_USERS" Table for Particular User and then Pass the Role Name with New dates as per your requirement to FM SUSR_BAPI_USER_ACTGROUPS_ASSIG .
Regard's
Smruti
11-08-2013 9:30 AM
Hi prachi,
i've no experience with roles through abap,
but i think this function may help you : SUSR_USER_SURFACE_MAINT_ATTRIB.
it has a table parameter typed with structure called USAGR that is the same that you have in the Roles Maintenance screen in SU01
Hope it helps,
Regards
11-08-2013 9:51 AM
Hi Enrique,
Thanks for the instant reply.
SUSR_USER_SURFACE_MAINT_ATTRIB has Role , From and To in structure USAGR, but this function module does not allow for change the Date of Role.
Can you suggest some other solution for this?
11-08-2013 10:03 AM
i'm sorry... my answer was wrong.
Instead i've tested Smruti Ranjan Mohanty solution below and i've modify my user role ...
Smruti Ranjan Mohanty solution is correct
Good to know, thats new for me, thanks Smruti!
Regards
11-08-2013 9:57 AM
Check below Steps..
OR
Fetch All Respective Role Name from 'AGR_USERS" Table for Particular User and then Pass the Role Name with New dates as per your requirement to FM SUSR_BAPI_USER_ACTGROUPS_ASSIG .
Regard's
Smruti
11-08-2013 10:23 AM
11-08-2013 10:31 AM
Prachi,
This will work.
Regards
Vivek Goyal
11-08-2013 11:20 AM
HI Vivek,
I have done the same, but the BAPI is not working. I have written following code for it:
LOOP AT it_agr_users INTO wa_agr_users WHERE uname = gs_usr02-bname.
username = gs_usr02-bname.
activitygroups-agr_name = wa_agr_users-agr_name.
activitygroups-from_dat = wa_agr_users-from_dat.
activitygroups-to_dat = sy-datum.
CALL FUNCTION 'BAPI_USER_ACTGROUPS_ASSIGN'
EXPORTING
username = username
tables
activitygroups = activitygroups
return = it3_return.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
Here it_agr_users contains all the users whose role expiry date needs to be modified.
Please suggest.
11-08-2013 12:07 PM
Check these Notes :
320460 - BAPI_USER_ACTGROUPS_ASSIGN: Perfo. problems
1240208 - BAPI_USER_ACTGROUPS_ASSIGN: Profile is not assigned
1505943 - BAPI_USER_ACTGROUPS_ASSIGN: Incorrect merging
Regard's
Smruti
11-09-2013 3:45 AM
Prachi,
I tried with SUSR_BAPI_USER_ACTGROUPS_ASSIG this only. And it it working for me.
What is the error you are getting in return table?