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

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.

  user = sy-uname
  object = 'P_ADMIN'
  field1 = 'P_ACTVT_AD'
  value1 = '01'
  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
* User is authorized

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


Install SAP Free
CRM Companies List
Web Based CRM Software

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