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

Authorization-check

Former Member
0 Likes
951

Hello All,

I want to do an authorization check in such a way that only few assigned users can execute my ABAP report program. How should I go about it?

Puru

6 REPLIES 6
Read only

Former Member
0 Likes
820

Hi

The ABAP code is

AUTHORITY-CHECK OBJECT <AUTH>

ID name1 FIELD f1

ID name2 FIELD f2

...

ID name10 FIELD f10.

IF SY-SUBRC <> 0.

MESSAGE E208(00) WITH 'user no auth...'.

ENDIF.

Now the porblem is if the object <AUTH> is std authorization or you have to create it.

If you've to create u've to use trx SU20 if u need to create z-field for authorization object and SU21 to create a new object.

After creating it you have to assign it to users profile

Max

Read only

0 Likes
820

What is ID and field?

Read only

0 Likes
820

Hi

THe ID is the field of authorization, for example in your case it should be the program name or trx code, the field is the variable where u store the value has to be checked by aut.:

AUTHORITY-CHECK OBJECT <Z_MY_AUTH>

ID PROGRAM FIELD SY-REPID .

IF SY-SUBRC <> 0.

MESSAGE E208(00) WITH 'user no auth...'.

ENDIF.

Max

Read only

0 Likes
820

Thanks, How to creat object Z_my_auth?

Read only

0 Likes
820

Hi

- Trx SU21;

- Press Icon to create;

- Create a new class

- Select your class

- Press Icon to create

- Create your object: u can assign PROGRAM as field

Max

Read only

Former Member
0 Likes
820

Hi,

you can authorize user to execute the program

in following ways

1) create a tcode for the report transaction

and use following code in program

at selection-screen output

authority-check object 'S_TCODE'

id 'TCD' field 'ZSPM'.

<b> where zspm is tcode</b>

if sy-subrc ne 0.

message s000 with 'You are NOT Authorized for

this Transaction'.

endif.

2) you can set authority group in program attributes

check with BASIS guys to set profile

3) you can restict the user at transaction level

in se93 by giving authorization object

check out sm01 transaction attributes in se93.

Regards

amole