AUTHORITY-CHECK abap Statement / command

Checking a users authority to veiw or change sap data using the SAP ABAP AUTHORITY-CHECK command. The code below demonstrates how to check if a user has view access to purchase documents of a specific purchasing group. If the returned sy-subrc is 0 then they have the correct authroity object within their security profile.

Check user authority
AUTHORITY-CHECK OBJECT 'M_RECH_EKG'
         ID 'ACTVT' FIELD '02'  "Display
         ID 'EKGRP' FIELD 'ZZ'. "Purchasing group
IF SY-SUBRC = 0.
 " User has correct authority
ENDIF.

Related Articles

ABAP COLLECT statement syntax to add up all numeric internal table values within SAP
ABAP DELETE statement keyword to delete data from SAP internal and database tables
ABAP DESCRIBE statement keyword to get information about tables and fields
PERFORM TABLES command passing internal table as parameter
ABAP read command to read line of internal table in SAP
ABAP UPDATE command to modify database field values
ABAP delete command in SAP
ABAP MODIFY statement to update SAP data within database and internal tables
ABAP WRITE statement command with in SAP to display data report to users
SAP ABAP Statement syntax including basic implementation code
Concatenate ABAP statement syntax for concatenating data objects, sting values or rows of an SAP internal table
ABAP EXPORT data TO MEMORY ID and import it back again
IF, CHECK & WHEN ABAP commends example source code and information
Call Function module IN BACKGROUND TASK - Execute abap code in seperate background process
Function module IN UPDATE TASK statement - Execute abap code in seperate unit of work
ABAP STRLEN command to get the value length of a SAP field
SAP ABAP SELECT command and its different uses
SELECT..ENDSELECT command
ABAP FOR ALL ENTRIES SELECT statement addition in SAP data retrieval
ABAP SELECT inner join statement to select from two tables at the same time
SELECT directly into an internal table
SELECT directly into an internal table when field order is different
Function module STARTING NEW TASK statement - Execute abap code in seperate work process