05-14-2020 7:29 AM
Hi all,
Is there FM/BAPI for deleting specific Profiles in user ?
if it's not there, how to delete it using abap?
Thank's
05-14-2020 8:36 AM
I am not a developer, but maybe I would try this first (assuming that you meant local profiles):
1. Get the list of the currently assigned profiles to the user with BAPI_USER_GET_DETAIL.
2. Delete all assigned profiles with BAPI_USER_PROFILES_DELETE.
3. Assign the profiles which you need to keep with BAPI_USER_PROFILES_ASSIGN.
Frankly speaking, I would use SU10 unless there is a very good reason for custom development.
05-14-2020 8:36 AM
I am not a developer, but maybe I would try this first (assuming that you meant local profiles):
1. Get the list of the currently assigned profiles to the user with BAPI_USER_GET_DETAIL.
2. Delete all assigned profiles with BAPI_USER_PROFILES_DELETE.
3. Assign the profiles which you need to keep with BAPI_USER_PROFILES_ASSIGN.
Frankly speaking, I would use SU10 unless there is a very good reason for custom development.
05-14-2020 10:31 AM
Okay Veselina
Initially I also thought that way, I thought there was an FM that covered all processes.
But, many thanks for your time
05-22-2020 10:31 AM
Hi Veselina,
Ur scenario succes with Composite Profile, but not working with Generate Profile.
I have profile like this :
SAP_ALL is Composite Profile
Why cannot Generate Profile?
05-22-2020 1:06 PM
For generated profiles I think that a better approach is to add or remove these through role assignment.
While it is possible to delete generated profiles via BAPI_USER_PROFILES_DELETE it does not seem the right thing to do, because the role will still be present in the user data, but without any profile.
For generated profiles I would use BAPI_USER_ACTGROUPS_DELETE and
BAPI_USER_ACTGROUPS_ASSIGN.
So, if you have a combination of profiles linked to roles and you have SAP_ALL for an user:
1. Use BAPI_USER_GET_DETAIL to find this out (you have the roles in ACTIVITYGROUPS and the generated profiles are in PROFILES with BAPITYPE = 'G'. You also get the role validity, which you might need at a later stage if you want to assign them again.
2. Delete the role assignments with BAPI_USER_ACTGROUPS_DELETE.
3. Delete SAP_ALL with BAPI_USER_PROFILES_DELETE.
4. Add the roles which you need with BAPI_USER_ACTGROUPS_ASSIGN.
5. Add the composite profiles (if needed).