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
Development resources, articles, tutorials, code samples, tools and downloads for SAP HANA and ABAP, HANA Database, SQLScript, SAP UI5, Screen Personas, Web Dynpro, Workflow

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

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

SAP

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.
ENDLOOP.
Code


SAP HANA and ABAP

Install SAP Free
CRM Companies List
Web Based CRM Software


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.