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: 

user constrain

Former Member
0 Kudos

Hi Experts,

i need to restrict the piece of code to a specific user, how can i do that

1 ACCEPTED SOLUTION

Former Member
0 Kudos

check for sy-uname

4 REPLIES 4

Former Member
0 Kudos

Using authorization object you can do it.

Check the authorization is exists.

if sy-subrc = 0.

then perform your code.

endif.

Regards,

Madan.

Former Member
0 Kudos

check for sy-uname

Former Member
0 Kudos

Lock objects are use in SAP to avoid the inconsistancy at the time of data is being insert/change into database. so this will Restrict the code to a particular user.ie will make ur code user constraint

SAP Provide three type of Lock objects.

- Read Lock(Shared Locked)

protects read access to an object. The read lock allows other transactions read access but not write access to

the locked area of the table

- Write Lock(exclusive lock)

protects write access to an object. The write lock allows other transactions neither read nor write access to

the locked area of the table.

- Enhanced write lock (exclusive lock without cumulating)

works like a write lock except that the enhanced write lock also protects from further accesses from the

same transaction.

You can create a lock on a object of SAP thorugh transaction SE11 and enter any meaningful name start with EZ Example EZTEST_LOCK.

Use: you can see in almost all transaction when you are open an object in Change mode SAP could not allow to any other user to open the same object in change mode.ie ur code will be user constraint

Example: in HR when we are enter a personal number in master data maintainance screen SAP can't allow to any other user to use same personal number for changes.

Technicaly:

When you create a lock object System automatically creat two function module.

1. ENQUEUE_<Lockobject name>. to insert the object in a queue.

2. DEQUEUE_<Lockobject name>. To remove the object is being queued through above FM.

You have to use these function module in your program.

using FM ENQUEUE you lock the object,then do the required coding you want to and at end unlock the object with the help of FM DEQUEUE.so your code is now user contraint.

Hope this will give a basic idea.

Plz reward if useful

Thanks

Richa khosla

Edited by: Richa Khosla on May 20, 2008 6:52 AM

Former Member
0 Kudos

Hi Karthick,

Please see the below link, it might be helpful.

http://help.sap.com/saphelp_nw04s/helpdata/en/bf/c9934258a5ca6ae10000000a155106/content.htm

****Reward points if found useful

Regards,

Naresh