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: 

Restrict Access to a Table

Former Member
0 Kudos

Hello All,

I am Developing RFC which will fetch some data from SAP HR tables. (For Example: -PA2002)

My requirement is to restrict one user to access SAP HR table. (PA2002). i.e. when that user tries to execute RFC, he should not able to get data from that table.

Any help??

Thanks,

Prashant

1 ACCEPTED SOLUTION

former_member181995
Active Contributor
0 Kudos

Else,

since you are using customing RFC than you may write small piece of code

if SY-UNAME = '<user name>'.
proceed.
else.
exit.
endif.

insode RFC.

this would be useful in your case only as you are saying My requirement is to restrict one user to access SAP HR table.

6 REPLIES 6

former_member188685
Active Contributor
0 Kudos

using the Function HR_READ_INFOTYPE read the infotype, maintain the authorization . remove the authorization to read the infotype . then he will not be able to read it.

0 Kudos

Thanks for the reply.

Can you elaborate more.

---

Prashant

0 Kudos

just go to the function module HR_READ_INFOTYPE and see the code. some authorization checks are happening inside. if you can remove the authorization for the user you want , he will not be able read the information from the infotype what ever you want.

so use the function HR_READ_INFOTYPE inside your rfc to read the data , instead of select.

0 Kudos

Hi Vijay,

Many thanks for help.

Do you have any sample steps or lines of code to do the same?? Can we do the same using Authorization object??

Please Guide!!!

Thanks in Advance,

Prashant

Former Member
0 Kudos

Make a lock custom object in se11 with name EZ* for table pa2002 with lock mode = S, in your report, before you start reading data lock the record using FM ENQUQUE_<LOCK_OBJECT_NAME>, read data, after reading, unlock record using FM DEQUQUE_<LOCK_OBJECT_NAME> now while you were reading the data, no body else could read the same record from table pa2002

former_member181995
Active Contributor
0 Kudos

Else,

since you are using customing RFC than you may write small piece of code

if SY-UNAME = '<user name>'.
proceed.
else.
exit.
endif.

insode RFC.

this would be useful in your case only as you are saying My requirement is to restrict one user to access SAP HR table.