Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Authorization Check

Former Member
0 Kudos
101

Hi,

all.

In one report i am displaying the list of executable reports.

Now if the user double clicks the code, the same T Code will be opened.

But if a particular user has no authorization, the system openes the T Code eventhough it is not authorized to do that.

For that I am using one functional module 'SUSR_AUTHORITY_CHECK_SIMULATE'.

CALL FUNCTION 'SUSR_AUTHORITY_CHECK_SIMULATE'

EXPORTING

USER_NAME = SY-UNAME

OBJECT = 'S_TCODE'

FIELD1 = 'TCD'

VAL1 = TCODE

IMPORTING

SY_SUBRC = SYSUBRC

EXCEPTIONS

NOT_AUTHORIZED = 2

The tcode is passed and if sy-subrc is set to 0 it shold allow the tCode to open.

But this is not working.

Please suggest me what to do.

Regards,

Sunny

1 REPLY 1

Former Member
0 Kudos
70

check this sample code...not a stright solution to your requirement..


DATA wa(20).
AT LINE-SELECTION.
  CLEAR wa.
  READ LINE sy-lilli LINE VALUE INTO wa.
  CALL FUNCTION 'AUTHORITY_CHECK_TCODE'
    EXPORTING
      tcode  = wa
    EXCEPTIONS
      ok     = 1
      not_ok = 2
      OTHERS = 3.
  IF sy-subrc EQ '1'.
    WRITE 😕 'You are authorised view this report'.
  ELSE.
    WRITE 😕 'you are NOT authorised to use this report'.
  ENDIF.

START-OF-SELECTION.
  WRITE 😕 'T-code List',
         / 'SM04',
         / 'SE38',
         / 'SE71'.