... SAP function modules provides proper checks inside them, but in many cases developer should take care about them inside the coding. The code I will provide below will scan program for AUTHORITY-CHECK statement ...
... with the AUTHORITY-CHECK, just assume that you want to display one or two columns only to specific users that have the authorization for it ( like simple sales margin). After checking the authorization, ...
...
form authorization_check.
authority-check object 'S_TCODE'
id 'TCD' field 'ZMB51'.
if sy-subrc ne 0.
message e172(00) with 'ZMB51'.
* You are not authorized to use Transaction & ...