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.