‎2006 Aug 16 5:21 PM
Hi All,
i have to check whether user has an authorization for custom t.code.
say for example i have a custom program assign in t.code. if the user 'USANP' execute that t.code , in my program itself i have to check authorization.
please give me some hints,
thanks,
john.
‎2006 Aug 16 5:22 PM
CALL FUNCTION 'AUTHORITY_CHECK_TCODE'
EXPORTING
tcode = 'SM59'
EXCEPTIONS
ok = 0
not_ok = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE e172(00) WITH 'SM59'.
ENDIF.
‎2006 Aug 16 5:22 PM
CALL FUNCTION 'AUTHORITY_CHECK_TCODE'
EXPORTING
tcode = 'SM59'
EXCEPTIONS
ok = 0
not_ok = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE e172(00) WITH 'SM59'.
ENDIF.
‎2006 Aug 16 5:27 PM
Hi John,
Check this
DATA : L_TCODE LIKE SYST-TCODE.
L_TCODE = 'VA02'.
*-Check whether user is authorized
CALL 'AUTH_CHECK_TCODE'
ID 'TCODE' FIELD L_TCODE.
IF SY-SUBRC <> 0.
MESSAGE S000(ZVA02) WITH TEXT-116 'ZVA02'.
LEAVE PROGRAM.
ENDIF.
Regards,
Vidya