<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: BI Analysis authorization concept to ECC transactions in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153487#M1514942</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BI authorization concept is not possible with R3 or ECC system. It is totally different approach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dynamic authorization is also not possible with coding. And suggested never try that.The research will be a waste of time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have created program to update user id with profile.This will create new authorization in authorization object and will add that to new Z profile.&lt;/P&gt;&lt;P&gt;following function modules can be used for this.&lt;/P&gt;&lt;P&gt;SUSR_AUTH_CREATE&lt;/P&gt;&lt;P&gt;SUSR_INTERFACE_PROF&lt;/P&gt;&lt;P&gt;SUSR_INTERFACE_USER&lt;/P&gt;&lt;P&gt;SUSR_USER_AUTH_FOR_OBJ_GET&lt;/P&gt;&lt;P&gt;SUSR_USER_PROFS_BUFFER_CLEAR&lt;/P&gt;&lt;P&gt;SUSR_USER_PROFS_REMOVE_ONE&lt;/P&gt;&lt;P&gt;SUSR_USER_PROFS_BUFFER_TO_DB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Following is the program to add new profile to SAP user id.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Following program read Z table data and create profile and add same to SAP user id.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report  zbasisr_costcenter_auth.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;constants : c_auth_obj(06)   type c value 'K_CCA'.&lt;/P&gt;&lt;P&gt;data : it_zbas_costcenter    type standard table of zbas_costcenter,&lt;/P&gt;&lt;P&gt;       wa_zbas_costcenter    type zbas_costcenter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:  agrs     like agr_texts occurs 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: it_tcodes          type standard table of ssm_tcodes,&lt;/P&gt;&lt;P&gt;      wa_tcodes          type  ssm_tcodes,&lt;/P&gt;&lt;P&gt;      it_hierarchy_nodes type  standard table of smensapnew,&lt;/P&gt;&lt;P&gt;      it_hierarchy_texts type  standard table of smencust .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : l_object    type  usr12-objct,&lt;/P&gt;&lt;P&gt;       l_auth_name type  usr12-auth,&lt;/P&gt;&lt;P&gt;       l_auth_text type  usr13-atext,&lt;/P&gt;&lt;P&gt;       l_timezone(12)  type c,&lt;/P&gt;&lt;P&gt;       l_btyp type  usr12-typ.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: it_fieldvalues type standard table of user12,&lt;/P&gt;&lt;P&gt;      wa_fieldvalues type user12.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: it_usval type standard table of usval,&lt;/P&gt;&lt;P&gt;      wa_usval type usval.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : l_profile type  usr10-profn,&lt;/P&gt;&lt;P&gt;       l_ptext  type  usr11-ptext.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: it_auths type standard table of usaut,&lt;/P&gt;&lt;P&gt;      wa_auths type usaut.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : it_prof_in type standard table of  uspro,&lt;/P&gt;&lt;P&gt;      it_prof_out type standard table of  uspro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data :  l_user    type usr04-bname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types: begin of ty_usr10,&lt;/P&gt;&lt;P&gt;        profn type usr10-profn,&lt;/P&gt;&lt;P&gt;       end of ty_usr10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: it_usr10 type standard table of ty_usr10,&lt;/P&gt;&lt;P&gt;       wa_usr10 type ty_usr10.&lt;/P&gt;&lt;P&gt;data:l_counter(9) type c,&lt;/P&gt;&lt;P&gt;     i_counter(9) type i,&lt;/P&gt;&lt;P&gt;     l_pac_count(9) type p.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : it_values type standard table of usvalues,&lt;/P&gt;&lt;P&gt;       wa_values type usvalues,&lt;/P&gt;&lt;P&gt;       l_remove_profile type usr10-profn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;selection-screen skip 1.&lt;/P&gt;&lt;P&gt;selection-screen begin of block blk1 with frame.&lt;/P&gt;&lt;P&gt;parameters   p_run as checkbox ."default 'X'.&lt;/P&gt;&lt;P&gt;selection-screen end of block blk1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;STRONG&gt;-----START OF SELECTION -&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="---------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;*if test run is selected&lt;/P&gt;&lt;P&gt;  if p_run is not initial.&lt;/P&gt;&lt;P&gt;    perform f_role_create.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  f_role_create&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form f_role_create .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  refresh it_zbas_costcenter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  select * from zbas_costcenter&lt;/P&gt;&lt;P&gt;          into corresponding fields of table it_zbas_costcenter&lt;/P&gt;&lt;P&gt;          where zto_updt = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  loop at it_zbas_costcenter into wa_zbas_costcenter.&lt;/P&gt;&lt;P&gt;    clear:l_object,l_auth_text,l_btyp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    l_object = c_auth_obj.  "'K_CCA'.&lt;/P&gt;&lt;P&gt;    l_auth_text = 'Auto generated Authorization'.&lt;/P&gt;&lt;P&gt;    l_btyp = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    refresh it_usr10.&lt;/P&gt;&lt;P&gt;    select profn&lt;/P&gt;&lt;P&gt;           from usr10&lt;/P&gt;&lt;P&gt;           into corresponding fields of table it_usr10&lt;/P&gt;&lt;P&gt;           where profn like 'ZAU%'.&lt;/P&gt;&lt;P&gt;    sort it_usr10 descending by profn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear l_counter.&lt;/P&gt;&lt;P&gt;    if it_usr10[] is initial.&lt;/P&gt;&lt;P&gt;      l_counter = '0'.&lt;/P&gt;&lt;P&gt;    else.&lt;/P&gt;&lt;P&gt;      clear wa_usr10.&lt;/P&gt;&lt;P&gt;      read table it_usr10 into wa_usr10 index 1.&lt;/P&gt;&lt;P&gt;      if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        l_counter = wa_usr10-profn+03(09).&lt;/P&gt;&lt;P&gt;        l_counter = l_counter + 1.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear l_pac_count.&lt;/P&gt;&lt;P&gt;    l_pac_count = l_counter.&lt;/P&gt;&lt;P&gt;    unpack l_pac_count to l_counter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear l_auth_name.&lt;/P&gt;&lt;P&gt;    concatenate 'ZAU' l_counter into l_auth_name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*add action type&lt;/P&gt;&lt;P&gt;    clear wa_fieldvalues.&lt;/P&gt;&lt;P&gt;    wa_fieldvalues-field = 'CO_ACTION'.&lt;/P&gt;&lt;P&gt;    wa_fieldvalues-von = '0001'.&lt;/P&gt;&lt;P&gt;    wa_fieldvalues-bis = '0008'.&lt;/P&gt;&lt;P&gt;    append wa_fieldvalues to it_fieldvalues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*add controlling area&lt;/P&gt;&lt;P&gt;    clear wa_fieldvalues.&lt;/P&gt;&lt;P&gt;    wa_fieldvalues-field =  'RESPAREA' .&lt;/P&gt;&lt;P&gt;    wa_fieldvalues-von = wa_zbas_costcenter-zco_area."'*'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   wa_fieldvalues-bis = '*'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    append wa_fieldvalues to it_fieldvalues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*add cost elements&lt;/P&gt;&lt;P&gt;    clear wa_fieldvalues.&lt;/P&gt;&lt;P&gt;    wa_fieldvalues-field =  'KSTAR'.&lt;/P&gt;&lt;P&gt;    wa_fieldvalues-von = wa_zbas_costcenter-zkostl_from.    "'600000' .&lt;/P&gt;&lt;P&gt;    wa_fieldvalues-bis = wa_zbas_costcenter-zkostl_to.      "'600010' .&lt;/P&gt;&lt;P&gt;    append wa_fieldvalues to it_fieldvalues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    call function 'SUSR_AUTH_CREATE'&lt;/P&gt;&lt;P&gt;      exporting&lt;/P&gt;&lt;P&gt;        object_                 = l_object&lt;/P&gt;&lt;P&gt;        auth_name               = l_auth_name&lt;/P&gt;&lt;P&gt;        auth_text               = l_auth_text&lt;/P&gt;&lt;P&gt;        btyp                    = l_btyp&lt;/P&gt;&lt;P&gt;      tables&lt;/P&gt;&lt;P&gt;        fieldvalues             = it_fieldvalues&lt;/P&gt;&lt;P&gt;      exceptions&lt;/P&gt;&lt;P&gt;        object_not_exist        = 1&lt;/P&gt;&lt;P&gt;        auth_already_exists     = 2&lt;/P&gt;&lt;P&gt;        fieldvalues_wrong_input = 3&lt;/P&gt;&lt;P&gt;        others                  = 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    if sy-subrc = 0." if authorization is added&lt;/P&gt;&lt;P&gt;      commit work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; 'New Authorization',l_auth_name,' is added to K_CCA.'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*create profile with same name as authorizaion name&lt;/P&gt;&lt;P&gt;      clear:l_profile,l_ptext.&lt;/P&gt;&lt;P&gt;      l_profile = l_auth_name.&lt;/P&gt;&lt;P&gt;      l_ptext  = 'Auto Generated Profile '.&lt;/P&gt;&lt;P&gt;      .&lt;/P&gt;&lt;P&gt;*add action type&lt;/P&gt;&lt;P&gt;      refresh it_usval.&lt;/P&gt;&lt;P&gt;      clear wa_usval.&lt;/P&gt;&lt;P&gt;      wa_usval-objct = c_auth_obj. "'K_CCA'.&lt;/P&gt;&lt;P&gt;      wa_usval-auth = l_auth_name.&lt;/P&gt;&lt;P&gt;      wa_usval-sfield = 'CO_ACTION'.&lt;/P&gt;&lt;P&gt;*wa_USVAL-LNG =&lt;/P&gt;&lt;P&gt;      wa_usval-von = '0001'.&lt;/P&gt;&lt;P&gt;      wa_usval-bis = '0008'.&lt;/P&gt;&lt;P&gt;      append wa_usval to it_usval.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*add cost elements as per table&lt;/P&gt;&lt;P&gt;      clear wa_usval.&lt;/P&gt;&lt;P&gt;      wa_usval-objct =  c_auth_obj. " 'K_CCA'.&lt;/P&gt;&lt;P&gt;      wa_usval-auth = l_auth_name.&lt;/P&gt;&lt;P&gt;      wa_usval-sfield = 'KSTAR'.&lt;/P&gt;&lt;P&gt;*wa_USVAL-LNG =&lt;/P&gt;&lt;P&gt;      wa_usval-von = wa_zbas_costcenter-zkostl_from.        "'600000'.&lt;/P&gt;&lt;P&gt;      wa_usval-bis = wa_zbas_costcenter-zkostl_to.          "'600010'.&lt;/P&gt;&lt;P&gt;      append wa_usval to it_usval.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*add controlling area&lt;/P&gt;&lt;P&gt;      clear wa_usval.&lt;/P&gt;&lt;P&gt;      wa_usval-objct =  c_auth_obj. "'K_CCA'.&lt;/P&gt;&lt;P&gt;      wa_usval-auth = l_auth_name.&lt;/P&gt;&lt;P&gt;      wa_usval-sfield = 'RESPAREA'.&lt;/P&gt;&lt;P&gt;*wa_USVAL-LNG =&lt;/P&gt;&lt;P&gt;      wa_usval-von = wa_zbas_costcenter-zco_area."'*'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     wa_usval-bis = '*'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      append wa_usval to it_usval.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      refresh it_auths.&lt;/P&gt;&lt;P&gt;      clear wa_auths.&lt;/P&gt;&lt;P&gt;      wa_auths-objct =  c_auth_obj. "'K_CCA'.&lt;/P&gt;&lt;P&gt;      wa_auths-auth = l_auth_name.&lt;/P&gt;&lt;P&gt;      wa_auths-atext = l_auth_text.&lt;/P&gt;&lt;P&gt;      append wa_auths to it_auths.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      refresh :it_prof_in,it_prof_out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      call function 'SUSR_INTERFACE_PROF'&lt;/P&gt;&lt;P&gt;       exporting&lt;/P&gt;&lt;P&gt;         profile                          = l_profile&lt;/P&gt;&lt;P&gt;         ptext                            = l_ptext&lt;/P&gt;&lt;P&gt;         ptype                            = ' '&lt;/P&gt;&lt;P&gt;         action                           = '01'&lt;/P&gt;&lt;P&gt;         no_check_in_create_mode          = 'X'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    NO_CHECK_IN_UPDATE_MODE          = ' '&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          dialog                           = 'X'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  IMPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    PSTATE                           =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        tables&lt;/P&gt;&lt;P&gt;          values                           = it_usval&lt;/P&gt;&lt;P&gt;          auths                            = it_auths&lt;/P&gt;&lt;P&gt;          prof_in                          = it_prof_in&lt;/P&gt;&lt;P&gt;          prof_out                         = it_prof_out&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    AUTH_OUT                         =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;       exceptions&lt;/P&gt;&lt;P&gt;         not_authorized_for_auth          = 1&lt;/P&gt;&lt;P&gt;         params_incomplete                = 2&lt;/P&gt;&lt;P&gt;         not_authorized_for_profile       = 3&lt;/P&gt;&lt;P&gt;         profile_exists                   = 4&lt;/P&gt;&lt;P&gt;         auth_exists                      = 5&lt;/P&gt;&lt;P&gt;         colective_profile                = 6&lt;/P&gt;&lt;P&gt;         bad_profile_name                 = 7&lt;/P&gt;&lt;P&gt;         bad_auth_name                    = 8&lt;/P&gt;&lt;P&gt;         profile_dont_exist               = 9&lt;/P&gt;&lt;P&gt;         authorization_overflow           = 10&lt;/P&gt;&lt;P&gt;         shorttext_missing                = 11&lt;/P&gt;&lt;P&gt;         others                           = 12&lt;/P&gt;&lt;P&gt;                .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      if sy-subrc = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; if profile created&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        commit work.&lt;/P&gt;&lt;P&gt;        write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; 'New Profile',l_profile,' is created.'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        clear l_user.&lt;/P&gt;&lt;P&gt;        l_user = wa_zbas_costcenter-zuserid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        call function 'SUSR_INTERFACE_USER'&lt;/P&gt;&lt;P&gt;          exporting&lt;/P&gt;&lt;P&gt;            profile                    = l_profile&lt;/P&gt;&lt;P&gt;            user                       = l_user&lt;/P&gt;&lt;P&gt;            action                     = 'I'&lt;/P&gt;&lt;P&gt;          exceptions&lt;/P&gt;&lt;P&gt;            params_incomplete          = 1&lt;/P&gt;&lt;P&gt;            not_authorized_for_user    = 2&lt;/P&gt;&lt;P&gt;            not_authorized_for_profile = 3&lt;/P&gt;&lt;P&gt;            profile_doesnt_exist       = 4&lt;/P&gt;&lt;P&gt;            user_doesnt_exist          = 5&lt;/P&gt;&lt;P&gt;            profile_already_in_user    = 6&lt;/P&gt;&lt;P&gt;            profile_wasnt_in_user      = 7&lt;/P&gt;&lt;P&gt;            user_locked                = 8&lt;/P&gt;&lt;P&gt;            bad_action                 = 9&lt;/P&gt;&lt;P&gt;            others                     = 10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;*if profile is added to SAP user id&lt;/P&gt;&lt;P&gt;          commit work.&lt;/P&gt;&lt;P&gt;          write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; 'New Profile',l_profile,' is added to user',l_user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*set updation flag as blank and changed on date&lt;/P&gt;&lt;P&gt;          update zbas_costcenter&lt;/P&gt;&lt;P&gt;                set zto_updt = ''&lt;/P&gt;&lt;P&gt;                    zaedtm = sy-datum&lt;/P&gt;&lt;P&gt;                 where zuserid = wa_zbas_costcenter-zuserid&lt;/P&gt;&lt;P&gt;                 and   zto_updt = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*get authorization profiles w.r.t. auth object K_CCA&lt;/P&gt;&lt;P&gt;          refresh it_values.&lt;/P&gt;&lt;P&gt;          call function 'SUSR_USER_AUTH_FOR_OBJ_GET'&lt;/P&gt;&lt;P&gt;            exporting&lt;/P&gt;&lt;P&gt;              new_buffering       = '3'&lt;/P&gt;&lt;P&gt;              mandant             = sy-mandt&lt;/P&gt;&lt;P&gt;              user_name           = l_user&lt;/P&gt;&lt;P&gt;              sel_object          = 'K_CCA'&lt;/P&gt;&lt;P&gt;            tables&lt;/P&gt;&lt;P&gt;              values              = it_values&lt;/P&gt;&lt;P&gt;            exceptions&lt;/P&gt;&lt;P&gt;              user_name_not_exist = 1&lt;/P&gt;&lt;P&gt;              not_authorized      = 2&lt;/P&gt;&lt;P&gt;              internal_error      = 3&lt;/P&gt;&lt;P&gt;              others              = 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;*delete profile record which is newly created from internal table&lt;/P&gt;&lt;P&gt;            delete it_values where auth = l_profile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*delete other profiles which are started with ZAU for this user&lt;/P&gt;&lt;P&gt;            loop at it_values into wa_values where auth(03) = 'ZAU' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              l_remove_profile = wa_values-auth.&lt;/P&gt;&lt;P&gt;              call function 'SUSR_USER_PROFS_BUFFER_CLEAR'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              call function 'SUSR_USER_PROFS_REMOVE_ONE'&lt;/P&gt;&lt;P&gt;                exporting&lt;/P&gt;&lt;P&gt;                  user_name           = l_user&lt;/P&gt;&lt;P&gt;                  profile             = l_remove_profile&lt;/P&gt;&lt;P&gt;                exceptions&lt;/P&gt;&lt;P&gt;                  user_name_not_exist = 1&lt;/P&gt;&lt;P&gt;                  others              = 2.&lt;/P&gt;&lt;P&gt;              if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;                commit work.&lt;/P&gt;&lt;P&gt;                call function 'SUSR_USER_PROFS_BUFFER_TO_DB'&lt;/P&gt;&lt;P&gt;                  exceptions&lt;/P&gt;&lt;P&gt;                    others = 0.&lt;/P&gt;&lt;P&gt;              endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              clear wa_values.&lt;/P&gt;&lt;P&gt;            endloop.&lt;/P&gt;&lt;P&gt;          endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear wa_zbas_costcenter.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;endform.                    " F_ROLE_CREATE&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 Aug 2010 08:15:16 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2010-08-31T08:15:16Z</dc:date>
    <item>
      <title>BI Analysis authorization concept to ECC transactions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153479#M1514934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can we implement BI Analysis authorization concept into ECC.?&lt;/P&gt;&lt;P&gt;Analysis authorization is carried out by transaction RSECADMIN  in BI, this authorization cocept works on inforpviders.&lt;/P&gt;&lt;P&gt;Can we implement same auto generation of profile for create,modify,change transasctions in ECC.?&lt;/P&gt;&lt;P&gt;Multiple profiles assign to multiple users with same role but different values for each user dynamically..&lt;/P&gt;&lt;P&gt;Let me know if any one have any idea on this.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kalpesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Aug 2010 09:16:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153479#M1514934</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-25T09:16:46Z</dc:date>
    </item>
    <item>
      <title>Re: BI Analysis authorization concept to ECC transactions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153480#M1514935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No, you cannot use variables in user authorizations at runtime of authority-checks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Slightly similar would be parametere ID's, user personalization keys, validations, check-tables, hardcoding, etc... but you have to maintain all of that which is not fun.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rather build goog quality roles.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Julius&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Aug 2010 09:46:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153480#M1514935</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-25T09:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: BI Analysis authorization concept to ECC transactions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153481#M1514936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;I created a program to create role as per template role and updated that to SAP user id with newly created profile.&lt;/P&gt;&lt;P&gt;I used below function modules for same.&lt;/P&gt;&lt;P&gt;PRGN_RFC_CREATE_ACTIVITY_GROUP - to create role&lt;/P&gt;&lt;P&gt;BAPI_USER_ACTGROUPS_ASSIGN - to assign profile&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As per my analysis we can create one profile for one role which will contain authorized values&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;But requirement is to keep one role with dynamic assignment of values which I dont ´think possible..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried below approach. Let me know if  SAP recommends this for authorization concept instead of going through PFCG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1.create new authorization for a authorization object and maintain values here. via transaction SU03&lt;/P&gt;&lt;P&gt;2.create new profile via transaction SU02 with above created authorization,&lt;/P&gt;&lt;P&gt;3.then assign this profile to user id.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Above approach will not create any role . But I am not sure whether this is recommended.&lt;/P&gt;&lt;P&gt;I tried to search any function modules to create profile without role but didnt find anything. &lt;/P&gt;&lt;P&gt;Kindly let me know if any one have any idea.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Kalpesh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Aug 2010 10:21:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153481#M1514936</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-25T10:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: BI Analysis authorization concept to ECC transactions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153482#M1514937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You will still need to assign the manual profile to the user. That is not a best practice and is very far away from "dynamic"...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Julius&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Aug 2010 10:52:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153482#M1514937</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-25T10:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: BI Analysis authorization concept to ECC transactions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153483#M1514938</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Julius,&lt;/P&gt;&lt;P&gt;Let me know if you have any idea regarding any BAPIs or function modules which will help me to create authorization or to create profile with only authorization and no roll&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Kalpesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Aug 2010 11:22:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153483#M1514938</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-25T11:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: BI Analysis authorization concept to ECC transactions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153484#M1514939</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will need to modify the code for &lt;EM&gt;every&lt;/EM&gt; transaction (or group of functions) that you want to give access to in this way.  It is a massive piece of work that requires the use of exits / enhancement points and &lt;EM&gt;significant&lt;/EM&gt; modification to standard SAP code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been there and done that for 1 module in SAP for a medium sized customer.  The costs significantly outweigh the benefits and it is not something I would ever recommend again as there are more effective and cheaper ways of achieving and maintaining authorisation controls.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Aug 2010 12:23:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153484#M1514939</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-25T12:23:16Z</dc:date>
    </item>
    <item>
      <title>Re: BI Analysis authorization concept to ECC transactions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153485#M1514940</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks..&lt;/P&gt;&lt;P&gt;even I am not recommending this to client. But just getting some expert opinion from sdn..&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;Kalpesh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Aug 2010 12:26:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153485#M1514940</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-25T12:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: BI Analysis authorization concept to ECC transactions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153486#M1514941</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There are no released API's to the ABAP authorizations maintenance. You cannot change the behaviour of the AUTHORITY-CHECK statement as you cannot access the coding behind it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So... you would need to change all the programs to use a different construct than the (SAP owned) locations of the authority-checks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see from Alex's advise, you will need to take lots of camels and water with you on that journey because there are about 3 million programs in ECC... &lt;SPAN __jive_emoticon_name="wink"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Julius&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Aug 2010 12:27:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153486#M1514941</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-25T12:27:25Z</dc:date>
    </item>
    <item>
      <title>Re: BI Analysis authorization concept to ECC transactions</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153487#M1514942</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BI authorization concept is not possible with R3 or ECC system. It is totally different approach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dynamic authorization is also not possible with coding. And suggested never try that.The research will be a waste of time.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have created program to update user id with profile.This will create new authorization in authorization object and will add that to new Z profile.&lt;/P&gt;&lt;P&gt;following function modules can be used for this.&lt;/P&gt;&lt;P&gt;SUSR_AUTH_CREATE&lt;/P&gt;&lt;P&gt;SUSR_INTERFACE_PROF&lt;/P&gt;&lt;P&gt;SUSR_INTERFACE_USER&lt;/P&gt;&lt;P&gt;SUSR_USER_AUTH_FOR_OBJ_GET&lt;/P&gt;&lt;P&gt;SUSR_USER_PROFS_BUFFER_CLEAR&lt;/P&gt;&lt;P&gt;SUSR_USER_PROFS_REMOVE_ONE&lt;/P&gt;&lt;P&gt;SUSR_USER_PROFS_BUFFER_TO_DB&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Following is the program to add new profile to SAP user id.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Following program read Z table data and create profile and add same to SAP user id.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;report  zbasisr_costcenter_auth.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;constants : c_auth_obj(06)   type c value 'K_CCA'.&lt;/P&gt;&lt;P&gt;data : it_zbas_costcenter    type standard table of zbas_costcenter,&lt;/P&gt;&lt;P&gt;       wa_zbas_costcenter    type zbas_costcenter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data:  agrs     like agr_texts occurs 0 with header line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: it_tcodes          type standard table of ssm_tcodes,&lt;/P&gt;&lt;P&gt;      wa_tcodes          type  ssm_tcodes,&lt;/P&gt;&lt;P&gt;      it_hierarchy_nodes type  standard table of smensapnew,&lt;/P&gt;&lt;P&gt;      it_hierarchy_texts type  standard table of smencust .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : l_object    type  usr12-objct,&lt;/P&gt;&lt;P&gt;       l_auth_name type  usr12-auth,&lt;/P&gt;&lt;P&gt;       l_auth_text type  usr13-atext,&lt;/P&gt;&lt;P&gt;       l_timezone(12)  type c,&lt;/P&gt;&lt;P&gt;       l_btyp type  usr12-typ.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: it_fieldvalues type standard table of user12,&lt;/P&gt;&lt;P&gt;      wa_fieldvalues type user12.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: it_usval type standard table of usval,&lt;/P&gt;&lt;P&gt;      wa_usval type usval.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : l_profile type  usr10-profn,&lt;/P&gt;&lt;P&gt;       l_ptext  type  usr11-ptext.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: it_auths type standard table of usaut,&lt;/P&gt;&lt;P&gt;      wa_auths type usaut.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : it_prof_in type standard table of  uspro,&lt;/P&gt;&lt;P&gt;      it_prof_out type standard table of  uspro.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data :  l_user    type usr04-bname.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;types: begin of ty_usr10,&lt;/P&gt;&lt;P&gt;        profn type usr10-profn,&lt;/P&gt;&lt;P&gt;       end of ty_usr10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data: it_usr10 type standard table of ty_usr10,&lt;/P&gt;&lt;P&gt;       wa_usr10 type ty_usr10.&lt;/P&gt;&lt;P&gt;data:l_counter(9) type c,&lt;/P&gt;&lt;P&gt;     i_counter(9) type i,&lt;/P&gt;&lt;P&gt;     l_pac_count(9) type p.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data : it_values type standard table of usvalues,&lt;/P&gt;&lt;P&gt;       wa_values type usvalues,&lt;/P&gt;&lt;P&gt;       l_remove_profile type usr10-profn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;selection-screen skip 1.&lt;/P&gt;&lt;P&gt;selection-screen begin of block blk1 with frame.&lt;/P&gt;&lt;P&gt;parameters   p_run as checkbox ."default 'X'.&lt;/P&gt;&lt;P&gt;selection-screen end of block blk1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&lt;STRONG&gt;-----START OF SELECTION -&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="---------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;start-of-selection.&lt;/P&gt;&lt;P&gt;*if test run is selected&lt;/P&gt;&lt;P&gt;  if p_run is not initial.&lt;/P&gt;&lt;P&gt;    perform f_role_create.&lt;/P&gt;&lt;P&gt;  endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;end-of-selection.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*&amp;amp;      Form  f_role_create&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;amp;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      text&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;form f_role_create .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  refresh it_zbas_costcenter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  select * from zbas_costcenter&lt;/P&gt;&lt;P&gt;          into corresponding fields of table it_zbas_costcenter&lt;/P&gt;&lt;P&gt;          where zto_updt = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  loop at it_zbas_costcenter into wa_zbas_costcenter.&lt;/P&gt;&lt;P&gt;    clear:l_object,l_auth_text,l_btyp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    l_object = c_auth_obj.  "'K_CCA'.&lt;/P&gt;&lt;P&gt;    l_auth_text = 'Auto generated Authorization'.&lt;/P&gt;&lt;P&gt;    l_btyp = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    refresh it_usr10.&lt;/P&gt;&lt;P&gt;    select profn&lt;/P&gt;&lt;P&gt;           from usr10&lt;/P&gt;&lt;P&gt;           into corresponding fields of table it_usr10&lt;/P&gt;&lt;P&gt;           where profn like 'ZAU%'.&lt;/P&gt;&lt;P&gt;    sort it_usr10 descending by profn.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear l_counter.&lt;/P&gt;&lt;P&gt;    if it_usr10[] is initial.&lt;/P&gt;&lt;P&gt;      l_counter = '0'.&lt;/P&gt;&lt;P&gt;    else.&lt;/P&gt;&lt;P&gt;      clear wa_usr10.&lt;/P&gt;&lt;P&gt;      read table it_usr10 into wa_usr10 index 1.&lt;/P&gt;&lt;P&gt;      if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;        l_counter = wa_usr10-profn+03(09).&lt;/P&gt;&lt;P&gt;        l_counter = l_counter + 1.&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear l_pac_count.&lt;/P&gt;&lt;P&gt;    l_pac_count = l_counter.&lt;/P&gt;&lt;P&gt;    unpack l_pac_count to l_counter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear l_auth_name.&lt;/P&gt;&lt;P&gt;    concatenate 'ZAU' l_counter into l_auth_name.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*add action type&lt;/P&gt;&lt;P&gt;    clear wa_fieldvalues.&lt;/P&gt;&lt;P&gt;    wa_fieldvalues-field = 'CO_ACTION'.&lt;/P&gt;&lt;P&gt;    wa_fieldvalues-von = '0001'.&lt;/P&gt;&lt;P&gt;    wa_fieldvalues-bis = '0008'.&lt;/P&gt;&lt;P&gt;    append wa_fieldvalues to it_fieldvalues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*add controlling area&lt;/P&gt;&lt;P&gt;    clear wa_fieldvalues.&lt;/P&gt;&lt;P&gt;    wa_fieldvalues-field =  'RESPAREA' .&lt;/P&gt;&lt;P&gt;    wa_fieldvalues-von = wa_zbas_costcenter-zco_area."'*'.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   wa_fieldvalues-bis = '*'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    append wa_fieldvalues to it_fieldvalues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*add cost elements&lt;/P&gt;&lt;P&gt;    clear wa_fieldvalues.&lt;/P&gt;&lt;P&gt;    wa_fieldvalues-field =  'KSTAR'.&lt;/P&gt;&lt;P&gt;    wa_fieldvalues-von = wa_zbas_costcenter-zkostl_from.    "'600000' .&lt;/P&gt;&lt;P&gt;    wa_fieldvalues-bis = wa_zbas_costcenter-zkostl_to.      "'600010' .&lt;/P&gt;&lt;P&gt;    append wa_fieldvalues to it_fieldvalues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    call function 'SUSR_AUTH_CREATE'&lt;/P&gt;&lt;P&gt;      exporting&lt;/P&gt;&lt;P&gt;        object_                 = l_object&lt;/P&gt;&lt;P&gt;        auth_name               = l_auth_name&lt;/P&gt;&lt;P&gt;        auth_text               = l_auth_text&lt;/P&gt;&lt;P&gt;        btyp                    = l_btyp&lt;/P&gt;&lt;P&gt;      tables&lt;/P&gt;&lt;P&gt;        fieldvalues             = it_fieldvalues&lt;/P&gt;&lt;P&gt;      exceptions&lt;/P&gt;&lt;P&gt;        object_not_exist        = 1&lt;/P&gt;&lt;P&gt;        auth_already_exists     = 2&lt;/P&gt;&lt;P&gt;        fieldvalues_wrong_input = 3&lt;/P&gt;&lt;P&gt;        others                  = 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    if sy-subrc = 0." if authorization is added&lt;/P&gt;&lt;P&gt;      commit work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; 'New Authorization',l_auth_name,' is added to K_CCA.'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*create profile with same name as authorizaion name&lt;/P&gt;&lt;P&gt;      clear:l_profile,l_ptext.&lt;/P&gt;&lt;P&gt;      l_profile = l_auth_name.&lt;/P&gt;&lt;P&gt;      l_ptext  = 'Auto Generated Profile '.&lt;/P&gt;&lt;P&gt;      .&lt;/P&gt;&lt;P&gt;*add action type&lt;/P&gt;&lt;P&gt;      refresh it_usval.&lt;/P&gt;&lt;P&gt;      clear wa_usval.&lt;/P&gt;&lt;P&gt;      wa_usval-objct = c_auth_obj. "'K_CCA'.&lt;/P&gt;&lt;P&gt;      wa_usval-auth = l_auth_name.&lt;/P&gt;&lt;P&gt;      wa_usval-sfield = 'CO_ACTION'.&lt;/P&gt;&lt;P&gt;*wa_USVAL-LNG =&lt;/P&gt;&lt;P&gt;      wa_usval-von = '0001'.&lt;/P&gt;&lt;P&gt;      wa_usval-bis = '0008'.&lt;/P&gt;&lt;P&gt;      append wa_usval to it_usval.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*add cost elements as per table&lt;/P&gt;&lt;P&gt;      clear wa_usval.&lt;/P&gt;&lt;P&gt;      wa_usval-objct =  c_auth_obj. " 'K_CCA'.&lt;/P&gt;&lt;P&gt;      wa_usval-auth = l_auth_name.&lt;/P&gt;&lt;P&gt;      wa_usval-sfield = 'KSTAR'.&lt;/P&gt;&lt;P&gt;*wa_USVAL-LNG =&lt;/P&gt;&lt;P&gt;      wa_usval-von = wa_zbas_costcenter-zkostl_from.        "'600000'.&lt;/P&gt;&lt;P&gt;      wa_usval-bis = wa_zbas_costcenter-zkostl_to.          "'600010'.&lt;/P&gt;&lt;P&gt;      append wa_usval to it_usval.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*add controlling area&lt;/P&gt;&lt;P&gt;      clear wa_usval.&lt;/P&gt;&lt;P&gt;      wa_usval-objct =  c_auth_obj. "'K_CCA'.&lt;/P&gt;&lt;P&gt;      wa_usval-auth = l_auth_name.&lt;/P&gt;&lt;P&gt;      wa_usval-sfield = 'RESPAREA'.&lt;/P&gt;&lt;P&gt;*wa_USVAL-LNG =&lt;/P&gt;&lt;P&gt;      wa_usval-von = wa_zbas_costcenter-zco_area."'*'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;     wa_usval-bis = '*'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      append wa_usval to it_usval.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      refresh it_auths.&lt;/P&gt;&lt;P&gt;      clear wa_auths.&lt;/P&gt;&lt;P&gt;      wa_auths-objct =  c_auth_obj. "'K_CCA'.&lt;/P&gt;&lt;P&gt;      wa_auths-auth = l_auth_name.&lt;/P&gt;&lt;P&gt;      wa_auths-atext = l_auth_text.&lt;/P&gt;&lt;P&gt;      append wa_auths to it_auths.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      refresh :it_prof_in,it_prof_out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      call function 'SUSR_INTERFACE_PROF'&lt;/P&gt;&lt;P&gt;       exporting&lt;/P&gt;&lt;P&gt;         profile                          = l_profile&lt;/P&gt;&lt;P&gt;         ptext                            = l_ptext&lt;/P&gt;&lt;P&gt;         ptype                            = ' '&lt;/P&gt;&lt;P&gt;         action                           = '01'&lt;/P&gt;&lt;P&gt;         no_check_in_create_mode          = 'X'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    NO_CHECK_IN_UPDATE_MODE          = ' '&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          dialog                           = 'X'&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  IMPORTING&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    PSTATE                           =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        tables&lt;/P&gt;&lt;P&gt;          values                           = it_usval&lt;/P&gt;&lt;P&gt;          auths                            = it_auths&lt;/P&gt;&lt;P&gt;          prof_in                          = it_prof_in&lt;/P&gt;&lt;P&gt;          prof_out                         = it_prof_out&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;    AUTH_OUT                         =&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;       exceptions&lt;/P&gt;&lt;P&gt;         not_authorized_for_auth          = 1&lt;/P&gt;&lt;P&gt;         params_incomplete                = 2&lt;/P&gt;&lt;P&gt;         not_authorized_for_profile       = 3&lt;/P&gt;&lt;P&gt;         profile_exists                   = 4&lt;/P&gt;&lt;P&gt;         auth_exists                      = 5&lt;/P&gt;&lt;P&gt;         colective_profile                = 6&lt;/P&gt;&lt;P&gt;         bad_profile_name                 = 7&lt;/P&gt;&lt;P&gt;         bad_auth_name                    = 8&lt;/P&gt;&lt;P&gt;         profile_dont_exist               = 9&lt;/P&gt;&lt;P&gt;         authorization_overflow           = 10&lt;/P&gt;&lt;P&gt;         shorttext_missing                = 11&lt;/P&gt;&lt;P&gt;         others                           = 12&lt;/P&gt;&lt;P&gt;                .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      if sy-subrc = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; if profile created&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        commit work.&lt;/P&gt;&lt;P&gt;        write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; 'New Profile',l_profile,' is created.'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        clear l_user.&lt;/P&gt;&lt;P&gt;        l_user = wa_zbas_costcenter-zuserid.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        call function 'SUSR_INTERFACE_USER'&lt;/P&gt;&lt;P&gt;          exporting&lt;/P&gt;&lt;P&gt;            profile                    = l_profile&lt;/P&gt;&lt;P&gt;            user                       = l_user&lt;/P&gt;&lt;P&gt;            action                     = 'I'&lt;/P&gt;&lt;P&gt;          exceptions&lt;/P&gt;&lt;P&gt;            params_incomplete          = 1&lt;/P&gt;&lt;P&gt;            not_authorized_for_user    = 2&lt;/P&gt;&lt;P&gt;            not_authorized_for_profile = 3&lt;/P&gt;&lt;P&gt;            profile_doesnt_exist       = 4&lt;/P&gt;&lt;P&gt;            user_doesnt_exist          = 5&lt;/P&gt;&lt;P&gt;            profile_already_in_user    = 6&lt;/P&gt;&lt;P&gt;            profile_wasnt_in_user      = 7&lt;/P&gt;&lt;P&gt;            user_locked                = 8&lt;/P&gt;&lt;P&gt;            bad_action                 = 9&lt;/P&gt;&lt;P&gt;            others                     = 10.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;*if profile is added to SAP user id&lt;/P&gt;&lt;P&gt;          commit work.&lt;/P&gt;&lt;P&gt;          write &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; 'New Profile',l_profile,' is added to user',l_user.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*set updation flag as blank and changed on date&lt;/P&gt;&lt;P&gt;          update zbas_costcenter&lt;/P&gt;&lt;P&gt;                set zto_updt = ''&lt;/P&gt;&lt;P&gt;                    zaedtm = sy-datum&lt;/P&gt;&lt;P&gt;                 where zuserid = wa_zbas_costcenter-zuserid&lt;/P&gt;&lt;P&gt;                 and   zto_updt = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*get authorization profiles w.r.t. auth object K_CCA&lt;/P&gt;&lt;P&gt;          refresh it_values.&lt;/P&gt;&lt;P&gt;          call function 'SUSR_USER_AUTH_FOR_OBJ_GET'&lt;/P&gt;&lt;P&gt;            exporting&lt;/P&gt;&lt;P&gt;              new_buffering       = '3'&lt;/P&gt;&lt;P&gt;              mandant             = sy-mandt&lt;/P&gt;&lt;P&gt;              user_name           = l_user&lt;/P&gt;&lt;P&gt;              sel_object          = 'K_CCA'&lt;/P&gt;&lt;P&gt;            tables&lt;/P&gt;&lt;P&gt;              values              = it_values&lt;/P&gt;&lt;P&gt;            exceptions&lt;/P&gt;&lt;P&gt;              user_name_not_exist = 1&lt;/P&gt;&lt;P&gt;              not_authorized      = 2&lt;/P&gt;&lt;P&gt;              internal_error      = 3&lt;/P&gt;&lt;P&gt;              others              = 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;*delete profile record which is newly created from internal table&lt;/P&gt;&lt;P&gt;            delete it_values where auth = l_profile.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*delete other profiles which are started with ZAU for this user&lt;/P&gt;&lt;P&gt;            loop at it_values into wa_values where auth(03) = 'ZAU' .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              l_remove_profile = wa_values-auth.&lt;/P&gt;&lt;P&gt;              call function 'SUSR_USER_PROFS_BUFFER_CLEAR'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              call function 'SUSR_USER_PROFS_REMOVE_ONE'&lt;/P&gt;&lt;P&gt;                exporting&lt;/P&gt;&lt;P&gt;                  user_name           = l_user&lt;/P&gt;&lt;P&gt;                  profile             = l_remove_profile&lt;/P&gt;&lt;P&gt;                exceptions&lt;/P&gt;&lt;P&gt;                  user_name_not_exist = 1&lt;/P&gt;&lt;P&gt;                  others              = 2.&lt;/P&gt;&lt;P&gt;              if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;                commit work.&lt;/P&gt;&lt;P&gt;                call function 'SUSR_USER_PROFS_BUFFER_TO_DB'&lt;/P&gt;&lt;P&gt;                  exceptions&lt;/P&gt;&lt;P&gt;                    others = 0.&lt;/P&gt;&lt;P&gt;              endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              clear wa_values.&lt;/P&gt;&lt;P&gt;            endloop.&lt;/P&gt;&lt;P&gt;          endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    endif.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    clear wa_zbas_costcenter.&lt;/P&gt;&lt;P&gt;  endloop.&lt;/P&gt;&lt;P&gt;endform.                    " F_ROLE_CREATE&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Aug 2010 08:15:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/bi-analysis-authorization-concept-to-ecc-transactions/m-p/7153487#M1514942</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-08-31T08:15:16Z</dc:date>
    </item>
  </channel>
</rss>

