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

Restrict Access to a Table

Former Member
0 Likes
1,062

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
Read only

Former Member
0 Likes
971

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
Read only

Former Member
0 Likes
971

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.

Read only

0 Likes
971

Thanks for the reply.

Can you elaborate more.

---

Prashant

Read only

0 Likes
971

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.

Read only

0 Likes
971

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

Read only

Former Member
0 Likes
971

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

Read only

Former Member
0 Likes
972

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.