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

Authority-check problem

Former Member
0 Likes
610

Hi,

I created a <b>authority object</b> which has 3 <b>object fields</b>, I want to confirm

whether the user has <b><u>anyone</u> of the 3 object fields</b>, is there a good way

to do it?

Please kindly advise.

Thanks and best regards.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
583

Hi tt,

I think the easiest way to do so is to check individually each one of the three fields:


AUTHORITY-CHECK OBJECT ...
  ID 'FIELD1' FIELD value1
  ID 'FIELD2' DUMMY
  ID 'FIELD3' DUMMY.
IF sy-subrc <> 0.
  AUTHORITY-CHECK OBJECT ...
    ID 'FIELD1' DUMMY
    ID 'FIELD2' FIELD value2
    ID 'FIELD3' DUMMY.
  IF sy-subrc <> 0.
    AUTHORITY-CHECK OBJECT ...
      ID 'FIELD1' DUMMY
      ID 'FIELD2' DUMMY
      ID 'FIELD3' FIELD value3.
  ENDIF.
ENDIF.

I hope this helps. Best regards,

Alvaro

4 REPLIES 4
Read only

Former Member
0 Likes
584

Hi tt,

I think the easiest way to do so is to check individually each one of the three fields:


AUTHORITY-CHECK OBJECT ...
  ID 'FIELD1' FIELD value1
  ID 'FIELD2' DUMMY
  ID 'FIELD3' DUMMY.
IF sy-subrc <> 0.
  AUTHORITY-CHECK OBJECT ...
    ID 'FIELD1' DUMMY
    ID 'FIELD2' FIELD value2
    ID 'FIELD3' DUMMY.
  IF sy-subrc <> 0.
    AUTHORITY-CHECK OBJECT ...
      ID 'FIELD1' DUMMY
      ID 'FIELD2' DUMMY
      ID 'FIELD3' FIELD value3.
  ENDIF.
ENDIF.

I hope this helps. Best regards,

Alvaro

Read only

Former Member
0 Likes
583

Check the below PDF Document and here you will see good example code.

https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a92195a9-0b01-0010-909c-f330ea4a...

Thanks

Seshu

Read only

Former Member
0 Likes
583

Hi,

you will need to use all the three field in the check..

1st will be the field that u r going to check.. for example a profit center

2nd will be the activity that u can perform 01, 02, 03

3rd will be the value for the above field.. for ex.. 10001

if i have PC 03 10001.. this means that i am authorized to view this profit center..

Thanks and Best Regards,

Vikas Bittera.

Read only

varma_narayana
Active Contributor
0 Likes
583

Hi..

Steps to implement authorization checks:

1. Creating Authorization object in SU21. (If it is not existing already)

Assign the Fields here

This is done by ABAP resouce.

2. Creating authorizations using these Auth Objects.

This is done by BASIS.

3. Assigning these authorizations to users (SU01)

This is done by BASIS.

4. Checking the Authorization of a user in a program

This is done by ABAP resouce

using the Statement called AUTHORITY-CHECK in a program.

This statement accepts the Values for the Fields and if a suitable authorization found in the User profile then it returns SY-SUBRC = 0.

<b>reward if Helpful</b>