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, samples, codes and tools for .Net, SQL Server, Windows, Windows Phone, SAP and ABAP, like SAP UI5, Screen Personas, etc.




CRM Companies List
Web Based CRM Software


Check Authorization Object using ABAP Function Module for SAP User


This tutorial shows how to check authorization object for SAP user using ABAP function modules. ABAP programmer can use function module AUTHORITY_CHECK to validate if an SAP user has the required authority object authorizations.

For example, I want to check if an SAP user has full administrative access to all features in SAP Screen Personas 3.0 Administration transaction /PERSONAS/ADMIN

If you launch SAP tcode SU21, Maintain the Authorization Objects transaction under PERS class P_ADMIN authorization object is used for "Personas Admin Authorization object"

SAP SU21 transaction for authorization objects

Double click on authorization object P_ADMIN to display details.

SAP authorization object details

Highlight the P_ACTVT_AD field in the Authorization fields table. Then click on Display Object Documentation button at the bottom of the screen.

SAP authorization object field values list

As seen in above screenshot, authorization field P_ACTVT_AD value 01 identifies whether a user has full administration privileges on Personas Administration screen.

ABAP programmers can use AUTHORITY_CHECK function module in their SAP reports to test if a user has authorization object P_ADMIN with 01 admin activity permissions.

CALL FUNCTION 'AUTHORITY_CHECK'
 EXPORTING
  user = sy-uname
  object = 'P_ADMIN'
  field1 = 'P_ACTVT_AD'
  value1 = '01'
 EXCEPTIONS
  user_dont_exist = 1
  user_is_authorized = 2
  user_not_authorized = 3
  user_is_locked = 4
  OTHERS = 5.
IF sy-subrc <> 0.
* Implement suitable error handling here
ELSE.
* User is authorized
ENDIF.

I hope above sample ABAP code block and short SU21 guide will help programmers to check whether user has an authorization object permission or not dynamically within ABAP code.

ABAP code to check SAP authorization object activities for given user






SAP Tutorials

SAP Tutorial

SAP Forums

SAP Tools

SAP Transaction Codes Table








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