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: 

how to restrict user to process own company code data in z program

Former Member
0 Kudos

Hi All,

I have this issue. in asset management I would like to restrict user to process its own company data.

for example A who works in company 0123 only can process comp code 0123 data whereas X who is manager can process all company code data.

In the abap program, how can i achive this? by authority object? if yes what asset management authority object to use?

i have company code in selection screen. so may i know what method i can achive so that A can only execute co 0123 whereas X can do for all company code.

thanks

5 REPLIES 5

former_member188827
Active Contributor
0 Kudos

u can proceed as follows:

make company code field mandatory on selection screen.

den use:

AT SELECTION-SCREEN.

if sy-uname = 'A' and bukrs ne '123'.

message 'You are not authorized to use company code other than '123' type 'E'.

endif.

Edited by: abapuser on May 8, 2008 10:45 AM

Edited by: abapuser on May 8, 2008 10:46 AM

0 Kudos

hi,

this is hardcoded.

i cannot code each and everyone here.

also what about user X who can execute all company code.

thanks

Former Member
0 Kudos

Better you create one authorization object and check the use in selection screen company code.

and rasie the exception.

It will work.

Regards,

Madan.

0 Kudos

hi,

may i know how to check the user access rights in the authority object? what authority object to use for asset management?

thanks

Former Member
0 Kudos

Hi,

One way would be:

For all persons for whom you would like to 'control' the access to a specific company, SU01-->Parameters--->Give some parameter ID say XXX, & in PArameter Value key in the compnay code whose data it can process.

Please note that this is only one time process which has to be carried out for all the users. Then in your z-program in SELECTIO-SCREEN OUTPUT use GET PARAMETER ID 'XXX" Field w_value. If GET PARAMETER ID returns su-subrc = 0 then move w_value to your company code on the selection screen. Then Use LOOP AT SCREEN & make SCREEN-INPUT = '0' for company code so that company code will be displayed but protected thus not allowing the user to change the company code.

I hope this helps,

Regards

Raju Chitale