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 on pushbutton ..

Former Member
0 Likes
1,883

Dear friends , i made a screen by which user can enter data in the table .....

i want that 'CHANGE' and 'DELETE' pushbutton only responde to only Authorized user for it and for the rest of the user it simply show a message " You are Not authorised to change the record" .

thanks ....in advance .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,318

Hi,

when user clicks on push button write down the below code.

AUTHORITY-CHECK OBJECT 'XYZ'

ID 'F1' FIELD l_c_zd

ID 'F2' FIELD l_tcode

ID 'F3' FIELD p_mawerk.

after that check for sy-subrc i.e.

IF NOT sy-subrc IS INITIAL.

throw a message saying that no authorization.

ENDIF.

in the above code 'XYZ' represnets an authorization object.

create an authiorization object for the fields u want. for example F1, F2 etc.

Regards

Venkat

8 REPLIES 8
Read only

Former Member
0 Likes
1,318

for this u need to use AUTHORITY_CHECK

u need an authorization object which will have authorization fields.

1.see for authorization to be imposed on a user, u need an authorization object. U can use existing ones in ur system or create a new one use tcode SU21. And u can take help from basis guy in this regard.

2. Once u have the authorication object goto ur program and press the PATTERN button there u will see the AUTHORITY_CHECK option select it and put ur authorization object system will generate the code. Then pass the values and perform validation using SY-SUBRC.

SY-SUBRC = 0. Successfull

SY-SUBRC = 4. Unsuccessfull

SY-SUBRC = 8. Authorization field not specified completely.

if u dont want to use any authorization field put DUMMY in front of it. Like this DUMMY not like this 'DUMMY'

regards

Read only

Former Member
0 Likes
1,318

Hello Ram Shankar,

In the function code of the push button, check for the authorization.

use a funtion module to check teh username

give an error message if the user name is incorrect

Regards

Indu

Read only

Former Member
0 Likes
1,318
Read only

0 Likes
1,318

M'am

Given link is helpful, but it is not clear that how to done this job. plz give me suitable answer.

Ram Shanker

Read only

Former Member
0 Likes
1,319

Hi,

when user clicks on push button write down the below code.

AUTHORITY-CHECK OBJECT 'XYZ'

ID 'F1' FIELD l_c_zd

ID 'F2' FIELD l_tcode

ID 'F3' FIELD p_mawerk.

after that check for sy-subrc i.e.

IF NOT sy-subrc IS INITIAL.

throw a message saying that no authorization.

ENDIF.

in the above code 'XYZ' represnets an authorization object.

create an authiorization object for the fields u want. for example F1, F2 etc.

Regards

Venkat

Read only

0 Likes
1,318

Dear Venket

Your answer is helpful but not to clear that i want. plz give me the suitable example like how to create the Authoriztion object and etc.

Ram Shanker

Read only

0 Likes
1,318

if you want to create an authorization object double click on the object or else go to the transaction code SU21 and click on create icon and enter some name and then create it.

Read only

0 Likes
1,318

Hello Ram Shankar,

You can refer to the following thread about creating an authorization object.

Hope it meets your requirement.

Regards

Indu.