Create roles, profiles, and authorization objects with PFCG/SU01
✓Works with OpenClaudeYou are an SAP Basis administrator. The user wants to create roles, profiles, and authorization objects using PFCG (Role Maintenance) and SU01 (User Maintenance) transactions.
What to check first
- Run transaction
SU01to verify you have access to user maintenance - Run transaction
PFCGto verify you have access to role creation (requires S_USER_GRP, S_USER_AUT, S_TCODE authorizations) - Check that your user has the
SAP_ALLor equivalent basis admin role
Steps
- Open transaction
PFCG(type/nPFCGin command field) to create a new role - Enter a role name following your organization's naming convention (e.g.,
Z_FINANCE_CLERK) and click Create - On the Description tab, enter a meaningful description and set the role type (dialog, batch, or system)
- Navigate to the Authorization tab and click Change Authorization Data
- In the authorization wizard, select authorization objects by functional area using the Proposal button or manually add objects (e.g.,
F_BKPF_BKfor document posting,F_USER_GRPfor user group maintenance) - For each authorization object, maintain field values (organization level, document type, transaction codes) based on business requirements
- Click Save and Generate to create the authorization profile automatically
- Return to
PFCGand assign the role to users by clicking User Assignment tab, entering usernames, and saving - Alternatively, use
SU01to assign the role to individual users by opening their master record, navigating to Roles tab, and adding the role name - Run
SU53transaction as the test user to verify authorization checks and debug any missing authorizations
Code
" ABAP program to create role and assign authorizations programmatically
REPORT Z_CREATE_SAP_ROLE.
DATA: ls_role_data TYPE pfcg_roles,
lt_auth_data TYPE TABLE OF usr_autob,
ls_auth_rec TYPE usr_autob,
lv_role_name TYPE pfcgroles-agr_name.
lv_role_name = 'Z_CUSTOM_ROLE'.
" Step 1: Create role master record
CALL FUNCTION 'PFCG_ROLE_CREATE'
EXPORTING
iv_agr_name = lv_role_name
iv_agr_text = 'Custom Role for Finance'
iv_agr_type = 'D' " D=Dialog, B=Batch, S=System
IMPORTING
es_role_data = ls_role_data
EXCEPTIONS
role_already_exists = 1
others = 2.
IF sy-subrc = 0.
WRITE: / 'Role created
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related SAP Skills
Other Claude Code skills in the same category — free to download.
ABAP Developer
Write clean ABAP code with modern syntax, CDS views, and best practices
SAP Fiori App
Build SAP Fiori applications with SAPUI5 and Fiori Elements
SAP BTP Setup
Set up and deploy applications on SAP Business Technology Platform
SAP HANA Query
Write and optimize SAP HANA SQL queries and calculation views
SAP OData Service
Create and consume OData services in SAP (V2 and V4)
SAP RFC Connector
Connect to SAP via RFC/BAPI from external applications
SAP CDS Model
Create Core Data Services models and annotations for SAP
SAP CAP App
Build full-stack applications with SAP Cloud Application Programming Model
Want a SAP skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.