SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software SAP ABAP Programming and HANA Database Tutorials
Development resources, articles, tutorials, code samples and tools and downloads for ASP.Net, SQL Server, R Script, Windows, Windows Phone, AWS, SAP HANA and ABAP, like SAP UI5, Screen Personas, etc.

Install SAP Free

List SAP User-Roles Assignments in ABAP Code

To get a list of valid SAP User Role assignments in ABAP codes, developers can use AGR_USERS SAP transparent table to get a similar list seen on SU01D transaction screen.

Using SAP SU01D transaction code (Display Users screen), SAP users can display the Roles assigned to a specific SAP user or assigned roles to themselves.


SAP user roles assignments are stored in ABAP table AGR_USERS with the validity dates.


If you query the transparent table AGR_USERS in SE11 or using ABAP codes, you can get a list of SAP roles assigned to a user as follows

SAP user roles in AGR_USERS ABAP table

Here is a short ABAP code which queries SAP table AGR_USERS for valid user roles at the execution time for the current SAP user and lists SAP user roles on the screen.

SELECT * INTO TABLE @DATA(gt_user_roles) FROM agr_users
 WHERE uname = @syst-uname
 AND agr_name LIKE '%CUS%'
 AND from_dat <= @syst-datum
 AND to_dat >= @syst-datum.

LOOP AT gt_user_roles REFERENCE INTO DATA(lr_user_role).
 WRITE :/ lr_user_role->agr_name.

SAP Tutorials

SAP Tutorial

SAP Forums

SAP Tools

SAP Transaction Codes Table

Meetup Sunumu 1 meetup

Copyright © 2004 - 2020 Eralper YILMAZ. All rights reserved.
Community Server by Telligent Systems