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: 

AUTHORITY-CHECK for an defined USER

Former Member
0 Kudos
187

Hi,

i write a abap (protokol) which shell be started every hour. In this report i will use

an AUTHORITY-CHECK for an defined user, because i will send the protokol via email, but i have

to check if this user is allowed to see the data.

I will use this:

AUTHORITY-CHECK OBJECT 'F_LFA1_BEK'

ID 'BRGRU' FIELD '__________'

ID 'ACTVT' FIELD '__________'.

for an defined user.

Is this possible, or how can i check this in another way?

Thanks.

Regards, Dieter

1 ACCEPTED SOLUTION

JozsefSzikszai
Active Contributor
0 Kudos
129

pls. have a look at FM AUTHORITY_CHECK. This is for basically authorization check where user >< sy-uname (if my understanding is right, this is what you need)

7 REPLIES 7

GauthamV
Active Contributor
0 Kudos
129

hi,

you can define authority check in your program in

at selection screen event and define the authorization object

in user role or profiles with values maintained with the help of

basis people.

This will restrict users from seeignthe data for which they are

not authorised.

Former Member
0 Kudos
129

Hi Gautham,

thanks for your answer, but i don't want to use the authority-check for the user who

starts the report, i want to chech the authority for a specific user, because the

report will be start in batch.

Example: i read all entries from LFA1. Then i will check if user A has the authority to see the data

then he gets a protocol. If not, then no protocol.

Regards, Dieter

JozsefSzikszai
Active Contributor
0 Kudos
130

pls. have a look at FM AUTHORITY_CHECK. This is for basically authorization check where user >< sy-uname (if my understanding is right, this is what you need)

0 Kudos
129

Hi Eric,

i tried it like this:

UTHORITY-CHECK OBJECT 'F_LFA1_BEK'

ID 'BRGRU' FIELD 'KRED'

ID 'ACTVT' FIELD '03'.

*

BREAK-POINT.

*

CALL FUNCTION 'AUTHORITY_CHECK'

EXPORTING

  • NEW_BUFFERING = 3

  • USER = SY-UNAME

OBJECT = 'F_LFA1_BEK'

FIELD1 = 'BRGRU'

VALUE1 = 'KRED'

FIELD2 = 'ACTVT'

VALUE2 = '03'

EXCEPTIONS

USER_DONT_EXIST = 1

USER_IS_AUTHORIZED = 2

USER_NOT_AUTHORIZED = 3

USER_IS_LOCKED = 4

OTHERS = 5.

*

BREAK-POINT.

at first breakt-point sy-subrc = 0 at second sy-subrc = 2. Can you tell why i get another sy-subrc?

is my FM-Call correct?

thanks.

Regards, Dieter

0 Kudos
129

this is absolutely OK, the FM comes back with sy-subrc = 2 if the user is authorised (just check the source code of the FM, there is another FM call (at the end) and after that the sy-subrc is set to 2 if everything is OK)

0 Kudos
129

Hi Eric,

sorry for my stupid question (better i read more exactly). In FM is USER_IS_AUTHORIZED = 2.

Thanks, you solved my problem.

Regards, Dieter

david_escofettrenado
Participant
0 Kudos
129

It's possible. You need to create a Profile for every User with this Object 'F_LFA1_BEK'.