Application Development and Automation 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: 
Read only

values in authority check

Former Member
0 Likes
3,342

hello friends,

I am using FM 'SUSR_USER_AUTH_FOR_OBJ_GET'. I want to display error message if user is not authorised.

For this I am entering value on selection screen and calling this FM.

call function 'SUSR_USER_AUTH_FOR_OBJ_GET'

exporting

user_name = 'TESTUSER'

SEL_OBJECT = 'S_TCODE'

tables

values = values

exceptions

user_not_exist = 1

not_authorized = 2

internal_error = 3

others = 4.

My problem is how will I display error message and which fields of table 'VALUES' shoulld I compare with selection screen field.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,055

Hi,

Please refer the documentation available in the system for that FM.

It clearly states all the possible exception which you can throw, how to compare the field values etc.

USER_NAME_NOT_EXIST

NOT_AUTHORIZED

INTERNAL_ERROR

regards,

Mullai

hello friends,

I am using FM 'SUSR_USER_AUTH_FOR_OBJ_GET'. I want to display error message if user is not authorised.

For this I am entering value on selection screen and calling this FM.

call function 'SUSR_USER_AUTH_FOR_OBJ_GET'

exporting

user_name = 'TESTUSER'

SEL_OBJECT = 'S_TCODE'

tables

values = values

exceptions

user_not_exist = 1

not_authorized = 2

internal_error = 3

others = 4.

My problem is how will I display error message and which fields of table 'VALUES' shoulld I compare with selection screen field.

8 REPLIES 8
Read only

Former Member
0 Likes
2,055

Hi,

I think what you are trying to do is enter transaction code on the selection and check if the user 'TESTUSER' has authorizations for it. The field that would have all the transactions that the user would have is 'VON' in the structure VALUES.

FM also has some documentation that you can refer to.

So you need to check if the value on the selections is there and fire the error if not.

Regards,

Himanshu

Read only

Former Member
0 Likes
2,055
DATA: user_nm LIKE usr02-bname,
sel_object LIKE ust12-objct VALUE 'K_CSKS'.

DATA: values LIKE STANDARD TABLE OF usvalues.

user_nm = sy-uname.

CALL FUNCTION 'SUSR_USER_AUTH_FOR_OBJ_GET'
  EXPORTING
    user_name           = user_nm
    sel_object          = sel_object
  TABLES
    values              = values
  EXCEPTIONS
    user_name_not_exist = 1
    not_authorized      = 2
    internal_error      = 3
    OTHERS              = 4.
IF sy-subrc 0.
  MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
  WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF

Check VON in USVALUES.

Edited by: K.Manas on Dec 30, 2010 7:45 AM

Read only

Former Member
0 Likes
2,056

Hi,

Please refer the documentation available in the system for that FM.

It clearly states all the possible exception which you can throw, how to compare the field values etc.

USER_NAME_NOT_EXIST

NOT_AUTHORIZED

INTERNAL_ERROR

regards,

Mullai

Read only

0 Likes
2,055

Thank you for replying friends..Points are given.

I would also like to know what values can VON have??

Like if VON is having value ' * ' then user is having all authorisations..right???

what other values can VON have?

Read only

0 Likes
2,055

Hi,

VON will have values for the fields in the authorization object that you are checking like when you have authorization object S_TCODE only has one field TCD it shows the value for that if it had other fields also they we would have got values for other objects also .The field name is in the Field 'Field'.

Yes '*' means auth to all.

Regards,

Himanshu

Read only

0 Likes
2,055

But my question is what other values VON can have besides ' * ' .

Read only

0 Likes
2,055

Other transactions codes like SE38,SE71 etc. when you use object S_TCODE.

Himanshu

Read only

Former Member
0 Likes
2,055

Thank you replying friends.