Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

Use reference user to create new user, assign defaults and roles

0 Kudos


I Need to create a new user via the function module 'BAPI_USER_CREATE1'. I'm using the ref_user value to Hand over a reference user.

The Problem is that the values in section 'defaults' aren't assigned. Also the roles are not visible until a click on the button next to the reference user (like shown in the picture).

So how can I assign values like 'Defaults' and 'Roles' from a reference user to my new user. Do I have to do that manually with reading a table and using another function module?

Thanks for any hints!


0 Kudos

Ok the problem with the default values and so is solved. I just pass them through with the parameter structure 'defaults' in the function module. I missed that part at first.

But the problem with the roles remain. Are they assigned already if it looks like in the picture shown in my question above?

I think you have a slight misunderstanding about the reference user. You have created an inheritance instead of direct role assignments. If you change your reference users' rights it will immediately affect all user accounts that refer to this user.

I'd like to suggest you either assign roles in a separate action after creating the users or start creating the users as a complete copy of your 'reference user' to get the correct role assignments right away.

Ah ok. Thanks for the explanation, helps me very much 🙂 Answers like that are always very helpful because they don't just solve the problem but help understandig the source of it and how to avoid it in the future. That's how young developers can step forward. So thank you very much for your help on this topic 🙂 I will describe the solution I'm using right now in a comment below.

Active Contributor
0 Kudos

If you actually want to copy an user and not build an inheritance as Jurjen wrote, better read and copy data from 'reference user' to 'new user'.




Hey thanks for your help! 🙂

I managed it like this right now:

I'm getting the reference user's roles with function module 'BAPI_USER_GET_DETAIL' and save them in an internal table. Then I create a new user with 'BAPI_USER_CREATE1' and afterwards I assign the roles via the function module: 'BAPI_USER_ACTGROUPS_ASSIGN'.

That works for us right now pretty good. 🙂