Skip to Content

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

Hey,

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!

unbenannt1.png (2.7 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Jan 30, 2017 at 12:43 PM

    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. :)

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 25, 2017 at 08:22 AM

    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?

    Add comment
    10|10000 characters needed characters exceeded

    • 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.

  • Jan 27, 2017 at 08:21 AM

    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'.

    BAPI_USER_GET_DETAIL 
    > BAPI_USER_CREATE1, BAPI_USER_ACTGROUPS_ASSIGN, BAPI_USER_PROFILES_ASSIGN
    BAPI_USER_WP_PERS_DATA_READ
    > BAPI_USER_WP_PERS_DATA_SAVE
    etc.

    Regards,
    Raymond

    Add comment
    10|10000 characters needed characters exceeded