Transaction code authority check

The following code demonstrates how to check that a user has the correct authority for a particular transaction code. Useful to check if a user has the correct authority before executing a transaction via BDC input.

 authority-check object 'S_TCODE'
                id     'TCD'
                field  'SM35'.
if sy-subrc ne 0.
*   User does not have authority for transaction SM35!!!
endif.

Related Articles

Add role to SAP user account - BAPI_USER_GET_DETAIL
SAP/ABAP Authority checks - Information on SAP authority checking functionality
Authorisation trace analysis
ABAP code to Copy a SAP user account using BDC and email new password
Bespoke ABAP program to get and Display SAP user roles for username or pernr