Are there any methods for the mass assignment of queries into roles
There are not methods for the mass assignment of queries into roles. This is the standard designed behavior. But you may use a different option how to manage this:
- Please check the SAP Note 588144. This is quite old one created for BW 3.x, but still the procedure can be used for query assignment.
- Typically the user has to be authorized to change the Role Menu (S_USER_AGR with activities 01,02)
- You may create a small ABAP report that will do such assignments. Technically the entry in the role is performes by the method CREATE_ROLE_ENTRY of the class CL_CORE_RSOBJS_BASE. This method is called when you use the command 'Publish to Role' from the BEx Query Designer. With this 3 steps approach it should work, please try...
Select queries to assign to a table: Select from the database view V_REP_JOIN. This joins the most important tables storing parts of the query definition with the GENUNIID that is needed for assignment. Use an internal table of type v_rep_join. Alternative: do select from RSRREPDIR table...
Loop over this table and get the query text for each query from the RSZELTTXT (SELECT SINGLE txtlg FROM rszeltxtx WHERE OBJVERS = 'A AND LANGU = sy-langu AND eltuid = COMPUID from internal table).
In the same loop iteration call the CL_CORE_RSOBJS_BASE->CREATE_ROLE_ENTRY with the parameters listed below. OBJ_KEY = GENUNIID of each query and the text is also derive a step above. Typically GENUNIIND is a 25 digits ID, but in the SE16 it can be presented as CUBE/QUERY technical name. This is just a conversion exit.Error rendering macro 'code': Invalid value specified for parameter 'lang'
OBJ_TYPE QU ACTION C OBJ_VIEW RO IS_FOLDER ROLE_KEY <Role Technical Name> OBJ_KEY <XYZ...> !!! Important, this is GENUNIID from the table RSRREPDIR.... OBJ_TECHNAME OBJ_TEXT <Text of the role entry> -> 'query description' from the table RSZELTTXT... OBJ_URL empty, it will be derived inside the method... WITH_ALL_REFS