Thursday 13 October 2011

Copy an existing role to a new role in SAP




The easiest way to create a new user role is to copy an already existing user role, either one of your own or one of the ones provided to you in the installation of SAP.  So let’s assume that you have none of your own and use one of the SAP role templates provided.  It might assist you with picking one of these roles if you have someone dump the appropriate information into a spreadsheet containing the Role Name, Role Description, Transactions contained in the Role, and the Transaction description.  The SQL query would be something like this:

SELECT AGR_TEXTS.AGR_NAME, AGR_TEXTS.TEXT, AGR_TCODES.TCODE, TSTCT.TTEXT
   FROM AGR_TEXTS, AGR_TCODES, TSTCT
WHERE AGR_TEXTS.MANDT = '000' AND
   AGR_TEXTS.SPRAS = 'E' AND
   AGR_TEXTS.LINE = 0 AND
   AGR_TCODES.MANDT = '000' AND
   AGR_TCODES.AGR_NAME = AGR_TEXTS.AGR_NAME AND
   TSTCT.SPRSL = 'E' AND
   TSTCT.TCODE = AGR_TCODES.TCODE
ORDER BY AGR_TEXTS.AGR_NAME, AGR_TCODES.TCODE;

This query should be changed based on the details of your SAP instance.  Identify the roles(s) to be used as the source for your role copy.

1.               Log on to client needing the role.
2.               Go to transaction PFCG.
3.               On the Role Maintenance screen, either type in the role name to be copied or select it from a dropdown.  Press Enter to confirm that the role exists.
4.               Click the Copy role button or press Shift+F11.
5.               One the Query popup box, fill in the to role field with the name to be given the new role.  Come up with a standard that everyone follows so the base original role is designated in some way so you don’t forget where you got the original.  The name must begin with Z or Y. Most people will add a Z- in the first two characters of the role name.  If you want to only select specific roles from a Composite role, you would click the Copy selectively button, otherwise click the Copy all button.
6.               Once the role has been copied, you will be taken back to the original PFCG screen where you will see the name of your new role.  Change you Role description and save the new role before working with it any further

No comments:

Post a Comment